diff --git a/livesupport/modules/htmlUI/var/conf.php b/livesupport/modules/htmlUI/var/conf.php
index a973eb28d..ec5b37f96 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.17 $
+ Version : $Revision: 1.18 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/conf.php,v $
------------------------------------------------------------------------------*/
@@ -143,4 +143,8 @@ define('UI_SCRATCHPAD_MAXLENGTH_KEY', 'djBagMaxlength');
define('UI_SCRATCHPAD_SESSNAME', 'SCRATCHPAD');
define('UI_STATIONINFO_SESSNAME', 'STATIONINFO');
define('UI_SEARCH_SESSNAME', 'SEARCH');
+
+define('UI_MDATA_KEY_TITLE', 'dc:title');
+define('UI_MDATA_KEY_ARTIST', 'dc:creator');
+define('UI_MDATA_KEY_DURATION', 'dcterms:extent');
?>
\ No newline at end of file
diff --git a/livesupport/modules/htmlUI/var/formmask/metadata.inc.php b/livesupport/modules/htmlUI/var/formmask/metadata.inc.php
index d40099b43..9a3029a84 100755
--- a/livesupport/modules/htmlUI/var/formmask/metadata.inc.php
+++ b/livesupport/modules/htmlUI/var/formmask/metadata.inc.php
@@ -57,7 +57,7 @@ $mask = array(
'groupit' => TRUE,
'attributes' => array('onClick' => 'showTalk()')
),
- 'group' => array(
+ array(
'group' => array('Main', 'Music', 'Talk'),
)
@@ -82,19 +82,22 @@ $mask = array(
'element' => 'dc:title',
'type' => 'text',
'label' => 'Title',
- 'required' => TRUE
+ 'required' => TRUE,
+ 'id3' => 'Title'
),
array(
'element' => 'dc:creator',
'type' => 'text',
'label' => 'Creator',
'required' => TRUE,
+ 'id3' => 'Artist'
),
array(
'element' => 'ls:genre',
'type' => 'text',
'label' => 'Genre',
'required' => TRUE,
+ 'id3' => 'Genre'
),
array(
'element' => 'dc:format',
@@ -102,17 +105,19 @@ $mask = array(
'label' => 'File format',
'required' => TRUE,
'options' => array(
- '' => '',
- 'File' => 'File',
- 'live stream' => 'Live Stream',
- 'networked file'=> 'Networked File',
- )
+ '' => '',
+ 'File' => 'File',
+ 'live stream' => 'Live Stream',
+ 'networked file'=> 'Networked File',
+ ),
+ 'id3' => FALSE
),
array(
'element' => 'dcterms:extent',
'type' => 'text',
'label' => 'Length',
- 'attributes'=> array('readonly' => 'on')
+ 'attributes'=> array('readonly' => 'on'),
+ 'id3' => FALSE
),
/*
array(
@@ -149,167 +154,195 @@ $mask = array(
'element' => 'dc:title',
'type' => 'text',
'label' => 'Title',
+ 'id3' => 'Title'
),
array(
'element' => 'dc:creator',
'type' => 'text',
'label' => 'Creator',
+ 'id3' => 'Artist'
),
array(
'element' => 'dc:source',
'type' => 'text',
'label' => 'Album',
+ 'id3' => 'Album'
),
array(
'element' => 'ls:year',
'type' => 'date',
'label' => 'Year',
'options' => array(
- 'language' => 'en',
- 'format' => 'dMY',
- 'addEmptyOption'=> TRUE,
- 'minYear' => 1900
- )
+ 'language' => 'en',
+ 'format' => 'dMY',
+ 'addEmptyOption'=> TRUE,
+ 'minYear' => 1900
+ ),
+ 'id3' => 'Year'
),
array(
'element' => 'dc:type',
'type' => 'text',
'label' => 'Genre',
+ 'id3' => 'Genre'
),
array(
'element' => 'dc:description',
'type' => 'textarea',
'label' => 'Description',
+ 'id3' => 'Comment'
),
array(
'element' => 'dc:format',
'type' => 'select',
'label' => 'Format',
'options' => array(
- '' => '',
- 'File' => 'File',
- 'live stream' => 'Live Stream',
- 'networked file'=> 'Networked File'
- )
+ '' => '',
+ 'File' => 'File',
+ 'live stream' => 'Live Stream',
+ 'networked file'=> 'Networked File'
+ ),
+ 'id3' => FALSE
),
array(
'element' => 'ls:bpm',
'type' => 'text',
'label' => 'BPM',
'rule' => 'numeric',
+ 'id3' => 'BPM'
),
array(
'element' => 'ls:rating',
'type' => 'text',
'label' => 'Rating',
'rule' => 'numeric',
+ 'id3' => 'Rating'
),
array(
'element' => 'dcterms:extent',
'type' => 'text',
'label' => 'Length',
- 'attributes'=> array('readonly' => 'on')
+ 'attributes'=> array('readonly' => 'on'),
+ 'id3' => FALSE
),
array(
'element' => 'ls:encoded_by',
'type' => 'text',
'label' => 'Encoded by',
+ 'id3' => 'Encoded by'
),
array(
'element' => 'ls:track_num',
'type' => 'select',
'label' => 'Track number',
- 'options' => _getNumArr(0, 99)
+ 'options' => _getNumArr(0, 99),
+ 'id3' => 'Track'
),
array(
'element' => 'ls:disc_num',
'type' => 'select',
'label' => 'Disc number',
- 'option' => _getNumArr(0, 9),
+ 'options' => _getNumArr(0, 20),
+ 'id3' => 'Disk'
),
array(
- 'element' => 'Description_Mood', ## something wrong in docu!!!
+ 'element' => 'ls:mood',
'type' => 'text',
'label' => 'Mood',
+ 'id3' => 'Mood'
),
array(
'element' => 'dc:publisher',
'type' => 'text',
'label' => 'Label',
+ 'id3' => 'Label'
),
array(
'element' => 'ls:composer',
'type' => 'text',
'label' => 'Composer',
+ 'id3' => 'Composer'
),
array(
'element' => 'ls:bitrate',
'type' => 'text',
'label' => 'Bitrate',
- 'rule' => 'numeric'
+ 'rule' => 'numeric',
+ 'id3' => 'Bitrate'
),
array(
'element' => 'ls:channels',
'type' => 'select',
'label' => 'Channels',
'options' => array(
- '' => '',
- 'mono' => 'Mono',
- 'stereo' => 'Stereo',
- '5.1' => '5.1'
- )
+ '' => '',
+ 'mono' => 'Mono',
+ 'stereo' => 'Stereo',
+ '5.1' => '5.1'
+ ),
+ 'id3' => 'Channels'
),
array(
'element' => 'ls:samplerate',
'type' => 'select',
'label' => 'Sample rate',
- 'options' => array() ## vervollständigen!
+ 'options' => array(), ## vervollständigen!
+ 'id3' => 'Samplerate'
),
array(
'element' => 'ls:encoder',
'type' => 'text',
'label' => 'Encoder software used',
+ 'id3' => 'Encoder'
),
array(
'element' => 'ls:crc',
'type' => 'text',
'label' => 'Checksum',
- 'rule' => 'numeric'
+ 'rule' => 'numeric',
+ 'id3' => 'CRC'
),
array(
'element' => 'ls:lyrics',
'type' => 'textarea',
'label' => 'Lyrics',
+ 'id3' => 'Lyrics'
),
array(
'element' => 'ls:orchestra',
'type' => 'text',
'label' => 'Orchestra or band',
+ 'id3' => 'Orchestra or band'
),
array(
'element' => 'ls:conductor',
'type' => 'text',
'label' => 'Conductor',
+ 'id3' => 'Conductor'
),
array(
'element' => 'ls:lyricist',
'type' => 'text',
'label' => 'Lyricist',
+ 'id3' => 'Lyricist'
),
array(
'element' => 'ls:originallyricist',
'type' => 'text',
'label' => 'Original lyricist',
+ 'id3' => 'Original lyricist'
),
array(
'element' => 'ls:radiostationname',
'type' => 'text',
'label' => 'Radio station name',
+ 'id3' => 'Radio station name'
),
array(
'element' => 'ls:audiofileinfourl',
'type' => 'text',
'label' => 'Audio file information web page',
+ 'id3' => 'Audio file information web page'
),
array(
'rule' => 'regex',
@@ -321,6 +354,7 @@ $mask = array(
'element' => 'ls:artisturl',
'type' => 'text',
'label' => 'Artist web page',
+ 'id3' => 'Artist web page'
),
array(
'rule' => 'regex',
@@ -332,6 +366,7 @@ $mask = array(
'element' => 'ls:audiosourceurl',
'type' => 'text',
'label' => 'Audio source web page',
+ 'id3' => 'Audio source web page'
),
array(
'rule' => 'regex',
@@ -343,6 +378,7 @@ $mask = array(
'element' => 'ls:radiostationurl',
'type' => 'text',
'label' => 'Radio station web page',
+ 'id3' => 'Radio station web page'
),
array(
'rule' => 'regex',
@@ -354,6 +390,7 @@ $mask = array(
'element' => 'ls:buycdurl',
'type' => 'text',
'label' => 'Buy CD web page',
+ 'id3' => 'Buy CD webpage'
),
array(
'rule' => 'regex',
@@ -365,23 +402,27 @@ $mask = array(
'element' => 'ls:isrcnumber',
'type' => 'text',
'label' => 'ISRC number',
- 'rule' => 'numeric'
+ 'rule' => 'numeric',
+ 'id3' => 'ISRC'
),
array(
'element' => 'ls:catalognumber',
'type' => 'text',
'label' => 'Catalog number',
- 'rule' => 'numeric'
+ 'rule' => 'numeric',
+ 'id3' => 'Catalog'
),
array(
'element' => 'ls:originalartist',
'type' => 'text',
'label' => 'Original artist',
+ 'id3' => 'Original Artist'
),
array(
'element' => 'dc:rights', ## ???
'type' => 'text',
'label' => 'Copyright',
+ 'id3' => 'Copyright'
),
),
'Talk' => array(
diff --git a/livesupport/modules/htmlUI/var/html/ui_browser.php b/livesupport/modules/htmlUI/var/html/ui_browser.php
index 7f4711f5e..1405cdc5c 100644
--- a/livesupport/modules/htmlUI/var/html/ui_browser.php
+++ b/livesupport/modules/htmlUI/var/html/ui_browser.php
@@ -148,7 +148,7 @@ if ($uiBrowser->userid) {
$Smarty->assign('changeStationPrefs', TRUE);
break;
- case "PL.simpleManagement": print_r($uiBrowser->PLAYLIST->get());
+ case "PL.simpleManagement":
if ($_REQUEST['createNew']) {
$uiBrowser->PLAYLIST->testNew();
#$Smarty->assign('PLAYLIST', $uiBrowser->PLAYLIST->get());
diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php
index f6a90ff88..9e57babb2 100644
--- a/livesupport/modules/htmlUI/var/html/ui_handler.php
+++ b/livesupport/modules/htmlUI/var/html/ui_handler.php
@@ -33,7 +33,7 @@ switch($_REQUEST['act']){
case "replaceFile":
$ui_tmpgunid = $uiHandler->gb->_gunidFromId($uiHandler->id);
- if ($uiHandler->delete($uiHandler->id)) {
+ if ($uiHandler->delete($uiHandler->id) === TRUE) {
$ui_tmpid = $uiHandler->uploadFile(array_merge($_REQUEST, $_FILES), $uiHandler->pid, $ui_fmask["uploadFile"], $ui_tmpgunid);
$uiHandler->SCRATCHPAD->removeItems($uiHandler->id);
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
@@ -47,7 +47,7 @@ switch($_REQUEST['act']){
case "replaceWebstream":
$ui_tmpgunid = $uiHandler->gb->_gunidFromId($uiHandler->id);
- if ($uiHandler->delete($uiHandler->id)) {
+ if ($uiHandler->delete($uiHandler->id) == TRUE) {
$ui_tmpid = $uiHandler->addWebstream($_REQUEST, $uiHandler->pid, $ui_fmask['addWebstream'], $ui_tmpgunid);
$uiHandler->SCRATCHPAD->removeItems($uiHandler->id);
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
@@ -149,13 +149,18 @@ switch($_REQUEST['act']){
break;
case "PL.activate":
- $uiHandler->PLAYLIST->activate($_REQUEST['id']);
$uiHandler->PLAYLIST->setReload();
+ if ($uiHandler->PLAYLIST->activate($_REQUEST['id']) === TRUE) {
+ $uiHandler->SCRATCHPAD->addItem($_REQUEST['id']);
+ }
break;
- case "PL.newUsingItem":
- $uiHandler->PLAYLIST->newUsingItem($_REQUEST['id']);
+ case "PL.create":
$uiHandler->PLAYLIST->setReload();
+ if (($ui_tmpid = $uiHandler->PLAYLIST->create($_REQUEST['id'])) !== FALSE) {
+ $uiHandler->SCRATCHPAD->addItem($ui_tmpid);
+ }
+
break;
case "PL.addItem":
@@ -163,6 +168,11 @@ switch($_REQUEST['act']){
$uiHandler->PLAYLIST->setReload();
break;
+ case "PL.removeItem":
+ $uiHandler->PLAYLIST->removeItem($_REQUEST['id']);
+ $uiHandler->PLAYLIST->setReload();
+ break;
+
case "PL.release":
$uiHandler->PLAYLIST->release();
$uiHandler->PLAYLIST->setReload();
diff --git a/livesupport/modules/htmlUI/var/templates/header.tpl b/livesupport/modules/htmlUI/var/templates/header.tpl
index 11d8a9fbe..0f204a514 100755
--- a/livesupport/modules/htmlUI/var/templates/header.tpl
+++ b/livesupport/modules/htmlUI/var/templates/header.tpl
@@ -6,6 +6,7 @@
{include file="script/basics.js.tpl"}
{include file="script/contextMenue.js.tpl"}
+ {include file="script/collector.js.tpl"}
\ No newline at end of file
diff --git a/livesupport/modules/htmlUI/var/templates/playlist/simpleManagement.tpl b/livesupport/modules/htmlUI/var/templates/playlist/simpleManagement.tpl
index 56ab96db7..75a42e191 100755
--- a/livesupport/modules/htmlUI/var/templates/playlist/simpleManagement.tpl
+++ b/livesupport/modules/htmlUI/var/templates/playlist/simpleManagement.tpl
@@ -3,22 +3,41 @@
{include file="sub/x.tpl"}
-
Simple Playlist Management
-
+
+
+
diff --git a/livesupport/modules/htmlUI/var/templates/scratchPad.tpl b/livesupport/modules/htmlUI/var/templates/scratchPad.tpl
index f04d73a76..7d27580ce 100755
--- a/livesupport/modules/htmlUI/var/templates/scratchPad.tpl
+++ b/livesupport/modules/htmlUI/var/templates/scratchPad.tpl
@@ -1,7 +1,5 @@
{*Smarty template*}
-{include file="script/scratchPad.js.tpl"}
-
%%ScratchPad%%
{if is_array($SCRATCHPAD)}
@@ -32,9 +30,9 @@
{/foreach}
-
- [Remove Selected]
- [Clear]
+
+ [Remove Selected]
+ [Clear]
diff --git a/livesupport/modules/htmlUI/var/templates/script/collector.js.tpl b/livesupport/modules/htmlUI/var/templates/script/collector.js.tpl
new file mode 100755
index 000000000..4be6e6e62
--- /dev/null
+++ b/livesupport/modules/htmlUI/var/templates/script/collector.js.tpl
@@ -0,0 +1,38 @@
+{*Smarty template*}
+
+{literal}
+
+{/literal}
diff --git a/livesupport/modules/htmlUI/var/templates/script/contextMenue.js.tpl b/livesupport/modules/htmlUI/var/templates/script/contextMenue.js.tpl
index 9d9aae9d3..2c712f903 100755
--- a/livesupport/modules/htmlUI/var/templates/script/contextMenue.js.tpl
+++ b/livesupport/modules/htmlUI/var/templates/script/contextMenue.js.tpl
@@ -36,12 +36,16 @@ function menu(id) {
menuHtml = menuHtml + " ";
break;
+ case "PL.removeItem":
+ menuHtml = menuHtml + " ";
+ break;
+
case "PL.activate":
menuHtml = menuHtml + " ";
break;
- case "PL.newUsingItem":
- menuHtml = menuHtml + " ";
+ case "PL.create":
+ menuHtml = menuHtml + " ";
break;
case "SP.addItem":
menuHtml = menuHtml + " ";
diff --git a/livesupport/modules/htmlUI/var/templates/script/scratchPad.js.tpl b/livesupport/modules/htmlUI/var/templates/script/scratchPad.js.tpl
deleted file mode 100755
index f39ac55e3..000000000
--- a/livesupport/modules/htmlUI/var/templates/script/scratchPad.js.tpl
+++ /dev/null
@@ -1,38 +0,0 @@
-{*Smarty template*}
-
-{literal}
-
-{/literal}
diff --git a/livesupport/modules/htmlUI/var/templates/sub/contextmenu.tpl b/livesupport/modules/htmlUI/var/templates/sub/contextmenu.tpl
index c6caa38ae..db0e9de99 100755
--- a/livesupport/modules/htmlUI/var/templates/sub/contextmenu.tpl
+++ b/livesupport/modules/htmlUI/var/templates/sub/contextmenu.tpl
@@ -6,7 +6,7 @@ onContextmenu="return menu('{$i.id}'
{if $PLid}
, 'PL.addItem'
{else}
- , 'PL.newUsingItem'
+ , 'PL.create'
{/if}
, 'delete'
{/if}
@@ -19,7 +19,7 @@ onContextmenu="return menu('{$i.id}'
, 'PL.addItem', 'delete'
{/if}
{else}
- , 'PL.activate', 'PL.newUsingItem', 'delete'
+ , 'PL.activate', 'PL.create', 'delete'
{/if}
{/if}
{$moreContextAfter}
diff --git a/livesupport/modules/htmlUI/var/ui_base.inc.php b/livesupport/modules/htmlUI/var/ui_base.inc.php
index 06da7de0a..31b1481c6 100644
--- a/livesupport/modules/htmlUI/var/ui_base.inc.php
+++ b/livesupport/modules/htmlUI/var/ui_base.inc.php
@@ -110,9 +110,9 @@ class uiBase
- function loadStationPrefs(&$mask)
+ function loadStationPrefs(&$mask, $reload=FALSE)
{
- if (!is_array($this->STATIONPREFS)) {
+ if (!is_array($this->STATIONPREFS || $reload===TRUE)) {
foreach ($mask as $key=>$val) {
if ($val['isPref']) {
if (is_string($setting = $this->gb->loadGroupPref(NULL, 'StationPrefs', $val['element']))) {
@@ -254,43 +254,26 @@ class uiBase
$s = $ia['playtime_seconds'];
$extent = date('H:i:s', floor($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.'));
- if ($format=='array') {
- return array(
- 'Format.Extent' => $extent,
- 'Format.Medium.Bitrate' => $ia['audio']['bitrate'],
- 'Format.Medium.Channels' => $ia['audio']['channelmode'],
- 'Format.Medium.Samplerate' => $ia['audio']['sample_rate'],
- 'Format.Medium.Encoder' => $ia['audio']['codec'] ? $ia['audio']['codec'] : $ia['audio']['encoder'],
- );
- } elseif ($format=='text') {
- #print_r($ia);
- return "fileformat: {$ia['fileformat']}
- seconds: {$ia['playtime_seconds']}
- length: $extent
- channels: {$ia['audio']['channels']}
- sample_rate: {$ia['audio']['sample_rate']}
- bits_per_sample: {$ia['audio']['bits_per_sample']}
- channelmode: {$ia['audio']['channelmode']}
- title: {$ia['id3v1']['title']}
- artist: {$ia['id3v1']['artist']}
- comment: {$ia['id3v1']['comment']}";
+ if ($format=='text') {
+ return "".var_export($ia, TRUE)." ";
} elseif ($format=='xml') {
return
'
-
-
+
- '.$this->_getFileTitle($id).'
- '.date('H:i:s', round($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.')).'
-
- ';
+ '.$this->_getFileTitle($id).'
+ '.date('H:i:s', round($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.')).'
+
+ ';
}
+ return FALSE;
}
@@ -331,9 +314,9 @@ class uiBase
{
$data = array('id' => $id,
'gunid' => $this->gb->_gunidFromId($id),
- 'title' => $this->_getMDataValue($id, 'title'),
- 'creator' => $this->_getMDataValue($id, 'creator'),
- 'duration' => $this->_niceTime($this->_getMDataValue($id, 'dcterms:extent')),
+ 'title' => $this->_getMDataValue($id, UI_MDATA_KEY_TITLE),
+ 'creator' => $this->_getMDataValue($id, UI_MDATA_KEY_ARTIST),
+ 'duration' => $this->_niceTime($this->_getMDataValue($id, UI_MDATA_KEY_DURATION)),
'type' => $this->gb->getFileType($id),
);
return ($data);
@@ -342,6 +325,9 @@ class uiBase
function _niceTime($in)
{
+ if(is_array($in)) {
+ $in = current($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);
diff --git a/livesupport/modules/htmlUI/var/ui_browser.class.php b/livesupport/modules/htmlUI/var/ui_browser.class.php
index af42d9627..bd72deced 100644
--- a/livesupport/modules/htmlUI/var/ui_browser.class.php
+++ b/livesupport/modules/htmlUI/var/ui_browser.class.php
@@ -133,7 +133,7 @@ class uiBrowser extends uiBase {
}
foreach ($data['listdata'] as $key=>$val) {
if ($val['type'] != 'Folder')
- $data['listdata'][$key]['title'] = $this->_getMDataValue($val['id'], 'title');
+ $data['listdata'][$key]['title'] = $this->_getMDataValue($val['id'], UI_MDATA_KEY_TITLE);
else
$data['listdata'][$key]['title'] = $val['name'];
}
@@ -371,7 +371,7 @@ class uiBrowser extends uiBase {
);
## convert element names to be unique over different forms-parts, add javascript to spread values over parts, add existing values from database
- foreach ($mask['tabs']['group']['group'] as $key) {
+ foreach ($mask['pages'] as $key=>$val) {
foreach ($mask['pages'][$key] as $k=>$v) {
$mask['pages'][$key][$k]['element'] = $key.'___'.$this->_formElementEncode($v['element']);
$mask['pages'][$key][$k]['attributes'] = array_merge($mask['pages'][$key][$k]['attributes'], array('onChange' => "spread(this, '".$this->_formElementEncode($v['element'])."')"));
diff --git a/livesupport/modules/htmlUI/var/ui_handler.class.php b/livesupport/modules/htmlUI/var/ui_handler.class.php
index 2f8c0f2d7..a76936aa9 100644
--- a/livesupport/modules/htmlUI/var/ui_handler.class.php
+++ b/livesupport/modules/htmlUI/var/ui_handler.class.php
@@ -161,12 +161,34 @@ class uiHandler extends uiBase {
$this->redirUrl = UI_BROWSER."?act=uploadFile&id=".$pid;
return FALSE;
}
- $this->gb->replaceMetadata($r, $this->_analyzeFile($r, 'xml'), 'string', $this->sessid);
+
+ $this->transMData($r);
+
$this->redirUrl = UI_BROWSER."?act=editMetaData&id=$r";
return $r;
}
+ function transMData($id)
+ {
+ include dirname(__FILE__).'/formmask/metadata.inc.php';
+ $this->gb->replaceMetadata($id, $this->_analyzeFile($id, 'xml'), 'string', $this->sessid);
+
+ $ia = $this->gb->analyzeFile($id, $this->sessid);
+ foreach ($mask['pages'] as $key=>$val) {
+ foreach ($mask['pages'][$key] as $k=>$v) {
+ if ($v['id3'] != FALSE) {
+ $key = strtolower($v['id3']);
+ if ($ia['comments'][$key][0]) {
+ $this->_setMdataValue($id, $v['element'], $ia['comments'][$key][0]);
+ #echo "E: ".$v['element']." V: ".$ia['comments'][$key][0]." ";
+ }
+ }
+ }
+ }
+ }
+
+
/**
* addWebstream
*
@@ -507,7 +529,7 @@ class uiHandler extends uiBase {
## first remove old entrys
$this->gb->replaceMetaData($id, $this->_analyzeFile($id, 'xml'), 'string', $this->sessid);
- foreach ($mask['tabs']['group']['group'] as $key) {
+ foreach ($mask['pages'] as $key=>$val) {
foreach ($mask['pages'][$key] as $k=>$v) {
$formdata[$key.'___'.$this->_formElementEncode($v['element'])] ? $mData[$this->_formElementDecode($v['element'])] = $formdata[$key.'___'.$this->_formElementEncode($v['element'])] : NULL;
}
@@ -574,7 +596,7 @@ class uiHandler extends uiBase {
$this->gb->saveGroupPref($this->sessid, 'StationPrefs', $val['element'], $formdata[$val['element']]);
else
$this->gb->delGroupPref($this->sessid, 'StationPrefs', $val['element']);
- $this->STATIONPREFS[$val['element']] = is_string($this->gb->loadGroupPref(NULL, 'StationPrefs', $val['element'])) ? $this->gb->loadGroupPref($this->sessid, 'StationPrefs', $val['element']) : NULL;
+ #$this->STATIONPREFS[$val['element']] = is_string($this->gb->loadGroupPref(NULL, 'StationPrefs', $val['element'])) ? $this->gb->loadGroupPref($this->sessid, 'StationPrefs', $val['element']) : NULL;
}
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')))
@@ -582,7 +604,7 @@ class uiHandler extends uiBase {
return;
}
}
-
+ $this->loadStationPrefs($mask, TRUE);
$this->_retMsg('Settings saved');
return TRUE;
}
diff --git a/livesupport/modules/htmlUI/var/ui_playlist.class.php b/livesupport/modules/htmlUI/var/ui_playlist.class.php
index 2119af127..26ad8f22a 100755
--- a/livesupport/modules/htmlUI/var/ui_playlist.class.php
+++ b/livesupport/modules/htmlUI/var/ui_playlist.class.php
@@ -19,6 +19,7 @@ class uiPlaylist
if (!$this->activeId) {
return FALSE;
}
+ #print_r( $this->Base->gb->getPlaylistArray($this->activeId, $this->Base->sessid));
return $this->Base->gb->getPlaylistArray($this->activeId, $this->Base->sessid);
}
@@ -40,7 +41,7 @@ class uiPlaylist
$this->Base->gb->savePref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY, $this->token);
#$this->active = $this->Base->gb->getPlaylistArray($plid, $this->Base->sessid);
$this->activeId = $plid;
- $this->Base->_retMsg('Playlist "$1" activated', $this->Base->_getMDataValue($plid, 'title'));
+ $this->Base->_retMsg('Playlist "$1" activated', $this->Base->_getMDataValue($plid, UI_MDATA_KEY_TITLE));
return TRUE;
}
@@ -55,7 +56,7 @@ class uiPlaylist
return FALSE;
}
$plgunid = $this->Base->gb->releaseLockedPlaylist($this->token, $this->Base->sessid);
- $this->Base->_retMsg('Playlist "$1" released', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($plgunid), 'title'));
+ $this->Base->_retMsg('Playlist "$1" released', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($plgunid), UI_MDATA_KEY_TITLE));
$this->activeId = NULL;
$this->token = NULL;
$this->Base->gb->delPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY);
@@ -74,55 +75,74 @@ class uiPlaylist
function addItem($id)
{
- if (!$this->Base->gb->addAudioClipToPlaylist($this->token, $id, $this->Base->sessid)) {
- $this->Base_retMsg('Cannot add File to Playlist');
+ if ($this->Base->gb->addAudioClipToPlaylist($this->token, $id, $this->Base->sessid) === FALSE) {
+ $this->Base_retMsg('Cannot add Item to Playlist');
return FALSE;
}
return TRUE;
-
}
- function removeItem($id)
+ function removeItem($gunids)
{
+ if (!$gunids) {
+ $this->Base->_retMsg('No Item(s) given');
+ return FALSE;
+ }
+ if (!is_array($gunids))
+ $gunids = array($gunids);
-
+ foreach ($gunids as $gunid) {
+ if ($this->Base->gb->delAudioClipFromPlaylist($this->token, $this->Base->gb->_idFromGunid($gunid), $this->Base->sessid) !== TRUE) {
+ $this->Base->_retMsg('Cannot remove Item from Playlist');
+ return FALSE;
+ }
+ }
+ return TRUE;
}
- function newUsingItem($id)
+ function create($id=FALSE)
{
# create PL
# activate
- # add clip
- if ($this->testNew() === FALSE) {
+ # add clip if given
+ if (is_array($this->activeId)) {
$this->Base->_retMsg('Already active Playlist');
return FALSE;
}
- $this->addItem($id);
- return TRUE;
- }
-
- function createEmpty()
- {
- if (!$plid = $this->Base->gb->createPlaylist($this->Base->homeid, date('Y-M-D H-i-s'), $this->Base->sessid)) {
+ $datetime = date('Y-m-d H:i:s');
+ if (!$plid = $this->Base->gb->createPlaylist($this->Base->homeid, $datetime, $this->Base->sessid)) {
$this->Base->_retMsg('Cannot create Playlist');
return FALSE;
}
- $this->Base->_setMDataValue($plid, 'dc:title', 'empty');
+ $this->Base->_setMDataValue($plid, 'dc:title', $datetime);
+ if ($this->activate($plid)===FALSE) {
+ return FALSE;
+ }
+ if ($id!==FALSE) {
+ if ($this->addItem($id)!==TRUE) {
+ return FALSE;
+ }
+ }
return $plid;
}
- function testNew()
- {
- # if exists -> return false
- # else
- # create empty
- # activate
- if (is_array($this->activeId)) {
- return FALSE;
+ function getFlat()
+ {
+ $this->plwalk($this->get(), 0);
+ return $this->flat;
+ }
+
+
+ function plwalk($arr, $parent)
+ {
+ foreach ($arr['children'] as $node=>$sub) {
+ if ($sub['elementname']=='playlistelement') {
+ $this->plwalk($sub, $node);
+ }
+ if ($sub['elementname']=='audioclip') {
+ $this->flat["$parent.$node"] = $sub['attrs'];
+ }
}
- $plid = $this->createEmpty();
- $this->activate($plid);
- return TRUE;
}
}
diff --git a/livesupport/modules/htmlUI/var/ui_scratchpad.class.php b/livesupport/modules/htmlUI/var/ui_scratchpad.class.php
index 50be9b375..83e2b0b41 100755
--- a/livesupport/modules/htmlUI/var/ui_scratchpad.class.php
+++ b/livesupport/modules/htmlUI/var/ui_scratchpad.class.php
@@ -89,10 +89,12 @@ class uiScratchPad
function removeItems($ids)
{
- if (!$ids)
- return FALSE; ## empty parameter
+ if (!$ids) {
+ $this->Base->_retMsg('No Item(s) given');
+ return FALSE;
+ }
if (!is_array($ids))
- $ids = array($ids); ## just single id given
+ $ids = array($ids);
foreach ($ids as $id) {
#$info = $this->Base->_getMetaInfo($id);
diff --git a/livesupport/modules/htmlUI/var/ui_search.class.php b/livesupport/modules/htmlUI/var/ui_search.class.php
index b79bb8afc..a52a7856e 100755
--- a/livesupport/modules/htmlUI/var/ui_search.class.php
+++ b/livesupport/modules/htmlUI/var/ui_search.class.php
@@ -18,7 +18,7 @@ class uiSearch
{
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));
+ $form->setConstants(array('id'=>$id, 'counter'=>$this->criteria['counter'] ? $this->criteria['counter'] : UI_SEARCH_MIN_ROWS));
foreach ($mask['tabs']['group']['group'] as $k=>$v) {
foreach ($mask['pages'][$v] as $val){
@@ -32,7 +32,7 @@ class uiSearch
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, "");
+ if ($n>UI_SEARCH_MIN_ROWS && $n>$this->criteria['counter']) $form->addElement('static', 's1_style', NULL, "");
$sel = &$form->createElement('hierselect', "row_$n", NULL);
$sel->setOptions(array($col1, $col2));
$group[] = &$sel;
@@ -61,16 +61,18 @@ class uiSearch
$this->criteria['operator'] = $formdata['operator'];
$this->criteria['filetype'] = $formdata['filetype'];
$this->criteria['limit'] = $formdata['limit'];
+ $this->criteria['counter'] = 0;
$this->criteria['form']['operator'] = $formdata['operator']; ## $criteria['form'] is used for retransfer to form ##
$this->criteria['form']['filetype'] = $formdata['filetype'];
$this->criteria['form']['limit'] = $formdata['limit'];
foreach ($formdata as $key=>$val) {
if (is_array($val) && strlen($val[2])) {
+ $this->criteria['counter']++;
$this->criteria['conditions'][$key] = array('cat' => $this->Base->_formElementDecode($val[0]),
'op' => $val[1],
'val' => stripslashes($val[2]));
- $this->criteria['form'][$key] = array(0 => $this->Base->_formElementDecode($val[0]),
+ $this->criteria['form'][$key] = array(0 => $val[0],
1 => $val[1],
2 => stripslashes($val[2]));
}
@@ -129,7 +131,8 @@ class uiSearch
function clear()
{
#$this->results = NULL;
- $this->criteria['form'] = NULL;
+ $this->criteria['form'] = NULL;
+ $this->criteria['counter'] = NULL;
$this->setReload();
}