dynamic update of now/next clip infobox added

This commit is contained in:
sebastian 2005-07-23 18:04:47 +00:00
parent b87375f90c
commit cc1830560a
18 changed files with 2609 additions and 2491 deletions

View file

@ -6,6 +6,8 @@ $Smarty->assign_by_ref ('PL', $uiBrowser->PLAYLIST);
$Smarty->assign_by_ref ('SCHEDULER', $uiBrowser->SCHEDULER);
$Smarty->assign_by_ref ('SCRATCHPAD', $uiBrowser->SCRATCHPAD);
$Smarty->assign_by_ref ('SUBJECTS', $uiBrowser->SUBJECTS);
$Smarty->assign_by_ref ('JSCOM', $jscom);
$Smarty->register_function('str_repeat', 'S_str_repeat');
$Smarty->register_function('urlencode', 'S_urlencode');

View file

@ -69,21 +69,21 @@ $mask = array(
'type' => 'text',
'label' => 'Title',
'required' => TRUE,
'id3' => 'Title'
'id3' => array('Title')
),
array(
'element' => 'dc:creator',
'type' => 'text',
'label' => 'Creator',
'required' => TRUE,
'id3' => 'Artist'
'id3' => array('Artist')
),
array(
'element' => 'dc:type',
'type' => 'text',
'label' => 'Genre',
'required' => TRUE,
'id3' => 'Genre'
'id3' => array('Genre')
),
array(
'element' => 'dc:format',
@ -110,52 +110,38 @@ $mask = array(
'element' => 'dc:title',
'type' => 'text',
'label' => 'Title',
'id3' => 'Title'
#'id3' => 'Title'
),
array(
'element' => 'dc:creator',
'type' => 'text',
'label' => 'Creator',
'id3' => 'Artist'
#'id3' => 'Artist'
),
array(
'element' => 'dc:source',
'type' => 'text',
'label' => 'Album',
'id3' => 'Album'
'id3' => array('Album')
),
/*
array(
'element' => 'ls:year',
'type' => 'date',
'label' => 'Year',
'options' => array(
'language' => 'en',
'format' => 'dMY',
'addEmptyOption'=> TRUE,
'minYear' => 1900
),
'id3' => 'Year'
),
*/
array(
'element' => 'ls:year',
'type' => 'select',
'label' => 'Year',
'options' => _getNumArr(1900, date('Y')+5),
'id3' => 'Year'
'id3' => array('Year')
),
array(
'element' => 'dc:type',
'type' => 'text',
'label' => 'Genre',
'id3' => 'Genre'
#'id3' => 'Genre'
),
array(
'element' => 'dc:description',
'type' => 'textarea',
'label' => 'Description',
'id3' => 'Comment'
'id3' => array('Comment', 'Comments')
),
array(
'element' => 'dc:format',
@ -173,14 +159,14 @@ $mask = array(
'type' => 'text',
'label' => 'BPM',
'rule' => 'numeric',
'id3' => 'BPM'
'id3' => array('BPM')
),
array(
'element' => 'ls:rating',
'type' => 'text',
'label' => 'Rating',
'rule' => 'numeric',
'id3' => 'Rating'
'id3' => array('Rating')
),
array(
'element' => 'dcterms:extent',
@ -193,46 +179,46 @@ $mask = array(
'element' => 'ls:encoded_by',
'type' => 'text',
'label' => 'Encoded by',
'id3' => 'Encoded by'
'id3' => array('Encoded by')
),
array(
'element' => 'ls:track_num',
'type' => 'select',
'label' => 'Track number',
'options' => _getNumArr(0, 99),
'id3' => 'Track'
'id3' => array('Track')
),
array(
'element' => 'ls:disc_num',
'type' => 'select',
'label' => 'Disc number',
'options' => _getNumArr(0, 20),
'id3' => 'Disk'
'id3' => array('Disk')
),
array(
'element' => 'ls:mood',
'type' => 'text',
'label' => 'Mood',
'id3' => 'Mood'
'id3' => array('Mood')
),
array(
'element' => 'dc:publisher',
'type' => 'text',
'label' => 'Label',
'id3' => 'Label'
'id3' => array('Label')
),
array(
'element' => 'ls:composer',
'type' => 'text',
'label' => 'Composer',
'id3' => 'Composer'
'id3' => array('Composer')
),
array(
'element' => 'ls:bitrate',
'type' => 'text',
'label' => 'Bitrate',
'rule' => 'numeric',
'id3' => 'Bitrate'
'id3' => array('Bitrate')
),
array(
'element' => 'ls:channels',
@ -244,69 +230,69 @@ $mask = array(
2 => 'Stereo',
6 => '5.1'
),
'id3' => 'Channels'
'id3' => array('Channels')
),
array(
'element' => 'ls:samplerate',
'type' => 'text',
'label' => 'Sample rate',
'rule' => 'numeric',
'id3' => 'Samplerate'
'id3' => array('Samplerate')
),
array(
'element' => 'ls:encoder',
'type' => 'text',
'label' => 'Encoder software used',
'id3' => 'Encoder'
'id3' => array('Encoder')
),
array(
'element' => 'ls:crc',
'type' => 'text',
'label' => 'Checksum',
'rule' => 'numeric',
'id3' => 'CRC'
'id3' => array('CRC')
),
array(
'element' => 'ls:lyrics',
'type' => 'textarea',
'label' => 'Lyrics',
'id3' => 'Lyrics'
'id3' => array('Lyrics')
),
array(
'element' => 'ls:orchestra',
'type' => 'text',
'label' => 'Orchestra or band',
'id3' => 'Orchestra or band'
'id3' => array('Orchestra or band')
),
array(
'element' => 'ls:conductor',
'type' => 'text',
'label' => 'Conductor',
'id3' => 'Conductor'
'id3' => array('Conductor')
),
array(
'element' => 'ls:lyricist',
'type' => 'text',
'label' => 'Lyricist',
'id3' => 'Lyricist'
'id3' => array('Lyricist')
),
array(
'element' => 'ls:originallyricist',
'type' => 'text',
'label' => 'Original lyricist',
'id3' => 'Original lyricist'
'id3' => array('Original lyricist')
),
array(
'element' => 'ls:radiostationname',
'type' => 'text',
'label' => 'Radio station name',
'id3' => 'Radio station name'
'id3' => array('Radio station name')
),
array(
'element' => 'ls:audiofileinfourl',
'type' => 'text',
'label' => 'Audio file information web page',
'id3' => 'Audio file information web page',
'id3' => array('Audio file information web page'),
'attributes'=> array('maxlength' => 256)
),
array(
@ -319,7 +305,7 @@ $mask = array(
'element' => 'ls:artisturl',
'type' => 'text',
'label' => 'Artist web page',
'id3' => 'Artist web page',
'id3' => array('Artist web page'),
'attributes'=> array('maxlength' => 256)
),
array(
@ -332,7 +318,7 @@ $mask = array(
'element' => 'ls:audiosourceurl',
'type' => 'text',
'label' => 'Audio source web page',
'id3' => 'Audio source web page',
'id3' => array('Audio source web page'),
'attributes'=> array('maxlength' => 256)
),
array(
@ -345,7 +331,7 @@ $mask = array(
'element' => 'ls:radiostationurl',
'type' => 'text',
'label' => 'Radio station web page',
'id3' => 'Radio station web page',
'id3' => array('Radio station web page'),
'attributes'=> array('maxlength' => 256)
),
array(
@ -358,7 +344,7 @@ $mask = array(
'element' => 'ls:buycdurl',
'type' => 'text',
'label' => 'Buy CD web page',
'id3' => 'Buy CD webpage',
'id3' => array('Buy CD webpage'),
'attributes'=> array('maxlength' => 256)
),
array(
@ -372,26 +358,26 @@ $mask = array(
'type' => 'text',
'label' => 'ISRC number',
'rule' => 'numeric',
'id3' => 'ISRC'
'id3' => array('ISRC')
),
array(
'element' => 'ls:catalognumber',
'type' => 'text',
'label' => 'Catalog number',
'rule' => 'numeric',
'id3' => 'Catalog'
'id3' => array('Catalog')
),
array(
'element' => 'ls:originalartist',
'type' => 'text',
'label' => 'Original artist',
'id3' => 'Original Artist'
'id3' => array('Original Artist')
),
array(
'element' => 'dc:rights', ## ???
'type' => 'text',
'label' => 'Copyright',
'id3' => 'Copyright'
'id3' => array('Copyright')
),
),
'Talk' => array(
@ -467,28 +453,24 @@ $mask = array(
'element' => 'dc:title',
'type' => 'text',
'label' => 'Title',
'required' => TRUE,
'id3' => 'Title'
'required' => TRUE
),
array(
'element' => 'dc:creator',
'type' => 'text',
'label' => 'Creator',
'required' => TRUE,
'id3' => 'Artist'
'required' => TRUE
),
array(
'element' => 'dcterms:extent',
'type' => 'text',
'label' => 'Length',
'attributes'=> array('disabled' => 'on'),
'id3' => FALSE
'attributes'=> array('disabled' => 'on')
),
array(
'element' => 'dc:description',
'type' => 'textarea',
'label' => 'Description',
'id3' => 'Comment'
'label' => 'Description'
),
)
);

View file

@ -209,12 +209,12 @@ input, select { font-size: 12px;
font-size: 11px;
}
.whatplaying .time .left { font-size: 12px;
.whatplaying .time .left {
float: left;
width: 125px;
}
.whatplaying .time .right { font-size: 12px;
.whatplaying .time .right {
width: 125px;
float: left;
text-align: right;

View file

@ -4,6 +4,10 @@ require_once dirname(__FILE__).'/../ui_browser_init.php';
if (is_array($_REQUEST['popup'])){
foreach ($_REQUEST['popup'] as $val) {
switch ($val) {
case "jscom":
$Smarty->display('jscom.tpl');
break;
case "_reload_parent":
$Smarty->display('popup/_reload_parent.tpl');
break;

View file

@ -0,0 +1,139 @@
<?php
class jscom{
var $prefix = 'jsc_';
var $callables = array();
var $method = 'POST';
var $uri = '';
function jscom($calls = NULL, $pars = NULL){
$this->uri = $_SERVER['REQUEST_URI'];
if(!is_null($calls)) $this->addCallables($calls);
if(is_array($pars)){
foreach($pars as $parname=>$par){
if(!is_null($par)) $this->setPar($parname, $par);
}
}
}
function noCacheHeader ()
{
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
}
function handler()
{
$args = array();
$mode = '';
if(!empty($_GET[$this->prefix."mn"])){ $mode = 'get'; $rqst = $_GET; $this->noCacheHeader(); }
if(!empty($_POST[$this->prefix."mn"])){ $mode = 'post'; $rqst = $_POST; }
if(empty($mode)){ return; }
$methodName = $rqst[$this->prefix.'mn'];
$args = $rqst[$this->prefix.'args'];
if(in_array($methodName, $this->callables)){
$res = call_user_func_array($methodName, $args);
}else{
$res = "ERROR: $methodName not callable";
}
if(is_array($res)){
$r = array();
foreach($res as $k=>$v){ $r[] = "'$v'"; }
$res = "[".join(', ', $r)."]";
}
echo $res;
exit;
}
function genJsCode(){
ob_start();
?>
var method = "<?php echo $this->method; ?>";
function createComObj() {
var co;
try{
co = new ActiveXObject("Msxml2.XMLHTTP");
}catch(err1){
try{
co = new ActiveXObject("Microsoft.XMLHTTP");
}catch(err2) {
co = null;
}
}
if(!co && typeof XMLHttpRequest != "undefined")
co = new XMLHttpRequest();
if(!co){
alert("Could not create connection object.");
}
return co;
}
// callbackOrId - callback function reference for processing result or html tag id to store result
function jsCom(methodName, args, callbackOrId) {
var i, n;
var comObj;
var uri;
var post_data = null;
uri = "<?php echo $this->uri; ?>";
arstr = "<?php echo$this->prefix; ?>mn="+escape(methodName);
for (i = 0; i < args.length; i++){ arstr += "&<?php echo$this->prefix; ?>args[]=" + escape(args[i]); }
if(method == "GET"){
uri += ((uri.indexOf("?") == -1) ? "?" : "&" ) + arstr;
uri += "&<?php echo$this->prefix; ?>x=" + new Date().getTime();
}else{ post_data = arstr; }
comObj = createComObj();
comObj.callbackOrId = callbackOrId;
comObj.open(method, uri, true);
if (method == "POST") {
comObj.setRequestHeader("Method", "POST " + uri + " HTTP/1.1");
comObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
}
comObj.onreadystatechange = function() {
if(comObj.readyState != 4) return;
var data = comObj.responseText;
if(typeof comObj.callbackOrId == "function"){
callbackOrId(data);
}else if(typeof comObj.callbackOrId == "object"){
eval("res="+data);
for(i=0; i<comObj.callbackOrId.length; i++){
setResult(comObj.callbackOrId[i], res[i])
}
}else if(typeof comObj.callbackOrId != "undefined"){
setResult(comObj.callbackOrId, data)
}else{
alert('result from server: '+data);
}
}
comObj.send(post_data);
delete comObj;
}
function setResult(id, data){
var el = document.getElementById(id) ;
if(el.tagName == 'INPUT'){ el.value = data; }
else{ el.innerHTML = data; }
}
<?php
$code = ob_get_contents();
ob_end_clean();
return $code;
}
function addCallables() {
$n = func_num_args();
for ($i = 0; $i < $n; $i++) {
$a = func_get_arg($i);
if(is_array($a)) $this->callables = array_merge($this->callables, $a);
else $this->callables[] = $a;
}
}
function setPar($parName, $value = NULL) {
switch($parName){
case"method":
case"uri":
$this->{$parName} = $value;
break;
}
}
}
?>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<status />
<Id>sr_CS</Id>
<item>
<key>Stream Data</key>
@ -611,8 +610,8 @@
<value>Saradnik</value>
</item>
<item>
<key>Copyright</key>
<value>Autorska prava</value>
<key>Data</key>
<value />
</item>
<item>
<key>Date</key>
@ -795,8 +794,8 @@
<value>Media fajl</value>
</item>
<item>
<key>Media Library</key>
<value>Audioteka</value>
<key>Metadata</key>
<value />
</item>
<item>
<key>Month</key>
@ -1135,7 +1134,7 @@
<value>sledeće</value>
</item>
<item>
<key>permissions</key>
<value>dopuštene radnje</value>
<key>previous</key>
<value />
</item>
</language>

View file

@ -1,2 +1,2 @@
style="cursor: pointer"
onClick="return contextmenu('{$i.attrs.id}', {if $i.type|lower == "audioclip"}'listen', '{$i.gunid}', {/if} 'PL.removeItem')"
onClick="return contextmenu('{$i.attrs.id}', {if $i.type|lower == "audioclip"}'listen', '{$i.gunid}', '{$i.type}', {/if} 'PL.removeItem')"

View file

@ -31,10 +31,10 @@
{else}
<div style="cursor: pointer">
{/if}
{$i.title|truncate:18}
{$i.title|truncate:14}
</div>
{else}
{$i.title|truncate:18}
{$i.title|truncate:14}
{/if} {* on some reason object call doesn´t like usage of array *}
</td> {assign var="_duration" value=$i.duration}
<td {include file="scratchpad/actionhandler.tpl"} style="text-align: right; cursor: pointer">{niceTime in=$_duration}</td>

View file

@ -1,4 +1,5 @@
<script type="text/javascript">
function frename(name, id){literal}{{/literal}
var s=document.getElementById('ID'+id);
s.innerHTML='<form action="{$UI_HANDLER}" method="post" style="display:inline">'+
@ -7,21 +8,25 @@
'<input type="hidden" name="act" value="rename">'+
'</form>';
{literal}}{/literal}
function fmove(id, relPath){literal}{{/literal}
var newPath=prompt('Destination folder (relative path):', relPath);
if(newPath==null) return;
location.href='{$UI_HANDLER}?id='+id+'&act=move&newPath='+newPath;
{literal}}{/literal}
function fcopy(id, relPath){literal}{{/literal}
var newPath=prompt('Destination folder (relative path):', relPath);
if(newPath==null) return;
location.href='{$UI_HANDLER}?id='+id+'&act=copy&newPath='+newPath;
{literal}}{/literal}
function freplicate(name, id){literal}{{/literal}
var np=prompt('Destination folder (relative path):', id);
if(np==null) return;
location.href='{$UI_HANDLER}?id='+id+'&act=repl&newparid='+np;
{literal}}{/literal}
function newFolder(){literal}{{/literal}
var nn=prompt('New folder name:');
if(nn==null) return;
@ -91,6 +96,13 @@
popupwin = window.open(url, name, arg);
//window.parent.focus();
}
function twoDigit(i) {
i = Math.round(i);
if(i < 10) i = "0" + i;
return i;
}
{/literal}
{UIBROWSER->getAlertMsg assign='alertMsg'}

View file

@ -1,80 +1,23 @@
<script language="javascript">
{literal}
function twoDigit(i) {
i = Math.round(i);
if(i < 10) i = "0" + i;
return i;
}
function pre0_myClock(y, m, d, h, i, s, interval) {
pre0_clock = new Array();
pre0_clock['interval'] = interval;
pre0_clock['time'] = new Date(y, m, d, h, i ,s);
pre0_clock['run'] = setInterval("pre0_incClock();", pre0_clock['interval']);
}
function pre0_incClock() {
pre0_clock['time'].setTime(pre0_clock['time'].getTime() + pre0_clock['interval']);
document.getElementById("statusbar_servertime").innerHTML = twoDigit(pre0_clock['time'].getHours()) + ":" + twoDigit(pre0_clock['time'].getMinutes()) + ":" + twoDigit(pre0_clock['time'].getSeconds());
}
function myClock(eh, ei, es, dh, di, ds, next, interval) {
function myClock(y, m, d, h, i, s, interval) {
clock = new Array();
clock['next'] = next;
clock['interval'] = interval;
clock['correction'] = new Date();
//clock['correction'].setTime(0);
//clock['corr_h'] = clock['correction'].getHours();
clock['elapsed'] = new Date();
clock['duration'] = new Date();
clock['remaining'] = new Date();
clock['elapsed'].setTime (Date.UTC(1970, 0, 1, eh, ei, es));
clock['duration'].setTime(Date.UTC(1970, 0, 1, dh, di, ds));
clock['time'] = new Date(y, m, d, h, i ,s);
clock['run'] = setInterval("incClock();", clock['interval']);
}
function incClock() {
if (clock['remaining'].getTime() <= clock['interval']*2) {
stopClock();
return;
}
clock['elapsed'].setTime(clock['elapsed'].getTime() + clock['interval']);
clock['remaining'].setTime(clock['duration'].getTime() - clock['elapsed'].getTime());
document.getElementById("statusbar_elapsed").innerHTML = twoDigit(clock['elapsed'].getUTCHours()) + ":" + twoDigit(clock['elapsed'].getUTCMinutes()) + ":" + twoDigit(clock['elapsed'].getUTCSeconds());
document.getElementById("statusbar_remaining").innerHTML = twoDigit(clock['remaining'].getUTCHours()) + ":" + twoDigit(clock['remaining'].getUTCMinutes()) + ":" + twoDigit(clock['remaining'].getUTCSeconds());
document.getElementById("statusbar_scala").style.width = (100 / clock['duration'].getTime() * clock['elapsed'].getTime()) + "%";
}
function stopClock() {
clearInterval(clock['run']);
if (clock['next'] == 0) {
// just if no next item to play
document.getElementById("statusbar_indicator").innerHTML = '<img src="img/el_offair.gif" alt="off air">';
document.getElementById("statusbar_whatsplaying").innerHTML = "";
}
clock['time'].setTime(clock['time'].getTime() + clock['interval']);
document.getElementById("statusbar_servertime").innerHTML = twoDigit(clock['time'].getHours()) + ":" + twoDigit(clock['time'].getMinutes()) + ":" + twoDigit(clock['time'].getSeconds());
}
{/literal}
pre0_myClock({$smarty.now|date_format:"%Y"|string_format:"%d"}, {$smarty.now|date_format:"%m"|string_format:"%d"}, {$smarty.now|date_format:"%d"|string_format:"%d"},
myClock({$smarty.now|date_format:"%Y"|string_format:"%d"}, {$smarty.now|date_format:"%m"|string_format:"%d"}, {$smarty.now|date_format:"%d"|string_format:"%d"},
{$smarty.now|date_format:"%H"|string_format:"%d"}, {$smarty.now|date_format:"%M"|string_format:"%d"}, {$smarty.now|date_format:"%S"|string_format:"%d"},
1000);
{if (is_array($_nowplaying.duration))}
myClock ({$_nowplaying.elapsed.h|string_format:"%d"}, {$_nowplaying.elapsed.m|string_format:"%d"}, {$_nowplaying.elapsed.s|string_format:"%d"},
{$_nowplaying.duration.h|string_format:"%d"}, {$_nowplaying.duration.m|string_format:"%d"}, {$_nowplaying.duration.s|string_format:"%d"},
{if is_array($_nextplaying)}1{else}0{/if}, 333);
{/if}
</script>

View file

@ -1,7 +1,6 @@
{assign var='_nowplaying' value=$SCHEDULER->getNowNextClip()}
{assign var='_nextplaying' value=$SCHEDULER->getNowNextClip(1)}
{include file="script/clock.js.tpl"}
<!-- start header -->
<!-- start header left -->
<div class="headLeft">
@ -39,24 +38,29 @@
<!-- start what playing -->
<div class="whatplaying" id="statusbar_whatsplaying">
{if $_nowplaying}
<div class="nowplaying">Now Playing: {$_nowplaying.title|truncate:33}</div>
<div class="nowplaying">##Now Playing##: <strong id="now_title"></strong></div>
<div class="scala">
<div class="scala_in" id="statusbar_scala" style="width: {$_nowplaying.percentage}%;">&nbsp;</div>
<div class="scala_in" id="now_scala" style="width: {$_nowplaying.percentage}%;">&nbsp;</div>
</div>
<div class="time">
<div class="left">Elapsed: <strong id="statusbar_elapsed">{$_nowplaying.elapsed.h}:{$_nowplaying.elapsed.m}:{$_nowplaying.elapsed.s|truncate:2:""}</strong></div>
<div class="right">Remaining: <strong id="statusbar_remaining">{$_nowplaying.remaining.h}:{$_nowplaying.remaining.m}:{$_nowplaying.remaining.s|truncate:2:""}</strong></div>
<div class="left">Elapsed: <strong id="now_elapsed"></strong></div>
<div class="right">Remaining: <strong id="now_remaining"></strong></div>
</div>
{/if}
<div class="clearer"></div>
<div id="next_clip">
{if $_nextplaying}
<p>Playing Next: {$_nextplaying.title|truncate:22} {$_nextplaying.duration.h}:{$_nextplaying.duration.m}:{$_nextplaying.duration.s|truncate:2:""}</p>
<p>##Playing Next##: <span id="next_title"></span> <span id="next_duration"></span></p>
{/if}
</div>
</div>
<!-- end what playing -->
</div>
<!-- end header right -->
<!-- end header -->
{include file="script/clock.js.tpl"}
{include file="script/progressbar.js.tpl"}
{assign var='_nowplaying' value=null}
{assign var='_nextplaying' value=null}

View file

@ -1,4 +1,12 @@
<?php
function jscom_wrapper($object, $parent, $method) {
$args = func_get_args();
unset($args[0]);
unset($args[1]);
unset($args[2]);
return call_user_func_array(array(&$GLOBALS[$object]->$parent, "$method"), $args);
}
function errCallBack($err)
{
echo "<pre>gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n";
@ -136,6 +144,7 @@ class uiBase
$this->PLAYLIST =& new uiPlaylist($this);
$this->SCHEDULER =& new uiScheduler($this);
$this->SUBJECTS =& new uiSubjects($this);
$this->_self_ =& $this;
}

View file

@ -387,7 +387,8 @@ class uiBrowser extends uiBase {
if ($handle = @fsockopen($host, $port, $errno, $errstr, 10)) {
fputs($handle, "GET $uri HTTP/1.0\r\n\r\n");
fputs($handle, "GET $uri HTTP/1.0\r\n");
fputs($handle, "Host: $host:$port\r\n\r\n");
$data = fread($handle, 1024);
list($header, $lost) = explode("\r\n\r\n", $data);
eregi("^[^\r^\n]*", $data, $piece);

View file

@ -15,6 +15,9 @@ require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
$Smarty =& new Smarty;
$uiBrowser =& new uiBrowser($config);
$uiBase =& $uiBrowser;
$jscom =& new jscom(array("jscom_wrapper"));
$jscom->handler();
## load Smarty+filters ##############################################
require_once dirname(__FILE__).'/SmartyExtensions.inc.php';

View file

@ -141,6 +141,7 @@ require_once dirname(__FILE__).'/formmask/generic.inc.php';
require_once dirname(__FILE__).'/ui_calendar.class.php';
require_once dirname(__FILE__).'/ui_scheduler.class.php';
require_once dirname(__FILE__).'/ui_subjects.class.php';
require_once dirname(__FILE__).'/jscom.php';
## well known classes
require_once 'DB.php';

View file

@ -121,10 +121,12 @@ class uiHandler extends uiBase {
$this->redirUrl = UI_BROWSER."?act=fileList";
return FALSE;
}
if (!$this->_validateForm($formdata, $mask)) {
$this->redirUrl = UI_BROWSER."?act=editFile&id=".$id;
return FALSE;
}
$tmpgunid = md5(microtime().$_SERVER['SERVER_ADDR'].rand()."org.mdlf.livesupport");
$ntmp = $this->gb->bufferDir.'/'.$tmpgunid;
move_uploaded_file($formdata['mediafile']['tmp_name'], $ntmp);
@ -179,10 +181,11 @@ class uiHandler extends uiBase {
if ($ia['audio']['codec']) $this->_setMDataValue($id, UI_MDATA_KEY_ENCODER, $ia['audio']['codec']);
// from id3 Tags
foreach ($mask['pages'] as $key=>$val) {
foreach ($mask['pages'][$key] as $k=>$v) {
if ($v['id3'] != FALSE) {
$key = strtolower($v['id3']);
foreach ($mask['pages'] as $key=>$val) { ## loop main, music, talk
foreach ($mask['pages'][$key] as $k=>$v) { ## loop throught elements
if (is_array($v['id3'])) {
foreach ($v['id3'] as $name) { ## loop throught list of equivalent id3-tags
$key = strtolower($name);
if ($ia['comments'][$key][0]) {
$this->_setMdataValue($id, $v['element'], $ia['comments'][$key][0], $langid);
}
@ -190,6 +193,7 @@ class uiHandler extends uiBase {
}
}
}
}
/**
@ -274,6 +278,7 @@ class uiHandler extends uiBase {
$this->_retMsg('Unable to set "$1" to value "$2".', $key, $val);
}
}
if (UI_VERBOSE) $this->_retMsg('Metadata saved');
}

View file

@ -122,6 +122,18 @@ class uiScheduler extends uiCalendar
{
extract($arr);
$this->schedulePrev['hour'] = 0;
$this->schedulePrev['minute'] = 0;
$this->schedulePrev['second'] = 0;
#$thisDay = $this->scheduleAtTime['year']."-".$this->scheduleAtTime['month']."-".$this->scheduleAtTime['day'];
#$nextDayStamp = strtotime('+1 day', strtotime($thisDay));
#$this->scheduleNext['year'] = strftime('%Y', $nextDayStamp);
#$this->scheduleNext['month'] = strftime('%m', $nextDayStamp);;
#$this->scheduleNext['day'] = strftime('%d', $nextDayStamp);
$this->scheduleNext['hour'] = 23;
$this->scheduleNext['minute'] = 59;
$this->scheduleNext['second'] = 59;
if (isset($today)) list($year, $month, $day) = explode("-", strftime("%Y-%m-%d"));
if (is_numeric($year)) $this->scheduleAtTime['year'] = sprintf('%04d', $year);
if (is_numeric($month)) $this->scheduleAtTime['month'] = sprintf('%02d', $month);
@ -133,14 +145,13 @@ class uiScheduler extends uiCalendar
$this->scheduleAtTime['stamp'] = $this->_datetime2timestamp($this->scheduleAtTime['year'].$this->scheduleAtTime['month'].$this->scheduleAtTime['day'].'T'.
$this->scheduleAtTime['hour'].':'.$this->scheduleAtTime['minute'].':'.$this->scheduleAtTime['second']);
$week = $this->getWeekEntrys();
if (is_array($week = $this->getWeekEntrys())) {
## search for previous entry
if (count($week[$this->scheduleAtTime['day']]) >= 1) {
foreach (array_reverse($week[$this->scheduleAtTime['day']]) as $hourly) {
foreach (array_reverse($hourly) as $entry) {
if ($entry['end_stamp'] <= $this->scheduleAtTime['stamp']) {
$prev = TRUE;
list ($this->schedulePrev['hour'], $this->schedulePrev['minute'], $this->schedulePrev['second']) =
explode (':', strftime('%H:%M:%S', strtotime('+'.UI_SCHEDULER_PAUSE_PL2PL, strtotime($entry['end'])))
);
@ -149,21 +160,14 @@ class uiScheduler extends uiCalendar
}
}
}
if ($prev !== TRUE) {
## start at midnight
$this->schedulePrev['hour'] = 0;
$this->schedulePrev['minute'] = 0;
$this->schedulePrev['second'] = 0;
}
reset ($week);
reset($week);
## search for next entry
if (count($week[$this->scheduleAtTime['day']]) >= 1) {
foreach ($week[$this->scheduleAtTime['day']] as $hourly) {
foreach (array_reverse($hourly) as $entry) {
foreach ($hourly as $entry) {
if ($entry['start_stamp'] >= $this->scheduleAtTime['stamp']) {
$next = TRUE;
list ($this->scheduleNext['hour'], $this->scheduleNext['minute'], $this->scheduleNext['second']) =
explode (':', strftime('%H:%M:%S', strtotime('-'.UI_SCHEDULER_PAUSE_PL2PL, strtotime($entry['start']))));
break 2;
@ -171,16 +175,6 @@ class uiScheduler extends uiCalendar
}
}
}
if ($next !== TRUE) {
## end one sec. before midnight
$thisDay = $this->scheduleAtTime['year']."-".$this->scheduleAtTime['month']."-".$this->scheduleAtTime['day'];
$nextDayStamp = strtotime('+1 day', $thisDay);
$this->scheduleNext['year'] = strftime('%Y', $nextDayStamp);
$this->scheduleNext['month'] = strftime('%m', $nextDayStamp);;
$this->scheduleNext['day'] = strftime('%d', $nextDayStamp);
$this->scheduleNext['hour'] = 23;
$this->scheduleNext['minute'] = 59;
$this->scheduleNext['second'] = 59;
}
#print_r($this->schedulePrev);
@ -383,7 +377,7 @@ class uiScheduler extends uiCalendar
if (!$clip['gunid']) return FALSE;
list($duration['h'], $duration['m'], $duration['s']) = explode(':', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($clip['gunid']), UI_MDATA_KEY_DURATION));
list($duration['h'], $duration['m'], $duration['s']) = explode(':', $this->Base->gb->_secsToPlTime($this->Base->gb->_plTimeToSecs($clip['elapsed']) + $this->Base->gb->_plTimeToSecs($clip['remaining'])));
list($elapsed['h'], $elapsed['m'], $elapsed['s']) = explode(':', $clip['elapsed']);
list($remaining['h'], $remaining['m'], $remaining['s']) = explode(':', $clip['remaining']);
@ -398,6 +392,26 @@ class uiScheduler extends uiCalendar
);
}
function getNowNextClip4jscom()
{
if ($curr = $this->getNowNextClip()) {
$next = $this->getNowNextClip(1);
return array(
'title' => $curr['title'],
'elapsed.h' => sprintf('%d', $curr['elapsed']['h']),
'elapsed.m' => sprintf('%d', $curr['elapsed']['m']),
'elapsed.s' => sprintf('%d', $curr['elapsed']['s']),
'duration.h' => sprintf('%d', $curr['duration']['h']),
'duration.m' => sprintf('%d', $curr['duration']['m']),
'duration.s' => sprintf('%d', $curr['duration']['s']),
'next' => $next ? 1 : 0,
'nexttitle' => $next ? $next['title'] : "",
'nextduration' => $next ? $next['duration']['h'].':'.$next['duration']['m'].':'.sprintf('%d', $next['duration']['s']) : "",
);
} else {
return FALSE;
}
}
function _datetime2timestamp($i)
{