*** empty log message ***

This commit is contained in:
sebastian 2005-03-11 21:16:22 +00:00
parent cae9c68173
commit b418a85f8d
23 changed files with 268 additions and 151 deletions

View file

@ -23,14 +23,14 @@
Author : $Author: sebastian $ Author : $Author: sebastian $
Version : $Revision: 1.2 $ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/SchedulerPhpClient.class.php,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/SchedulerPhpClient.class.php,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
/* ================================================================= includes */ /* ================================================================= includes */
require_once 'DB.php'; #require_once 'DB.php';
require_once "XML/RPC.php"; #require_once "XML/RPC.php";
#include_once "../conf.php"; #include_once "../conf.php";
/* ================================================== method definition array */ /* ================================================== method definition array */
@ -482,10 +482,19 @@ class SchedulerPhpClient{
if($res->faultCode() > 0) { if($res->faultCode() > 0) {
return array('error' => array('code' => $res->faultCode(), 'message' => $res->faultString())); ## changed by sebastian return array('error' => array('code' => $res->faultCode(), 'message' => $res->faultString())); ## changed by sebastian
/* /*
tomas´ orig. method
return $this->dbc->raiseError( return $this->dbc->raiseError(
"SchedulerPhpClient::$method:".$res->faultString()." ". "SchedulerPhpClient::$method:".$res->faultString()." ".
$res->faultCode()."\n", $res->faultCode() $res->faultCode()."\n", $res->faultCode()
); */ );
newer method:
return PEAR::raiseError(
"SchedulerPhpClient::$method:".$res->faultString()." ".
$res->faultCode()."\n", $res->faultCode(),
PEAR_ERROR_RETURN
);
*/
} }
if($this->verbose){ if($this->verbose){
echo "result:\n"; echo "result:\n";

View file

@ -93,7 +93,7 @@ $mask = array(
'id3' => 'Artist' 'id3' => 'Artist'
), ),
array( array(
'element' => 'ls:genre', 'element' => 'dc:type',
'type' => 'text', 'type' => 'text',
'label' => 'Genre', 'label' => 'Genre',
'required' => TRUE, 'required' => TRUE,
@ -168,6 +168,7 @@ $mask = array(
'label' => 'Album', 'label' => 'Album',
'id3' => 'Album' 'id3' => 'Album'
), ),
/*
array( array(
'element' => 'ls:year', 'element' => 'ls:year',
'type' => 'date', 'type' => 'date',
@ -180,6 +181,14 @@ $mask = array(
), ),
'id3' => 'Year' 'id3' => 'Year'
), ),
*/
array(
'element' => 'ls:year',
'type' => 'select',
'label' => 'Year',
'options' => _getNumArr(1900, date('Y')+5),
'id3' => 'Year'
),
array( array(
'element' => 'dc:type', 'element' => 'dc:type',
'type' => 'text', 'type' => 'text',

View file

@ -45,6 +45,10 @@ if (is_array($_REQUEST['popup'])){
$Smarty->assign('dynform', $uiBrowser->PLAYLIST->changeTransitionForm($_REQUEST['id'], $_REQUEST['type'], $ui_fmask['PL.changeTransition'])); $Smarty->assign('dynform', $uiBrowser->PLAYLIST->changeTransitionForm($_REQUEST['id'], $_REQUEST['type'], $ui_fmask['PL.changeTransition']));
$Smarty->display('playlist/changeTransition.tpl'); $Smarty->display('playlist/changeTransition.tpl');
break; break;
case "SCHEDULER.schedule":
$Smarty->display('scheduler/schedule.tpl');
break;
} }
} }
die(); die();
@ -83,7 +87,7 @@ if ($uiBrowser->userid) {
case "editItem": case "editItem":
$Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id)); $Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id));
$Smarty->assign('editItem', array('type' => $uiBrowser->type=='webstream' ? 'webstream' : 'file', 'id' => $_REQUEST['id'], 'folderId' => $uiBrowser->fid)); $Smarty->assign('editItem', array('type' => $uiBrowser->type, 'id' => $_REQUEST['id'], 'folderId' => $uiBrowser->fid));
break; break;
case "editFile": case "editFile":

View file

