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 ('SCHEDULER', $uiBrowser->SCHEDULER);
$Smarty->assign_by_ref ('SCRATCHPAD', $uiBrowser->SCRATCHPAD); $Smarty->assign_by_ref ('SCRATCHPAD', $uiBrowser->SCRATCHPAD);
$Smarty->assign_by_ref ('SUBJECTS', $uiBrowser->SUBJECTS); $Smarty->assign_by_ref ('SUBJECTS', $uiBrowser->SUBJECTS);
$Smarty->assign_by_ref ('JSCOM', $jscom);
$Smarty->register_function('str_repeat', 'S_str_repeat'); $Smarty->register_function('str_repeat', 'S_str_repeat');
$Smarty->register_function('urlencode', 'S_urlencode'); $Smarty->register_function('urlencode', 'S_urlencode');

View file

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

View file

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

View file

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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

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

View file

@ -1,5 +1,6 @@
<script type="text/javascript"> <script type="text/javascript">
function frename(name, id){literal}{{/literal}
function frename(name, id){literal}{{/literal}
var s=document.getElementById('ID'+id); var s=document.getElementById('ID'+id);
s.innerHTML='<form action="{$UI_HANDLER}" method="post" style="display:inline">'+ s.innerHTML='<form action="{$UI_HANDLER}" method="post" style="display:inline">'+
'<input type="text" name="newname" value="'+name+'" size="12">'+ '<input type="text" name="newname" value="'+name+'" size="12">'+
@ -7,30 +8,34 @@
'<input type="hidden" name="act" value="rename">'+ '<input type="hidden" name="act" value="rename">'+
'</form>'; '</form>';
{literal}}{/literal} {literal}}{/literal}
function fmove(id, relPath){literal}{{/literal}
function fmove(id, relPath){literal}{{/literal}
var newPath=prompt('Destination folder (relative path):', relPath); var newPath=prompt('Destination folder (relative path):', relPath);
if(newPath==null) return; if(newPath==null) return;
location.href='{$UI_HANDLER}?id='+id+'&act=move&newPath='+newPath; location.href='{$UI_HANDLER}?id='+id+'&act=move&newPath='+newPath;
{literal}}{/literal} {literal}}{/literal}
function fcopy(id, relPath){literal}{{/literal}
function fcopy(id, relPath){literal}{{/literal}
var newPath=prompt('Destination folder (relative path):', relPath); var newPath=prompt('Destination folder (relative path):', relPath);
if(newPath==null) return; if(newPath==null) return;
location.href='{$UI_HANDLER}?id='+id+'&act=copy&newPath='+newPath; location.href='{$UI_HANDLER}?id='+id+'&act=copy&newPath='+newPath;
{literal}}{/literal} {literal}}{/literal}
function freplicate(name, id){literal}{{/literal}
function freplicate(name, id){literal}{{/literal}
var np=prompt('Destination folder (relative path):', id); var np=prompt('Destination folder (relative path):', id);
if(np==null) return; if(np==null) return;
location.href='{$UI_HANDLER}?id='+id+'&act=repl&newparid='+np; location.href='{$UI_HANDLER}?id='+id+'&act=repl&newparid='+np;
{literal}}{/literal} {literal}}{/literal}
function newFolder(){literal}{{/literal}
function newFolder(){literal}{{/literal}
var nn=prompt('New folder name:'); var nn=prompt('New folder name:');
if(nn==null) return; if(nn==null) return;
location.href='{$UI_HANDLER}?id={$START.id}&act=newFolder&newname='+nn; location.href='{$UI_HANDLER}?id={$START.id}&act=newFolder&newname='+nn;
{literal}} {literal}}
function popup(url, name, width, height) // popup in center of perent window function popup(url, name, width, height) // popup in center of perent window
{ {
var screenX; var screenX;
var screenY; var screenY;
var Xpos; var Xpos;
@ -57,10 +62,10 @@
popupwin = window.open(url, name, arg); popupwin = window.open(url, name, arg);
window.popupwin.focus(); window.popupwin.focus();
} }
function hpopup(url) function hpopup(url)
{ {
var width = 160; var width = 160;
var height = 120; var height = 120;
var name = Math.random(); var name = Math.random();
@ -90,13 +95,20 @@
popupwin = window.open(url, name, arg); popupwin = window.open(url, name, arg);
//window.parent.focus(); //window.parent.focus();
} }
{/literal}
{UIBROWSER->getAlertMsg assign='alertMsg'} function twoDigit(i) {
{if $alertMsg} i = Math.round(i);
if(i < 10) i = "0" + i;
return i;
}
{/literal}
{UIBROWSER->getAlertMsg assign='alertMsg'}
{if $alertMsg}
alert('{$alertMsg}'); alert('{$alertMsg}');
{/if} {/if}
</script> </script>

