From b418a85f8dc70dc0d0bb360307147f3d1e7d9b9a Mon Sep 17 00:00:00 2001 From: sebastian Date: Fri, 11 Mar 2005 21:16:22 +0000 Subject: [PATCH] *** empty log message *** --- .../htmlUI/var/SchedulerPhpClient.class.php | 17 +++- .../htmlUI/var/formmask/metadata.inc.php | 11 ++- .../modules/htmlUI/var/html/ui_browser.php | 6 +- .../modules/htmlUI/var/html/ui_handler.php | 12 ++- .../htmlUI/var/templates/file/edit.tpl | 18 ++-- .../htmlUI/var/templates/playlist/editor.tpl | 15 ++-- .../templates/playlist/simpleManagement.tpl | 14 ++- .../htmlUI/var/templates/scheduler/day.tpl | 2 +- .../htmlUI/var/templates/scheduler/main.tpl | 2 +- .../var/templates/scheduler/schedule.tpl | 44 ++++++---- .../htmlUI/var/templates/scheduler/week.tpl | 18 ++-- .../htmlUI/var/templates/scratchPad.tpl | 17 ++-- .../htmlUI/var/templates/script/clock.js.tpl | 6 +- .../var/templates/script/collector.js.tpl | 10 +-- .../var/templates/script/contextMenue.js.tpl | 32 +++---- .../htmlUI/var/templates/sub/contextmenu.tpl | 2 +- .../modules/htmlUI/var/ui_base.inc.php | 27 ++---- .../modules/htmlUI/var/ui_calendar.class.php | 10 +-- livesupport/modules/htmlUI/var/ui_conf.php | 6 +- .../modules/htmlUI/var/ui_handler.class.php | 11 +-- .../modules/htmlUI/var/ui_playlist.class.php | 45 +++++++--- .../modules/htmlUI/var/ui_scheduler.class.php | 88 ++++++++++++++----- .../htmlUI/var/ui_scratchpad.class.php | 6 +- 23 files changed, 268 insertions(+), 151 deletions(-) diff --git a/livesupport/modules/htmlUI/var/SchedulerPhpClient.class.php b/livesupport/modules/htmlUI/var/SchedulerPhpClient.class.php index f906ba351..95c577877 100755 --- a/livesupport/modules/htmlUI/var/SchedulerPhpClient.class.php +++ b/livesupport/modules/htmlUI/var/SchedulerPhpClient.class.php @@ -23,14 +23,14 @@ 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 $ ------------------------------------------------------------------------------*/ /* ================================================================= includes */ -require_once 'DB.php'; -require_once "XML/RPC.php"; +#require_once 'DB.php'; +#require_once "XML/RPC.php"; #include_once "../conf.php"; /* ================================================== method definition array */ @@ -482,10 +482,19 @@ class SchedulerPhpClient{ if($res->faultCode() > 0) { return array('error' => array('code' => $res->faultCode(), 'message' => $res->faultString())); ## changed by sebastian /* + tomas´ orig. method return $this->dbc->raiseError( "SchedulerPhpClient::$method:".$res->faultString()." ". $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){ echo "result:\n"; diff --git a/livesupport/modules/htmlUI/var/formmask/metadata.inc.php b/livesupport/modules/htmlUI/var/formmask/metadata.inc.php index 9a3029a84..8be049bc8 100755 --- a/livesupport/modules/htmlUI/var/formmask/metadata.inc.php +++ b/livesupport/modules/htmlUI/var/formmask/metadata.inc.php @@ -93,7 +93,7 @@ $mask = array( 'id3' => 'Artist' ), array( - 'element' => 'ls:genre', + 'element' => 'dc:type', 'type' => 'text', 'label' => 'Genre', 'required' => TRUE, @@ -168,6 +168,7 @@ $mask = array( 'label' => 'Album', 'id3' => 'Album' ), + /* array( 'element' => 'ls:year', 'type' => 'date', @@ -180,6 +181,14 @@ $mask = array( ), 'id3' => 'Year' ), + */ + array( + 'element' => 'ls:year', + 'type' => 'select', + 'label' => 'Year', + 'options' => _getNumArr(1900, date('Y')+5), + 'id3' => 'Year' + ), array( 'element' => 'dc:type', 'type' => 'text', diff --git a/livesupport/modules/htmlUI/var/html/ui_browser.php b/livesupport/modules/htmlUI/var/html/ui_browser.php index 886d3c53b..ea3a61f73 100644 --- a/livesupport/modules/htmlUI/var/html/ui_browser.php +++ b/livesupport/modules/htmlUI/var/html/ui_browser.php @@ -45,6 +45,10 @@ if (is_array($_REQUEST['popup'])){ $Smarty->assign('dynform', $uiBrowser->PLAYLIST->changeTransitionForm($_REQUEST['id'], $_REQUEST['type'], $ui_fmask['PL.changeTransition'])); $Smarty->display('playlist/changeTransition.tpl'); break; + + case "SCHEDULER.schedule": + $Smarty->display('scheduler/schedule.tpl'); + break; } } die(); @@ -83,7 +87,7 @@ if ($uiBrowser->userid) { case "editItem": $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; case "editFile": diff --git a/livesupport/modules/htmlUI/var/html/ui_handler.php b/livesupport/modules/htmlUI/var/html/ui_handler.php index fa28597ef..daf1305ac 100644 --- a/livesupport/modules/htmlUI/var/html/ui_handler.php +++ b/livesupport/modules/htmlUI/var/html/ui_handler.php @@ -6,7 +6,7 @@ switch($_REQUEST['act']){ case "login": if ($uiHandler->login($_REQUEST, $ui_fmask["login"]) === TRUE) { $uiHandler->loadStationPrefs($ui_fmask['stationPrefs'], TRUE); - $uiHandler->PLAYLIST->loadLookedFromPref(); + $uiHandler->PLAYLIST->reportLookedPL(TRUE); } break; @@ -206,7 +206,13 @@ switch($_REQUEST['act']){ break; 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(); break; @@ -227,7 +233,7 @@ switch($_REQUEST['act']){ case "SCHEDULER.uploadPlaylistMethod": $uiHandler->SCHEDULER->uploadPlaylistMethod($_REQUEST); - $uiHandler->SCHEDULER->setReload(); + $uiHandler->SCHEDULER->setReload(); break; default: diff --git a/livesupport/modules/htmlUI/var/templates/file/edit.tpl b/livesupport/modules/htmlUI/var/templates/file/edit.tpl index 4250da01d..fca801a99 100755 --- a/livesupport/modules/htmlUI/var/templates/file/edit.tpl +++ b/livesupport/modules/htmlUI/var/templates/file/edit.tpl @@ -7,17 +7,12 @@ {else} New {/if} -{if $editItem.type == 'file'} - File -{else} - Webstream -{/if} +{$editItem.type|capitalize} +{if $editItem.type == 'audioclip'} - -{if $editItem.type == 'file'}
{include file="file/fileform.tpl"}
@@ -27,8 +22,9 @@ {/if} - {if $editItem.type == 'webstream'} + +
{include file="file/webstreamform.tpl"}
@@ -37,6 +33,12 @@ {/if} +{if $editItem.type == 'playlist'} +
+ {include file="file/metadataform.tpl"} +
+{/if} + {literal} diff --git a/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl b/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl index 835a28129..fea9c540a 100755 --- a/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl +++ b/livesupport/modules/htmlUI/var/templates/playlist/editor.tpl @@ -7,7 +7,7 @@ - {$i.fadein_ms} ms + {$i.fadein_ms|string_format:"%d"} ms - {$i.fadeout_ms} ms + {$i.fadeout_ms|string_format:"%d"} ms {/if} - - [Remove Selected] - [Clear] + + [Remove Selected] + [Clear] - - + + + diff --git a/livesupport/modules/htmlUI/var/templates/playlist/simpleManagement.tpl b/livesupport/modules/htmlUI/var/templates/playlist/simpleManagement.tpl index ba85d32a7..94a4551a1 100755 --- a/livesupport/modules/htmlUI/var/templates/playlist/simpleManagement.tpl +++ b/livesupport/modules/htmlUI/var/templates/playlist/simpleManagement.tpl @@ -9,11 +9,21 @@ Simple Playlist Management {PL->get assign='PL'} +{PL->reportLookedPL assign="_looked"} + {if is_array($PL)} {* already activated Playlist *} {include file="playlist/editor.tpl"} {else} {* no active Playlist *} - No active Playlist! - + + + + {if $_looked} + + {else} + + {/if} + + {/if} diff --git a/livesupport/modules/htmlUI/var/templates/scheduler/day.tpl b/livesupport/modules/htmlUI/var/templates/scheduler/day.tpl index c89511c2e..9b8feb385 100755 --- a/livesupport/modules/htmlUI/var/templates/scheduler/day.tpl +++ b/livesupport/modules/htmlUI/var/templates/scheduler/day.tpl @@ -6,7 +6,7 @@ {assign var="_hour" value=$_Hour.hour} - {$_Hour.hour} + {$_Hour.hour} diff --git a/livesupport/modules/htmlUI/var/templates/scheduler/main.tpl b/livesupport/modules/htmlUI/var/templates/scheduler/main.tpl index 23d04b447..ef7bf8f9a 100755 --- a/livesupport/modules/htmlUI/var/templates/scheduler/main.tpl +++ b/livesupport/modules/htmlUI/var/templates/scheduler/main.tpl @@ -4,7 +4,7 @@ - + {include file="scheduler/calendar.tpl"} diff --git a/livesupport/modules/htmlUI/var/templates/scheduler/schedule.tpl b/livesupport/modules/htmlUI/var/templates/scheduler/schedule.tpl index 46db4ac64..d0f883f87 100755 --- a/livesupport/modules/htmlUI/var/templates/scheduler/schedule.tpl +++ b/livesupport/modules/htmlUI/var/templates/scheduler/schedule.tpl @@ -1,24 +1,35 @@ +{include file="header.tpl"} {$SCHEDULER->copyPlFromSP()}
- - - : - : - - - - + + + + + + + -
- + + + + +
Schedule date{$SCHEDULER->curr.year}-{$SCHEDULER->curr.month}-{$SCHEDULER->curr.day}
Select Playlist + +
Schedule time + + : + : + + - + + +
 
