*
- * $Id: SmartyStatic_example.php,v 1.1 2005/02/03 16:55:35 sebastian Exp $
+ * $Id: SmartyStatic_example.php,v 1.2 2005/02/08 11:06:17 sebastian Exp $
*/
require_once 'HTML/QuickForm.php';
diff --git a/livesupport/modules/htmlUI/var/html/ui_browser.php b/livesupport/modules/htmlUI/var/html/ui_browser.php
index 1b2ac660b..c8e7d6975 100644
--- a/livesupport/modules/htmlUI/var/html/ui_browser.php
+++ b/livesupport/modules/htmlUI/var/html/ui_browser.php
@@ -38,7 +38,7 @@ if (is_array($_REQUEST['popup'])){
};
-$Smarty->assign('statusbar', $uiBrowser->getStationInfo());
+$Smarty->assign('statusbar', $uiBrowser->getStationInfo($ui_fmask['systemPrefs']));
if ($uiBrowser->userid) {
$Smarty->assign('showMenuTop', TRUE);
@@ -85,7 +85,7 @@ if ($uiBrowser->userid) {
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;
@@ -140,7 +140,7 @@ if ($uiBrowser->userid) {
break;
case "getInfo":
- $Smarty->assign('fInfo', $uiBrowser->getInfo($uiBrowser->id));
+ $Smarty->assign('fInfo', $uiBrowser->getInfo($uiBrowser->id, 'text'));
$Smarty->assign('showFile', TRUE);
break;
diff --git a/livesupport/modules/htmlUI/var/ui_browser.class.php b/livesupport/modules/htmlUI/var/ui_browser.class.php
index 8070004f6..8eb1bbc6c 100644
--- a/livesupport/modules/htmlUI/var/ui_browser.class.php
+++ b/livesupport/modules/htmlUI/var/ui_browser.class.php
@@ -51,11 +51,12 @@ class uiBrowser extends uiBase {
}
- function getStationInfo()
+ function getStationInfo(&$mask)
{
- $a['frequency'] = $this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'frequency');
- $a['stationName'] = $this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'stationName');
- $a['stationLogoPath'] = $this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'stationLogoPath');
+ foreach ($mask as $key=>$val) {
+ if ($val['type']=='text')
+ $a[$val['element']] = is_string($this->gb->loadGroupPref($this->sessid, 'StationPrefs', $val['element'])) ? $this->gb->loadGroupPref($this->sessid, 'StationPrefs', $val['element']) : NULL;
+ }
return $a;
}
@@ -75,7 +76,7 @@ class uiBrowser extends uiBase {
$form->setRequiredNote(file_get_contents(UI_QFORM_REQUIREDNOTE));
$this->_parseArr2Form($form, $mask['loginform']);
$this->_parseArr2Form($form, $mask['languages']);
-
+
## using Static Smarty Renderer
$renderer =& new HTML_QuickForm_Renderer_ArraySmarty($Smarty, true);
$renderer->setRequiredTemplate(file_get_contents(UI_QFORM_REQUIRED));
@@ -313,54 +314,29 @@ class uiBrowser extends uiBase {
foreach ($mask['mData']['tabs']['group']['group'] as $k=>$v) {
foreach ($mask['mData']['pages'][$v] as $val){
$options[$val['element']] = $val['element'];
+ if (isset($val['relation']))
+ $col2[$val['element']] = $mask['relations'][$val['relation']];
+ else
+ $col2[$val['element']] = $mask['relations']['standard'];
};
};
+ $col1 = $options;
+
for($n=1; $n<=UI_SEARCH_MAX_ROWS; $n++) {
- $advRow = array(
- array(
- 'element' => 's1',
- 'type' => 'static',
- 'text' => ""
- ),
- $n>$rowsBegin ? array(
- 'element' => 's1_style',
- 'type' => 'static',
- 'text' => ""
- ) : NULL,
- array(
- 'element' => 'searchBy['.$n.']',
- 'type' => 'select',
- 'label' => 'Search by',
- 'groupit' => TRUE,
- 'options' => $options,
- ),
- array(
- 'element' => 'relation['.$n.']',
- 'type' => 'select',
- 'groupit' => TRUE,
- 'options' => $mask['searchform.relations'],
- 'selected' => '=',
- ),
- array(
- 'element' => 'criteria['.$n.']',
- 'type' => 'text',
- 'groupit' => TRUE
- ),
- array(
- 'group' => array('searchBy['.$n.']', 'relation['.$n.']', 'criteria['.$n.']'),
- 'name' => NULL,
- 'label' => NULL,
- 'seperator' => ' ',
- 'appendName'=> NULL
- ),
- $n>$rowsBegin ? array(
- 'element' => 's2',
- 'type' => 'static',
- 'text' => "
"
- ) : NULL,
- );
- $this->_parseArr2Form($form, $advRow);
+ unset ($group);
+
+ $form->addElement('static', 's1', NULL, "");
+
+ if ($n>$rowsBegin) $form->addElement('static', 's1_style', NULL, "");
+ $sel = &$form->createElement('hierselect', "row_$n", NULL);
+ $sel->setOptions(array($col1, $col2));
+ $group[] = &$sel;
+ $group[] = &$form->createElement('text', 'criteria['.$n.']', NULL);
+ $group[] = &$form->createElement('button', "dropRow_$n", 'Drop', array('onClick' => "document.getElementById('searchRow_$n').style.visibility = 'hidden'; document.getElementById('searchRow_$n').style.height = '0px'"));
+ $form->addGroup($group);
+
+ $form->addElement('static', 's2', NULL, "
");
}
diff --git a/livesupport/modules/htmlUI/var/ui_fmask.inc.php b/livesupport/modules/htmlUI/var/ui_fmask.inc.php
index 201667a42..1e1543c24 100644
--- a/livesupport/modules/htmlUI/var/ui_fmask.inc.php
+++ b/livesupport/modules/htmlUI/var/ui_fmask.inc.php
@@ -52,7 +52,7 @@ $ui_fmask = array(
array(
'rule' => 'regex',
'element' => 'stationURL',
- 'format' => '/^[0-9]{5}$/',
+ 'format' => UI_REGEX_URL,
'rulemsg' => 'URL seems not to be valid'
),
array(
@@ -167,29 +167,29 @@ $ui_fmask = array(
'pages' => array(
'Main' => array(
array(
- 'element' => 'Title',
- 'type' => 'text',
- 'label' => 'Title',
- 'required'=> TRUE,
+ 'element' => 'Title',
+ 'type' => 'text',
+ 'label' => 'Title',
+ 'required' => TRUE
),
array(
- 'element' => 'Creator',
- 'type' => 'text',
- 'label' => 'Creator',
- 'required'=> TRUE,
+ 'element' => 'Creator',
+ 'type' => 'text',
+ 'label' => 'Creator',
+ 'required' => TRUE
),
array(
- 'element' => 'Type_Genre',
- 'type' => 'text',
- 'label' => 'Type_Genre',
- 'required'=> TRUE,
+ 'element' => 'Type_Genre',
+ 'type' => 'text',
+ 'label' => 'Type_Genre',
+ 'required' => TRUE,
),
array(
- 'element' => 'Format',
- 'type' => 'select',
- 'label' => 'Format',
- 'required'=> TRUE,
- 'options' => array(
+ 'element' => 'Format',
+ 'type' => 'select',
+ 'label' => 'Format',
+ 'required' => TRUE,
+ 'options' => array(
'File' => 'File',
'live stream' => 'Live Stream',
'networked file'=> 'Networked File',
@@ -197,33 +197,33 @@ $ui_fmask = array(
)
),
array(
- 'element' => 'Format_Extent',
- 'type' => 'text',
- 'label' => 'Format_Extent',
- 'required'=> TRUE,
+ 'element' => 'Format_Extent',
+ 'type' => 'text',
+ 'label' => 'Format_Extent',
+ 'required' => TRUE,
),
),
'Music_Basic' => array(
array(
- 'element' => 'Title',
- 'type' => 'text',
- 'label' => 'Title',
+ 'element' => 'Title',
+ 'type' => 'text',
+ 'label' => 'Title',
),
array(
- 'element' => 'Creator',
- 'type' => 'text',
- 'label' => 'Creator',
+ 'element' => 'Creator',
+ 'type' => 'text',
+ 'label' => 'Creator',
),
array(
- 'element' => 'Source_Album',
- 'type' => 'text',
- 'label' => 'Source_Album',
+ 'element' => 'Source_Album',
+ 'type' => 'text',
+ 'label' => 'Source_Album',
),
array(
- 'element' => 'Source_Year',
- 'type' => 'date',
- 'label' => 'Source_Year',
- 'options' => array(
+ 'element' => 'Source_Year',
+ 'type' => 'date',
+ 'label' => 'Source_Year',
+ 'options' => array(
'language' => 'en',
'format' => 'dMY',
'addEmptyOption'=> TRUE,
@@ -231,20 +231,20 @@ $ui_fmask = array(
)
),
array(
- 'element' => 'Type_Genre',
- 'type' => 'text',
- 'label' => 'Type_Genre',
+ 'element' => 'Type_Genre',
+ 'type' => 'text',
+ 'label' => 'Type_Genre',
),
array(
- 'element' => 'Description',
- 'type' => 'textarea',
- 'label' => 'Description',
+ 'element' => 'Description',
+ 'type' => 'textarea',
+ 'label' => 'Description',
),
array(
- 'element' => 'Format',
- 'type' => 'select',
- 'label' => 'Format',
- 'options' => array(
+ 'element' => 'Format',
+ 'type' => 'select',
+ 'label' => 'Format',
+ 'options' => array(
'File' => 'File',
'live stream' => 'Live Stream',
'networked file'=> 'Networked File',
@@ -252,203 +252,204 @@ $ui_fmask = array(
)
),
array(
- 'element' => 'Type_BPM',
- 'type' => 'text',
- 'label' => 'Type_BPM',
- 'rule' => 'numeric',
+ 'element' => 'Type_BPM',
+ 'type' => 'text',
+ 'label' => 'Type_BPM',
+ 'rule' => 'numeric',
),
array(
- 'element' => 'Description_Rating',
- 'type' => 'text',
- 'label' => 'Description_Rating',
- 'rule' => 'numeric',
+ 'element' => 'Description_Rating',
+ 'type' => 'text',
+ 'label' => 'Description_Rating',
+ 'rule' => 'numeric',
),
array(
- 'element' => 'Format_Extent',
- 'type' => 'text',
- 'label' => 'Format_Extent',
+ 'element' => 'Format_Extent',
+ 'type' => 'text',
+ 'label' => 'Format_Extent',
),
),
'Music_Advanced'=> array(
array(
- 'element' => 'Creator_Role_Encoder',
- 'type' => 'text',
- 'label' => 'Creator_Role_Encoder',
+ 'element' => 'Creator_Role_Encoder',
+ 'type' => 'text',
+ 'label' => 'Creator_Role_Encoder',
),
array(
- 'element' => 'Source_Album_TrackNumber',
- 'type' => '',
- 'label' => 'Source_Album_TrackNumber',
- 'rule' => 'numeric',
+ 'element' => 'Source_Album_TrackNumber',
+ 'type' => '',
+ 'label' => 'Source_Album_TrackNumber',
+ 'rule' => 'numeric',
),
array(
- 'element' => 'Source_Album_DiscNumber',
- 'type' => 'text',
- 'label' => 'Source_Album_DiscNumber',
- 'rule' => 'numeric',
+ 'element' => 'Source_Album_DiscNumber',
+ 'type' => 'text',
+ 'label' => 'Source_Album_DiscNumber',
+ 'rule' => 'numeric',
),
array(
- 'element' => 'Description_Mood',
- 'type' => 'text',
- 'label' => 'Description_Mood',
+ 'element' => 'Description_Mood',
+ 'type' => 'text',
+ 'label' => 'Description_Mood',
),
array(
- 'element' => 'Publisher',
- 'type' => 'text',
- 'label' => 'Publisher',
+ 'element' => 'Publisher',
+ 'type' => 'text',
+ 'label' => 'Publisher',
),
array(
- 'element' => 'Creator_Role_Composer',
- 'type' => 'text',
- 'label' => 'Creator_Role_Composer',
+ 'element' => 'Creator_Role_Composer',
+ 'type' => 'text',
+ 'label' => 'Creator_Role_Composer',
),
array(
- 'element' => 'Format_Medium_Bitrate',
- 'type' => 'text',
- 'label' => 'Format_Medium_Bitrate',
- 'rule' => 'numeric'
+ '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(
+ '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'
+ 'element' => 'Format_Medium_Samplerate',
+ 'type' => 'text',
+ 'label' => 'Format_Medium_Samplerate',
+ 'rule' => 'numeric'
),
array(
- 'element' => 'Format_Medium_Encoder',
- 'type' => 'text',
- 'label' => 'Format_Medium_Encoder',
+ 'element' => 'Format_Medium_Encoder',
+ 'type' => 'text',
+ 'label' => 'Format_Medium_Encoder',
),
array(
- 'element' => 'Format_CRC',
- 'type' => 'text',
- 'label' => 'Format_CRC',
- 'rule' => 'numeric'
+ 'element' => 'Format_CRC',
+ 'type' => 'text',
+ 'label' => 'Format_CRC',
+ 'rule' => 'numeric'
),
array(
- 'element' => 'Description_Lyrics',
- 'type' => 'textarea',
- 'label' => 'Description_Lyrics',
+ 'element' => 'Description_Lyrics',
+ 'type' => 'textarea',
+ 'label' => 'Description_Lyrics',
),
array(
- 'element' => 'Creator_Role_Orchestra',
- 'type' => 'text',
- 'label' => 'Creator_Role_Orchestra',
+ 'element' => 'Creator_Role_Orchestra',
+ 'type' => 'text',
+ 'label' => 'Creator_Role_Orchestra',
),
array(
- 'element' => 'Creator_Role_Conductor',
- 'type' => 'text',
- 'label' => 'Creator_Role_Conductor',
+ 'element' => 'Creator_Role_Conductor',
+ 'type' => 'text',
+ 'label' => 'Creator_Role_Conductor',
),
array(
- 'element' => 'Creator_Role_Lyricist',
- 'type' => 'text',
- 'label' => 'Creator_Role_Lyricist',
+ 'element' => 'Creator_Role_Lyricist',
+ 'type' => 'text',
+ 'label' => 'Creator_Role_Lyricist',
),
array(
- 'element' => 'Creator_Role_OriginalLyricist',
- 'type' => 'text',
- 'label' => 'Creator_Role_OriginalLyricist',
+ 'element' => 'Creator_Role_OriginalLyricist',
+ 'type' => 'text',
+ 'label' => 'Creator_Role_OriginalLyricist',
),
array(
- 'element' => 'Creator_Role_RadioStationName',
- 'type' => 'text',
- 'label' => 'Creator_Role_RadioStationName',
+ 'element' => 'Creator_Role_RadioStationName',
+ 'type' => 'text',
+ 'label' => 'Creator_Role_RadioStationName',
),
array(
- 'element' => 'Description_AudioFileInfoURL',
- 'type' => 'text',
- 'label' => 'Description_AudioFileInfoURL',
+ 'element' => 'Description_AudioFileInfoURL',
+ 'type' => 'text',
+ 'label' => 'Description_AudioFileInfoURL',
),
array(
- 'element' => 'Description_ArtistURL',
- 'type' => 'text',
- 'label' => 'Description_ArtistURL',
+ 'element' => 'Description_ArtistURL',
+ 'type' => 'text',
+ 'label' => 'Description_ArtistURL',
),
array(
- 'element' => 'Description_AudioSourceURL',
- 'type' => 'text',
- 'label' => 'Description_AudioSourceURL',
+ 'element' => 'Description_AudioSourceURL',
+ 'type' => 'text',
+ 'label' => 'Description_AudioSourceURL',
),
array(
- 'element' => 'Description_RadioStationURL',
- 'type' => 'text',
- 'label' => 'Description_RadioStationURL',
+ 'element' => 'Description_RadioStationURL',
+ 'type' => 'text',
+ 'label' => 'Description_RadioStationURL',
),
array(
- 'element' => 'Description_BuyCDURL',
- 'type' => 'text',
- 'label' => 'Description_BuyCDURL',
+ 'element' => 'Description_BuyCDURL',
+ 'type' => 'text',
+ 'label' => 'Description_BuyCDURL',
),
array(
- 'element' => 'Identifier_ISRCNumber',
- 'type' => 'text',
- 'label' => 'Identifier_ISRCNumber',
- 'rule' => 'numeric'
+ 'element' => 'Identifier_ISRCNumber',
+ 'type' => 'text',
+ 'label' => 'Identifier_ISRCNumber',
+ 'rule' => 'numeric'
),
array(
- 'element' => 'Identifier_CatalogNumber',
- 'type' => 'text',
- 'label' => 'Identifier_CatalogNumber',
- 'rule' => 'numeric'
+ 'element' => 'Identifier_CatalogNumber',
+ 'type' => 'text',
+ 'label' => 'Identifier_CatalogNumber',
+ 'rule' => 'numeric'
),
array(
- 'element' => 'Creator_Role_OriginalArtist',
- 'type' => 'text',
- 'label' => 'Creator_Role_OriginalArtist',
+ 'element' => 'Creator_Role_OriginalArtist',
+ 'type' => 'text',
+ 'label' => 'Creator_Role_OriginalArtist',
),
array(
- 'element' => 'Rights_Copyright',
- 'type' => 'text',
- 'label' => 'Rights_Copyright',
+ 'element' => 'Rights_Copyright',
+ 'type' => 'text',
+ 'label' => 'Rights_Copyright',
),
),
'Talk_Basic' => array(
array(
- 'element' => 'Title',
- 'type' => 'text',
- 'label' => 'Title',
+ 'element' => 'Title',
+ 'type' => 'text',
+ 'label' => 'Title',
+ 'relation' => 1
),
array(
- 'element' => 'Coverage',
- 'type' => 'text',
- 'label' => 'Coverage',
+ 'element' => 'Coverage',
+ 'type' => 'text',
+ 'label' => 'Coverage',
),
array(
- 'element' => 'Description',
- 'type' => 'textarea',
- 'label' => 'Description',
+ 'element' => 'Description',
+ 'type' => 'textarea',
+ 'label' => 'Description',
),
array(
- 'element' => 'Creator',
- 'type' => 'text',
- 'label' => 'Creator',
+ 'element' => 'Creator',
+ 'type' => 'text',
+ 'label' => 'Creator',
),
array(
- 'element' => 'Subject',
- 'type' => 'text',
- 'label' => 'Subject',
+ 'element' => 'Subject',
+ 'type' => 'text',
+ 'label' => 'Subject',
),
array(
- 'element' => 'Type_Genre',
- 'type' => 'text',
- 'label' => 'Type_Genre',
+ 'element' => 'Type_Genre',
+ 'type' => 'text',
+ 'label' => 'Type_Genre',
),
array(
- 'element' => 'Format',
- 'type' => 'select',
- 'label' => 'Format',
- 'options' => array(
+ 'element' => 'Format',
+ 'type' => 'select',
+ 'label' => 'Format',
+ 'options' => array(
'File' => 'File',
'live stream' => 'Live Stream',
'networked file'=> 'Networked File',
@@ -458,19 +459,19 @@ $ui_fmask = array(
),
'Talk_Advanced' => array(
array(
- 'element' => 'Contributor',
- 'type' => 'text',
- 'label' => 'Contributor',
+ 'element' => 'Contributor',
+ 'type' => 'text',
+ 'label' => 'Contributor',
),
array(
- 'element' => 'Language',
- 'type' => 'text',
- 'label' => 'Language',
+ 'element' => 'Language',
+ 'type' => 'text',
+ 'label' => 'Language',
),
array(
- 'element' => 'Rights',
- 'type' => 'text',
- 'label' => 'Rights',
+ 'element' => 'Rights',
+ 'type' => 'text',
+ 'label' => 'Rights',
),
)
)
@@ -717,16 +718,23 @@ $ui_fmask = array(
array('group' => array('addRow', 'doSearch')
),
),
- 'searchform.relations' =>
- array(
- 'full' => 'full',
- 'partial' => 'partial',
- 'prefix' => 'prefix',
- '=' => '=' ,
- '<' => '<',
- '<=' => '<=',
- '>' => '>',
- '>=' => '>='
+ 'relations' => array(
+ 'standard' => array(
+ 'full' => 'full',
+ 'partial' => 'partial',
+ 'prefix' => 'prefix',
+ '=' => '=' ,
+ '<' => '<',
+ '<=' => '<=',
+ '>' => '>',
+ '>=' => '>='
+ ),
+ 1 => array(
+ 'full' => 'full',
+ 'partial' => 'partial',
+ 'prefix' => 'prefix',
+ '=' => '='
+ ),
),
'languages' => array(
array(
diff --git a/livesupport/modules/htmlUI/var/ui_handler.class.php b/livesupport/modules/htmlUI/var/ui_handler.class.php
index aa3809567..1b1bd8879 100644
--- a/livesupport/modules/htmlUI/var/ui_handler.class.php
+++ b/livesupport/modules/htmlUI/var/ui_handler.class.php
@@ -463,18 +463,19 @@ class uiHandler extends uiBase {
$form = new HTML_QuickForm('validation', UI_STANDARD_FORM_METHOD, UI_HANDLER);
$this->_parseArr2Form($form, $mask, 'server');
if (!$form->validate()) {
- $_SESSION['retransferFormData'] = $formdata;
+ $_SESSION['retransferFormData'] = $_REQUEST;
return FALSE;
}
## test for uploadet files bacause HTMLQuickForm::validate() ignores them ####
foreach($mask as $k) {
if ($k['type']=='file' && $k['required']==TRUE) {
- if ($formdata[$k['element']]['error']) {
- $_SESSION['retransferFormData'] = $formdata;
+ if ($_FILES[$k['element']]['error']) {
+ $_SESSION['retransferFormData'] = array_merge($_REQUEST, $_FILES);
return FALSE;
}
}
}
+
reset($mask);
return TRUE;
}
@@ -488,7 +489,12 @@ class uiHandler extends uiBase {
if ($this->_validateForm($formdata, $mask)) {
foreach($mask as $key=>$val) {
- if ($this->_isTextInput ($val['type'], $mask)) $this->gb->saveGroupPref($this->sessid, 'StationPrefs', $val['element'], $formdata[$val['element']]);
+ if ($this->_isTextInput ($val['type'], $mask)) {
+ if (strlen($formdata[$val['element']]))
+ $this->gb->saveGroupPref($this->sessid, 'StationPrefs', $val['element'], $formdata[$val['element']]);
+ else
+ $this->gb->delGroupPref($this->sessid, 'StationPrefs', $val['element']);
+ }
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');