diff --git a/livesupport/modules/htmlUI/var/conf.php b/livesupport/modules/htmlUI/var/conf.php index 6a77ad84d..a9c18d3cc 100644 --- a/livesupport/modules/htmlUI/var/conf.php +++ b/livesupport/modules/htmlUI/var/conf.php @@ -23,7 +23,7 @@ Author : $Author: sebastian $ - Version : $Revision: 1.8 $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/conf.php,v $ ------------------------------------------------------------------------------*/ @@ -124,5 +124,5 @@ define('UI_SEARCH_MAX_ROWS', 8); define('UI_SEARCH_MIN_ROWS', 2); define('UI_REGEX_URL', '/^(ht|f)tps?:\/\/[^ ]+$/'); define('UI_SCRATCHPAD_KEY', 'djBagContents'); -define('UI_SCRATCHPAD_REGEX', '/^([0-9a-f]{16}:[0-9]{4}-[0-9]{2}-[0-9]{2}( )?)+$/'); +#define('UI_SCRATCHPAD_REGEX', '/^[0-9a-f]{16}:[0-9]{4}-[0-9]{2}-[0-9]{2}$/'); ?> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/html/templates/menu_top.tpl b/livesupport/modules/htmlUI/var/html/templates/menu_top.tpl index 5b4a22626..c61397447 100644 --- a/livesupport/modules/htmlUI/var/html/templates/menu_top.tpl +++ b/livesupport/modules/htmlUI/var/html/templates/menu_top.tpl @@ -1,10 +1,10 @@ diff --git a/livesupport/modules/htmlUI/var/html/ui_browser.php b/livesupport/modules/htmlUI/var/html/ui_browser.php index dec930d05..bf9f5243f 100644 --- a/livesupport/modules/htmlUI/var/html/ui_browser.php +++ b/livesupport/modules/htmlUI/var/html/ui_browser.php @@ -58,7 +58,7 @@ if ($uiBrowser->userid) { break; case "permissions": - $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id, $_REQUEST['act']=='getHomeDir' ? TRUE : FALSE)); + $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); $Smarty->assign('showPath', TRUE); $Smarty->assign('perms', $uiBrowser->getPermissions($uiBrowser->id)); @@ -67,29 +67,31 @@ if ($uiBrowser->userid) { case "newfile": - $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id, $_REQUEST['act']=='getHomeDir' ? TRUE : FALSE)); + $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); $Smarty->assign('showPath', TRUE); $Smarty->assign('newfileform', $uiBrowser->getNewFileForm($uiBrowser->id, $ui_fmask['upload'])); $Smarty->assign('showNewFileForm', TRUE); - break; + break; - case "upload_1": - $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id, $_REQUEST['act']=='getHomeDir' ? TRUE : FALSE)); + case "uploadFile": + $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); + $Smarty->assign('showPath', FALSE); + + $Smarty->assign('uploadform', $uiBrowser->getUploadFileForm($uiBrowser->id, $ui_fmask['uploadFile'])); + $Smarty->assign('showUploadForm', TRUE); + break; + + + case "editFile": + $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); $Smarty->assign('showPath', FALSE); $Smarty->assign('uploadform', $uiBrowser->getUploadFileForm($uiBrowser->id, $ui_fmask['upload_1'])); $Smarty->assign('showUploadForm', TRUE); - break; + break; - case "upload_2": - $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id, $_REQUEST['act']=='getHomeDir' ? TRUE : FALSE)); - $Smarty->assign('showPath', FALSE); - - $Smarty->assign('mDataForm', $uiBrowser->getMetaDataForm($uiBrowser->id, $ui_fmask['mData'], FALSE, $uiBrowser->getInfo($id, 'array'))); - $Smarty->assign('showMetaDataForm', TRUE); - break; case "search": if($_REQUEST['doSearch']) { @@ -130,7 +132,7 @@ if ($uiBrowser->userid) { $Smarty->assign('showFile', TRUE); break; - case "getMdata": + case "getMData": $Smarty->assign('fMetaData', $uiBrowser->getMdata($uiBrowser->id)); $Smarty->assign('showFile', TRUE); break; @@ -141,7 +143,7 @@ if ($uiBrowser->userid) { break; case "getInfo": - $Smarty->assign('fInfo', $uiBrowser->getInfo($uiBrowser->id, 'text')); + $Smarty->assign('fInfo', $uiBrowser->_getInfo($uiBrowser->id, 'text')); $Smarty->assign('showFile', TRUE); break; diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php index 4e45f26a9..8b0a84e11 100644 --- a/livesupport/modules/htmlUI/var/html/ui_handler.php +++ b/livesupport/modules/htmlUI/var/html/ui_handler.php @@ -15,16 +15,12 @@ switch($_REQUEST['act']){ $uiHandler->logout(TRUE); break; - case "upload": ## media- and metadata file together + case "upload": ## media- and metadata file together ##### $uiHandler->upload(array_merge($_REQUEST, $_FILES), $uiHandler->id, $ui_fmask["upload"]); break; - case "upload_1": ## first upload - $uiHandler->upload_1(array_merge($_REQUEST, $_FILES), $uiHandler->id, $ui_fmask["upload_1"]); - break; - - case "upload_2": ## then edit metadata - + case "uploadFile": ## just media file ####################### + $uiHandler->uploadFile(array_merge($_REQUEST, $_FILES), $uiHandler->id, $ui_fmask["uploadFile"]); break; case "newFolder": diff --git a/livesupport/modules/htmlUI/var/ui_base.inc.php b/livesupport/modules/htmlUI/var/ui_base.inc.php index c4f83babf..ff64795c2 100644 --- a/livesupport/modules/htmlUI/var/ui_base.inc.php +++ b/livesupport/modules/htmlUI/var/ui_base.inc.php @@ -28,12 +28,12 @@ class uiBase */ function uiBase(&$config) { - $dbc = DB::connect($config['dsn'], TRUE); - if (DB::isError($dbc)) { - die($dbc->getMessage()); + $this->dbc = DB::connect($config['dsn'], TRUE); + if (DB::isError($this->dbc)) { + die($this->dbc->getMessage()); } - $dbc->setFetchMode(DB_FETCHMODE_ASSOC); - $this->gb =& new GreenBox(&$dbc, $config); + $this->dbc->setFetchMode(DB_FETCHMODE_ASSOC); + $this->gb =& new GreenBox(&$this->dbc, $config); $this->config = $config; $this->sessid = $_REQUEST[$config['authCookieName']]; $this->userid = $this->gb->getSessUserId($this->sessid); @@ -211,7 +211,7 @@ class uiBase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > '.$this->_getFileTitle($id).' - '.$ia['playtime_string'].' + '.$ia['playtime_string'].' '; @@ -250,20 +250,50 @@ class uiBase } + function _toHex($gunid) + { + $res = $this->dbc->query("SELECT to_hex($gunid)"); + $row = $res->fetchRow(); + + return $row['to_hex']; + } + + + function _toInt8($gunid) + { + $res = $this->dbc->query("SELECT x'$gunid'::bigint"); + $row = $res->fetchRow(); + + return $row['int8']; + } + + function getSP() { $spData = $this->gb->loadPref($this->sessid, UI_SCRATCHPAD_KEY); if (!PEAR::isError($spData) && trim($spData) != '') { $arr = explode(' ', $spData); + /* + ## Akos old format ##################################### foreach($arr as $val) { - $pieces = explode(':', $val); - if (preg_match(UI_SCRATCHPAD_REGEX, $val)) { - $res[] = array_merge($this->_getMetaInfo($this->gb->_idFromGunid($pieces[0])), - array('added' => $pieces[1]) - ); + list ($gunid, $date) = explode(':', $val); + if ($this->gb->_idFromGunid($gunid) != FALSE) { + $res[] = array_merge($this->_getMetaInfo($this->gb->_idFromGunid($gunid)), array('added' => $date)); + } } } + */ + + ## new format ########################################## + foreach($arr as $gunid) { + if (preg_match('/[0-9]{1,20}/', $gunid)) { + if ($this->gb->_idFromGunid($this->_toHex($gunid)) != FALSE) { + $res[] = $this->_getMetaInfo($this->gb->_idFromGunid($this->_toHex($gunid))); + } + } + } + return ($res); } else { @@ -275,11 +305,12 @@ class uiBase { if (is_array($data)) { foreach($data as $val) { - $str .= $val['gunid'].':'.$val['added'].' '; + #$str .= $val['gunid'].':'.$val['added'].' '; ## new format ### + $str .= $this->_toInt8($val['gunid']).' '; ## Akosī old format ### } } - $this->gb->savePref($this->sessid, UI_SCRATCHPAD_KEY, trim($str)); + $this->gb->savePref($this->sessid, UI_SCRATCHPAD_KEY, $str); } function add2SP($id) @@ -288,27 +319,26 @@ class uiBase $this->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; if ($sp = $this->getSP()) { - foreach ($sp as $val) { + foreach ($sp as $key => $val) { if ($val['gunid'] == $info['gunid']) { - $exists = TRUE; + unset($sp[$key]); + $this->_retMsg('Entry $1 was already on $2.\nMoved to Top.', $info['title'], $val['added']); + } else { + #$this->incAccessCounter($id); } } } - if(!$exists) { - $sp = array_merge(array(array('gunid' => $info['gunid'], - 'added' => date('Y-m-d') - ), - ), - is_array($sp) ? $sp : NULL); - #print_r($sp); - $this->_saveSP($sp); - #$this->_retmsg('Entry $1 added', $gunid); - return TRUE; - } else { - $this->_retmsg('Entry $1 already exists', $info['title']); - return FALSE; - } + + $sp = array_merge(array(array('gunid' => $info['gunid'], + 'added' => date('Y-m-d') + ), + ), + is_array($sp) ? $sp : NULL); + + $this->_saveSP($sp); + #$this->_retmsg('Entry $1 added', $info['title']); + return TRUE; } @@ -339,12 +369,13 @@ class uiBase function _getMetaInfo($id) { - $data['id'] = $id; - $data['gunid'] = $this->gb->_gunidFromId($id); - $data['title'] = $this->_getMDataValue($id, 'Title'); - $data['artist'] = $this->_getMDataValue($id, 'Artist'); - $data['duration'] = substr($this->_getMDataValue($id, 'format.extent'), 0 ,8); - $data['type'] = $this->gb->existsPlaylist($this->sessid, $this->gb->_idFromgunid($id)) ? $this->tra('playlist') : $this->tra('file'); + $data = array('id' => $id, + 'gunid' => $this->gb->_gunidFromId($id), + 'title' => $this->_getMDataValue($id, 'title'), + 'artist' => $this->_getMDataValue($id, 'artist'), + 'duration' => substr($this->_getMDataValue($id, 'format.extent'), 0 ,8), + 'type' => $this->_getType($id), + ); return ($data); } @@ -362,5 +393,15 @@ class uiBase $file = array_pop($this->gb->getPath($id)); return $file['name']; } + + function _getType($id) + { + if ($this->gb->existsPlaylist($this->sessid, $this->gb->_gunidFromId($id))) return 'playlist'; + return 'file'; + #if ($this->gb->existsAudioClip($this->sessid, $this->gb->_gunidFromId($id))) return 'audioclip'; + #if ($this->gb->existsFile($this->sessid, $this->gb->_gunidFromId($id))) return 'File'; + + return FALSE; + } } ?> diff --git a/livesupport/modules/htmlUI/var/ui_browser.class.php b/livesupport/modules/htmlUI/var/ui_browser.class.php index c50379c03..4b6ced735 100644 --- a/livesupport/modules/htmlUI/var/ui_browser.class.php +++ b/livesupport/modules/htmlUI/var/ui_browser.class.php @@ -16,20 +16,45 @@ class uiBrowser extends uiBase { $this->uiBase($config); } + /** + * login + * + * Perform a frontend action + * map to a function called action_.inc.php + * + * @param actionName string, name of a action + * @param params array[], request vars + */ + function performAction( $actionName, $params ) + { + $actionFunctionName = 'action_' . $actionName ; + $actionFunctionFileName = ACTION_BASE . '/action_' . $actionName . '.inc.php' ; + if ( file_exists( $actionFunctionFileName ) ) + { + include ( $actionFunctionFileName ) ; + if ( method_exists( $actionFunctionName ) ) + { + $actionFunctionName( &$this, $params ) ; + } + } + } + // --- error handling --- /** - * alertMsg + * getAlertMsg * - * takes error message from session var + * extractes error message from session var * * @return string */ - function alertMsg() + + function getAlertMsg() { if ($_SESSION['alertMsg']) { $this->alertMsg = $_SESSION['alertMsg']; unset($_SESSION['alertMsg']); + return $this->alertMsg; } return false; diff --git a/livesupport/modules/htmlUI/var/ui_browser_init.php b/livesupport/modules/htmlUI/var/ui_browser_init.php index e51b94c19..932fc0ae0 100644 --- a/livesupport/modules/htmlUI/var/ui_browser_init.php +++ b/livesupport/modules/htmlUI/var/ui_browser_init.php @@ -30,7 +30,7 @@ $uiBase = new uiBase($config); ## load Smarty+filters ############################################## require_once dirname(__FILE__).'/SmartyExtensions.inc.php'; -#$Smarty->load_filter('output', 'trimwhitespace'); +$Smarty->load_filter('output', 'trimwhitespace'); $Smarty->load_filter('post', 'template_marker'); diff --git a/livesupport/modules/htmlUI/var/ui_fmask.inc.php b/livesupport/modules/htmlUI/var/ui_fmask.inc.php index dd98d9951..500d2d015 100644 --- a/livesupport/modules/htmlUI/var/ui_fmask.inc.php +++ b/livesupport/modules/htmlUI/var/ui_fmask.inc.php @@ -165,7 +165,7 @@ $ui_fmask = array( 'pages' => array( 'Main' => array( array( - 'element' => 'Title', + 'element' => 'dc:title', 'type' => 'text', 'label' => 'Title', 'required' => TRUE @@ -174,31 +174,31 @@ $ui_fmask = array( 'element' => 'Creator', 'type' => 'text', 'label' => 'Creator', - 'required' => TRUE + #'required' => TRUE, ), array( 'element' => 'Type_Genre', 'type' => 'text', 'label' => 'Type_Genre', - 'required' => TRUE, + #'required' => TRUE, ), array( - 'element' => 'Format', + 'element' => 'dc:format', 'type' => 'select', 'label' => 'Format', - 'required' => TRUE, + #'required' => TRUE, 'options' => array( '' => '', + 'audio/mpeg' => 'audio/mpeg', 'File' => 'File', 'live stream' => 'Live Stream', 'networked file'=> 'Networked File', - 'audio/mpeg' => 'audio/mpeg' ) ), array( - 'element' => 'Format_Extent', + 'element' => 'dcterms:extent', 'type' => 'text', - 'label' => 'Format_Extent', + 'label' => 'Extent', #'attributes'=> array('readonly' => 'on') ), /* @@ -233,12 +233,12 @@ $ui_fmask = array( ), 'Music_Basic' => array( array( - 'element' => 'Title', + 'element' => 'dc:title', 'type' => 'text', 'label' => 'Title', ), array( - 'element' => 'Creator', + 'element' => 'dc:creator', 'type' => 'text', 'label' => 'Creator', ), @@ -247,6 +247,7 @@ $ui_fmask = array( 'type' => 'text', 'label' => 'Source_Album', ), + /* array( 'element' => 'Source_Year', 'type' => 'date', @@ -258,25 +259,27 @@ $ui_fmask = array( 'minYear' => 1900 ) ), + */ array( 'element' => 'Type_Genre', 'type' => 'text', 'label' => 'Type_Genre', ), array( - 'element' => 'Description', + 'element' => 'dc:description', 'type' => 'textarea', 'label' => 'Description', ), array( - 'element' => 'Format', + 'element' => 'dc:format', 'type' => 'select', 'label' => 'Format', 'options' => array( + '' => '', + 'audio/mpeg' => 'audio/mpeg', 'File' => 'File', 'live stream' => 'Live Stream', - 'networked file'=> 'Networked File', - 'audio/mpeg' => 'audio/mpeg' + 'networked file'=> 'Networked File' ) ), array( @@ -292,9 +295,9 @@ $ui_fmask = array( 'rule' => 'numeric', ), array( - 'element' => 'Format_Extent', + 'element' => 'dcterms:extent', 'type' => 'text', - 'label' => 'Format_Extent', + 'label' => 'Extent', 'attributes'=> array('readonly' => 'on') ), ), @@ -342,6 +345,7 @@ $ui_fmask = array( 'type' => 'select', 'label' => 'Format_Medium_Channels', 'options' => array( + '' => '', 'mono' => 'Mono', 'stereo' => 'Stereo', '5.1' => '5.1' @@ -444,7 +448,7 @@ $ui_fmask = array( ), 'Talk_Basic' => array( array( - 'element' => 'Title', + 'element' => 'dc:title', 'type' => 'text', 'label' => 'Title', 'relation' => 1 @@ -455,7 +459,7 @@ $ui_fmask = array( 'label' => 'Coverage', ), array( - 'element' => 'Description', + 'element' => 'dc:description', 'type' => 'textarea', 'label' => 'Description', ), @@ -475,14 +479,15 @@ $ui_fmask = array( 'label' => 'Type_Genre', ), array( - 'element' => 'Format', + 'element' => 'dc:format', 'type' => 'select', 'label' => 'Format', 'options' => array( + '' => '', + 'audio/mpeg' => 'audio/mpeg', 'File' => 'File', 'live stream' => 'Live Stream', 'networked file'=> 'Networked File', - 'audio/mpeg' => 'audio/mpeg' ) ), ), @@ -663,11 +668,11 @@ $ui_fmask = array( ) ), - 'upload_1' => array( + 'uploadFile' => array( array( 'element' => 'act', 'type' => 'hidden', - 'constant' => 'upload_1' + 'constant' => 'uploadFile' ), array( 'element' => 'id', diff --git a/livesupport/modules/htmlUI/var/ui_handler.class.php b/livesupport/modules/htmlUI/var/ui_handler.class.php index 67fceee54..6b670328f 100644 --- a/livesupport/modules/htmlUI/var/ui_handler.class.php +++ b/livesupport/modules/htmlUI/var/ui_handler.class.php @@ -1,4 +1,7 @@ uiBase($config); } + + + // --- authentication --- /** * login @@ -42,7 +48,7 @@ class uiHandler extends uiBase { $fid = $this->gb->getObjId($formdata['login'], $this->gb->storId); if(!PEAR::isError($fid)) $this->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; }else{ - $this->alertMsg = 'Login failed.'; + $this->_retMsg('Login failed.'); $_SESSION['retransferFormData']['login']=$formdata['login']; $this->redirUrl = UI_BROWSER.'?popup[]=login'; } @@ -97,7 +103,7 @@ class uiHandler extends uiBase { } } $r = $this->gb->putFile($id, $formdata['mediafile']['name'], $ntmp, $mdtmp, $this->sessid); - if(PEAR::isError($r)) $this->alertMsg = $r->getMessage(); + if(PEAR::isError($r)) $this->_retMsg($r->getMessage()); else{ # $gb->updateMetadataDB($gb->_pathFromId($r), $mdata, $sessid); @unlink($ntmp); @@ -114,14 +120,14 @@ class uiHandler extends uiBase { /** - * upload_1 + * uploadS1 * * Provides file upload and store it to the storage * * @param formdata array, submitted text and file * @param id int, destination folder id */ - function upload_1(&$formdata, $id, &$mask) + function uploadFile(&$formdata, $id, &$mask) { if ($this->_validateForm($formdata, $mask)) { $tmpgunid = md5( @@ -134,7 +140,7 @@ class uiHandler extends uiBase { chmod($ntmp, 0664); $r = $this->gb->putFile($id, $formdata['mediafile']['name'], $ntmp, NULL, $this->sessid); - if(PEAR::isError($r)) $this->alertMsg = $r->getMessage(); + if(PEAR::isError($r)) $this->_retMsg($r->getMessage()); else{ # $gb->updateMetadataDB($gb->_pathFromId($r), $mdata, $sessid); @unlink($ntmp); @@ -147,7 +153,7 @@ class uiHandler extends uiBase { $this->redirUrl = UI_BROWSER."?act=editMetaDataValues&id=$r"; return $r; } else { - $this->redirUrl = UI_BROWSER."?act=upload_1&id=$id"; + $this->redirUrl = UI_BROWSER."?act=uploadFile&id=$id"; return FALSE; } } @@ -163,7 +169,7 @@ class uiHandler extends uiBase { function newFolder($newname, $id) { $r = $this->gb->createFolder($id, $newname, $this->sessid); - if(PEAR::isError($r)) $this->alertMsg = $r->getMessage(); + if(PEAR::isError($r)) $this->_retMsg($r->getMessage()); $this->redirUrl = UI_BROWSER.'?id='.$id; } @@ -179,7 +185,7 @@ class uiHandler extends uiBase { { $parid = $this->gb->getparent($this->id); $r = $this->gb->renameFile($id, $newname, $this->sessid); - if(PEAR::isError($r)) $this->alertMsg = $r->getMessage(); + if(PEAR::isError($r)) $this->_retMsg($r->getMessage()); $this->redirUrl = UI_BROWSER."?id=$parid"; } @@ -199,7 +205,7 @@ class uiHandler extends uiBase { $parid = $this->gb->getparent($id); $r = $this->gb->moveFile($id, $did, $this->sessid); if(PEAR::isError($r)){ - $this->alertMsg = $r->getMessage(); + $this->_retMsg($r->getMessage()); $this->redirUrl = UI_BROWSER."?id=$parid"; } else $this->redirUrl = UI_BROWSER."?id=$did"; @@ -221,7 +227,7 @@ class uiHandler extends uiBase { $parid = $this->gb->getparent($id); $r = $this->gb->copyFile($id, $did, $this->sessid); if(PEAR::isError($r)){ - $this->alertMsg = $r->getMessage(); + $this->_retMsg($r->getMessage()); $this->redirUrl = UI_BROWSER."?id=$parid"; } else $this->redirUrl = UI_BROWSER."?id=$did"; @@ -242,14 +248,14 @@ class uiHandler extends uiBase { ## add emtyness-test here ### if (!($delOverride==$id) && (count($this->gb->getObjType($id)=='Folder'? $this->gb->listFolder($id, $this->sessid):NULL))) { - $this->alertMsg = $this->tra("Folder is not empty. You can override this protection by clicking DEL again"); + $this->_retMsg("Folder is not empty. You can override this protection by clicking DEL again"); $this->redirUrl = UI_BROWSER."?id=$parid&delOverride=$id"; return; } ############################# $r = $this->gb->deleteFile($id, $this->sessid); - if(PEAR::isError($r)) $this->alertMsg = $r->getMessage(); + if(PEAR::isError($r)) $this->_retMsg($r->getMessage()); $this->redirUrl = UI_BROWSER."?id=$parid"; } @@ -266,7 +272,7 @@ class uiHandler extends uiBase { function getFile($id) { $r = $this->gb->access($id, $this->sessid); - if(PEAR::isError($r)) $this->alertMsg = $r->getMessage(); + if(PEAR::isError($r)) $this->_retMsg($r->getMessage()); else echo $r; } @@ -300,13 +306,13 @@ class uiHandler extends uiBase { if ($this->_validateForm($formdata, $mask)) { if($this->gb->checkPerm($this->userid, 'subjects')){ $res = $this->gb->addSubj($formdata['login'], ($formdata['pass']=='' ? NULL:$formdata['pass'] )); - $this->alertMsg = $this->tra('Subject "'.$formdata['login'].'" added.'); + $this->_retMsg('Subject $1 added.', $formdata['login']); } else { - $this->alertMsg = $this->tra('Access denied.'); + $this->_retMsg('Access denied.'); return; } } - if(PEAR::isError($res)) $this->alertMsg = $res->getMessage(); + if(PEAR::isError($res)) $this->_retMsg($res->getMessage()); } /** @@ -323,10 +329,10 @@ class uiHandler extends uiBase { if($this->gb->checkPerm($this->userid, 'subjects')){ $res = $this->gb->removeSubj($login); }else{ - $this->alertMsg='Access denied.'; + $this->_retMsg('Access denied.'); return; } - if(PEAR::isError($res)) $this->alertMsg = $res->getMessage(); + if(PEAR::isError($res)) $this->_retMsg($res->getMessage()); } /** @@ -346,15 +352,15 @@ class uiHandler extends uiBase { if($this->userid != $uid && ! $this->gb->checkPerm($this->userid, 'subjects')){ - $this->alertMsg='Access denied..'; + $this->_retMsg('Access denied.'); return; } if(FALSE === $this->gb->authenticate($ulogin, $oldpass)){ - $this->alertMsg='Wrong old pasword.'; + $this->_retMsg('Wrong old pasword.'); return; } if($pass !== $pass2){ - $this->alertMsg = "Passwords do not match. ". + $this->_retMsg("Passwords do not match."). "($pass/$pass2)"; $this->redirUrl = UI_BROWSER.'?act=subjects'; return; @@ -379,7 +385,7 @@ class uiHandler extends uiBase { $this->gb->addPerm($subj, $permAction, $id, $allowDeny); }else{ - $this->alertMsg='Access denied.'; + $this->_retMsg('Access denied.'); } $this->redirUrl = UI_BROWSER.'?id='.$id.'&act=permissions'; } @@ -396,7 +402,7 @@ class uiHandler extends uiBase { { if($this->gb->checkPerm($this->userid, 'editPerms', $oid)) $this->gb->removePerm($permid); - else $this->alertMsg='Access denied.'; + else $this->_retMsg('Access denied.'); $this->redirUrl = UI_BROWSER.'?act=permissions&id='.$oid; } @@ -416,10 +422,10 @@ class uiHandler extends uiBase { if($this->gb->checkPerm($this->userid, 'subjects')){ $res = $this->gb->addSubj2Gr($login, $gname); }else{ - $this->alertMsg='Access denied.'; + $this->_retMsg('Access denied.'); return; } - if(PEAR::isError($res)) $this->alertMsg = $res->getMessage(); + if(PEAR::isError($res)) $this->_retMsg($res->getMessage()); $this->redirUrl = UI_BROWSER.'?act=groups&id='.$reid; } @@ -436,10 +442,10 @@ class uiHandler extends uiBase { if($this->gb->checkPerm($this->userid, 'subjects')){ $res = $this->gb->removeSubjFromGr($login, $gname); }else{ - $this->alertMsg='Access denied.'; + $this->_retMsg('Access denied.'); return; } - if(PEAR::isError($res)) $this->alertMsg = $res->getMessage(); + if(PEAR::isError($res)) $this->_retMsg($res->getMessage()); $this->redirUrl = UI_BROWSER.'?act=groups&id='.$reid; } @@ -457,10 +463,11 @@ class uiHandler extends uiBase { $this->_dateArr2Str(&$mData); foreach ($mData as $key=>$val) { + #echo "id: {$formdata['id']}, key: $key, val: $val
"; $this->gb->setMDataValue($formdata['id'], $key, $this->sessid, $val); } - $this->alertMsg = $this->tra('Metadata saved'); + $this->_retMsg('Metadata saved'); } @@ -519,7 +526,7 @@ class uiHandler extends uiBase { } if ($val['type'] == 'file' && $formdata[$val['element']]['name']) { if (FALSE === @move_uploaded_file($formdata[$val['element']]['tmp_name'], $this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'stationLogoPath'))) - $this->alertMsg = $this->tra('Error uploading Logo'); + $this->_retMsg('Error uploading Logo'); return; } }