- - + + + diff --git a/livesupport/modules/htmlUI/var/templates/scheduler/week.tpl b/livesupport/modules/htmlUI/var/templates/scheduler/week.tpl index 686cd294d..cca5fa93c 100755 --- a/livesupport/modules/htmlUI/var/templates/scheduler/week.tpl +++ b/livesupport/modules/htmlUI/var/templates/scheduler/week.tpl @@ -15,14 +15,20 @@ {$_Day.day} {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)} {foreach from=$_oneday item="i"} - + + + {/foreach}
- Start:{$i.start|regex_replace:"/[0-9]+T/":""} -
- End:  {$i.end|regex_replace:"/[0-9]+T/":""} -
+ {if is_array($i.entry)} + Start:{$i.entry.start|regex_replace:"/[0-9]+T/":""} +
+ End:  {$i.entry.end|regex_replace:"/[0-9]+T/":""} + {else} + Gap + {/if} +
{/if} diff --git a/livesupport/modules/htmlUI/var/templates/scratchPad.tpl b/livesupport/modules/htmlUI/var/templates/scratchPad.tpl index 35770df9a..0875ed826 100755 --- a/livesupport/modules/htmlUI/var/templates/scratchPad.tpl +++ b/livesupport/modules/htmlUI/var/templates/scratchPad.tpl @@ -30,19 +30,22 @@ {/foreach} - + - + + {if $_PL_activeId} - + {else} - + {/if} + - [Clear] + [Clear] diff --git a/livesupport/modules/htmlUI/var/templates/script/clock.js.tpl b/livesupport/modules/htmlUI/var/templates/script/clock.js.tpl index 06f4ae17e..879bac367 100644 --- a/livesupport/modules/htmlUI/var/templates/script/clock.js.tpl +++ b/livesupport/modules/htmlUI/var/templates/script/clock.js.tpl @@ -33,9 +33,9 @@ function sClock() { sinterval = 100; // milliseconds {/literal} - hours = {$smarty.now|date_format:"%H"}; - minutes = {$smarty.now|date_format:"%M"}; - seconds = {$smarty.now|date_format:"%S"}; + hours = {$smarty.now|date_format:"%H"|string_format:"%d"}; + minutes = {$smarty.now|date_format:"%M"|string_format:"%d"}; + seconds = {$smarty.now|date_format:"%S"|string_format:"%d"}; {literal} if(timer){clearInterval(timer);timer=null;} timer=setInterval("work();", sinterval); diff --git a/livesupport/modules/htmlUI/var/templates/script/collector.js.tpl b/livesupport/modules/htmlUI/var/templates/script/collector.js.tpl index 2f0a209d2..f19efa93c 100755 --- a/livesupport/modules/htmlUI/var/templates/script/collector.js.tpl +++ b/livesupport/modules/htmlUI/var/templates/script/collector.js.tpl @@ -2,7 +2,7 @@ {literal} diff --git a/livesupport/modules/htmlUI/var/templates/script/contextMenue.js.tpl b/livesupport/modules/htmlUI/var/templates/script/contextMenue.js.tpl index a9c23652c..f05898b8e 100755 --- a/livesupport/modules/htmlUI/var/templates/script/contextMenue.js.tpl +++ b/livesupport/modules/htmlUI/var/templates/script/contextMenue.js.tpl @@ -11,7 +11,7 @@ document.write(''); menuWidth = 180, menuHeight = 0; -function menu(id) { +function menu(param) { var menuHeader = ""; @@ -25,7 +25,7 @@ function menu(id) { for (var i = 1; i < menu.arguments.length; ++i) { switch (menu.arguments[i]) { case "PL.display": - menuHtml = menuHtml + " Display this Playlist "; + menuHtml = menuHtml + " Display this Playlist "; break; case "PL.release": @@ -33,55 +33,57 @@ function menu(id) { break; case "PL.addItem": - menuHtml = menuHtml + " Add to active Playlist "; + menuHtml = menuHtml + " Add to active Playlist "; break; case "PL.removeItem": - menuHtml = menuHtml + " Remove Item from Playlist "; + menuHtml = menuHtml + " Remove Item from Playlist "; break; case "PL.activate": - menuHtml = menuHtml + " Activate this Playlist "; + menuHtml = menuHtml + " Activate this Playlist "; break; case "PL.create": - menuHtml = menuHtml + " New Playlist using Item "; + menuHtml = menuHtml + " New Playlist using Item "; break; case "PL.changeFadeIn": - menuHtml = menuHtml + " Change Fadein "; + menuHtml = menuHtml + " Change Fadein "; break; case "PL.changeTransition": - menuHtml = menuHtml + " Change Transition "; + menuHtml = menuHtml + " Change Transition "; break; case "PL.changeFadeOut": - menuHtml = menuHtml + " Change Fadeout "; + menuHtml = menuHtml + " Change Fadeout "; break; case "SP.addItem": - menuHtml = menuHtml + " Add to ScratchPad "; + menuHtml = menuHtml + " Add to ScratchPad "; break; case "SP.removeItem": - menuHtml = menuHtml + " Remove from Scratchpad "; + menuHtml = menuHtml + " Remove from Scratchpad "; break; case "edit": - menuHtml = menuHtml + " Edit "; + menuHtml = menuHtml + " Edit "; break; case "delete": - menuHtml = menuHtml + " !Delete Item! "; + menuHtml = menuHtml + " !Delete Item! "; break; case "fileList": - menuHtml = menuHtml + " List Folder "; + menuHtml = menuHtml + " List Folder "; break; case "SCHEDULER.schedule": - menuHtml = menuHtml + " Schedule Playlist "; + //menuHtml = menuHtml + " Schedule Playlist "; + menuHtml = menuHtml + " Schedule Playlist "; + break; } } diff --git a/livesupport/modules/htmlUI/var/templates/sub/contextmenu.tpl b/livesupport/modules/htmlUI/var/templates/sub/contextmenu.tpl index 46483f1a9..aff8bd567 100755 --- a/livesupport/modules/htmlUI/var/templates/sub/contextmenu.tpl +++ b/livesupport/modules/htmlUI/var/templates/sub/contextmenu.tpl @@ -21,7 +21,7 @@ onContextmenu="return menu('{$i.id}' , 'PL.addItem', 'delete' {/if} {else} - , 'PL.activate', 'PL.create', 'delete' + , 'PL.activate', 'PL.create', 'edit', 'delete' {/if} {/if} diff --git a/livesupport/modules/htmlUI/var/ui_base.inc.php b/livesupport/modules/htmlUI/var/ui_base.inc.php index 10831fadb..027c208f4 100644 --- a/livesupport/modules/htmlUI/var/ui_base.inc.php +++ b/livesupport/modules/htmlUI/var/ui_base.inc.php @@ -37,14 +37,14 @@ function _getDArr($format) switch($format) { case 'h': for($n=0; $n<=23; $n++) { - $arr[$this->_twoDigits($n)] = $this->_twoDigits($n); + $arr[sprintf('%02d', $n)] = sprintf('%02d', $n); } break; case 'm': case 's': for($n=0; $n<=59; $n++) { - $arr[$this->_twoDigits($n)] = $this->_twoDigits($n); + $arr[sprintf('%02d', $n)] = sprintf('%02d', $n); } break; } @@ -54,7 +54,7 @@ function _getDArr($format) function _getNumArr($start, $end, $step=1) { - for($n=$start; $n<=$end; $n=$n+$step) { + for($n=$start; $n<=$end; $n+=$step) { $arr[$n] = $n; } return $arr; @@ -230,10 +230,10 @@ class uiBase foreach ($input as $k=>$v){ if (is_array($v)) { 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']) ) ) { - $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) { $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); else $s = $in; - if ($all || $h > 0) $H = $this->_twoDigits($h).':'; + if ($all || $h > 0) $H = sprintf('%02d', $h).':'; else $H = '   '; - $I = $this->_twoDigits($i).':'; - $S = $this->_twoDigits($s); + $I = sprintf('%02d', $i).':'; + $S = sprintf('%02d', $s); return $H.$I.$S; } diff --git a/livesupport/modules/htmlUI/var/ui_calendar.class.php b/livesupport/modules/htmlUI/var/ui_calendar.class.php index 755271c5e..e03d9dcd0 100755 --- a/livesupport/modules/htmlUI/var/ui_calendar.class.php +++ b/livesupport/modules/htmlUI/var/ui_calendar.class.php @@ -32,7 +32,7 @@ class uiCalendar $Year->build($selections, $this->firstDayOfWeek); while ($Month = $Year->fetch()) { $this->Year[] = array( - 'month' => $this->Base->_twoDigits($Month->thisMonth()), + 'month' => sprintf('%02d', $Month->thisMonth()), 'label' => $this->_getMonthName($Month), 'isSelected' => $Month->isSelected() ); @@ -50,10 +50,10 @@ class uiCalendar $Month = new Calendar_Month_Weekdays($this->curr['year'], $this->curr['month'], $this->firstDayOfWeek); $Month->build($this->_scheduledDays('month')); ## scheduled days are selected 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 $this->Month[] = array( - 'day' => $this->Base->_twoDigits($Day->thisDay()), + 'day' => sprintf('%02d', $Day->thisDay()), 'week' => $this->_getWeekNr($Day), 'month' => $corrMonth, 'year' => $corrYear, @@ -78,9 +78,9 @@ class uiCalendar $Week->build($this->_scheduledDays('week')); while ($Day = $Week->fetch()) { $this->Week[] = array( - 'day' => $this->Base->_twoDigits($Day->thisDay()), + 'day' => sprintf('%02d', $Day->thisDay()), 'week' => $this->_getWeekNr($Day), - 'month' => $this->Base->_twoDigits($Day->thisMonth()), + 'month' => sprintf('%02d', $Day->thisMonth()), 'year' => $Day->thisYear(), 'label' => $this->_getDayName($Day), 'isSelected' => $Day->isSelected(), diff --git a/livesupport/modules/htmlUI/var/ui_conf.php b/livesupport/modules/htmlUI/var/ui_conf.php index b73f818b7..c0206a1e9 100755 --- a/livesupport/modules/htmlUI/var/ui_conf.php +++ b/livesupport/modules/htmlUI/var/ui_conf.php @@ -1,5 +1,9 @@ redirUrl = UI_BROWSER."?act=editWebstream&id=".$id; 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_DURATION, $this->sessid, $length); $this->redirUrl = UI_BROWSER."?act=editWebstream&id=$r"; @@ -244,7 +244,7 @@ class uiHandler extends uiBase { $this->redirUrl = UI_BROWSER."?act=editWebstream&id=".$id; 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_URL, $this->sessid, $formdata['url']); $this->gb->setMDataValue($id, UI_MDATA_KEY_DURATION, $this->sessid, $length); @@ -266,12 +266,13 @@ class uiHandler extends uiBase { } } $data = $this->_dateArr2Str($mData); - foreach ($data as $key=>$val) { - $this->gb->setMDataValue($id, $key, $this->sessid, $val); + foreach ($data as $key=>$val) { echo "\n".$key.": ".$val."\n"; + $r = $this->gb->setMDataValue($id, $key, $this->sessid, $val); + print_r($r); } $this->_retMsg('Metadata saved'); $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"; } diff --git a/livesupport/modules/htmlUI/var/ui_playlist.class.php b/livesupport/modules/htmlUI/var/ui_playlist.class.php index 2fdc75f84..f0df8d2c9 100755 --- a/livesupport/modules/htmlUI/var/ui_playlist.class.php +++ b/livesupport/modules/htmlUI/var/ui_playlist.class.php @@ -38,11 +38,11 @@ class uiPlaylist # store access token to ls_pref abd session # load PL into session 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; } 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; } $this->token = $this->Base->gb->lockPlaylistForEdit($plid, $this->Base->sessid); @@ -59,12 +59,13 @@ class uiPlaylist # delete PL from session # remove token from ls_pref 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; } $plgunid = $this->Base->gb->releaseLockedPlaylist($this->token, $this->Base->sessid); 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; } 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() { 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; } $plgunid = $this->Base->gb->revertEditedPlaylist($this->token, $this->Base->sessid); 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; } $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->Base->gb->delPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY); - $this->activate($this->Base->gb->_idFromGunid($plgunid), FALSE); - return TRUE; + if ($this->activate($this->Base->gb->_idFromGunid($plgunid), FALSE) !== 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() { 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(); list ($this->activeId, $this->token) = explode (':', $saved); @@ -123,7 +134,7 @@ class uiPlaylist function addItem($elemIds) { if (!$elemIds) { - $this->Base->_retMsg('No Item(s) given'); + if (UI_WARNING) $this->Base->_retMsg('No Item(s) selected'); return FALSE; } if (!is_array($elemIds)) @@ -143,7 +154,7 @@ class uiPlaylist function removeItem($elemIds) { if (!$elemIds) { - $this->Base->_retMsg('No Item(s) given'); + if (UI_WARNING) $this->Base->_retMsg('No Item(s) selected'); return FALSE; } if (!is_array($elemIds)) @@ -162,7 +173,7 @@ class uiPlaylist { # create PL # activate - # add clip if given + # add clip if $id is set if (is_array($this->activeId)) { $this->Base->_retMsg('Already active Playlist'); return FALSE; @@ -262,7 +273,13 @@ class uiPlaylist 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; case "transition": $d = $this->getPrevElement($id); - $duration = $d['fadeout_ms']; + $duration = $s['fadein_ms']; $form->setConstants(array('headline' => ''.$d['title'].' <-> '.$s['title'].'')); break; case "fadeOut": diff --git a/livesupport/modules/htmlUI/var/ui_scheduler.class.php b/livesupport/modules/htmlUI/var/ui_scheduler.class.php index 73a453473..d2d435e4a 100755 --- a/livesupport/modules/htmlUI/var/ui_scheduler.class.php +++ b/livesupport/modules/htmlUI/var/ui_scheduler.class.php @@ -28,26 +28,24 @@ class uiScheduler extends uiCalendar function set($arr) { extract($arr); - if ($view) $this->curr['view'] = $view; - if ($year) $this->curr['year'] = $year; - if ($day) $this->curr['day'] = $this->Base->_twoDigits($day); - if ($hour) $this->curr['hour'] = $this->Base->_twoDigits($hour); + + if (isset($view)) $this->curr['view'] = $view; + if (isset($year)) $this->curr['year'] = $year; + if (isset($day)) $this->curr['day'] = sprintf('%02d', $day); + if (isset($hour)) $this->curr['hour'] = sprintf('%02d', $hour); 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']); $stampTarget = $stampNow; - if ($month=='++') $stampTarget = strtotime("+1 month", $stampNow); if ($month=='--') $stampTarget = strtotime("-1 month", $stampNow); - if ($week=='++') $stampTarget = strtotime("+1 week", $stampNow); if ($week=='--') $stampTarget = strtotime("-1 week", $stampNow); - $this->curr['year'] = strftime("%Y", $stampTarget); $this->curr['month'] = strftime("%m", $stampTarget); $this->curr['day'] = strftime("%d", $stampTarget); @@ -74,20 +72,62 @@ class uiScheduler extends uiCalendar function getDayUsagePercentage($year, $month, $day) { - #echo "date: ".$year.$month.$day."
"; - 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)) return false; foreach ($arr as $val) { - #print_r($val); - $this->_duration[$year.$month.$day] += ($this->_datetime2timestamp($val['end'])-$this->_datetime2timestamp($val['start']))/86400*100; + $duration += ($this->_datetime2timestamp($val['end'])-$this->_datetime2timestamp($val['start']))/86400*100; } - #echo "duration: ".$this->_duration[$year.$month.$day]."
"; - return $this->_duration[$year.$month.$day]; + return $duration; + } + + + 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(); } $d = $Period->fetch(); - $corrMonth = $d->thisMonth()<=12 ? $this->Base->_twoDigits($d->thisMonth()) : '01'; ## due to bug in - $corrYear = $d->thisMonth()<=12 ? $d->thisYear() : $d->thisYear()+1; ## Calendar_Month_Weekdays - $first = array('day' => $this->Base->_twoDigits($d->thisDay()), + $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 + $first = array('day' => sprintf('%02d', $d->thisDay()), 'month' => $corrMonth, 'year' => $corrYear ); @@ -115,9 +155,9 @@ class uiScheduler extends uiCalendar while ($l = $Period->fetch()) { $d = $l; } - $corrMonth = $d->thisMonth()<=12 ? $this->Base->_twoDigits($d->thisMonth()) : '01'; ## due to bug in - $corrYear = $d->thisMonth()<=12 ? $d->thisYear() : $d->thisYear()+1; ## Calendar_Month_Weekdays - $last = array('day' => $this->Base->_twoDigits($d->thisDay()), + $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 + $last = array('day' => sprintf('%02d', $d->thisDay()), 'month' => $corrMonth, 'year' => $corrYear ); @@ -172,7 +212,7 @@ class uiScheduler extends uiCalendar function _isError($r) { 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 FALSE; diff --git a/livesupport/modules/htmlUI/var/ui_scratchpad.class.php b/livesupport/modules/htmlUI/var/ui_scratchpad.class.php index 5fc3725a9..9c0efffbc 100755 --- a/livesupport/modules/htmlUI/var/ui_scratchpad.class.php +++ b/livesupport/modules/htmlUI/var/ui_scratchpad.class.php @@ -67,7 +67,7 @@ class uiScratchPad function addItem($id) { 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; } @@ -76,7 +76,7 @@ class uiScratchPad foreach ($sp as $key=>$val) { if ($val['id'] == $item['id']) { 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 { #$this->Base->incAccessCounter($id); } @@ -91,7 +91,7 @@ class uiScratchPad function removeItems($ids) { if (!$ids) { - $this->Base->_retMsg('No Item(s) given'); + if (UI_WARNING) $this->Base->_retMsg('No Item(s) selected'); return FALSE; } if (!is_array($ids))