*** empty log message ***

This commit is contained in:
sebastian 2005-02-26 19:29:36 +00:00
parent 2f6ef90968
commit 8f28715ddb
17 changed files with 279 additions and 169 deletions

View File

@ -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');
?>

View File

@ -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(

View File

@ -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());

View File

@ -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();

View File

@ -6,6 +6,7 @@
{include file="script/basics.js.tpl"}
{include file="script/contextMenue.js.tpl"}
{include file="script/collector.js.tpl"}
</head>
<body>

View File

@ -3,22 +3,41 @@
<div class="standardFrame">
{include file="sub/x.tpl"}
<div align="center"><b>Simple Playlist Management</b></div>
<br>
<center>
<form name="PL">
<table border="1">
<tr><th colspan="4">Simple Playlist Management</th></tr>
{PL->get assign='PL'}
{if is_array($PL)} {* already activated Playlist *}
active Playlist: {$PL.children.0.children.0.content}
<br>
{foreach from=$PL item=pl}
{$pl}
<br>
{/foreach}
<tr><th colspan="4">active Playlist: {$PL.children.0.children.0.content}</th></tr>
<tr align="center"><td></td><td>Title</td><td>Duration</td><td>Type</td></tr>
{PL->getFlat assign='FLAT'}
{foreach from=$FLAT item='i'}
{uiBrowser->_niceTime p1=$i.playlength assign='nicelength'}
<tr onMouseOver="highlight()" onMouseOut="darklight()" onContextmenu="return menu('{$i.id}', 'PL.removeItem')">
<td><input type="checkbox" name="{$i.id}"></td>
<td>{$i.title}</td>
<td>{$nicelength}</td>
<td>{$i.type}</td>
</tr>
{/foreach}
<tr style="background-color: {cycle values='#eeeeee, #dadada'}">
<td><input type="checkbox" name="all" onClick="form_switchAll('PL')"></th>
<td align="center" colspan="2"><a href="#" onClick="form_submit('PL')">[Remove Selected]</a></th>
<td align="center" colspan="2"><a href="#" onClick="form_clearAll('PL')">[Clear]</a></th>
</tr>
</table>
{else} {* no active Playlist *}
No active Playlist!
<br>
<input type="button" value="Make new Playlist" onClick="location.href='{$UI_BRWOSER}?act=PL.simpleManagement&createNew=1'">
<input type="button" value="Make new Playlist" onClick="hpopup('{$UI_HANDLER}?act=PL.create')">
{/if}
</table>
</form>
</div>
</div>

View File

@ -1,7 +1,5 @@
{*Smarty template*}
{include file="script/scratchPad.js.tpl"}
<div id="scratchpad">
<center><b>%%ScratchPad%%</b>
{if is_array($SCRATCHPAD)}
@ -32,9 +30,9 @@
</tr>
{/foreach}
<tr style="background-color: {cycle values='#eeeeee, #dadada'}">
<td><input type="checkbox" name="all" onClick="SP_switchAll()"></th>
<td align="center" colspan="2"><a href="#" onClick="SP_submit()">[Remove Selected]</a></th>
<td align="center" colspan="2"><a href="#" onClick="SP_clearAll()">[Clear]</a></th>
<td><input type="checkbox" name="all" onClick="form_switchAll('SP')"></th>
<td align="center" colspan="2"><a href="#" onClick="form_submit('SP')">[Remove Selected]</a></th>
<td align="center" colspan="2"><a href="#" onClick="form_clearAll('SP')">[Clear]</a></th>
</tr>
</table>
</form>

View File

@ -0,0 +1,38 @@
{*Smarty template*}
{literal}
<script type="text/javascript">
function form_submit(formname)
{
var href = '{/literal}{$UI_HANDLER}?act='+formname+'.removeItem{literal}';
var n;
for (n=0; n < (document.forms[formname].elements.length-1); n++) {
if (document.forms[formname].elements[n].checked) {
href = href + '&id[]=' + document.forms[formname].elements[n].name;
}
}
hpopup(href);
}
function form_switchAll(formname)
{
var n;
for (n=0; n < document.forms[formname].elements.length; n++) {
if (document.forms[formname].elements[n].type == 'checkbox') {
document.forms[formname].elements[n].checked = document.forms[formname].elements['all'].checked;
}
}
}
function form_clearAll(formname)
{
if (confirm("{/literal}{tra 0='Are you sure to remove all Items?'}{literal}")) {
document.forms[formname].elements['all'].checked = true;
form_switchAll(formname);
form_submit(formname);
}
}
</script>
{/literal}