View file

@ -1,80 +1,23 @@
<script language="javascript"> <script language="javascript">
{literal}
function twoDigit(i) { {literal}
i = Math.round(i);
if(i < 10) i = "0" + i; function myClock(y, m, d, h, i, s, interval) {
clock = new Array();
return i; clock['interval'] = interval;
} clock['time'] = new Date(y, m, d, h, i ,s);
clock['run'] = setInterval("incClock();", clock['interval']);
}
function pre0_myClock(y, m, d, h, i, s, interval) {
pre0_clock = new Array(); function incClock() {
pre0_clock['interval'] = interval; clock['time'].setTime(clock['time'].getTime() + clock['interval']);
pre0_clock['time'] = new Date(y, m, d, h, i ,s); document.getElementById("statusbar_servertime").innerHTML = twoDigit(clock['time'].getHours()) + ":" + twoDigit(clock['time'].getMinutes()) + ":" + twoDigit(clock['time'].getSeconds());
pre0_clock['run'] = setInterval("pre0_incClock();", pre0_clock['interval']); }
}
{/literal}
function pre0_incClock() {
pre0_clock['time'].setTime(pre0_clock['time'].getTime() + pre0_clock['interval']); 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"},
document.getElementById("statusbar_servertime").innerHTML = twoDigit(pre0_clock['time'].getHours()) + ":" + twoDigit(pre0_clock['time'].getMinutes()) + ":" + twoDigit(pre0_clock['time'].getSeconds()); {$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);
</script>
function myClock(eh, ei, es, dh, di, ds, next, 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['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 = "";
}
}
{/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"},
{$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='_nowplaying' value=$SCHEDULER->getNowNextClip()}
{assign var='_nextplaying' value=$SCHEDULER->getNowNextClip(1)} {assign var='_nextplaying' value=$SCHEDULER->getNowNextClip(1)}
{include file="script/clock.js.tpl"}
<!-- start header --> <!-- start header -->
<!-- start header left --> <!-- start header left -->
<div class="headLeft"> <div class="headLeft">
@ -39,24 +38,29 @@
<!-- start what playing --> <!-- start what playing -->
<div class="whatplaying" id="statusbar_whatsplaying"> <div class="whatplaying" id="statusbar_whatsplaying">
{if $_nowplaying} {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">
<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>
<div class="time"> <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="left">Elapsed: <strong id="now_elapsed"></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="right">Remaining: <strong id="now_remaining"></strong></div>
</div> </div>
{/if} {/if}
<div class="clearer"></div> <div class="clearer"></div>
<div id="next_clip">
{if $_nextplaying} {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} {/if}
</div>
</div> </div>
<!-- end what playing --> <!-- end what playing -->
</div> </div>
<!-- end header right --> <!-- end header right -->
<!-- end header --> <!-- end header -->
{include file="script/clock.js.tpl"}
{include file="script/progressbar.js.tpl"}
{assign var='_nowplaying' value=null} {assign var='_nowplaying' value=null}
{assign var='_nextplaying' value=null} {assign var='_nextplaying' value=null}

View file

@ -1,4 +1,12 @@
<?php <?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) function errCallBack($err)
{ {
echo "<pre>gm:\n".$err->getMessage()."\ndi:\n".$err->getDebugInfo()."\nui:\n".$err->getUserInfo()."\n"; 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->PLAYLIST =& new uiPlaylist($this);
$this->SCHEDULER =& new uiScheduler($this); $this->SCHEDULER =& new uiScheduler($this);
$this->SUBJECTS =& new uiSubjects($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)) { 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); $data = fread($handle, 1024);
list($header, $lost) = explode("\r\n\r\n", $data); list($header, $lost) = explode("\r\n\r\n", $data);
eregi("^[^\r^\n]*", $data, $piece); eregi("^[^\r^\n]*", $data, $piece);

View file

@ -15,6 +15,9 @@ require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
$Smarty =& new Smarty; $Smarty =& new Smarty;
$uiBrowser =& new uiBrowser($config); $uiBrowser =& new uiBrowser($config);
$uiBase =& $uiBrowser; $uiBase =& $uiBrowser;
$jscom =& new jscom(array("jscom_wrapper"));
$jscom->handler();
## load Smarty+filters ############################################## ## load Smarty+filters ##############################################
require_once dirname(__FILE__).'/SmartyExtensions.inc.php'; 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_calendar.class.php';
require_once dirname(__FILE__).'/ui_scheduler.class.php'; require_once dirname(__FILE__).'/ui_scheduler.class.php';
require_once dirname(__FILE__).'/ui_subjects.class.php'; require_once dirname(__FILE__).'/ui_subjects.class.php';
require_once dirname(__FILE__).'/jscom.php';
## well known classes ## well known classes
require_once 'DB.php'; require_once 'DB.php';

View file

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

View file

@ -122,6 +122,18 @@ class uiScheduler extends uiCalendar
{ {
extract($arr); 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 (isset($today)) list($year, $month, $day) = explode("-", strftime("%Y-%m-%d"));
if (is_numeric($year)) $this->scheduleAtTime['year'] = sprintf('%04d', $year); if (is_numeric($year)) $this->scheduleAtTime['year'] = sprintf('%04d', $year);
if (is_numeric($month)) $this->scheduleAtTime['month'] = sprintf('%02d', $month); if (is_numeric($month)) $this->scheduleAtTime['month'] = sprintf('%02d', $month);
@ -133,55 +145,37 @@ class uiScheduler extends uiCalendar
$this->scheduleAtTime['stamp'] = $this->_datetime2timestamp($this->scheduleAtTime['year'].$this->scheduleAtTime['month'].$this->scheduleAtTime['day'].'T'. $this->scheduleAtTime['stamp'] = $this->_datetime2timestamp($this->scheduleAtTime['year'].$this->scheduleAtTime['month'].$this->scheduleAtTime['day'].'T'.
$this->scheduleAtTime['hour'].':'.$this->scheduleAtTime['minute'].':'.$this->scheduleAtTime['second']); $this->scheduleAtTime['hour'].':'.$this->scheduleAtTime['minute'].':'.$this->scheduleAtTime['second']);
$week = $this->getWeekEntrys(); if (is_array($week = $this->getWeekEntrys())) {
## search for previous entry ## search for previous entry
if (count($week[$this->scheduleAtTime['day']]) >= 1) { if (count($week[$this->scheduleAtTime['day']]) >= 1) {
foreach (array_reverse($week[$this->scheduleAtTime['day']]) as $hourly) { foreach (array_reverse($week[$this->scheduleAtTime['day']]) as $hourly) {
foreach (array_reverse($hourly) as $entry) { foreach (array_reverse($hourly) as $entry) {
if ($entry['end_stamp'] <= $this->scheduleAtTime['stamp']) { if ($entry['end_stamp'] <= $this->scheduleAtTime['stamp']) {
$prev = TRUE; list ($this->schedulePrev['hour'], $this->schedulePrev['minute'], $this->schedulePrev['second']) =
list ($this->schedulePrev['hour'], $this->schedulePrev['minute'], $this->schedulePrev['second']) = explode (':', strftime('%H:%M:%S', strtotime('+'.UI_SCHEDULER_PAUSE_PL2PL, strtotime($entry['end'])))
explode (':', strftime('%H:%M:%S', strtotime('+'.UI_SCHEDULER_PAUSE_PL2PL, strtotime($entry['end']))) );
); break 2;
break 2; }
} }
} }
} }
}
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 ## search for next entry
if (count($week[$this->scheduleAtTime['day']]) >= 1) { if (count($week[$this->scheduleAtTime['day']]) >= 1) {
foreach ($week[$this->scheduleAtTime['day']] as $hourly) { foreach ($week[$this->scheduleAtTime['day']] as $hourly) {
foreach (array_reverse($hourly) as $entry) { foreach ($hourly as $entry) {
if ($entry['start_stamp'] >= $this->scheduleAtTime['stamp']) { if ($entry['start_stamp'] >= $this->scheduleAtTime['stamp']) {
$next = TRUE; list ($this->scheduleNext['hour'], $this->scheduleNext['minute'], $this->scheduleNext['second']) =
list ($this->scheduleNext['hour'], $this->scheduleNext['minute'], $this->scheduleNext['second']) = explode (':', strftime('%H:%M:%S', strtotime('-'.UI_SCHEDULER_PAUSE_PL2PL, strtotime($entry['start']))));
explode (':', strftime('%H:%M:%S', strtotime('-'.UI_SCHEDULER_PAUSE_PL2PL, strtotime($entry['start'])))); break 2;
break 2; }
} }
} }
} }
} }
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); #print_r($this->schedulePrev);
#print_r($this->scheduleNext); #print_r($this->scheduleNext);
@ -383,7 +377,7 @@ class uiScheduler extends uiCalendar
if (!$clip['gunid']) return FALSE; 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($elapsed['h'], $elapsed['m'], $elapsed['s']) = explode(':', $clip['elapsed']);
list($remaining['h'], $remaining['m'], $remaining['s']) = explode(':', $clip['remaining']); 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) function _datetime2timestamp($i)
{ {