diff --git a/livesupport/modules/htmlUI/var/conf.php b/livesupport/modules/htmlUI/var/conf.php index c93cda9d6..f07edbc65 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.11 $ + Version : $Revision: 1.12 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/conf.php,v $ ------------------------------------------------------------------------------*/ @@ -117,9 +117,9 @@ define('UI_INPUT_STANDARD_SIZE', 20); define('UI_INPUT_STANDARD_MAXLENGTH', 50); define('UI_TEXTAREA_STANDART_ROWS', 5); define('UI_TEXTAREA_STANDART_COLS', 17); -define('UI_QFORM_REQUIRED', 'templates/form_parts/required.tpl'); -define('UI_QFORM_REQUIREDNOTE', 'templates/form_parts/requirednote.tpl'); -define('UI_QFORM_ERROR', 'templates/form_parts/error.tpl'); +define('UI_QFORM_REQUIRED', 'templates/sub/form_required.tpl'); +define('UI_QFORM_REQUIREDNOTE', 'templates/sub/form_requirednote.tpl'); +define('UI_QFORM_ERROR', 'templates/sub/form_error.tpl'); define('UI_SEARCH_MAX_ROWS', 8); define('UI_SEARCH_MIN_ROWS', 2); define('UI_REGEX_URL', '/^(ht|f)tps?:\/\/[^ ]+$/'); diff --git a/livesupport/modules/htmlUI/var/formmask/general.inc.php b/livesupport/modules/htmlUI/var/formmask/general.inc.php new file mode 100755 index 000000000..3cef45e0d --- /dev/null +++ b/livesupport/modules/htmlUI/var/formmask/general.inc.php @@ -0,0 +1,417 @@ + array( + array( + 'element' => 'act', + 'type' => 'hidden', + 'constant' => 'systemPrefs' + ), + array( + 'element' => 'basics', + 'type' => 'header', + 'label' => 'Basic Settings', + ), + array( + 'element' => 'stationMaxfilesize', + 'isPref' => TRUE, + 'type' => 'text', + 'label' => 'Maximum File Size for Upload', + 'required' => TRUE, + 'default' => ini_get('upload_max_filesize') + ), + array( + 'rule' => 'nopunctuation', + 'element' => 'maxfilesize', + ), + array( + 'element' => 'stationFrequency', + 'isPref' => TRUE, + 'type' => 'text', + 'label' => 'Frequency', + 'required' => TRUE + ), + array( + 'element' => 'stationName', + 'isPref' => TRUE, + 'type' => 'text', + 'label' => 'Staion Name', + 'required' => TRUE + ), + array( + 'element' => 'stationLogoPath', + 'isPref' => TRUE, + 'type' => 'text', + 'label' => 'Station Logo path', + 'default' => 'img/logo.jpg', + 'required' => TRUE + ), + array( + 'rule' => 'regex', + 'element' => 'stationLogoPath', + 'format' => '/^img\/[a-z0-9.-_]*$/', + 'rulemsg' => 'Path seems invalid' + ), + array( + 'element' => 'stationURL', + 'isPref' => TRUE, + 'type' => 'text', + 'label' => 'Station URL', + 'default' => 'http://' + ), + array( + 'rule' => 'regex', + 'element' => 'stationURL', + 'format' => UI_REGEX_URL, + 'rulemsg' => 'URL seems not to be valid' + ), + array( + 'element' => UI_SCRATCHPAD_MAXLENGTH_KEY, + 'isPref' => TRUE, + 'type' => 'select', + 'label' => 'Maximun length of ScratchPad', + 'options' => array( + '4' => '4', + '5' => '5', + '6' => '6', + '7' => '7', + '8' => '8', + '9' => '9', + '10'=>'10' + ) + ), + array( + 'element' => 'upload', + 'type' => 'header', + 'label' => 'Upload' + ), + array( + 'element' => 'stationlogo', + 'type' => 'file', + 'label' => 'Station Logo', + 'requiredmsg'=> 'please select Logo file' + ), + array( + 'element' =>'Submit', + 'type' =>'submit', + 'label' =>'Submit' + ) + ), + + 'chgPasswd' => array( + array( + 'element' => 'act', + 'type' => 'hidden', + 'default' => 'chgPasswd' + ), + array( + 'element' => 'uid', + 'type' => 'hidden', + ), + array( + 'element' => 'oldpass', + 'type' => 'password', + 'label' => 'Old Password', + 'required' => TRUE, + ), + array( + 'element' => 'pass', + 'type' => 'password', + 'label' => 'New Password', + 'required' => TRUE, + ), + array( + 'element' => 'pass2', + 'type' => 'password', + 'label' => 'Retype Password', + 'required' => TRUE, + ), + array( + 'rule' => 'compare', + 'element' => array('pass','pass2'), + 'rulemsg' => 'The Passwords do not match' + ), + array( + 'element' =>'Submit', + 'type' =>'submit', + 'label' =>'Submit' + ) + + ), + + 'addUser' => array( + array( + 'element' => 'act', + 'type' => 'hidden', + 'constant' => 'addUser' + ), + array( + 'element' => 'login', + 'type' => 'text', + 'label' => 'Username', + 'required' => TRUE + ), + array( + 'element' =>'pass', + 'type' =>'password', + 'label' =>'Users Password', + 'required' =>TRUE + ), + array( + 'element' =>'pass2', + 'type' =>'password', + 'label' =>'Repeat Password', + 'required' =>TRUE + ), + array( + 'rule' =>'compare', + 'element' =>array('pass','pass2'), + 'rulemsg' =>'The Passwords do not match' + ), + array( + 'element' =>'Submit', + 'type' =>'submit', + 'label' =>'Submit' + ) + ), + + 'addGroup' => array( + array( + 'element' => 'act', + 'type' => 'hidden', + 'constant' => 'addGroup' + ), + array( + 'element' => 'login', + 'type' => 'text', + 'label' => 'Group Name', + 'required' => TRUE + ), + array( + 'element' =>'Submit', + 'type' =>'submit', + 'label' =>'Submit' + ) + ), + + 'login' => array( + array( + 'element' => 'act', + 'type' => 'hidden', + 'constant' => 'login' + ), + array( + 'element' => 'login', + 'type' => 'text', + 'label' => 'Username', + 'required' => TRUE + ), + array( + 'element' => 'pass', + 'type' => 'password', + 'label' => 'Password', + 'required' => TRUE + ), + array( + 'element' => 'Submit', + 'type' => 'submit', + 'label' => 'Submit' + ), + array( + 'element' => 'cancel', + 'type' => 'button', + 'label' => 'Cancel', + 'attributes'=> array('onClick' => 'window.close()') + ) + ), + + 'uploadFileM' => array( + array( + 'element' => 'act', + 'type' => 'hidden' + ), + array( + 'element' => 'id', + 'type' => 'hidden' + ), + array( + 'element' => 'mediafile', + 'type' => 'file', + 'label' => 'Mediafile', + 'required' => TRUE, + 'requiredmsg'=> 'please select Media file' + ), + array( + 'element' => 'mdatafile', + 'type' => 'file', + 'label' => 'Metadata', + 'required' => TRUE, + 'requiredmsg'=> 'please select Metadata file' + ), + array( + 'element' => 'Submit', + 'type' => 'submit', + 'label' => 'Submit' + ) + ), + + 'uploadFile' => array( + array( + 'element' => 'act', + 'type' => 'hidden' + ), + array( + 'element' => 'id', + 'type' => 'hidden' + ), + array( + 'element' => 'mediafile', + 'type' => 'file', + 'label' => 'Mediafile', + 'required' => TRUE, + 'requiredmsg'=> 'please select Media file' + ), + array( + 'element' => 'Submit', + 'type' => 'submit', + 'label' => 'Submit' + ) + ), + + 'addWebstream' => array( + array( + 'element' => 'act', + 'type' => 'hidden', + ), + array( + 'element' => 'id', + 'type' => 'hidden' + ), + array( + 'element' => 'name', + 'type' => 'text', + 'label' => 'Name', + 'required' => TRUE, + 'rule' => 'alphanumeric', + 'rulemsg' => 'Name must be alphanumeric' + ), + array( + 'element' => 'url', + 'type' => 'text', + 'default' => 'http://', + 'label' => 'Stream URL', + 'required' => TRUE, + 'requiredmsg'=> 'URL is missing', + 'rule' => 'regex', + 'format' => UI_REGEX_URL, + 'rulemsg' => 'URL seems invalid', + ), + array( + 'element' => 'duration', + 'type' => 'date', + 'label' => 'Duration', + 'options' => array( + 'format' => 'His', + ) + ), + array( + 'element' => 'Submit', + 'type' => 'submit', + 'label' => 'Submit' + ) + ), + + 'searchform' => array( + array( + 'element' => 'act', + 'type' => 'hidden', + 'constant' => 'search' + ), + array( + 'element' => 'id', + 'type' => 'hidden' + ), + array( + 'element' => 'counter', + 'type' => 'hidden' + ), + array( + 'element' => 'max_rows', + 'type' => 'hidden', + 'constant' => UI_SEARCH_MAX_ROWS + ), + array( + 'element' => 'operator', + 'type' => 'select', + 'label' => 'Operator', + 'options' => array( + 'or' => 'Or', + 'and' => 'And', + ) + ), + array( + 'element' => 'filetype', + 'type' => 'select', + 'label' => 'Filetype', + 'options' => array( + 'File' => '*', + 'audioclip' => 'Audioclip', + 'webstream' => 'Webstream', + 'playlist' => 'Playlist' + ) + ), + array( + 'element' => 'clear', + 'type' => 'button', + 'label' => 'Clear', + 'attributes' => array('onClick' => "this.form.reset(); hpopup('".UI_HANDLER."?act=search&clear=1', 'SF')"), + 'groupit' => TRUE, + ), + array( + 'element' => 'addrow', + 'type' => 'button', + 'label' => 'One more Row', + 'attributes' => array('onClick' => 'SearchForm_addRow()'), + 'groupit' => TRUE, + ), + array( + 'element' => 'submit', + 'type' => 'submit', + 'label' => 'Submit', + 'groupit' => TRUE, + ), + array('group' => array('clear', 'addrow', 'submit') + ), + ), + 'relations' => array( + 'standard' => array( + 'partial' => 'partial', + 'full' => 'full', + 'prefix' => 'prefix', + '=' => '=' , + '<' => '<', + '<=' => '<=', + '>' => '>', + '>=' => '>=' + ), + 1 => array( + 'partial' => 'partial', + 'full' => 'full', + 'prefix' => 'prefix', + '=' => '=' + ), + ), + 'languages' => array( + array( + 'element' => 'langid', + 'type' => 'select', + 'label' => 'Language', + 'options' => array( + 'en' => 'English', + 'cz' => 'Czech', + 'de' => 'German', + 'hu' => 'Hungarian', + ) + ) + ) +); diff --git a/livesupport/modules/htmlUI/var/formmask/metadata.inc.php b/livesupport/modules/htmlUI/var/formmask/metadata.inc.php new file mode 100755 index 000000000..e2f222f6f --- /dev/null +++ b/livesupport/modules/htmlUI/var/formmask/metadata.inc.php @@ -0,0 +1,440 @@ + array( + array( + 'element' => 'act', + 'type' => 'hidden', + 'constant'=> 'editMetaData' + ), + array( + 'element' => 'id', + 'type' => 'hidden' + ), + array( + 'element' => 'langid', + 'type' => 'hidden' + ), + ), + 'buttons' => array ( + array( + 'element' =>'reset', + 'type' =>'reset', + 'label' =>'Reset', + 'groupit' => TRUE, + ), + array( + 'element' =>'button', + 'type' =>'button', + 'label' =>'Submit', + 'groupit' => TRUE, + 'attributes'=> array( + 'onClick' => 'return switchMDataLang();' + ), + ), + array( + 'group' => array('reset', 'button'), + ) + ), + 'tabs' => array( + array( + 'element' => 'Main', + 'type' => 'button', + 'label' => 'Main', + 'groupit' => TRUE, + 'attributes' => array('onClick' => 'showMain()') + ), + array( + 'element' => 'Music_Basic', + 'type' => 'button', + 'label' => 'Music_Basic', + 'groupit' => TRUE, + 'attributes' => array('onClick' => 'showMusic_Basic()') + ), + array( + 'element' => 'Music_Advanced', + 'type' => 'button', + 'label' => 'Music_Advanced', + 'groupit' => TRUE, + 'attributes' => array('onClick' => 'showMusic_Advanced()') + ), + array( + 'element' => 'Talk_Basic', + 'type' => 'button', + 'label' => 'Talk_Basic', + 'groupit' => TRUE, + 'attributes' => array('onClick' => 'showTalk_Basic()') + ), + array( + 'element' => 'Talk_Advanced', + 'type' => 'button', + 'label' => 'Talk_Advanced', + 'groupit' => TRUE, + 'attributes' => array('onClick' => 'showTalk_Advanced()') + ), + 'group' => array( + 'group' => array('Main', 'Music_Basic', 'Music_Advanced', 'Talk_Basic', 'Talk_Advanced'), + ) + + ), + 'langswitch' => array( + array( + 'element' => 'langid', + 'type' => 'select', + 'label' => 'Language', + 'options' => array( + 'en' => 'English', + 'cz' => 'Czech', + 'de' => 'German', + 'hu' => 'Hungarian', + ), + 'attributes'=> array('onChange' => 'return switchMDataLang()') + ) + ), + 'pages' => array( + 'Main' => array( + array( + 'element' => 'dc:title', + 'type' => 'text', + 'label' => 'Title', + 'required' => TRUE + ), + array( + 'element' => 'Creator', + 'type' => 'text', + 'label' => 'Creator', + #'required' => TRUE, + ), + array( + 'element' => 'Type_Genre', + 'type' => 'text', + 'label' => 'Type_Genre', + #'required' => TRUE, + ), + array( + 'element' => 'dc:format', + 'type' => 'select', + 'label' => 'Format', + #'required' => TRUE, + 'options' => array( + '' => '', + 'audio/mpeg' => 'audio/mpeg', + 'File' => 'File', + 'live stream' => 'Live Stream', + 'networked file'=> 'Networked File', + ) + ), + array( + 'element' => 'dcterms:extent', + 'type' => 'text', + 'label' => 'Extent', + #'attributes'=> array('readonly' => 'on') + ), + /* + array( + 'element' => 'Format_Extent_h', + 'type' => 'select', + 'options' => getDArr('h'), + 'groupit' => TRUE + ), + array( + 'element' => 'Format_Extent_m', + 'type' => 'select', + 'options' => getDArr('m'), + 'groupit' => TRUE + ), + array( + 'element' => 'Format_Extent_s', + 'type' => 'select', + 'options' => getDArr('h'), + 'groupit' => TRUE + ), + array( + 'group' => array('Main__Format_Extent_h', 'Main__Format_Extent_m', 'Main__Format_Extent_s'), + #'name' => 'gr_Format_Extent', + 'label' => 'Format_Extent', + 'rule' => 'required', + #'grouprule' => 'regex', + #'format' => '/([1-9]0)|([1-9]{2})|(0[1-9])/', + #'arg1' => 'Please enter Format_Extent', + #'howmany' => 1 + ), */ + ), + 'Music_Basic' => array( + array( + 'element' => 'dc:title', + 'type' => 'text', + 'label' => 'Title', + ), + array( + 'element' => 'dc:creator', + 'type' => 'text', + 'label' => 'Creator', + ), + array( + 'element' => 'Source_Album', + 'type' => 'text', + 'label' => 'Source_Album', + ), + /* + array( + 'element' => 'Source_Year', + 'type' => 'date', + 'label' => 'Source_Year', + 'options' => array( + 'language' => 'en', + 'format' => 'dMY', + 'addEmptyOption'=> TRUE, + 'minYear' => 1900 + ) + ), + */ + array( + 'element' => 'Type_Genre', + 'type' => 'text', + 'label' => 'Type_Genre', + ), + array( + 'element' => 'dc:description', + 'type' => 'textarea', + 'label' => 'Description', + ), + array( + 'element' => 'dc:format', + 'type' => 'select', + 'label' => 'Format', + 'options' => array( + '' => '', + 'audio/mpeg' => 'audio/mpeg', + 'File' => 'File', + 'live stream' => 'Live Stream', + 'networked file'=> 'Networked File' + ) + ), + array( + 'element' => 'Type_BPM', + 'type' => 'text', + 'label' => 'Type_BPM', + 'rule' => 'numeric', + ), + array( + 'element' => 'Description_Rating', + 'type' => 'text', + 'label' => 'Description_Rating', + 'rule' => 'numeric', + ), + array( + 'element' => 'dcterms:extent', + 'type' => 'text', + 'label' => 'Extent', + 'attributes'=> array('readonly' => 'on') + ), + ), + 'Music_Advanced'=> array( + array( + 'element' => 'Creator_Role_Encoder', + 'type' => 'text', + 'label' => 'Creator_Role_Encoder', + ), + array( + 'element' => 'Source_Album_TrackNumber', + 'type' => '', + 'label' => 'Source_Album_TrackNumber', + 'rule' => 'numeric', + ), + array( + 'element' => 'Source_Album_DiscNumber', + 'type' => 'text', + 'label' => 'Source_Album_DiscNumber', + 'rule' => 'numeric', + ), + array( + 'element' => 'Description_Mood', + 'type' => 'text', + 'label' => 'Description_Mood', + ), + array( + 'element' => 'Publisher', + 'type' => 'text', + 'label' => 'Publisher', + ), + array( + 'element' => 'Creator_Role_Composer', + 'type' => 'text', + 'label' => 'Creator_Role_Composer', + ), + array( + 'element' => 'Format_Medium_Bitrate', + 'type' => 'text', + 'label' => 'Format_Medium_Bitrate', + 'rule' => 'numeric' + ), + array( + 'element' => 'Format_Medium_Channels', + 'type' => 'select', + 'label' => 'Format_Medium_Channels', + 'options' => array( + '' => '', + 'mono' => 'Mono', + 'stereo' => 'Stereo', + '5.1' => '5.1' + ) + ), + array( + 'element' => 'Format_Medium_Samplerate', + 'type' => 'text', + 'label' => 'Format_Medium_Samplerate', + 'rule' => 'numeric' + ), + array( + 'element' => 'Format_Medium_Encoder', + 'type' => 'text', + 'label' => 'Format_Medium_Encoder', + ), + array( + 'element' => 'Format_CRC', + 'type' => 'text', + 'label' => 'Format_CRC', + 'rule' => 'numeric' + ), + array( + 'element' => 'Description_Lyrics', + 'type' => 'textarea', + 'label' => 'Description_Lyrics', + ), + array( + 'element' => 'Creator_Role_Orchestra', + 'type' => 'text', + 'label' => 'Creator_Role_Orchestra', + ), + array( + 'element' => 'Creator_Role_Conductor', + 'type' => 'text', + 'label' => 'Creator_Role_Conductor', + ), + array( + 'element' => 'Creator_Role_Lyricist', + 'type' => 'text', + 'label' => 'Creator_Role_Lyricist', + ), + array( + 'element' => 'Creator_Role_OriginalLyricist', + 'type' => 'text', + 'label' => 'Creator_Role_OriginalLyricist', + ), + array( + 'element' => 'Creator_Role_RadioStationName', + 'type' => 'text', + 'label' => 'Creator_Role_RadioStationName', + ), + array( + 'element' => 'Description_AudioFileInfoURL', + 'type' => 'text', + 'label' => 'Description_AudioFileInfoURL', + ), + array( + 'element' => 'Description_ArtistURL', + 'type' => 'text', + 'label' => 'Description_ArtistURL', + ), + array( + 'element' => 'Description_AudioSourceURL', + 'type' => 'text', + 'label' => 'Description_AudioSourceURL', + ), + array( + 'element' => 'Description_RadioStationURL', + 'type' => 'text', + 'label' => 'Description_RadioStationURL', + ), + array( + 'element' => 'Description_BuyCDURL', + 'type' => 'text', + 'label' => 'Description_BuyCDURL', + ), + array( + 'element' => 'Identifier_ISRCNumber', + 'type' => 'text', + 'label' => 'Identifier_ISRCNumber', + 'rule' => 'numeric' + ), + array( + 'element' => 'Identifier_CatalogNumber', + 'type' => 'text', + 'label' => 'Identifier_CatalogNumber', + 'rule' => 'numeric' + ), + array( + 'element' => 'Creator_Role_OriginalArtist', + 'type' => 'text', + 'label' => 'Creator_Role_OriginalArtist', + ), + array( + 'element' => 'Rights_Copyright', + 'type' => 'text', + 'label' => 'Rights_Copyright', + ), + ), + 'Talk_Basic' => array( + array( + 'element' => 'dc:title', + 'type' => 'text', + 'label' => 'Title', + ), + array( + 'element' => 'Coverage', + 'type' => 'text', + 'label' => 'Coverage', + ), + array( + 'element' => 'dc:description', + 'type' => 'textarea', + 'label' => 'Description', + ), + array( + 'element' => 'Creator', + 'type' => 'text', + 'label' => 'Creator', + ), + array( + 'element' => 'Subject', + 'type' => 'text', + 'label' => 'Subject', + ), + array( + 'element' => 'Type_Genre', + 'type' => 'text', + 'label' => 'Type_Genre', + ), + array( + 'element' => 'dc:format', + 'type' => 'select', + 'label' => 'Format', + 'options' => array( + '' => '', + 'audio/mpeg' => 'audio/mpeg', + 'File' => 'File', + 'live stream' => 'Live Stream', + 'networked file'=> 'Networked File', + ) + ), + ), + 'Talk_Advanced' => array( + array( + 'element' => 'Contributor', + 'type' => 'text', + 'label' => 'Contributor', + ), + array( + 'element' => 'Language', + 'type' => 'text', + 'label' => 'Language', + ), + array( + 'element' => 'Rights', + 'type' => 'text', + 'label' => 'Rights', + ), + ) + ) +); +?> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/html/templates/editMetaData.tpl b/livesupport/modules/htmlUI/var/html/templates/editMetaData.tpl index bd04bd416..422f1a26b 100755 --- a/livesupport/modules/htmlUI/var/html/templates/editMetaData.tpl +++ b/livesupport/modules/htmlUI/var/html/templates/editMetaData.tpl @@ -8,11 +8,12 @@ {/literal}
+{include file="sub/x.tpl"}
{$editMetaData.tabs} {$editMetaData.langswitch} {foreach from=$editMetaData.pages key=key item=dynform} - {include file="form_parts/dynForm_plain.tpl"} + {include file="sub/dynForm_plain.tpl"} {/foreach}
@@ -31,7 +32,7 @@ function switchMDataLang() } function spread(element, name) -{ +{ if (document.forms['editMetaData'].elements['Main___' + name]) document.forms['editMetaData'].elements['Main___' + name].value = element.value; if (document.forms['editMetaData'].elements['Music_Basic___' + name]) document.forms['editMetaData'].elements['Music_Basic___' + name].value = element.value; if (document.forms['editMetaData'].elements['Music_Advanced___' + name]) document.forms['editMetaData'].elements['Music_Advanced___' + name].value = element.value; diff --git a/livesupport/modules/htmlUI/var/html/templates/filedata.tpl b/livesupport/modules/htmlUI/var/html/templates/filedata.tpl index 2a77d0b75..bc72a49e9 100644 --- a/livesupport/modules/htmlUI/var/html/templates/filedata.tpl +++ b/livesupport/modules/htmlUI/var/html/templates/filedata.tpl @@ -1,5 +1,6 @@ {* Smarty template *}
+{include file="sub/x.tpl"}
{if $fMetaData} diff --git a/livesupport/modules/htmlUI/var/html/templates/masterpanel.tpl b/livesupport/modules/htmlUI/var/html/templates/masterpanel.tpl index d17a46130..e7d2d8549 100644 --- a/livesupport/modules/htmlUI/var/html/templates/masterpanel.tpl +++ b/livesupport/modules/htmlUI/var/html/templates/masterpanel.tpl @@ -11,23 +11,14 @@ {include file="ScratchPad.tpl"} {/if} -{if $showPath} - {include file="path.tpl"} +{if $structure} + {include file="fileBrowse/path.tpl"} {/if} -{if $showTree} - {include file="tree.tpl"} +{if $fileBrowse} + {include file="fileBrowse/fileBrowse.tpl"} {/if} -{if $showObjects} - {include file="objects.tpl"} -{/if} - -{if $permissions} - {include file="permissions.tpl"} -{/if} - - {if ($showSearchForm || $showSearchRes)} {include file="search.tpl"} {/if} @@ -40,6 +31,10 @@ {include file="filedata.tpl"} {/if} +{if $uploadform} + {include file="uploadform.tpl"} +{/if} + {if $editMetaData} {include file="editMetaData.tpl"} {/if} @@ -48,9 +43,6 @@ {include file="systemPrefs.tpl"} {/if} -{if $uploadform} - {include file="uploadform.tpl"} -{/if}
diff --git a/livesupport/modules/htmlUI/var/html/templates/menu_top.tpl b/livesupport/modules/htmlUI/var/html/templates/menu_top.tpl index 97cc2d782..05a7c5de8 100644 --- a/livesupport/modules/htmlUI/var/html/templates/menu_top.tpl +++ b/livesupport/modules/htmlUI/var/html/templates/menu_top.tpl @@ -1,12 +1,12 @@ \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/html/templates/objects.tpl b/livesupport/modules/htmlUI/var/html/templates/objects.tpl deleted file mode 100644 index b287dde8f..000000000 --- a/livesupport/modules/htmlUI/var/html/templates/objects.tpl +++ /dev/null @@ -1,58 +0,0 @@ -
- - -{if $structure.msg} - -{/if} - -{if count($structure.listdata)} - {foreach from=$structure.listdata item=o} - - - - - - {/foreach} -{else} - -{/if} -
- - {if $structure.tree} - {str_repeat str=' ' count=$o.level} - {else} - {str_repeat str=' ' count=3} - {/if} - [{$o.title}]:   - - - {$a.$o.type} -  [rename] -  [move] -  [copy] -  [permissions] -
-   - {if ($delOverride eq $o.id)} - [DEL] - {else} - [DEL] - {/if} - {if $o.type != 'Folder'} -  [Access] -  [vMData] -  [Analyze] -  [Edit] -  [eMData] -  [SP] - {/if} -   -
No objects
- -
\ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/html/templates/path.tpl b/livesupport/modules/htmlUI/var/html/templates/path.tpl deleted file mode 100644 index 5dd307a2f..000000000 --- a/livesupport/modules/htmlUI/var/html/templates/path.tpl +++ /dev/null @@ -1,17 +0,0 @@ -{*Smarty template*} - -
- - [Tree view]  |  - {foreach from=$structure.pathdata item=o} - [{$o.name}] - {if ($o.type eq 'Folder')} - / - {/if} - {/foreach} - - -
diff --git a/livesupport/modules/htmlUI/var/html/templates/permissions.tpl b/livesupport/modules/htmlUI/var/html/templates/permissions.tpl deleted file mode 100644 index f91fbf102..000000000 --- a/livesupport/modules/htmlUI/var/html/templates/permissions.tpl +++ /dev/null @@ -1,67 +0,0 @@ -
- - - - - {if (is_array($perms.perms) && count($perms.perms)>0)} - - {foreach from=$perms.perms item=row} - {if $row.type eq 'A'} - {assign var='da' value='allow'} - {else} - {if $row.type eq 'D'} - {assign var='da' value='deny'} - {else} - {assign var='da' value=$row.type} - {/if} - {/if} - - - - - - - - {/foreach} - {else} - - {/if} -
Subject NameActionPermission
{* > *}{$row.login}{$row.action}{$da} - [remove] -
No Permissions set.
- -
- -
- -Add Permission - - -for Action - - -to Subject - - - - -
- -
\ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/html/templates/scratchpad.tpl b/livesupport/modules/htmlUI/var/html/templates/scratchpad.tpl deleted file mode 100644 index 3b0ff61d7..000000000 --- a/livesupport/modules/htmlUI/var/html/templates/scratchpad.tpl +++ /dev/null @@ -1,21 +0,0 @@ -{*Smarty template*} - -
-
ScratchPad
- -{if is_array($sp)} - - - {foreach from=$sp item=i} - - - - - - - - {/foreach} - -
{tra 0=Name}{tra 0=Duration}{tra 0=Type}Del
{$i.title}{$i.duration}{$i.type} X
[Edit][Delete]
-{/if} -
diff --git a/livesupport/modules/htmlUI/var/html/templates/script/basics.js.tpl b/livesupport/modules/htmlUI/var/html/templates/script/basics.js.tpl index 0a35f958b..953467e08 100644 --- a/livesupport/modules/htmlUI/var/html/templates/script/basics.js.tpl +++ b/livesupport/modules/htmlUI/var/html/templates/script/basics.js.tpl @@ -44,8 +44,8 @@ function hpopup(url, name) //hidden popup! { - popupwin = window.open(url, name); - //window.parent.focus(); + popupwin = window.open(url, name, 'width=1, height=1'); + window.parent.focus(); } {/literal} diff --git a/livesupport/modules/htmlUI/var/html/templates/search.tpl b/livesupport/modules/htmlUI/var/html/templates/search.tpl index bff59ccae..61c675804 100644 --- a/livesupport/modules/htmlUI/var/html/templates/search.tpl +++ b/livesupport/modules/htmlUI/var/html/templates/search.tpl @@ -11,9 +11,10 @@ {/literal}
+ {include file="sub/x.tpl"}
{foreach from=$searchform item=dynform} - {include file="form_parts/dynForm_plain.tpl"} + {include file="sub/dynForm_plain.tpl"} {/foreach}
@@ -29,8 +30,8 @@ {$s.title} {$s.duration} - [XML] - [Form] + + [PL] [SP] diff --git a/livesupport/modules/htmlUI/var/html/templates/smarty-static.tpl b/livesupport/modules/htmlUI/var/html/templates/smarty-static.tpl deleted file mode 100644 index 37bcac50f..000000000 --- a/livesupport/modules/htmlUI/var/html/templates/smarty-static.tpl +++ /dev/null @@ -1,156 +0,0 @@ - - - - - Smarty template for ArraySmarty renderer: 2 column layout example - -{$form.javascript} - - - - -
-{$form.hidden} - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
{$form.header.personal}
{$form.name.label}{$form.name.error} - - - - - - - - - -
{$form.name.first.html}{$form.name.last.html}
{$form.name.first.label}{$form.name.last.label}
-
{$form.phone.label}{$form.phone.html}
{$form.email.label}{$form.email.html}
{$form.pass.label_note}
{$form.pass.label}{$form.pass.html}
-
- - - - - - - - - - - - - - - - - - - - - - -
{$form.header.company_info}
{$form.company.label}{$form.company.html}
{$form.street.label}{$form.street.html}
{$form.address.label}{$form.address.error} - - - - - - - - - -
{$form.address.zip.html}{$form.address.city.html}
{$form.address.zip.label}{$form.address.city.label}
-
{$form.country.label}{$form.country.html}
{$form.destination.label}{$form.destination.html}
-
- - - - - - - - - -
{$form.requirednote}{$form.reset.html} {$form.submit.html}

{$form.news.html}
- -
- -
-Collected Errors:
-{foreach key=name item=error from=$form.errors} - {$error} in element [{$name}]
-{/foreach} - -  -

The used "Static" Array

-
-{$static_array|htmlentities}
-
- - - \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/html/templates/styles.css b/livesupport/modules/htmlUI/var/html/templates/styles.css index 83e86c1fe..e696db9df 100644 --- a/livesupport/modules/htmlUI/var/html/templates/styles.css +++ b/livesupport/modules/htmlUI/var/html/templates/styles.css @@ -143,6 +143,13 @@ margin-top: 10px; } +.closer { + width : 10px; + float : right; + font-weight : bold; + background-color : Gray; +} + a { text-decoration: none; } diff --git a/livesupport/modules/htmlUI/var/html/templates/subjects.tpl b/livesupport/modules/htmlUI/var/html/templates/subjects.tpl index 54146ec40..3aef76379 100644 --- a/livesupport/modules/htmlUI/var/html/templates/subjects.tpl +++ b/livesupport/modules/htmlUI/var/html/templates/subjects.tpl @@ -1,5 +1,6 @@ {* Smarty template *}
+{include file="sub/x.tpl"} {if $chgPasswd} {$chgPasswd} diff --git a/livesupport/modules/htmlUI/var/html/templates/systemPrefs.tpl b/livesupport/modules/htmlUI/var/html/templates/systemPrefs.tpl index a2d34fb2a..8087a3160 100644 --- a/livesupport/modules/htmlUI/var/html/templates/systemPrefs.tpl +++ b/livesupport/modules/htmlUI/var/html/templates/systemPrefs.tpl @@ -1,5 +1,6 @@
+{include file="sub/x.tpl"}
-{include file="form_parts/dynForm_sections.tpl"} +{include file="sub/dynForm_sections.tpl"}
diff --git a/livesupport/modules/htmlUI/var/html/templates/tree.tpl b/livesupport/modules/htmlUI/var/html/templates/tree.tpl deleted file mode 100644 index 5bb17f78c..000000000 --- a/livesupport/modules/htmlUI/var/html/templates/tree.tpl +++ /dev/null @@ -1,20 +0,0 @@ -{*Smarty template*} - -
- -{if is_array($structure.treedata)} - {foreach from=$structure.treedata item=o} -
- {$structure.treedata.type} - {if $structure.treedata.tree} - {str_repeat str=' ' count=3} - {else} - {str_repeat str='  ' count=$o.level} - {/if} - - [{$o.name}]
-
- {/foreach} -{/if} - -
diff --git a/livesupport/modules/htmlUI/var/html/templates/uploadform.tpl b/livesupport/modules/htmlUI/var/html/templates/uploadform.tpl index 957ae2fa0..110ad0dc9 100644 --- a/livesupport/modules/htmlUI/var/html/templates/uploadform.tpl +++ b/livesupport/modules/htmlUI/var/html/templates/uploadform.tpl @@ -1,6 +1,7 @@ {*Smarty template*}
+{include file="sub/x.tpl"}
{$uploadform}
diff --git a/livesupport/modules/htmlUI/var/html/ui_browser.php b/livesupport/modules/htmlUI/var/html/ui_browser.php index 9dc1ff1f8..e6358e6f7 100644 --- a/livesupport/modules/htmlUI/var/html/ui_browser.php +++ b/livesupport/modules/htmlUI/var/html/ui_browser.php @@ -1,161 +1,151 @@ -display('popup/_reload_parent.tpl'); - break; - - case "_close": - $Smarty->display('popup/_close.tpl'); - break; - - case "login": - $Smarty->assign('login', $uiBrowser->login($Smarty, $ui_fmask)); - $Smarty->display('popup/login.tpl'); - break; - - case "logout": - $Smarty->assign('logouttype', 'logout'); - $Smarty->display('popup/logout.tpl'); - break; - - case "signover_1": - $Smarty->assign('logouttype', 'signover'); - $Smarty->display('popup/logout.tpl'); - break; - - case "signover_2": - $Smarty->assign('loginform', $uiBrowser->loginform($Smarty, $ui_fmask)); - $Smarty->display('popup/login.tpl'); - break; - } - } - die(); -}; - -$uiBrowser->loadSystemPrefs($ui_fmask['systemPrefs']); -$Smarty->assign('systemPrefs', $uiBrowser->systemPrefs); #print_r($uiBrowser->systemPrefs); - -if ($uiBrowser->userid) { - $Smarty->assign('showMenuTop', TRUE); - $Smarty->assign('ScratchPad', $uiBrowser->SP->get()); - - switch ($_REQUEST['act']){ - default: - $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); - $Smarty->assign('showPath', TRUE); - - if ($_REQUEST['tree']=='Y') { - $Smarty->assign('showTree', TRUE); - } else { - $Smarty->assign('showObjects', TRUE); - } - $Smarty->assign('delOverride', $_REQUEST['delOverride']); - #$Smarty->assign('obj_types', array('Folder'=>'D', 'File'=>'F', 'Replica'=>'R')); - break; - - case "permissions": - $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); - $Smarty->assign('showPath', TRUE); - - $Smarty->assign('perms', $uiBrowser->permissions($uiBrowser->id)); - $Smarty->assign('permissions', TRUE); - break; - - - case "uploadFileM": - $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); - $Smarty->assign('showPath', TRUE); - - $Smarty->assign('uploadform', $uiBrowser->uploadFileM($uiBrowser->id, $ui_fmask['uploadFileM'])); - break; - - - case "uploadFile": - $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); - $Smarty->assign('showPath', TRUE); - - $Smarty->assign('uploadform', $uiBrowser->uploadFile($uiBrowser->id, $ui_fmask['uploadFile'])); - break; - - - case "addWebstream": - $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); - $Smarty->assign('showPath', TRUE); - - $Smarty->assign('uploadform', $uiBrowser->addWebstream($uiBrowser->id, $ui_fmask['addWebstream'])); - break; - - - case "editFile": - $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); - $Smarty->assign('showPath', FALSE); - - $Smarty->assign('uploadform', $uiBrowser->uploadFile($uiBrowser->id, $ui_fmask['uploadFile'])); - break; - - - case "search": - if (is_array($uiBrowser->search['result']) ){ - $Smarty->assign('searchres', $uiBrowser->search['result']); - $Smarty->assign('showSearchRes', TRUE); - }; - - $Smarty->assign('searchform', $uiBrowser->getSearchForm($_REQUEST['id'], $ui_fmask)); - $Smarty->assign('showSearchForm', TRUE); - - break; - - case "subjects": - case "addUser": - case "addGroup": - $Smarty->assign('subjects', $uiBrowser->getSubjects()); - switch($_REQUEST['act']) { - case "addUser": $Smarty->assign('addSubjectForm', $uiBrowser->getAddSubjectForm($ui_fmask['addUser'])); break; - case "addGroup": $Smarty->assign('addSubjectForm', $uiBrowser->getAddSubjectForm($ui_fmask['addGroup'])); break; - } - $Smarty->assign('showSubjects', TRUE); - break; - - case "chgPasswd": - $Smarty->assign('chgPasswd', $uiBrowser->chgPasswd($_REQUEST['uid'], $ui_fmask['chgPasswd'])); - $Smarty->assign('showSubjects', TRUE); - break; - - case "groupMembers": - $Smarty->assign('groupMembers', $uiBrowser->groupMembers($uiBrowser->id)); - $Smarty->assign('addGroupMember', $uiBrowser->addGroupMember($uiBrowser->id)); - $Smarty->assign('showSubjects', TRUE); - break; - - case "getFile": - $Smarty->assign('fData', $uiBrowser->getFile($uiBrowser->id)); - $Smarty->assign('showFile', TRUE); - break; - - case "getMData": - $Smarty->assign('fMetaData', $uiBrowser->getMdata($uiBrowser->id)); - $Smarty->assign('showFile', TRUE); - break; - - case "editMetaData": - $Smarty->assign('editMetaData', $uiBrowser->editMetaData($uiBrowser->id, $ui_fmask['metaData'], TRUE)); - break; - - case "_analyzeFile": - $Smarty->assign('_analyzeFile', $uiBrowser->_analyzeFile($uiBrowser->id, 'text')); - $Smarty->assign('showFile', TRUE); - break; - - case "editSystemPrefs": - $Smarty->assign('dynform', $uiBrowser->systemPrefsForm($ui_fmask['systemPrefs'])); - $Smarty->assign('editSystemPrefs', TRUE); - break; - } -} - -$Smarty->display('main.tpl'); -?> +display('popup/_reload_parent.tpl'); + break; + + case "_close": + $Smarty->display('popup/_close.tpl'); + break; + + case "login": + $Smarty->assign('login', $uiBrowser->login($Smarty, $ui_fmask)); + $Smarty->display('popup/login.tpl'); + break; + + case "logout": + $Smarty->assign('logouttype', 'logout'); + $Smarty->display('popup/logout.tpl'); + break; + + case "signover_1": + $Smarty->assign('logouttype', 'signover'); + $Smarty->display('popup/logout.tpl'); + break; + + case "signover_2": + $Smarty->assign('loginform', $uiBrowser->loginform($Smarty, $ui_fmask)); + $Smarty->display('popup/login.tpl'); + break; + } + } + die(); +}; + +$uiBrowser->loadSystemPrefs($ui_fmask['systemPrefs']); +$Smarty->assign('systemPrefs', $uiBrowser->systemPrefs); + +if ($uiBrowser->userid) { + $Smarty->assign('showMenuTop', TRUE); + $Smarty->assign('ScratchPad', $uiBrowser->SP->get()); + + switch ($_REQUEST['act']){ + case "fileBrowse": + $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->fid)); + + $Smarty->assign('fileBrowse', TRUE); + if ($_REQUEST['tree']=='Y') + $Smarty->assign('showTree', TRUE); + else + $Smarty->assign('showObjects', TRUE); + $Smarty->assign('delOverride', $_REQUEST['delOverride']); + break; + + case "permissions": + $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); + + $Smarty->assign('permissions', $uiBrowser->permissions($uiBrowser->id)); + $Smarty->assign('fileBrowse', TRUE); + break; + + + case "uploadFileM": + $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); + + $Smarty->assign('uploadform', $uiBrowser->uploadFileM($ui_fmask['uploadFileM'], $uiBrowser->id)); + break; + + + case "uploadFile": + $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); + + $Smarty->assign('uploadform', $uiBrowser->uploadFile($ui_fmask['uploadFile'], $uiBrowser->id, $_REQUEST['replace'])); + break; + + + case "addWebstream": + $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); + + $Smarty->assign('uploadform', $uiBrowser->addWebstream($ui_fmask['addWebstream'], $uiBrowser->id, $_REQUEST['replace'])); + break; + + + case "editMetaData": + $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); + + $Smarty->assign('editMetaData', $uiBrowser->editMetaData($uiBrowser->id, TRUE)); + break; + + + case "search": + if (is_array($uiBrowser->search['criteria']) ){ + $Smarty->assign('searchres', $uiBrowser->search['result']); + $Smarty->assign('showSearchRes', TRUE); + }; + + $Smarty->assign('searchform', $uiBrowser->getSearchForm($uiBrowser->id, $ui_fmask)); + $Smarty->assign('showSearchForm', TRUE); + + break; + + case "subjects": + case "addUser": + case "addGroup": + $Smarty->assign('subjects', $uiBrowser->getSubjects()); + switch($_REQUEST['act']) { + case "addUser": $Smarty->assign('addSubjectForm', $uiBrowser->getAddSubjectForm($ui_fmask['addUser'])); break; + case "addGroup": $Smarty->assign('addSubjectForm', $uiBrowser->getAddSubjectForm($ui_fmask['addGroup'])); break; + } + $Smarty->assign('showSubjects', TRUE); + break; + + case "chgPasswd": + $Smarty->assign('chgPasswd', $uiBrowser->chgPasswd($uiBrowser->id, $ui_fmask['chgPasswd'])); + $Smarty->assign('showSubjects', TRUE); + break; + + case "groupMembers": + $Smarty->assign('groupMembers', $uiBrowser->groupMembers($uiBrowser->id)); + $Smarty->assign('addGroupMember', $uiBrowser->addGroupMember($uiBrowser->id)); + $Smarty->assign('showSubjects', TRUE); + break; + + case "getFile": + $Smarty->assign('fData', $uiBrowser->getFile($uiBrowser->id)); + $Smarty->assign('showFile', TRUE); + break; + + case "getMData": + $Smarty->assign('fMetaData', $uiBrowser->getMdata($uiBrowser->id)); + $Smarty->assign('showFile', TRUE); + break; + + + case "_analyzeFile": + $Smarty->assign('_analyzeFile', $uiBrowser->_analyzeFile($uiBrowser->id, 'text')); + $Smarty->assign('showFile', TRUE); + break; + + case "editSystemPrefs": + $Smarty->assign('dynform', $uiBrowser->systemPrefsForm($ui_fmask['systemPrefs'])); + $Smarty->assign('editSystemPrefs', TRUE); + break; + } +} + +$Smarty->display('main.tpl'); +?> \ No newline at end of file diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php index 6ba8db1a6..e7cdeabab 100644 --- a/livesupport/modules/htmlUI/var/html/ui_handler.php +++ b/livesupport/modules/htmlUI/var/html/ui_handler.php @@ -27,11 +27,29 @@ switch($_REQUEST['act']){ $uiHandler->SP->addItem($ui_tmpid); break; + case "replaceFile": + $ui_tmpgunid = $uiHandler->gb->_gunidFromId($uiHandler->id); + if ($uiHandler->delete($uiHandler->id)) { + $ui_tmpid = $uiHandler->uploadFile(array_merge($_REQUEST, $_FILES), $uiHandler->pid, $ui_fmask["uploadFile"], $ui_tmpgunid); + $uiHandler->SP->removeItems($uiHandler->id); + $uiHandler->SP->addItem($ui_tmpid); + } + break; + case "addWebstream": if ($ui_tmpid = $uiHandler->addWebstream($_REQUEST, $uiHandler->id, $ui_fmask['addWebstream'])) $uiHandler->SP->addItem($ui_tmpid); break; + case "replaceWebstream": + $ui_tmpgunid = $uiHandler->gb->_gunidFromId($uiHandler->id); + if ($uiHandler->delete($uiHandler->id)) { + $ui_tmpid = $uiHandler->addWebstream($_REQUEST, $uiHandler->pid, $ui_fmask['addWebstream'], $ui_tmpgunid); + $uiHandler->SP->removeItems($uiHandler->id); + $uiHandler->SP->addItem($ui_tmpid); + } + break; + case "newFolder": $uiHandler->newFolder($_REQUEST["newname"], $uiHandler->id); break; @@ -49,7 +67,8 @@ switch($_REQUEST['act']){ break; case "delete": - $uiHandler->delete($uiHandler->id, $_REQUEST["delOverride"]); + if ($uiHandler->delete($uiHandler->id, $_REQUEST['delOverride'])) + $uiHandler->SP->removeItems($uiHandler->id); break; case "addUser": @@ -89,7 +108,8 @@ switch($_REQUEST['act']){ break; case "editMetaData": - $uiHandler->editMetaData($uiHandler->id, $_REQUEST, $ui_fmask["metaData"]); + $uiHandler->editMetaData($uiHandler->id, $_REQUEST); + $uiHandler->SP->reLoadM(); break; case "SP.addItem": @@ -113,7 +133,7 @@ switch($_REQUEST['act']){ default: $_SESSION["alertMsg"] = tra("Unknown method: $1", $_REQUEST["act"]); - header("Location: ".UI_BROWSER); + header("Location: ".UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'); die(); } if ($uiHandler->alertMsg) $_SESSION['alertMsg'] = $uiHandler->alertMsg; diff --git a/livesupport/modules/htmlUI/var/ui_base.inc.php b/livesupport/modules/htmlUI/var/ui_base.inc.php index 85231f617..5a34fdffb 100644 --- a/livesupport/modules/htmlUI/var/ui_base.inc.php +++ b/livesupport/modules/htmlUI/var/ui_base.inc.php @@ -81,16 +81,20 @@ class uiBase die($this->dbc->getMessage()); } $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); - $this->login = $this->gb->getSessLogin($this->sessid); - $this->id = $_REQUEST['id'] ? $_REQUEST['id'] : $this->gb->getObjId($this->login, $this->gb->storId); + $this->gb =& new GreenBox($this->dbc, $config); + $this->config = $config; + $this->sessid = $_REQUEST[$config['authCookieName']]; + $this->userid = $this->gb->getSessUserId($this->sessid); + $this->login = $this->gb->getSessLogin($this->sessid); + $this->id = $_REQUEST['id'] ? $_REQUEST['id'] : $this->gb->getObjId($this->login, $this->gb->storId); + $this->pid = $this->gb->getparent($this->id) != 1 ? $this->gb->getparent($this->id) : FALSE; + $this->type = $this->gb->getFileType($this->id); + $this->fid = $this->type=='Folder' ? $this->id : $this->pid; + $this->InputTextStandardAttrib = array('size' =>UI_INPUT_STANDARD_SIZE, 'maxlength'=>UI_INPUT_STANDARD_MAXLENGTH); - $this->SP =& new uiScratchPad(&$this); + $this->SP =& new uiScratchPad($this); $this->systemPrefs =& $_SESSION[UI_STATIONINFO_SESSNAME]; $this->search =& $_SESSION[UI_SEARCH_SESSNAME]; } @@ -313,6 +317,7 @@ class uiBase function _niceTime($in) { + list ($in, $lost) = explode('.', $in); if (preg_match('/^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$/', $in)) list($h, $i, $s) = explode(':', $in); elseif (preg_match('/^[0-9]{1,2}:[0-9]{1,2}$/', $in)) @@ -335,22 +340,27 @@ class uiBase function _getMDataValue($id, $key) { - $value = array_pop($this->gb->getMDataValue($id, $key, $this->sessid)); - return $value['value']; + if (is_array($arr = $this->gb->getMDataValue($id, $key, $this->sessid))) { + $value = array_pop($arr); + return $value['value']; + } + return FALSE; } function _getFileTitle($id) { - $file = array_pop($this->gb->getPath($id)); - return $file['name']; + if (is_array($arr = $this->gb->getPath($id))) { + $file = array_pop($arr); + return $file['name']; + } + return FALSE; } function _isFolder($id) { if (strtolower($this->gb->getFileType($id)) != 'folder') { - $this->_retMsg('Parent is not Folder'); return FALSE; } return TRUE; diff --git a/livesupport/modules/htmlUI/var/ui_browser.class.php b/livesupport/modules/htmlUI/var/ui_browser.class.php index 5f9a3ca4b..8e921cf63 100644 --- a/livesupport/modules/htmlUI/var/ui_browser.class.php +++ b/livesupport/modules/htmlUI/var/ui_browser.class.php @@ -17,7 +17,7 @@ class uiBrowser extends uiBase { } /** - * login + * performAction * * Perform a frontend action * map to a function called action_.inc.php @@ -117,28 +117,27 @@ class uiBrowser extends uiBase { { $data = array( 'pathdata' => $this->gb->getPath($id, $this->sessid), - 'listdata' => ($this->gb->getObjType($id)=='Folder'? - $this->gb->listFolder($id, $this->sessid) : array()), - #'tree' => ($_REQUEST['tree']=='Y'), - 'showPath' => true, - 'showTree' => true, + 'listdata' => $this->gb->getObjType($id)=='Folder' ? $this->gb->listFolder($id, $this->sessid) : array(), ); - if($_REQUEST['tree']=='Y'){ - $data['treedata'] = $this->gb->getSubTree($id, $this->sessid); + if($_REQUEST['tree']=='Y'){ + $tmp = $this->gb->getSubTree($id, $this->sessid); + foreach ($tmp as $key=>$val) { + $val['type'] = $this->gb->getFileType($val['id']); + $data['treedata'][$key] = $val; } - + } if(PEAR::isError($data['listdata'])){ $data['msg'] = $data['listdata']->getMessage(); $data['listdata'] = array(); - } else { - foreach ($data['listdata'] as $key=>$val) { - if ($val['type'] != 'Folder') - $data['listdata'][$key]['title'] = $this->_getMDataValue($val['id'], 'title'); - else - $data['listdata'][$key]['title'] = $val['name']; - } + return FALSE; } - + foreach ($data['listdata'] as $key=>$val) { + if ($val['type'] != 'Folder') + $data['listdata'][$key]['title'] = $this->_getMDataValue($val['id'], 'title'); + else + $data['listdata'][$key]['title'] = $val['name']; + } + #print_r($data); return $data; } @@ -152,16 +151,13 @@ class uiBrowser extends uiBase { * * @eturn string (html) */ - function uploadFileM($id, $mask) + function uploadFileM(&$mask, $id) { $form = new HTML_QuickForm('uploadFileM', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $form->setMaxFileSize(!PEAR::isError($this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'maxfilesize')) ? - $this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'maxfilesize') - : ini_get('upload_max_filesize')); - $form->setConstants(array('id' => $id)); - + $form->setMaxFileSize($this->systemPrefs['stationMaxfilesize']); + $form->setConstants(array('id' => $id, + 'act' => 'uploadFileM')); $this->_parseArr2Form($form, $mask); - return $form->toHTML(); } @@ -175,16 +171,13 @@ class uiBrowser extends uiBase { * * @eturn string (html) */ - function uploadFile($id, $mask) + function uploadFile(&$mask, $id, $replace=FALSE) { $form = new HTML_QuickForm('uploadFile', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $form->setMaxFileSize(!PEAR::isError($this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'maxfilesize')) ? - $this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'maxfilesize') - : ini_get('upload_max_filesize')); - $form->setConstants(array('id' => $id)); - + $form->setMaxFileSize($this->systemPrefs['stationMaxfilesize']); + $form->setConstants(array('id' => $id, + 'act' => $replace ? 'replaceFile' : 'uploadFile')); $this->_parseArr2Form($form, $mask); - return $form->toHTML(); } @@ -198,16 +191,12 @@ class uiBrowser extends uiBase { * * @eturn string (html) */ - function addWebstream($id, $mask) + function addWebstream($mask, $id, $replace=FALSE) { $form = new HTML_QuickForm('addWebstream', UI_STANDARD_FORM_METHOD, UI_HANDLER); - $form->setMaxFileSize(!PEAR::isError($this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'maxfilesize')) ? - $this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'maxfilesize') - : ini_get('upload_max_filesize')); - $form->setConstants(array('id' => $id)); - + $form->setConstants(array('id' => $id, + 'act' => $replace ? 'replaceWebstream' : 'addWebstream')); $this->_parseArr2Form($form, $mask); - return $form->toHTML(); } @@ -222,8 +211,7 @@ class uiBrowser extends uiBase { function getSubjects() { return array('subj' => $this->gb->getSubjectsWCnt(), - 'loggedAs' => $this->login - ); + 'loggedAs' => $this->login); } @@ -291,7 +279,6 @@ class uiBrowser extends uiBase { foreach($g['subj'] as $s) { $this->logins[($s['login'])]=$s['login']; } - $form = new HTML_QuickForm('addGroupMember', UI_STANDARD_FORM_METHOD, UI_HANDLER); $form->setConstants(array('act'=>'addGroupMember', 'reid'=>$g['id'], @@ -303,7 +290,6 @@ class uiBrowser extends uiBase { $s->loadArray($this->logins, NULL); $form->addElement($s); $form->addElement('submit', NULL, tra('Do')); - return $form->toHTML(); } @@ -323,8 +309,7 @@ class uiBrowser extends uiBase { 'actions' => $this->gb->getAllowedActions($this->gb->getObjType($id)), 'subjects' => $this->gb->getSubjects(), 'id' => $id, - 'loggedAs' => $this->login - ); + 'loggedAs' => $this->login); } @@ -337,26 +322,24 @@ class uiBrowser extends uiBase { * * @return string (html) */ - function getSearchForm($id, &$mask) + function getSearchForm($id, &$mask2) { + include dirname(__FILE__).'/formmask/metadata.inc.php'; $form = new HTML_QuickForm('search', UI_STANDARD_FORM_METHOD, UI_HANDLER); $form->setConstants(array('id'=>$id, 'counter'=>UI_SEARCH_MIN_ROWS)); - foreach ($mask['metaData']['tabs']['group']['group'] as $k=>$v) { - foreach ($mask['metaData']['pages'][$v] as $val){ + foreach ($mask['tabs']['group']['group'] as $k=>$v) { + foreach ($mask['pages'][$v] as $val){ $col1[$this->_formElementEncode($val['element'])] = $val['label']; if (isset($val['relation'])) - $col2[$this->_formElementEncode($val['element'])] = $mask['relations'][$val['relation']]; + $col2[$this->_formElementEncode($val['element'])] = $mask2['relations'][$val['relation']]; else - $col2[$this->_formElementEncode($val['element'])] = $mask['relations']['standard']; + $col2[$this->_formElementEncode($val['element'])] = $mask2['relations']['standard']; }; }; - for($n=1; $n<=UI_SEARCH_MAX_ROWS; $n++) { unset ($group); - $form->addElement('static', 's1', NULL, "
"); - if ($n > UI_SEARCH_MIN_ROWS) $form->addElement('static', 's1_style', NULL, ""); $sel = &$form->createElement('hierselect', "row_$n", NULL); $sel->setOptions(array($col1, $col2)); @@ -366,15 +349,13 @@ class uiBrowser extends uiBase { $form->addGroup($group); $form->addElement('static', 's2', NULL, "
"); } - - $this->_parseArr2Form($form, $mask['searchform']); + $this->_parseArr2Form($form, $mask2['searchform']); $form->setConstants($this->search['criteria']); $form->validate(); - $renderer =& new HTML_QuickForm_Renderer_Array(true, true); $form->accept($renderer); $output['dynform'] = $renderer->toArray(); - #print_r($output); + #print_r($output); return $output; } @@ -417,8 +398,10 @@ class uiBrowser extends uiBase { * @param id int * @return string (html) */ - function editMetaData($id, $mask, $get=FALSE, $data=NULL) + function editMetaData($id, $get=FALSE, $data=NULL) { + include dirname(__FILE__).'/formmask/metadata.inc.php'; + $form = new HTML_QuickForm('tabs', UI_STANDARD_FORM_METHOD, UI_BROWSER); $this->_parseArr2Form($form, $mask['tabs']); $output['tabs'] = $form->toHTML(); diff --git a/livesupport/modules/htmlUI/var/ui_browser_init.php b/livesupport/modules/htmlUI/var/ui_browser_init.php index 79f4f4cd6..a394626ea 100644 --- a/livesupport/modules/htmlUI/var/ui_browser_init.php +++ b/livesupport/modules/htmlUI/var/ui_browser_init.php @@ -7,7 +7,7 @@ require_once dirname(__FILE__).'/ui_base.inc.php'; require_once dirname(__FILE__).'/ui_browser.class.php'; require_once dirname(__FILE__).'/ui_scratchPad.class.php'; require_once dirname(__FILE__).'/../../storageServer/var/GreenBox.php'; - +require_once dirname(__FILE__).'/formmask/general.inc.php'; ## well known classes ############################################### require_once dirname(__FILE__).'/html/Smarty/libs/Smarty.class.php'; @@ -40,7 +40,12 @@ $Smarty->load_filter('output', 'localizer'); ## some basic things ################################################ $Smarty->assign('UI_BROWSER', UI_BROWSER); $Smarty->assign('UI_HANDLER', UI_HANDLER); -$Smarty->assign('GLOBALS', array_merge($GLOBALS, array('id' => &$uiBrowser->id))); ## ??? really all GLOBALS ??? ## +$Smarty->assign('GLOBALS', array( + 'id' => &$uiBrowser->id, + 'pid' => &$uiBrowser->pid, + 'fid' => &$uiBrowser->fid + ) + ); $Smarty->assign('user', array('sessid' => &$uiBrowser->sessid, 'userid' => &$uiBrowser->userid, 'login' => &$uiBrowser->login @@ -55,8 +60,4 @@ if (is_array($_SESSION['retransferFormData'])){ } unset($_SESSION['retransferFormData']); } - - -## mask for forms, at the end because $uiBase is used ############### -require_once dirname(__FILE__).'/ui_fmask.inc.php'; ?> diff --git a/livesupport/modules/htmlUI/var/ui_handler.class.php b/livesupport/modules/htmlUI/var/ui_handler.class.php index 97443ed58..2fa7e3ce0 100644 --- a/livesupport/modules/htmlUI/var/ui_handler.class.php +++ b/livesupport/modules/htmlUI/var/ui_handler.class.php @@ -42,17 +42,15 @@ class uiHandler extends uiBase { $sessid = $this->gb->login($formdata['login'], $formdata['pass']); if($sessid && !PEAR::isError($sessid)){ setcookie($this->config['authCookieName'], $sessid); - - $fid = $this->gb->getObjId($formdata['login'], $this->gb->storId); - if(!PEAR::isError($fid)) $this->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; + $id = $this->gb->getObjId($formdata['login'], $this->gb->storId); + if(!PEAR::isError($id)) $this->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; }else{ $this->_retMsg('Login failed.'); $_SESSION['retransferFormData']['login']=$formdata['login']; $this->redirUrl = UI_BROWSER.'?popup[]=login'; } } - - } + } /** * logout @@ -86,40 +84,35 @@ class uiHandler extends uiBase { */ function uploadFileM(&$formdata, $id, &$mask) { - if ($this->_isFolder($id)) { - if ($this->_validateForm($formdata, $mask)) { - $tmpgunid = md5( - microtime().$_SERVER['SERVER_ADDR'].rand()."org.mdlf.livesupport" - ); - $ntmp = $this->gb->bufferDir.'/'.$tmpgunid; - $mdtmp = ""; - move_uploaded_file($formdata['mediafile']['tmp_name'], $ntmp); - chmod($ntmp, 0664); - if($formdata['mdatafile']['tmp_name']){ - $mdtmp = "$ntmp.xml"; - if(move_uploaded_file($formdata['mdatafile']['tmp_name'], $mdtmp)){ - chmod($mdtmp, 0664); - } - } - $r = $this->gb->putFile($id, $formdata['mediafile']['name'], $ntmp, $mdtmp, $this->sessid); - if(PEAR::isError($r)) { - $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER."?act=uploadFileM&id=".$id; - return FALSE; - } else{ - @unlink($ntmp); - @unlink($mdtmp); - $this->redirUrl = UI_BROWSER."?id=".$id; - return $r; - } - } else { - $this->redirUrl = UI_BROWSER."?act=uploadFileM&id=".$id; - return FALSE; - } - } else { - $this->redirUrl = UI_BROWSER.'?id='.$this->gb->getParent($id); + if (!$this->_isFolder($id)) { + $this->_retMsg('Target is not Folder'); + $this->redirUrl = UI_BROWSER.'?act=fileBrowse&id='.$id; return FALSE; } + if (!$this->_validateForm($formdata, $mask)) { + $this->redirUrl = UI_BROWSER."?act=uploadFileM&id=".$id; + return FALSE; + } + $tmpgunid = md5(microtime().$_SERVER['SERVER_ADDR'].rand()."org.mdlf.livesupport"); + $ntmp = $this->gb->bufferDir.'/'.$tmpgunid; + move_uploaded_file($formdata['mediafile']['tmp_name'], $ntmp); + chmod($ntmp, 0664); + if($formdata['mdatafile']['tmp_name']){ + $mdtmp = "$ntmp.xml"; + if(move_uploaded_file($formdata['mdatafile']['tmp_name'], $mdtmp)){ + chmod($mdtmp, 0664); + } + } + $r = $this->gb->putFile($id, $formdata['mediafile']['name'], $ntmp, $mdtmp, $this->sessid); + @unlink($ntmp); + @unlink($mdtmp); + if(PEAR::isError($r)) { + $this->_retMsg($r->getMessage()); + $this->redirUrl = UI_BROWSER."?act=uploadFileM&id=".$id; + return FALSE; + } + $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$id; + return $r; } @@ -131,38 +124,32 @@ class uiHandler extends uiBase { * @param formdata array, submitted text and file * @param id int, destination folder id */ - function uploadFile(&$formdata, $id, &$mask) + function uploadFile(&$formdata, $id, &$mask, $replace=NULL) { - if ($this->_isFolder($id)) { - if ($this->_validateForm($formdata, $mask)) { - $tmpgunid = md5( - microtime().$_SERVER['SERVER_ADD3R'].rand()."org.mdlf.livesupport" - ); - $ntmp = $this->gb->bufferDir.'/'.$tmpgunid; - $mdtmp = ""; - move_uploaded_file($formdata['mediafile']['tmp_name'], $ntmp); - chmod($ntmp, 0664); - - $r = $this->gb->putFile($id, $formdata['mediafile']['name'], $ntmp, NULL, $this->sessid); - if(PEAR::isError($r)) { - $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER."?act=uploadFile&id=$id"; - return FALSE; - } else{ - @unlink($ntmp); - @unlink($mdtmp); - $this->redirUrl = UI_BROWSER."?act=editMetaData&id=$r"; - $this->gb->replaceMetadata($r, $this->_analyzeFile($r, 'xml'), 'string', $this->sessid); - return $r; - } - } else { - $this->redirUrl = UI_BROWSER."?act=uploadFile&id=$id"; - return FALSE; - } - } else { - $this->redirUrl = UI_BROWSER.'?id='.$this->gb->getParent($id); + if (!$replace && $this->type!='Folder') { + $this->_retMsg ('Target is not Folder'); + $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$pid; return FALSE; } + if (!$this->_validateForm($formdata, $mask)) { + $this->redirUrl = UI_BROWSER."?act=addWebstream&id=".$id; + return FALSE; + } + $tmpgunid = md5(microtime().$_SERVER['SERVER_ADD3R'].rand()."org.mdlf.livesupport"); + $ntmp = $this->gb->bufferDir.'/'.$tmpgunid; + move_uploaded_file($formdata['mediafile']['tmp_name'], $ntmp); + chmod($ntmp, 0664); + + $r = $this->gb->putFile($id, $formdata['mediafile']['name'], $ntmp, NULL, $this->sessid, $replace); + @unlink($ntmp); + if(PEAR::isError($r)) { + $this->_retMsg($r->getMessage()); + $this->redirUrl = UI_BROWSER."?act=uploadFile&id=".$pid; + return FALSE; + } + $this->gb->replaceMetadata($r, $this->_analyzeFile($r, 'xml'), 'string', $this->sessid); + $this->redirUrl = UI_BROWSER."?act=editMetaData&id=$r"; + return $r; } @@ -174,32 +161,28 @@ class uiHandler extends uiBase { * @param formdata array, submitted text and file * @param id int, destination folder id */ - function addWebstream(&$formdata, $id, &$mask) + function addWebstream(&$formdata, $id, &$mask, $replace=NULL) { - if ($this->_isFolder($id)) { - if ($this->_validateForm($formdata, $mask)) { - - $r = $this->gb->storeWebstream($id, $formdata['name'], NULL, $this->sessid, NULL, $formdata['url']); - if(PEAR::isError($r)) { - $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER."?act=addWebstream&id=$id"; - return FALSE; - } - else{ - $data = $this->_dateArr2Str($formdata); - $this->gb->setMDataValue($r, 'dc:title', $this->sessid, $data['name']); - $this->gb->setMDataValue($r, 'dcterms:extent', $this->sessid, $data['duration']); - $this->redirUrl = UI_BROWSER."?act=editMetaData&id=$r"; - return $r; - } - } else { - $this->redirUrl = UI_BROWSER."?act=addWebstream&id=$id"; - return FALSE; - } - } else { - $this->redirUrl = UI_BROWSER.'?id='.$this->gb->getParent($id); + if (!$replace && $this->type != 'Folder') { + $this->_retMsg ('Target is not Folder'); + $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$pid; return FALSE; } + if (!$this->_validateForm($formdata, $mask)) { + $this->redirUrl = UI_BROWSER."?act=addWebstream&id=".$id; + return FALSE; + } + $r = $this->gb->storeWebstream($id, $formdata['name'], NULL, $this->sessid, $replace, $formdata['url']); + if(PEAR::isError($r)) { + $this->_retMsg($r->getMessage()); + $this->redirUrl = UI_BROWSER."?act=addWebstream&id=".$id; + return FALSE; + } + $data = $this->_dateArr2Str($formdata); + $this->gb->setMDataValue($r, 'dc:title', $this->sessid, $data['name']); + $this->gb->setMDataValue($r, 'dcterms:extent', $this->sessid, $data['duration']); + $this->redirUrl = UI_BROWSER."?act=editMetaData&id=$r"; + return $r; } @@ -209,18 +192,14 @@ class uiHandler extends uiBase { * Create new folder in the storage * * @param newname string, name for the new folder - * @param id int, destination folder id + * @param id int, local id to create folder in */ - function newFolder($newname, $id) + function newFolder($name, $id) { - if ($this->_isFolder($id)) { - $r = $this->gb->createFolder($id, $newname, $this->sessid); - if(PEAR::isError($r)) - $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER.'?id='.$id; - } else { - $this->redirUrl = UI_BROWSER.'?id='.$this->gb->getParent($id); - } + $r = $this->gb->createFolder($id, $name, $this->sessid); + if(PEAR::isError($r)) + $this->_retMsg($r->getMessage()); + $this->redirUrl = UI_BROWSER.'?act=fileBrowse&id='.$this->id; } /** @@ -233,10 +212,9 @@ class uiHandler extends uiBase { */ function rename($newname, $id) { - $parid = $this->gb->getparent($this->id); $r = $this->gb->renameFile($id, $newname, $this->sessid); if(PEAR::isError($r)) $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER."?id=$parid"; + $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$this->pid; } /** @@ -250,15 +228,14 @@ class uiHandler extends uiBase { */ function move($newPath, $id) { - $newPath = urlencode($newPath); + $newPath = urldecode($newPath); $did = $this->gb->getObjIdFromRelPath($id, $newPath); - $parid = $this->gb->getparent($id); $r = $this->gb->moveFile($id, $did, $this->sessid); if(PEAR::isError($r)){ $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER."?id=$parid"; + $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$this->pid; } - else $this->redirUrl = UI_BROWSER."?id=$did"; + else $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$did; } /** @@ -274,13 +251,12 @@ class uiHandler extends uiBase { { $newPath = urldecode($newPath); $did = $this->gb->getObjIdFromRelPath($id, $newPath); - $parid = $this->gb->getparent($id); $r = $this->gb->copyFile($id, $did, $this->sessid); if(PEAR::isError($r)){ $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER."?id=$parid"; + $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$this->pid; } - else $this->redirUrl = UI_BROWSER."?id=$did"; + else $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$did; } /** @@ -293,20 +269,21 @@ class uiHandler extends uiBase { */ function delete($id, $delOverride=FALSE) { - $parid = $this->gb->getparent($id); + $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$this->pid; - ## add emtyness-test here ### if (!($delOverride==$id) && (count($this->gb->getObjType($id)=='Folder'? $this->gb->listFolder($id, $this->sessid):NULL))) { $this->_retMsg("Folder is not empty. You can override this protection by clicking DEL again"); - $this->redirUrl = UI_BROWSER."?id=$parid&delOverride=$id"; - return; + $this->redirUrl = UI_BROWSER."?act=fileBrowse&id=".$this->pid."&delOverride=$id"; + return FALSE; } - ############################# $r = $this->gb->deleteFile($id, $this->sessid); - if(PEAR::isError($r)) $this->_retMsg($r->getMessage()); - $this->redirUrl = UI_BROWSER."?id=$parid"; + if(PEAR::isError($r)) { + $this->_retMsg($r->getMessage()); + return FALSE; + } + return TRUE; } @@ -439,7 +416,7 @@ class uiHandler extends uiBase { }else{ $this->_retMsg('Access denied.'); } - $this->redirUrl = UI_BROWSER.'?id='.$id.'&act=permissions'; + $this->redirUrl = UI_BROWSER.'?act=permissions&id='.$id; } /** @@ -504,9 +481,11 @@ class uiHandler extends uiBase { } - function editMetaData($id, &$formdata, &$mask) + function editMetaData($id, &$formdata) { - $this->redirUrl = UI_BROWSER.'?id='.$this->gb->getParent($id); + include dirname(__FILE__).'/formmask/metadata.inc.php'; + + $this->redirUrl = UI_BROWSER.'?act=fileBrowse&id='.$this->pid; ## first remove old entrys $this->gb->replaceMetaData($id, $this->_analyzeFile($id, 'xml'), 'string', $this->sessid); @@ -546,6 +525,7 @@ class uiHandler extends uiBase { } if ($was_error) { $_SESSION['retransferFormData'] = array_merge($_REQUEST, $_FILES); + $this->retMsg('Invalid Form Data'); return FALSE; } } @@ -601,30 +581,33 @@ class uiHandler extends uiBase { */ function search(&$formdata) { - $this->search = FALSE;; - $this->search['criteria']['operator'] = $formdata['operator']; - $this->search['criteria']['filetype'] = $formdata['filetype']; + $this->search = FALSE; + if ($formdata['clear']) { + $this->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; + } else { + $this->redirUrl = UI_BROWSER.'?act=search&id='.$formdata['id']; + $this->search['criteria']['operator'] = $formdata['operator']; + $this->search['criteria']['filetype'] = $formdata['filetype']; - foreach ($formdata as $key=>$val) { - if (is_array($val) && strlen($val[2])) { - $critArr[] = array('cat' => $this->_formElementDecode($val[0]), - 'op' => $val[1], - 'val' => $val[2] - ); - $this->search['criteria'][$key] = $val; + foreach ($formdata as $key=>$val) { + if (is_array($val) && strlen($val[2])) { + $critArr[] = array('cat' => $this->_formElementDecode($val[0]), + 'op' => $val[1], + 'val' => $val[2] + ); + $this->search['criteria'][$key] = $val; + } } - } - $searchCriteria = array('filetype' => $formdata['filetype'], - 'operator' => $formdata['operator'], - 'conditions'=> $critArr - ); + $searchCriteria = array('filetype' => $formdata['filetype'], + 'operator' => $formdata['operator'], + 'conditions'=> $critArr + ); - $results = $this->gb->localSearch($searchCriteria, $this->sessid); - foreach ($results['results'] as $rec) { + $results = $this->gb->localSearch($searchCriteria, $this->sessid); + foreach ($results['results'] as $rec) { $this->search['result'][] = $this->_getMetaInfo($this->gb->_idFromGunid($rec)); } - - $this->redirUrl = UI_BROWSER.'?act=search&id='.$formdata['id']; + } } } diff --git a/livesupport/modules/htmlUI/var/ui_handler_init.php b/livesupport/modules/htmlUI/var/ui_handler_init.php index 751f99c52..bc52a54db 100644 --- a/livesupport/modules/htmlUI/var/ui_handler_init.php +++ b/livesupport/modules/htmlUI/var/ui_handler_init.php @@ -8,7 +8,7 @@ require_once dirname(__FILE__).'/ui_base.inc.php'; require_once dirname(__FILE__).'/ui_handler.class.php'; require_once dirname(__FILE__).'/ui_scratchPad.class.php'; require_once dirname(__FILE__).'/../../storageServer/var/GreenBox.php'; - +require_once dirname(__FILE__).'/formmask/general.inc.php'; ## well known classes ############################################### require_once 'DB.php'; @@ -23,9 +23,6 @@ PEAR::setErrorHandling(PEAR_ERROR_RETURN); ## initialize objects ############################################### $uiHandler =& new uiHandler($config); #$uiBase = new uiBase($config); -$uiBase =& $uiHandler; +$uiBase =& $uiHandler; #$uiScratchPad =& new uiScratchPad(&$uiHandler); - -## mask for forms, at the end because $uiBase is used ############### -require_once dirname(__FILE__).'/ui_fmask.inc.php'; ?> diff --git a/livesupport/modules/htmlUI/var/ui_scratchPad.class.php b/livesupport/modules/htmlUI/var/ui_scratchPad.class.php index 441d286f3..ba286cd33 100755 --- a/livesupport/modules/htmlUI/var/ui_scratchPad.class.php +++ b/livesupport/modules/htmlUI/var/ui_scratchPad.class.php @@ -3,9 +3,9 @@ class uiScratchPad { function uiScratchPad(&$uiBase) { - $this->Base = &$uiBase; - $this->items = &$_SESSION[UI_SCRATCHPAD_SESSNAME]['content']; - $this->order = &$_SESSION[UI_SCRATCHPAD_SESSNAME]['order']; + $this->Base =& $uiBase; + $this->items =& $_SESSION[UI_SCRATCHPAD_SESSNAME]['content']; + $this->order =& $_SESSION[UI_SCRATCHPAD_SESSNAME]['order']; $this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close'; } @@ -44,7 +44,8 @@ class uiScratchPad foreach($arr as $gunid) { if (preg_match('/[0-9]{1,20}/', $gunid)) { if ($this->Base->gb->_idFromGunid($this->Base->_toHex($gunid)) != FALSE) { - $this->items[] = $this->Base->_getMetaInfo($this->Base->gb->_idFromGunid($this->Base->_toHex($gunid))); + if ($i = $this->Base->_getMetaInfo($this->Base->gb->_idFromGunid($this->Base->_toHex($gunid)))) + $this->items[] = $i; } } } @@ -64,10 +65,15 @@ class uiScratchPad function addItem($id) { + if(!$this->Base->systemPrefs[UI_SCRATCHPAD_MAXLENGTH_KEY]) { + $this->Base->_retMsg('ScratchPad length is not set in System Preferences, so it cannot be used.'); + return false; + } + $item = $this->Base->_getMetaInfo($id); $sp = $this->get(); foreach ($sp as $key=>$val) { - if ($val['gunid'] == $item['gunid']) { + if ($val['id'] == $item['id']) { unset($sp[$key]); $this->Base->_retMsg('Entry $1 was already on SP since $2.\nMoved to Top.', $item['title'], $val['added']); } else { @@ -84,7 +90,7 @@ class uiScratchPad function removeItems($ids) { if (!$ids) - return; ## empty parameter + return FALSE; ## empty parameter if (!is_array($ids)) $ids = array($ids); ## just single id given @@ -92,12 +98,14 @@ class uiScratchPad $info = $this->Base->_getMetaInfo($id); $sp =& $this->get(); foreach ($sp as $key=>$val) { - if ($val['gunid'] == $info['gunid']) { + if ($val['id'] == $info['id']) { unset ($sp[$key]); #$this->Base->decAccessCounter($id); } } } + + return TRUE; } @@ -119,5 +127,12 @@ class uiScratchPad $this->items = $res; } + + + function reLoadM() + { + foreach($this->items as $key=>$val) + $this->items[$key] = $this->Base->_getMetaInfo($val['id']); + } } ?>