CC-2524:Manage Media Folders:No error msg

- fixed
- changed error msg text
This commit is contained in:
james 2011-07-13 09:01:48 -04:00
parent 4e28ee629a
commit be7af45c66
2 changed files with 26 additions and 12 deletions

View file

@ -126,13 +126,20 @@ class PreferenceController extends Zend_Controller_Action
$watched_dirs_form->populate(array('storageFolder' => $chosen));
$bool = $watched_dirs_form->verifyChosenFolder($element);
// it has error checking in two part. It checks is_dir above, and
// check uniqueness in DB below. We should put is_dir checking into
// MusicDir class.
if ($bool === true) {
MusicDir::setStorDir($chosen);
$dirId = MusicDir::getStorDir()->getId();
$data = array();
$data["directory"] = $chosen;
$data["dir_id"] = $dirId;
RabbitMq::SendMessageToMediaMonitor("change_stor", $data);
$res = MusicDir::setStorDir($chosen);
if($res['code'] == 0){
$dirId = MusicDir::getStorDir()->getId();
$data = array();
$data["directory"] = $chosen;
$data["dir_id"] = $dirId;
RabbitMq::SendMessageToMediaMonitor("change_stor", $data);
}else{
$watched_dirs_form->getElement($element)->setErrors(array($res['error']));
}
}
$this->view->subform = $watched_dirs_form->render();
@ -146,11 +153,18 @@ class PreferenceController extends Zend_Controller_Action
$watched_dirs_form->populate(array('watchedFolder' => $chosen));
$bool = $watched_dirs_form->verifyChosenFolder($element);
// it has error checking in two part. It checks is_dir above, and
// check uniqueness in DB below. We should put is_dir checking into
// MusicDir class.
if ($bool === true) {
MusicDir::addWatchedDir($chosen);
$data = array();
$data["directory"] = $chosen;
RabbitMq::SendMessageToMediaMonitor("new_watch", $data);
$res = MusicDir::addWatchedDir($chosen);
if($res['code'] == 0){
$data = array();
$data["directory"] = $chosen;
RabbitMq::SendMessageToMediaMonitor("new_watch", $data);
}else{
$watched_dirs_form->getElement($element)->setErrors(array($res['error']));
}
}
$this->view->subform = $watched_dirs_form->render();

View file

@ -54,7 +54,7 @@ class MusicDir {
}
catch(Exception $e){
//echo $e->getMessage();
return array("code"=>1, "error"=>"$p_path is already set as the current storage dir or the watched folders");
return array("code"=>1, "error"=>"$p_path is already set as the current storage dir or in the watched folders list");
}
}
@ -124,7 +124,7 @@ class MusicDir {
$dir->setDirectory($p_dir);
return array("code"=>0);
}else{
return array("code"=>1, "error"=>"$p_dir is already set as the current storage dir or the watched folders");
return array("code"=>1, "error"=>"$p_dir is already set as the current storage dir or in the watched folders list");
}
}