View File

@ -36,12 +36,16 @@ function menu(id) {
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.addItem&id="+id+"')\" "+oF+">&nbsp;Add to active Playlist&nbsp;</a></td></tr>";
break;
case "PL.removeItem":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.removeItem&id="+id+"')\" "+oF+">&nbsp;Remove Item from Playlist&nbsp;</a></td></tr>";
break;
case "PL.activate":
menuHtml = menuHtml + "<tr><td><a class='menu' href=\"javascript: hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.activate&id="+id+"')\" "+oF+">&nbsp;Activate this Playlist&nbsp;</a></td></tr>";
break;
case "PL.newUsingItem":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.newUsingItem&id="+id+"')\" "+oF+">&nbsp;New Playlist using Item&nbsp;</a></td></tr>";
case "PL.create":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.create&id="+id+"')\" "+oF+">&nbsp;New Playlist using Item&nbsp;</a></td></tr>";
break;
case "SP.addItem":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=SP.addItem&id="+id+"')\" "+oF+">&nbsp;Add to ScratchPad&nbsp;</a></td></tr>";

View File

@ -1,38 +0,0 @@
{*Smarty template*}
{literal}
<script type="text/javascript">
function SP_submit()
{
var href = '{/literal}{$UI_HANDLER}?act=SP.removeItem{literal}';
var n;
for (n=0; n < (document.forms['SP'].elements.length-1); n++) {
if (document.forms['SP'].elements[n].checked) {
href = href + '&id[]=' + document.forms['SP'].elements[n].name;
}
}
hpopup(href, 'SP');
}
function SP_switchAll()
{
var n;
for (n=0; n < document.forms['SP'].elements.length; n++) {
if (document.forms['SP'].elements[n].type == 'checkbox') {
document.forms['SP'].elements[n].checked = document.forms['SP'].elements['all'].checked;
}
}
}
function SP_clearAll()
{
if (confirm("{/literal}{tra 0='Are you sure to clear ScratchPad?'}{literal}")) {
document.forms['SP'].elements['all'].checked = true;
SP_switchAll();
SP_submit();
}
}
</script>
{/literal}

View File

@ -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}

View File

@ -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']}<br>
seconds: {$ia['playtime_seconds']}<br>
length: $extent<br>
channels: {$ia['audio']['channels']}<br>
sample_rate: {$ia['audio']['sample_rate']}<br>
bits_per_sample: {$ia['audio']['bits_per_sample']}<br>
channelmode: {$ia['audio']['channelmode']}<br>
title: {$ia['id3v1']['title']}<br>
artist: {$ia['id3v1']['artist']}<br>
comment: {$ia['id3v1']['comment']}";
if ($format=='text') {
return "<div align='left'><pre>".var_export($ia, TRUE)."</pre></div>";
} elseif ($format=='xml') {
return
'<?xml version="1.0" encoding="utf-8"?>
<audioClip>
<metadata
<audioClip>
<metadata
xmlns="http://www.streamonthefly.org/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:xbmf="http://www.streamonthefly.org/xbmf"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<dc:title>'.$this->_getFileTitle($id).'</dc:title>
<dcterms:extent>'.date('H:i:s', round($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.')).'</dcterms:extent>
</metadata>
</audioClip>';
<dc:title>'.$this->_getFileTitle($id).'</dc:title>
<dcterms:extent>'.date('H:i:s', round($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.')).'</dcterms:extent>
</metadata>
</audioClip>';
}
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);

View File

@ -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'])."')"));

View File

@ -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]."<br>";
}
}
}
}
}
/**
* 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;
}

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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, "<div id='searchRow_$n'>");
if ($n > UI_SEARCH_MIN_ROWS) $form->addElement('static', 's1_style', NULL, "<style type='text/css'>#searchRow_$n {visibility : hidden; height : 0px;}</style>");
if ($n>UI_SEARCH_MIN_ROWS && $n>$this->criteria['counter']) $form->addElement('static', 's1_style', NULL, "<style type='text/css'>#searchRow_$n {visibility : hidden; height : 0px;}</style>");
$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();
}