@ -6,7 +6,7 @@ switch($_REQUEST['act']){
case "login": case "login":
if ($uiHandler->login($_REQUEST, $ui_fmask["login"]) === TRUE) { if ($uiHandler->login($_REQUEST, $ui_fmask["login"]) === TRUE) {
$uiHandler->loadStationPrefs($ui_fmask['stationPrefs'], TRUE); $uiHandler->loadStationPrefs($ui_fmask['stationPrefs'], TRUE);
$uiHandler->PLAYLIST->loadLookedFromPref(); $uiHandler->PLAYLIST->reportLookedPL(TRUE);
} }
break; break;
@ -206,7 +206,13 @@ switch($_REQUEST['act']){
break; break;
case "PL.revert": case "PL.revert":
$uiHandler->PLAYLIST->revert(); if (($ui_tmpid = $uiHandler->PLAYLIST->revert()) !== FALSE)
$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
$uiHandler->PLAYLIST->setReload();
break;
case"PL.unlook":
$uiHandler->PLAYLIST->loadLookedFromPref();
$uiHandler->PLAYLIST->setReload(); $uiHandler->PLAYLIST->setReload();
break; break;
@ -227,7 +233,7 @@ switch($_REQUEST['act']){
case "SCHEDULER.uploadPlaylistMethod": case "SCHEDULER.uploadPlaylistMethod":
$uiHandler->SCHEDULER->uploadPlaylistMethod($_REQUEST); $uiHandler->SCHEDULER->uploadPlaylistMethod($_REQUEST);
$uiHandler->SCHEDULER->setReload(); $uiHandler->SCHEDULER->setReload();
break; break;
default: default:

View file

@ -7,17 +7,12 @@
{else} {else}
New New
{/if} {/if}
{if $editItem.type == 'file'} {$editItem.type|capitalize}
File
{else}
Webstream
{/if}
</h4> </h4>
{if $editItem.type == 'audioclip'}
<input type="button" onClick="showData()" value="Data"> <input type="button" onClick="showData()" value="Data">
<input type="button" onClick="showMData()" value="MData"> <input type="button" onClick="showMData()" value="MData">
{if $editItem.type == 'file'}
<div id="div_Data"> <div id="div_Data">
{include file="file/fileform.tpl"} {include file="file/fileform.tpl"}
</div> </div>
@ -27,8 +22,9 @@
{/if} {/if}
{if $editItem.type == 'webstream'} {if $editItem.type == 'webstream'}
<input type="button" onClick="showData()" value="Data">
<input type="button" onClick="showMData()" value="MData">
<div id="div_Data"> <div id="div_Data">
{include file="file/webstreamform.tpl"} {include file="file/webstreamform.tpl"}
</div> </div>
@ -37,6 +33,12 @@
</div> </div>
{/if} {/if}
{if $editItem.type == 'playlist'}
<div id="div_MData">
{include file="file/metadataform.tpl"}
</div>
{/if}
</div> </div>
{literal} {literal}

View file

@ -7,7 +7,7 @@
<tr onMouseOver="highlight()" <tr onMouseOver="highlight()"
onMouseOut="darklight()" onMouseOut="darklight()"
onContextmenu="return menu('{$i.attrs.id}', {if $n == 1}'PL.changeFadeIn'{else}'PL.changeTransition'{/if})}" style="background-color: lightblue"> onContextmenu="return menu('{$i.attrs.id}', {if $n == 1}'PL.changeFadeIn'{else}'PL.changeTransition'{/if})}" style="background-color: lightblue">
<td colspan="4" align="center">{$i.fadein_ms} ms</td> <td colspan="4" align="center">{$i.fadein_ms|string_format:"%d"} ms</td>
</tr> </tr>
<tr onMouseOver="highlight()" <tr onMouseOver="highlight()"
onMouseOut="darklight()" onMouseOut="darklight()"
@ -28,18 +28,19 @@
<tr onMouseOver="highlight()" <tr onMouseOver="highlight()"
onMouseOut="darklight()" onMouseOut="darklight()"
onContextmenu="return menu('{$i.attrs.id}', 'PL.changeFadeOut')" style="background-color: lightblue"> onContextmenu="return menu('{$i.attrs.id}', 'PL.changeFadeOut')" style="background-color: lightblue">
<td colspan="4" align="center">{$i.fadeout_ms} ms</td> <td colspan="4" align="center">{$i.fadeout_ms|string_format:"%d"} ms</td>
</tr> </tr>
{/if} {/if}
<tr style="background-color: {cycle values='#eeeeee, #dadada'}"> <tr style="background-color: {cycle values='#eeeeee, #dadada'}">
<td><input type="checkbox" name="all" onClick="form_switchAll('PL')"></th> <td><input type="checkbox" name="all" onClick="collector_switchAll('PL')"></th>
<td align="center" colspan="2"><a href="#" onClick="form_submit('PL', 'PL.removeItem')">[Remove Selected]</a></th> <td align="center" colspan="2"><a href="#" onClick="collector_submit('PL', 'PL.removeItem')">[Remove Selected]</a></th>
<td align="center" colspan="2"><a href="#" onClick="form_clearAll('PL')">[Clear]</a></th> <td align="center" colspan="2"><a href="#" onClick="collector_clearAll('PL', 'PL.removeItem')">[Clear]</a></th>
</tr> </tr>
<tr> <tr>
<td><input type="button" value="Save Changes" onClick="hpopup('{$UI_HANDLER}?act=PL.save')"></td> <td><input type="button" value="Save" onClick="hpopup('{$UI_HANDLER}?act=PL.save')"></td>
<td colspan="2"><input type="button" value="Revert all Changes" onClick="hpopup('{$UI_HANDLER}?act=PL.revert')"></td> <td><input type="button" value="Revert" onClick="hpopup('{$UI_HANDLER}?act=PL.revert')"></td>
<td><input type="button" value="Release" onClick="hpopup('{$UI_HANDLER}?act=PL.release')"></td>
<td><input type="button" value="Delete" onClick="hpopup('{$UI_HANDLER}?act=PL.delete')"></td> <td><input type="button" value="Delete" onClick="hpopup('{$UI_HANDLER}?act=PL.delete')"></td>
</tr> </tr>

View file

@ -9,11 +9,21 @@
<tr><th colspan="4">Simple Playlist Management</th></tr> <tr><th colspan="4">Simple Playlist Management</th></tr>
{PL->get assign='PL'} {PL->get assign='PL'}
{PL->reportLookedPL assign="_looked"}
{if is_array($PL)} {* already activated Playlist *} {if is_array($PL)} {* already activated Playlist *}
{include file="playlist/editor.tpl"} {include file="playlist/editor.tpl"}
{else} {* no active Playlist *} {else} {* no active Playlist *}
<tr><td colspan="4">No active Playlist!</td></tr>
<tr><td colspan="4"><input type="button" value="Create empty Playlist" onClick="hpopup('{$UI_HANDLER}?act=PL.create')"></td></tr> <tr>
<td colspan="4">
{if $_looked}
<input type="button" value="Unlook crashed Playlist" onClick="hpopup('{$UI_HANDLER}?act=PL.unlook')">
{else}
<input type="button" value="New empty Playlist" onClick="hpopup('{$UI_HANDLER}?act=PL.create')">
{/if}
</td>
</tr>
{/if} {/if}
</table> </table>

View file

@ -6,7 +6,7 @@
{assign var="_hour" value=$_Hour.hour} {assign var="_hour" value=$_Hour.hour}
<tr> <tr>
<td {include file="scheduler/contextmenu.tpl"}> <td {include file="scheduler/contextmenu.tpl"}>
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&day={$_Day.day}')">{$_Hour.hour} <a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&hour={$_Hour.hour}')">{$_Hour.hour}
</td> </td>
</tr> </tr>

View file

@ -4,7 +4,7 @@
<input type="button" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=day')" value="Day"> <input type="button" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=day')" value="Day">
<input type="button" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=week')" value="Week"> <input type="button" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=week')" value="Week">
<input type="button" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=month')" value="Month"> <input type="button" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=month')" value="Month">
<input type="button" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=schedule')" value="Schedule"> <input type="button" onClick="popup('{$UI_BROWSER}?popup[]=SCHEDULER.schedule', 'Schedule', 600, 400)" value="Schedule">
{include file="scheduler/calendar.tpl"} {include file="scheduler/calendar.tpl"}

View file

@ -1,24 +1,35 @@
{include file="header.tpl"}
{$SCHEDULER->copyPlFromSP()} {$SCHEDULER->copyPlFromSP()}
<form name="schedule_it"> <form name="schedule_it">
<select name="gunid"> <table>
{foreach from=$SCHEDULER->playlists item="_pl"} <tr><td><b>Schedule date</b></td><td>{$SCHEDULER->curr.year}-{$SCHEDULER->curr.month}-{$SCHEDULER->curr.day}</td></tr>
<option value="{$_pl.gunid}">{$_pl.title}</option> <tr>
{/foreach} <td><b>Select Playlist</b></td>
</select> <td>
<input type="hidden" name="sc_last"> <select name="gunid" multiple>
<input value="{$SCHEDULER->curr.hour}" type="text" size="2" name="hour" onClick="sc_act(this)" onChange="sc_checkrange(); sc_twodigits()" onBlur="sc_check_int(this)"> : {foreach from=$SCHEDULER->playlists item="_pl"}
<input value="00" type="text" size="2" name="min" onClick="sc_act(this)" onChange="sc_checkrange(); sc_twodigits()" onBlur="sc_check_int(this)"> : <option value="{$_pl.gunid}">{$_pl.title}</option>
<input value="00" type="text" size="2" name="sec" onClick="sc_act(this)" onChange="sc_checkrange(); sc_twodigits()" onBlur="sc_check_int(this)"> {/foreach}
<a href="#" onClick="sc_change('-')" onMouseDown="sc_start('-')" onMouseUp="sc_stop()" onMouseOut="sc_stop()">-</a> </select>
<a href="#" onClick="sc_change('+')" onMouseDown="sc_start('+')" onMouseUp="sc_stop()" onMouseOut="sc_stop()">+</a> </td>
</tr>
<br> <tr>
<input type="button" value="schedule" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.uploadPlaylistMethod&gunid='+schedule_it.gunid.value+'&time='+schedule_it.hour.value+':'+schedule_it.min.value+':'+schedule_it.sec.value)"> <td><b>Schedule time</b></td>
<td>
<input type="hidden" name="sc_last">
<input value="{$SCHEDULER->curr.hour}" type="text" size="2" name="hour" onClick="sc_act(this)" onChange="sc_checkrange(); sc_twodigits()" onBlur="sc_check_int(this)"> :
<input value="00" type="text" size="2" name="min" onClick="sc_act(this)" onChange="sc_checkrange(); sc_twodigits()" onBlur="sc_check_int(this)"> :
<input value="00" type="text" size="2" name="sec" onClick="sc_act(this)" onChange="sc_checkrange(); sc_twodigits()" onBlur="sc_check_int(this)">
<a href="#" onClick="sc_change('-')" onMouseDown="sc_start('-')" onMouseUp="sc_stop()" onMouseOut="sc_stop()">-</a>
<a href="#" onClick="sc_change('+')" onMouseDown="sc_start('+')" onMouseUp="sc_stop()" onMouseOut="sc_stop()">+</a
</td>
</tr>
<tr><td>&nbsp;</td><td><input type="button" value="schedule" onClick="location.href='{$UI_HANDLER}?act=SCHEDULER.uploadPlaylistMethod&gunid='+schedule_it.gunid.value+'&time='+schedule_it.hour.value+':'+schedule_it.min.value+':'+schedule_it.sec.value"></td></tr>
</table>
</form> </form>
<script type="text/javascript"> <script type="text/javascript">
{literal} {literal}
var sc_loop; var sc_loop;
@ -106,3 +117,6 @@ function sc_check_int(element)
} }
{/literal} {/literal}
</script> </script>
</body>
</html>

View file

@ -15,14 +15,20 @@
<td valign="top"> <td valign="top">
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=day&day={$_Day.day}&month={$_Day.month}&year={$_Day.year}')"><b>{$_Day.day}</b></a> <a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=day&day={$_Day.day}&month={$_Day.month}&year={$_Day.year}')"><b>{$_Day.day}</b></a>
{if $_Day.isSelected} {if $_Day.isSelected}
{assign var="_oneday" value=$SCHEDULER->getDayUsage($_Day.year, $_Day.month, $_Day.day)} {assign var="_oneday" value=$SCHEDULER->getDayTiming($_Day.year, $_Day.month, $_Day.day)}
<table border="1" style="font-family : monospace"> <table border="1" style="font-family : monospace">
{foreach from=$_oneday item="i"} {foreach from=$_oneday item="i"}
<tr><td> <tr height="{$i.length/360}">
Start:{$i.start|regex_replace:"/[0-9]+T/":""} <td><small>
<br> {if is_array($i.entry)}
End:&nbsp;&nbsp;{$i.end|regex_replace:"/[0-9]+T/":""} Start:{$i.entry.start|regex_replace:"/[0-9]+T/":""}
</td></tr> <br>
End:&nbsp;&nbsp;{$i.entry.end|regex_replace:"/[0-9]+T/":""}
{else}
Gap
{/if}
</small></td>
</tr>
{/foreach} {/foreach}
</table> </table>
{/if} {/if}

View file

@ -30,19 +30,22 @@
</tr> </tr>
{/foreach} {/foreach}
<tr style="background-color: {cycle values='#eeeeee, #dadada'}"> <tr style="background-color: {cycle values='#eeeeee, #dadada'}">
<td><input type="checkbox" name="all" onClick="form_switchAll('SP')"></th> <td><input type="checkbox" name="all" onClick="collector_switchAll('SP')"></th>
<td align="center" colspan="2"> <td align="center" colspan="2">
<select> <select name="SP_multiaction">
<option selected>Multiple Action:</option> <option>Multiple Action:</option>
<option onClick="form_submit('SP', 'SP.removeItem')">Remove</option> <option onClick="collector_submit('SP', 'SP.removeItem')">Remove</option>
{if $_PL_activeId} {if $_PL_activeId}
<option onClick="form_submit('SP', 'PL.addItem')">Add to Playlist</option> <option onClick="collector_submit('SP', 'PL.addItem')">Add to Playlist</option>
{else} {else}
<option onClick="form_submit('SP', 'PL.create')">New Playlist using Item</option> <option onClick="collector_submit('SP', 'PL.create')">New Playlist using Item</option>
{/if} {/if}
</select> </select>
<script type="text/javascript">
document.forms['SP'].elements['SP_multiaction'].options[0].selected=true;
</script>
</th> </th>
<td align="center" colspan="2"><a href="#" onClick="form_clearAll('SP', 'SP.removeItem')">[Clear]</a></th> <td align="center" colspan="2"><a href="#" onClick="collector_clearAll('SP', 'SP.removeItem')">[Clear]</a></th>
</tr> </tr>
</table> </table>
</form> </form>

View file

@ -33,9 +33,9 @@ function sClock()
{ {
sinterval = 100; // milliseconds sinterval = 100; // milliseconds
{/literal} {/literal}
hours = {$smarty.now|date_format:"%H"}; hours = {$smarty.now|date_format:"%H"|string_format:"%d"};
minutes = {$smarty.now|date_format:"%M"}; minutes = {$smarty.now|date_format:"%M"|string_format:"%d"};
seconds = {$smarty.now|date_format:"%S"}; seconds = {$smarty.now|date_format:"%S"|string_format:"%d"};
{literal} {literal}
if(timer){clearInterval(timer);timer=null;} if(timer){clearInterval(timer);timer=null;}
timer=setInterval("work();", sinterval); timer=setInterval("work();", sinterval);

View file

@ -2,7 +2,7 @@
{literal} {literal}
<script type="text/javascript"> <script type="text/javascript">
function form_submit(formname, action) function collector_submit(formname, action)
{ {
var href = '{/literal}{$UI_HANDLER}{literal}?act='+action; var href = '{/literal}{$UI_HANDLER}{literal}?act='+action;
var n; var n;
@ -15,7 +15,7 @@ function form_submit(formname, action)
hpopup(href); hpopup(href);
} }
function form_switchAll(formname) function collector_switchAll(formname)
{ {
var n; var n;
@ -26,12 +26,12 @@ function form_switchAll(formname)
} }
} }
function form_clearAll(formname, action) function collector_clearAll(formname, action)
{ {
if (confirm("{/literal}{tra 0='Are you sure to remove all Items?'}{literal}")) { if (confirm("{/literal}{tra 0='Are you sure to remove all Items?'}{literal}")) {
document.forms[formname].elements['all'].checked = true; document.forms[formname].elements['all'].checked = true;
form_switchAll(formname); collector_switchAll(formname);
form_submit(formname, action); collector_submit(formname, action);
} }
} }
</script> </script>

View file

@ -11,7 +11,7 @@ document.write('<div id="menucontainer"></div>');
menuWidth = 180, menuWidth = 180,
menuHeight = 0; menuHeight = 0;
function menu(id) { function menu(param) {
var menuHeader = "<div id='menu' style='position:absolute;top:-250;left:0;z-index:100'>"+ var menuHeader = "<div id='menu' style='position:absolute;top:-250;left:0;z-index:100'>"+
"<table cellpadding='5' cellspacing='0' width='"+menuWidth+"' height='"+menuHeight+"' style='border-style:outset;border-width:1;border-color:#3a6c96;background-color:#4682B4'>"; "<table cellpadding='5' cellspacing='0' width='"+menuWidth+"' height='"+menuHeight+"' style='border-style:outset;border-width:1;border-color:#3a6c96;background-color:#4682B4'>";
var menuFooter = "</table></div>"; var menuFooter = "</table></div>";
@ -25,7 +25,7 @@ function menu(id) {
for (var i = 1; i < menu.arguments.length; ++i) { for (var i = 1; i < menu.arguments.length; ++i) {
switch (menu.arguments[i]) { switch (menu.arguments[i]) {
case "PL.display": case "PL.display":
menuHtml = menuHtml + "<tr><td><a class='menu' href=\"{/literal}{$UI_BROWSER}{literal}?act=PL.display&id="+id+"\" "+oF+">&nbsp;Display this Playlist&nbsp;</a></td></tr>"; menuHtml = menuHtml + "<tr><td><a class='menu' href=\"{/literal}{$UI_BROWSER}{literal}?act=PL.display&id="+param+"\" "+oF+">&nbsp;Display this Playlist&nbsp;</a></td></tr>";
break; break;
case "PL.release": case "PL.release":
@ -33,55 +33,57 @@ function menu(id) {
break; break;
case "PL.addItem": case "PL.addItem":
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>"; menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.addItem&id="+param+"')\" "+oF+">&nbsp;Add to active Playlist&nbsp;</a></td></tr>";
break; break;
case "PL.removeItem": 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>"; menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.removeItem&id="+param+"')\" "+oF+">&nbsp;Remove Item from Playlist&nbsp;</a></td></tr>";
break; break;
case "PL.activate": 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>"; menuHtml = menuHtml + "<tr><td><a class='menu' href=\"javascript: hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.activate&id="+param+"')\" "+oF+">&nbsp;Activate this Playlist&nbsp;</a></td></tr>";
break; break;
case "PL.create": 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>"; menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.create&id="+param+"')\" "+oF+">&nbsp;New Playlist using Item&nbsp;</a></td></tr>";
break; break;
case "PL.changeFadeIn": case "PL.changeFadeIn":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"popup('{/literal}{$UI_BROWSER}{literal}?popup[]=PL.changeTransition&type=fadeIn&id="+id+"', 'PL', '350', '100')\" "+oF+">&nbsp;Change Fadein&nbsp;</a></td></tr>"; menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"popup('{/literal}{$UI_BROWSER}{literal}?popup[]=PL.changeTransition&type=fadeIn&id="+param+"', 'PL', '350', '100')\" "+oF+">&nbsp;Change Fadein&nbsp;</a></td></tr>";
break; break;
case "PL.changeTransition": case "PL.changeTransition":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"popup('{/literal}{$UI_BROWSER}{literal}?popup[]=PL.changeTransition&type=transition&id="+id+"', 'PL', '350', '100')\" "+oF+">&nbsp;Change Transition&nbsp;</a></td></tr>"; menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"popup('{/literal}{$UI_BROWSER}{literal}?popup[]=PL.changeTransition&type=transition&id="+param+"', 'PL', '350', '100')\" "+oF+">&nbsp;Change Transition&nbsp;</a></td></tr>";
break; break;
case "PL.changeFadeOut": case "PL.changeFadeOut":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"popup('{/literal}{$UI_BROWSER}{literal}?popup[]=PL.changeTransition&type=fadeOut&id="+id+"', 'PL', '350', '100')\" "+oF+">&nbsp;Change Fadeout&nbsp;</a></td></tr>"; menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"popup('{/literal}{$UI_BROWSER}{literal}?popup[]=PL.changeTransition&type=fadeOut&id="+param+"', 'PL', '350', '100')\" "+oF+">&nbsp;Change Fadeout&nbsp;</a></td></tr>";
break; break;
case "SP.addItem": 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>"; menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=SP.addItem&id="+param+"')\" "+oF+">&nbsp;Add to ScratchPad&nbsp;</a></td></tr>";
break; break;
case "SP.removeItem": case "SP.removeItem":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=SP.removeItem&id="+id+"')\" "+oF+">&nbsp;Remove from Scratchpad&nbsp;</a></td></tr>"; menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=SP.removeItem&id="+param+"')\" "+oF+">&nbsp;Remove from Scratchpad&nbsp;</a></td></tr>";
break; break;
case "edit": case "edit":
menuHtml = menuHtml + "<tr><td><a class='menu' href='{/literal}{$UI_BROWSER}{literal}?act=editItem&id="+id+"'"+oF+">&nbsp;Edit&nbsp;</a></td></tr>"; menuHtml = menuHtml + "<tr><td><a class='menu' href='{/literal}{$UI_BROWSER}{literal}?act=editItem&id="+param+"'"+oF+">&nbsp;Edit&nbsp;</a></td></tr>";
break; break;
case "delete": case "delete":
menuHtml = menuHtml + "<tr><td><a class='menu' href='{/literal}{$UI_HANDLER}{literal}?act=delete&id="+id+"'"+oF+">&nbsp;!Delete Item!&nbsp;</a></td></tr>"; menuHtml = menuHtml + "<tr><td><a class='menu' href='{/literal}{$UI_HANDLER}{literal}?act=delete&id="+param+"'"+oF+">&nbsp;!Delete Item!&nbsp;</a></td></tr>";
break; break;
case "fileList": case "fileList":
menuHtml = menuHtml + "<tr><td><a class='menu' href='{/literal}{$UI_BROWSER}{literal}?act=fileList&id="+id+"'"+oF+">&nbsp;List Folder&nbsp;</a></td></tr>"; menuHtml = menuHtml + "<tr><td><a class='menu' href='{/literal}{$UI_BROWSER}{literal}?act=fileList&id="+param+"'"+oF+">&nbsp;List Folder&nbsp;</a></td></tr>";
break; break;
case "SCHEDULER.schedule": case "SCHEDULER.schedule":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=SCHEDULER.set&view=schedule&hour="+id+"')\" "+oF+">&nbsp;Schedule Playlist&nbsp;</a></td></tr>"; //menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=SCHEDULER.set&view=schedule&hour="+param+"')\" "+oF+">&nbsp;Schedule Playlist&nbsp;</a></td></tr>";
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' {/literal}onClick=\"hpopup('{$UI_HANDLER}?act=SCHEDULER.set&hour="+param+"'); popup('{$UI_BROWSER}?popup[]=SCHEDULER.schedule', 'Schedule', 600, 400)\"'){literal}"+oF+">&nbsp;Schedule Playlist&nbsp;</a></td></tr>";
break; break;
} }
} }

View file

@ -21,7 +21,7 @@ onContextmenu="return menu('{$i.id}'
, 'PL.addItem', 'delete' , 'PL.addItem', 'delete'
{/if} {/if}
{else} {else}
, 'PL.activate', 'PL.create', 'delete' , 'PL.activate', 'PL.create', 'edit', 'delete'
{/if} {/if}
{/if} {/if}

View file

@ -37,14 +37,14 @@ function _getDArr($format)
switch($format) { switch($format) {
case 'h': case 'h':
for($n=0; $n<=23; $n++) { for($n=0; $n<=23; $n++) {
$arr[$this->_twoDigits($n)] = $this->_twoDigits($n); $arr[sprintf('%02d', $n)] = sprintf('%02d', $n);
} }
break; break;
case 'm': case 'm':
case 's': case 's':
for($n=0; $n<=59; $n++) { for($n=0; $n<=59; $n++) {
$arr[$this->_twoDigits($n)] = $this->_twoDigits($n); $arr[sprintf('%02d', $n)] = sprintf('%02d', $n);
} }
break; break;
} }
@ -54,7 +54,7 @@ function _getDArr($format)
function _getNumArr($start, $end, $step=1) function _getNumArr($start, $end, $step=1)
{ {
for($n=$start; $n<=$end; $n=$n+$step) { for($n=$start; $n<=$end; $n+=$step) {
$arr[$n] = $n; $arr[$n] = $n;
} }
return $arr; return $arr;
@ -230,10 +230,10 @@ class uiBase
foreach ($input as $k=>$v){ foreach ($input as $k=>$v){
if (is_array($v)) { if (is_array($v)) {
if ( ( isset($v['d']) ) && ( isset($v['M']) || isset($v['m']) ) && ( isset($v['Y']) || isset($v['y']) ) ) { if ( ( isset($v['d']) ) && ( isset($v['M']) || isset($v['m']) ) && ( isset($v['Y']) || isset($v['y']) ) ) {
$input[$k] = $v['Y'].$v['y'].'-'.$this->_twoDigits($v['M'].$v['m']).'-'.$this->_twoDigits($v['d']); $input[$k] = $v['Y'].$v['y'].'-'.sprintf('%02d', $v['M'].$v['m']).'-'.sprintf('%02d', $v['d']);
} }
if ( ( isset($v['H']) ) || isset($v['h'] ) && ( isset($v['i']) ) && ( isset($v['s']) ) ) { if ( ( isset($v['H']) ) || isset($v['h'] ) && ( isset($v['i']) ) && ( isset($v['s']) ) ) {
$input[$k] = $this->_twoDigits($v['H'].$v['h']).':'.$this->_twoDigits($v['i']).':'.$this->_twoDigits($v['s']); $input[$k] = sprintf('%02d', $v['H'].$v['h']).':'.sprintf('%02d', $v['i']).':'.sprintf('%02d', $v['s']);
} }
} }
} }
@ -278,17 +278,6 @@ class uiBase
} }
function _twoDigits($num)
{
if (strlen($num) == 1)
return "0$num";
if (strlen($num) == 0)
return '00';
return $num;
}
function _toHex($gunid) function _toHex($gunid)
{ {
$res = $this->dbc->query("SELECT to_hex($gunid)"); $res = $this->dbc->query("SELECT to_hex($gunid)");
@ -337,10 +326,10 @@ class uiBase
elseif (preg_match('/^[0-9]{1,2}:[0-9]{1,2}$/', $in)) list($i, $s) = explode(':', $in); elseif (preg_match('/^[0-9]{1,2}:[0-9]{1,2}$/', $in)) list($i, $s) = explode(':', $in);
else $s = $in; else $s = $in;
if ($all || $h > 0) $H = $this->_twoDigits($h).':'; if ($all || $h > 0) $H = sprintf('%02d', $h).':';
else $H = '&nbsp;&nbsp;&nbsp;'; else $H = '&nbsp;&nbsp;&nbsp;';
$I = $this->_twoDigits($i).':'; $I = sprintf('%02d', $i).':';
$S = $this->_twoDigits($s); $S = sprintf('%02d', $s);
return $H.$I.$S; return $H.$I.$S;
} }

View file

@ -32,7 +32,7 @@ class uiCalendar
$Year->build($selections, $this->firstDayOfWeek); $Year->build($selections, $this->firstDayOfWeek);
while ($Month = $Year->fetch()) { while ($Month = $Year->fetch()) {
$this->Year[] = array( $this->Year[] = array(
'month' => $this->Base->_twoDigits($Month->thisMonth()), 'month' => sprintf('%02d', $Month->thisMonth()),
'label' => $this->_getMonthName($Month), 'label' => $this->_getMonthName($Month),
'isSelected' => $Month->isSelected() 'isSelected' => $Month->isSelected()
); );
@ -50,10 +50,10 @@ class uiCalendar
$Month = new Calendar_Month_Weekdays($this->curr['year'], $this->curr['month'], $this->firstDayOfWeek); $Month = new Calendar_Month_Weekdays($this->curr['year'], $this->curr['month'], $this->firstDayOfWeek);
$Month->build($this->_scheduledDays('month')); ## scheduled days are selected $Month->build($this->_scheduledDays('month')); ## scheduled days are selected
while ($Day = $Month->fetch()) { while ($Day = $Month->fetch()) {
$corrMonth = $Day->thisMonth()<=12 ? $this->Base->_twoDigits($Day->thisMonth()) : '01'; ## due to bug in $corrMonth = $Day->thisMonth()<=12 ? sprintf('%02d', $Day->thisMonth()) : '01'; ## due to bug in
$corrYear = $Day->thisMonth()<=12 ? $Day->thisYear() : $Day->thisYear()+1; ## Calendar_Month_Weekdays $corrYear = $Day->thisMonth()<=12 ? $Day->thisYear() : $Day->thisYear()+1; ## Calendar_Month_Weekdays
$this->Month[] = array( $this->Month[] = array(
'day' => $this->Base->_twoDigits($Day->thisDay()), 'day' => sprintf('%02d', $Day->thisDay()),
'week' => $this->_getWeekNr($Day), 'week' => $this->_getWeekNr($Day),
'month' => $corrMonth, 'month' => $corrMonth,
'year' => $corrYear, 'year' => $corrYear,
@ -78,9 +78,9 @@ class uiCalendar
$Week->build($this->_scheduledDays('week')); $Week->build($this->_scheduledDays('week'));
while ($Day = $Week->fetch()) { while ($Day = $Week->fetch()) {
$this->Week[] = array( $this->Week[] = array(
'day' => $this->Base->_twoDigits($Day->thisDay()), 'day' => sprintf('%02d', $Day->thisDay()),
'week' => $this->_getWeekNr($Day), 'week' => $this->_getWeekNr($Day),
'month' => $this->Base->_twoDigits($Day->thisMonth()), 'month' => sprintf('%02d', $Day->thisMonth()),
'year' => $Day->thisYear(), 'year' => $Day->thisYear(),
'label' => $this->_getDayName($Day), 'label' => $this->_getDayName($Day),
'isSelected' => $Day->isSelected(), 'isSelected' => $Day->isSelected(),

View file

@ -1,5 +1,9 @@
<?php <?php
define('UI_VERBOSE', TRUE); define('UI_VERBOSE', FALSE);
define('UI_WARNING', TRUE);
define('UI_ERROR', TRUE);
#define('UI_TIMEZONE', ' +100');
define('UI_TIMEZONEOFFSET', date('Z'));
define('UI_HANDLER', 'ui_handler.php'); define('UI_HANDLER', 'ui_handler.php');
define('UI_BROWSER', 'ui_browser.php'); define('UI_BROWSER', 'ui_browser.php');

View file

@ -228,7 +228,7 @@ class uiHandler extends uiBase {
$this->redirUrl = UI_BROWSER."?act=editWebstream&id=".$id; $this->redirUrl = UI_BROWSER."?act=editWebstream&id=".$id;
return FALSE; return FALSE;
} }
$length = $this->_twoDigits($formdata['length']['H']).':'.$this->_twoDigits($formdata['length']['i']).':'.$this->_twoDigits($formdata['length']['s']).'.000000'; $length = sprintf('%02d', $formdata['length']['H']).':'.sprintf('%02d', $formdata['length']['i']).':'.sprintf('%02d', $formdata['length']['s']).'.000000';
$this->gb->setMDataValue($r, UI_MDATA_KEY_TITLE, $this->sessid, $formdata['title']); $this->gb->setMDataValue($r, UI_MDATA_KEY_TITLE, $this->sessid, $formdata['title']);
$this->gb->setMDataValue($r, UI_MDATA_KEY_DURATION, $this->sessid, $length); $this->gb->setMDataValue($r, UI_MDATA_KEY_DURATION, $this->sessid, $length);
$this->redirUrl = UI_BROWSER."?act=editWebstream&id=$r"; $this->redirUrl = UI_BROWSER."?act=editWebstream&id=$r";
@ -244,7 +244,7 @@ class uiHandler extends uiBase {
$this->redirUrl = UI_BROWSER."?act=editWebstream&id=".$id; $this->redirUrl = UI_BROWSER."?act=editWebstream&id=".$id;
return FALSE; return FALSE;
} }
$length = $this->_twoDigits($formdata['length']['H']).':'.$this->_twoDigits($formdata['length']['i']).':'.$this->_twoDigits($formdata['length']['s']).'.000000'; $length = sprintf('%02d', $formdata['length']['H']).':'.sprintf('%02d', $formdata['length']['i']).':'.sprintf('%02d', $formdata['length']['s']).'.000000';
$this->gb->setMDataValue($id, UI_MDATA_KEY_TITLE, $this->sessid, $formdata['title']); $this->gb->setMDataValue($id, UI_MDATA_KEY_TITLE, $this->sessid, $formdata['title']);
$this->gb->setMDataValue($id, UI_MDATA_KEY_URL, $this->sessid, $formdata['url']); $this->gb->setMDataValue($id, UI_MDATA_KEY_URL, $this->sessid, $formdata['url']);
$this->gb->setMDataValue($id, UI_MDATA_KEY_DURATION, $this->sessid, $length); $this->gb->setMDataValue($id, UI_MDATA_KEY_DURATION, $this->sessid, $length);
@ -266,12 +266,13 @@ class uiHandler extends uiBase {
} }
} }
$data = $this->_dateArr2Str($mData); $data = $this->_dateArr2Str($mData);
foreach ($data as $key=>$val) { foreach ($data as $key=>$val) { echo "\n".$key.": ".$val."\n";
$this->gb->setMDataValue($id, $key, $this->sessid, $val); $r = $this->gb->setMDataValue($id, $key, $this->sessid, $val);
print_r($r);
} }
$this->_retMsg('Metadata saved'); $this->_retMsg('Metadata saved');
$type = $this->gb->getFileType($id)=='webstream' ? 'Webstream' : 'File'; $type = $this->gb->getFileType($id)=='webstream' ? 'Webstream' : 'File';
$this->redirUrl = UI_BROWSER."?act=edit$type&id=$id"; $this->redirUrl = UI_BROWSER."?act=editItem&id=$id";
} }

View file

@ -38,11 +38,11 @@ class uiPlaylist
# store access token to ls_pref abd session # store access token to ls_pref abd session
# load PL into session # load PL into session
if($this->token) { if($this->token) {
$this->Base->_retMsg('You have an Playlist already activated,\n first close it'); if (UI_WARNING) $this->Base->_retMsg('You have an Playlist already activated,\n first close it');
return FALSE; return FALSE;
} }
if(($userid = $this->Base->gb->playlistIsAvailable($plid, $this->Base->sessid)) !== TRUE) { if(($userid = $this->Base->gb->playlistIsAvailable($plid, $this->Base->sessid)) !== TRUE) {
$this->Base->_retMsg('Playlist is looked by $1', $this->Base->gb->getSubjName($userid)); if (UI_WARNING) $this->Base->_retMsg('Playlist is looked by $1', $this->Base->gb->getSubjName($userid));
return FALSE; return FALSE;
} }
$this->token = $this->Base->gb->lockPlaylistForEdit($plid, $this->Base->sessid); $this->token = $this->Base->gb->lockPlaylistForEdit($plid, $this->Base->sessid);
@ -59,12 +59,13 @@ class uiPlaylist
# delete PL from session # delete PL from session
# remove token from ls_pref # remove token from ls_pref
if(!$this->token) { if(!$this->token) {
$this->Base->_retMsg('No Playlist is looked by You'); if (UI_WARNING) $this->Base->_retMsg('No Playlist is looked by You');
return FALSE; return FALSE;
} }
$plgunid = $this->Base->gb->releaseLockedPlaylist($this->token, $this->Base->sessid); $plgunid = $this->Base->gb->releaseLockedPlaylist($this->token, $this->Base->sessid);
if (PEAR::isError($plgunid)) { if (PEAR::isError($plgunid)) {
$this->Base->_retMsg('Unable to release Playlist'); if (UI_VERBOSE) print_r($plgunid);
if (UI_WARNING) $this->Base->_retMsg('Unable to release Playlist');
return FALSE; return FALSE;
} }
if($msg) $this->Base->_retMsg('Playlist "$1" released', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($plgunid), UI_MDATA_KEY_TITLE)); if($msg) $this->Base->_retMsg('Playlist "$1" released', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($plgunid), UI_MDATA_KEY_TITLE));
@ -89,12 +90,13 @@ class uiPlaylist
function revert() function revert()
{ {
if(!$this->token) { if(!$this->token) {
$this->Base->_retMsg('No Playlist is looked by You'); if (UI_WARNING) $this->Base->_retMsg('No Playlist is looked by You');
return FALSE; return FALSE;
} }
$plgunid = $this->Base->gb->revertEditedPlaylist($this->token, $this->Base->sessid); $plgunid = $this->Base->gb->revertEditedPlaylist($this->token, $this->Base->sessid);
if (PEAR::isError($plgunid)) { if (PEAR::isError($plgunid)) {
$this->Base->_retMsg('Unable to revert to looked state'); if (UI_VERBOSE) print_r($plgunid);
if (UI_WARNING) $this->Base->_retMsg('Unable to revert to looked state');
return FALSE; return FALSE;
} }
$this->Base->_retMsg('Playlist "$1" reverted', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($plgunid), UI_MDATA_KEY_TITLE)); $this->Base->_retMsg('Playlist "$1" reverted', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($plgunid), UI_MDATA_KEY_TITLE));
@ -102,15 +104,24 @@ class uiPlaylist
$this->token = NULL; $this->token = NULL;
$this->Base->gb->delPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY); $this->Base->gb->delPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY);
$this->activate($this->Base->gb->_idFromGunid($plgunid), FALSE); if ($this->activate($this->Base->gb->_idFromGunid($plgunid), FALSE) !== TRUE)
return TRUE; return FALSE;
return $this->activeId;
} }
function reportLookedPL($setMsg)
{
if(is_string($saved = $this->Base->gb->loadPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY))) {
if ($setMsg === TRUE) $this->Base->_retMsg('Found looked Playlist');
return TRUE;
}
return FALSE;
}
function loadLookedFromPref() function loadLookedFromPref()
{ {
if(is_string($saved = $this->Base->gb->loadPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY))) { if(is_string($saved = $this->Base->gb->loadPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY))) {
$this->Base->_retMsg('Found Playlist looked by you');
#$this->release(); #$this->release();
list ($this->activeId, $this->token) = explode (':', $saved); list ($this->activeId, $this->token) = explode (':', $saved);
@ -123,7 +134,7 @@ class uiPlaylist
function addItem($elemIds) function addItem($elemIds)
{ {
if (!$elemIds) { if (!$elemIds) {
$this->Base->_retMsg('No Item(s) given'); if (UI_WARNING) $this->Base->_retMsg('No Item(s) selected');
return FALSE; return FALSE;
} }
if (!is_array($elemIds)) if (!is_array($elemIds))
@ -143,7 +154,7 @@ class uiPlaylist
function removeItem($elemIds) function removeItem($elemIds)
{ {
if (!$elemIds) { if (!$elemIds) {
$this->Base->_retMsg('No Item(s) given'); if (UI_WARNING) $this->Base->_retMsg('No Item(s) selected');
return FALSE; return FALSE;
} }
if (!is_array($elemIds)) if (!is_array($elemIds))
@ -162,7 +173,7 @@ class uiPlaylist
{ {
# create PL # create PL
# activate # activate
# add clip if given # add clip if $id is set
if (is_array($this->activeId)) { if (is_array($this->activeId)) {
$this->Base->_retMsg('Already active Playlist'); $this->Base->_retMsg('Already active Playlist');
return FALSE; return FALSE;
@ -262,7 +273,13 @@ class uiPlaylist
function moveItem($id, $pos) function moveItem($id, $pos)
{ {
$this->Base->gb->moveAudioClipInPlaylist($this->token, $id, $pos, $this->Base->sessid); $r = $this->Base->gb->moveAudioClipInPlaylist($this->token, $id, $pos, $this->Base->sessid);
if (PEAR::isError($r)) {
if (UI_VERBOSE) print_r($r);
$this->Base->_retMsg('Cannot move item');
return FALSE;
}
return TRUE;
} }
@ -314,7 +331,7 @@ class uiPlaylist
break; break;
case "transition": case "transition":
$d = $this->getPrevElement($id); $d = $this->getPrevElement($id);
$duration = $d['fadeout_ms']; $duration = $s['fadein_ms'];
$form->setConstants(array('headline' => '<b>'.$d['title'].'</b> <-> <b>'.$s['title'].'</b>')); $form->setConstants(array('headline' => '<b>'.$d['title'].'</b> <-> <b>'.$s['title'].'</b>'));
break; break;
case "fadeOut": case "fadeOut":

View file

@ -28,26 +28,24 @@ class uiScheduler extends uiCalendar
function set($arr) function set($arr)
{ {
extract($arr); extract($arr);
if ($view) $this->curr['view'] = $view;
if ($year) $this->curr['year'] = $year; if (isset($view)) $this->curr['view'] = $view;
if ($day) $this->curr['day'] = $this->Base->_twoDigits($day); if (isset($year)) $this->curr['year'] = $year;
if ($hour) $this->curr['hour'] = $this->Base->_twoDigits($hour); if (isset($day)) $this->curr['day'] = sprintf('%02d', $day);
if (isset($hour)) $this->curr['hour'] = sprintf('%02d', $hour);
if (is_numeric($month)) if (is_numeric($month))
$this->curr['month'] = $this->Base->_twoDigits($month); $this->curr['month'] = sprintf('%02d', $month);
$stampNow = $this->_datetime2timestamp($this->curr['year'].$this->curr['month'].$this->curr['day']); $stampNow = $this->_datetime2timestamp($this->curr['year'].$this->curr['month'].$this->curr['day']);
$stampTarget = $stampNow; $stampTarget = $stampNow;
if ($month=='++') if ($month=='++')
$stampTarget = strtotime("+1 month", $stampNow); $stampTarget = strtotime("+1 month", $stampNow);
if ($month=='--') if ($month=='--')
$stampTarget = strtotime("-1 month", $stampNow); $stampTarget = strtotime("-1 month", $stampNow);
if ($week=='++') if ($week=='++')
$stampTarget = strtotime("+1 week", $stampNow); $stampTarget = strtotime("+1 week", $stampNow);
if ($week=='--') if ($week=='--')
$stampTarget = strtotime("-1 week", $stampNow); $stampTarget = strtotime("-1 week", $stampNow);
$this->curr['year'] = strftime("%Y", $stampTarget); $this->curr['year'] = strftime("%Y", $stampTarget);
$this->curr['month'] = strftime("%m", $stampTarget); $this->curr['month'] = strftime("%m", $stampTarget);
$this->curr['day'] = strftime("%d", $stampTarget); $this->curr['day'] = strftime("%d", $stampTarget);
@ -74,20 +72,62 @@ class uiScheduler extends uiCalendar
function getDayUsagePercentage($year, $month, $day) function getDayUsagePercentage($year, $month, $day)
{ {
#echo "date: ".$year.$month.$day."<br>";
if (isset($this->_duration[$year.$month.$day]))
return $this->_duration[$year.$month.$day];
$this->_duration[$year.$month.$day] = 0;
if (!$arr = $this->getDayUsage($year, $month, $day)) if (!$arr = $this->getDayUsage($year, $month, $day))
return false; return false;
foreach ($arr as $val) { foreach ($arr as $val) {
#print_r($val); $duration += ($this->_datetime2timestamp($val['end'])-$this->_datetime2timestamp($val['start']))/86400*100;
$this->_duration[$year.$month.$day] += ($this->_datetime2timestamp($val['end'])-$this->_datetime2timestamp($val['start']))/86400*100;
} }
#echo "duration: ".$this->_duration[$year.$month.$day]."<br>"; return $duration;
return $this->_duration[$year.$month.$day]; }
function getDayTiming($year, $month, $day)
{
if (!$arr = $this->getDayUsage($year, $month, $day))
return false;
## !! bug in strtotime. zeigt 8h später an als reines datum, wenn Txx:xx:xx verwendet wird !!
$day_start = $this->_datetime2timestamp($year.$month.$day.'T00:00:00');
$day_end = $this->_datetime2timestamp($year.$month.$day.'T23:59:59');
$curr = current($arr);
if (strtotime($curr['start']) > $day_start) ## insert gap if first entry start after 00:00:00
$list[] = array(
'type' => 'firstgap',
'pos' => 0,
'length' => strtotime($curr['start']) - $day_start -1
);
while ($curr = current($arr)) {
$list[] = array(
'type' => 'entry',
'pos' => strtotime($curr['start']) - $day_start,
'length' => strtotime($curr['end']) - strtotime($curr['start']),
'entry' => $curr
);
if ($next = next($arr)) {
if ($next['start'] > $curr['end']+1) ## insert gap between entrys
$list[] = array(
'type' => 'gap',
'pos' => strtotime($curr['start'])-$day_start,
'length' => strtotime($next['start']) - strtotime($curr['end']) -1,
);
}
else {
if (strtotime($curr['end']) < $day_end) ## insert gap if prev entry was not until midnight
$list[] = array(
'type' => 'lastgap',
'pos' => strtotime($curr['end']) - $day_start,
'length' => $day_end-strtotime($curr['end']),
);
}
}
#print_r($list);
return $list;
} }
@ -105,9 +145,9 @@ class uiScheduler extends uiCalendar
return array(); return array();
} }
$d = $Period->fetch(); $d = $Period->fetch();
$corrMonth = $d->thisMonth()<=12 ? $this->Base->_twoDigits($d->thisMonth()) : '01'; ## due to bug in $corrMonth = $d->thisMonth()<=12 ? sprintf('%02d', $d->thisMonth()) : '01'; ## due to bug in
$corrYear = $d->thisMonth()<=12 ? $d->thisYear() : $d->thisYear()+1; ## Calendar_Month_Weekdays $corrYear = $d->thisMonth()<=12 ? $d->thisYear() : $d->thisYear()+1; ## Calendar_Month_Weekdays
$first = array('day' => $this->Base->_twoDigits($d->thisDay()), $first = array('day' => sprintf('%02d', $d->thisDay()),
'month' => $corrMonth, 'month' => $corrMonth,
'year' => $corrYear 'year' => $corrYear
); );
@ -115,9 +155,9 @@ class uiScheduler extends uiCalendar
while ($l = $Period->fetch()) { while ($l = $Period->fetch()) {
$d = $l; $d = $l;
} }
$corrMonth = $d->thisMonth()<=12 ? $this->Base->_twoDigits($d->thisMonth()) : '01'; ## due to bug in $corrMonth = $d->thisMonth()<=12 ? sprintf('%02d', $d->thisMonth()) : '01'; ## due to bug in
$corrYear = $d->thisMonth()<=12 ? $d->thisYear() : $d->thisYear()+1; ## Calendar_Month_Weekdays $corrYear = $d->thisMonth()<=12 ? $d->thisYear() : $d->thisYear()+1; ## Calendar_Month_Weekdays
$last = array('day' => $this->Base->_twoDigits($d->thisDay()), $last = array('day' => sprintf('%02d', $d->thisDay()),
'month' => $corrMonth, 'month' => $corrMonth,
'year' => $corrYear 'year' => $corrYear
); );
@ -172,7 +212,7 @@ class uiScheduler extends uiCalendar
function _isError($r) function _isError($r)
{ {
if (is_array($r['error'])) { if (is_array($r['error'])) {
$this->Base->_retMsg('Error: $1', $r['error']['message']); $this->Base->_retMsg('Error: $1', str_replace("\n", "\\n", addslashes($r['error']['message'])));
return TRUE; return TRUE;
} }
return FALSE; return FALSE;

View file

@ -67,7 +67,7 @@ class uiScratchPad
function addItem($id) function addItem($id)
{ {
if(!$this->Base->STATIONPREFS[UI_SCRATCHPAD_MAXLENGTH_KEY]) { if(!$this->Base->STATIONPREFS[UI_SCRATCHPAD_MAXLENGTH_KEY]) {
if ($this->verbose) $this->Base->_retMsg('ScratchPad length is not set in System Preferences, so it cannot be used.'); if (UI_WARNING) $this->Base->_retMsg('ScratchPad length is not set in System Preferences, so it cannot be used.');
return false; return false;
} }
@ -76,7 +76,7 @@ class uiScratchPad
foreach ($sp as $key=>$val) { foreach ($sp as $key=>$val) {
if ($val['id'] == $item['id']) { if ($val['id'] == $item['id']) {
unset($sp[$key]); unset($sp[$key]);
if ($this->verbose) $this->Base->_retMsg('Entry $1 was already on SP since $2.\nMoved to Top.', $item['title'], $val['added']); if (UI_VERBOSE) $this->Base->_retMsg('Entry $1 was already on SP since $2.\nMoved to Top.', $item['title'], $val['added']);
} else { } else {
#$this->Base->incAccessCounter($id); #$this->Base->incAccessCounter($id);
} }
@ -91,7 +91,7 @@ class uiScratchPad
function removeItems($ids) function removeItems($ids)
{ {
if (!$ids) { if (!$ids) {
$this->Base->_retMsg('No Item(s) given'); if (UI_WARNING) $this->Base->_retMsg('No Item(s) selected');
return FALSE; return FALSE;
} }
if (!is_array($ids)) if (!is_array($ids))