*** empty log message ***

This commit is contained in:
sebastian 2005-03-14 17:38:33 +00:00
parent c7ba993c18
commit 5f5a6c65b5
25 changed files with 280 additions and 91 deletions

View file

@ -1,8 +1,8 @@
<?php
$Smarty->register_object('UIBROWSER', $uiBrowser);
$Smarty->register_object('PL', $uiBrowser->PLAYLIST);
$Smarty->register_object('BROWSE', $uiBrowser->BROWSE);
$Smarty->register_object('SEARCH', $uiBrowser->SEARCH);
$Smarty->assign_by_ref ('PL', $uiBrowser->PLAYLIST);
$Smarty->assign_by_ref ('SCHEDULER', $uiBrowser->SCHEDULER);
$Smarty->register_function('str_repeat', 'S_str_repeat');

View file

@ -4,7 +4,6 @@ $mask = array(
array(
'element' => 'act',
'type' => 'hidden',
'constant'=> 'editMetaData'
),
array(
'element' => 'id',
@ -502,6 +501,35 @@ $mask = array(
'label' => 'Copyright',
),
)
),
'playlist' => array(
array(
'element' => 'dc:title',
'type' => 'text',
'label' => 'Title',
'required' => TRUE,
'id3' => 'Title'
),
array(
'element' => 'dc:creator',
'type' => 'text',
'label' => 'Creator',
'required' => TRUE,
'id3' => 'Artist'
),
array(
'element' => 'dcterms:extent',
'type' => 'text',
'label' => 'Length',
'attributes'=> array('readonly' => 'on'),
'id3' => FALSE
),
array(
'element' => 'dc:description',
'type' => 'textarea',
'label' => 'Description',
'id3' => 'Comment'
),
)
);
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

View file

@ -159,6 +159,11 @@ if ($uiBrowser->userid) {
$Smarty->assign('PL_simpleManagement', TRUE);
break;
case "PL.editMetaData":
$Smarty->assign('PL_editMetaData', TRUE);
$Smarty->assign('PL_simpleManagement', TRUE);
break;
case "SCHEDULER":
$Smarty->assign('showScheduler', TRUE);
break;

View file

@ -226,6 +226,10 @@ switch($_REQUEST['act']){
$uiHandler->PLAYLIST->setReload();
break;
case "PL.editMetaData":
$uiHandler->PLAYLIST->editMetaData($_REQUEST);
break;
case "SCHEDULER.set":
$uiHandler->SCHEDULER->set($_REQUEST);
$uiHandler->SCHEDULER->setReload();

View file

@ -10,7 +10,7 @@
{$editItem.type|capitalize}
</h4>
{if $editItem.type == 'audioclip'}
{if $editItem.type == 'audioclip' || $editItem.type == 'file'}
<input type="button" onClick="showData()" value="Data">
<input type="button" onClick="showMData()" value="MData">
<div id="div_Data">

View file

@ -1,4 +1,4 @@
{PL->getActiveId assign=_PL_activeId}
{assign var="_PL_activeId" value=$PL->getActiveId()}
<div id="objects">
{include file="sub/x.tpl"}

View file

@ -1,8 +1,9 @@
<form name="PL">
<table border="0">
<tr><th colspan="4">active Playlist: {$PL.children.0.children.0.content}</th></tr>
<tr align="center" style="background-color: {cycle values='#eeeeee, #dadada'}"><td></td><td>Title</td><td>Duration</td><td>Type</td></tr>
{PL->getFlat assign='FLAT'}
{foreach from=$FLAT key='pos' item='i'}
{foreach from=$PL->getFlat() key='pos' item='i'}
<!-- {$n++} -->
<tr onMouseOver="highlight()"
onMouseOut="darklight()"
@ -42,5 +43,7 @@
<td><input type="button" value="Save" onClick="hpopup('{$UI_HANDLER}?act=PL.save')"></td>
<td><input type="button" value="Revert" onClick="hpopup('{$UI_HANDLER}?act=PL.revert')"></td>
<td><input type="button" value="Release" onClick="hpopup('{$UI_HANDLER}?act=PL.release')"></td>
<td><input type="button" value="Delete" onClick="hpopup('{$UI_HANDLER}?act=PL.delete')"></td>
<td><input type="button" value="MData" onClick="location.href='{$UI_BROWSER}?act=PL.editMetaData'"></td>
</tr>
</table>
</form>

View file

@ -0,0 +1,18 @@
{assign var="_form" value=$PL->metaDataForm()}
{assign var="dynform" value=$_form.main}
{$_form.langswitch}
{include file="sub/dynForm_plain.tpl"}
<script type="text/javascript">
{literal}
function switchMDataLang()
{
if (validate_editMetaData(document.forms['editMetaData'])) {
document.forms['editMetaData'].elements['langid'].value = document.forms['langswitch'].elements['langid'].value;
document.forms['editMetaData'].submit();
}
return false;
}
{/literal}
</script>

View file

@ -1,32 +1,22 @@
{*Smarty template*}
<div class="standardFrame">
{include file="sub/x.tpl"}
<center>
<form name="PL">
<table border="0">
<tr><th colspan="4">Simple Playlist Management</th></tr>
<h4>Simple Playlist Management</h4>
{PL->get assign='PL'}
{PL->reportLookedPL assign="_looked"}
{if is_array($PL)} {* already activated Playlist *}
{include file="playlist/editor.tpl"}
{else} {* no active Playlist *}
<tr>
<td colspan="4">
{if $_looked}
<input type="button" value="Unlook crashed Playlist" onClick="hpopup('{$UI_HANDLER}?act=PL.unlook')">
{else}
<input type="button" value="New empty Playlist" onClick="hpopup('{$UI_HANDLER}?act=PL.create')">
{/if}
</td>
</tr>
{if is_array($PL->get())} {* already activated Playlist *}
{if $PL_editMetaData}
{include file="playlist/metadata.tpl"}
{else}
{include file="playlist/editor.tpl"}
{/if}
{else} {* no active Playlist *}
{if $PL->reportLookedPL()}
<input type="button" value="Unlook crashed Playlist" onClick="hpopup('{$UI_HANDLER}?act=PL.unlook')">
{else}
<input type="button" value="New empty Playlist" onClick="hpopup('{$UI_HANDLER}?act=PL.create')">
{/if}
{/if}
</table>
</form>
</div>
</center>
</div>

View file

@ -0,0 +1,7 @@
onMouseOver="highlight()"
onMouseOut="darklight()"
onContextmenu="return menu('{$_hour}', {$moreContextBefore} 'SCHEDULER.schedule' {$moreContextAfter})"
{assign var="moreContextBefore" value=""}
{assign var="moreContextAfter" value=""}

View file

@ -1,16 +1,74 @@
{$SCHEDULER->buildDay()}
{assign var="_usage" value=$SCHEDULER->getDayUsage($SCHEDULER->curr.year, $SCHEDULER->curr.month, $SCHEDULER->curr.day)}
<table border=1>
{foreach from=$SCHEDULER->Day item="_Hour"}
{assign var="_hour" value=$_Hour.hour}
{assign var="_border" value=""}
<tr>
<td {include file="scheduler/contextmenu.tpl"}>
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&hour={$_Hour.hour}')">{$_Hour.hour}
</td>
<td>
{foreach from=$_usage item="_entry"}
{if $_entry.timestamp >= $_Hour.timestamp && $_entry.timestamp < $_Hour.timestamp+3600}
{$_border}
<b>{$_entry.title}</b>
{$_entry.start|regex_replace:"/[0-9]+T/":""|truncate:5:""}-{$_entry.end|regex_replace:"/[0-9]+T/":""|truncate:5:""}
{$_entry.creator}
{assign var="_border" value="|"}
{/if}
{/foreach}
</td>
</tr>
{/foreach}
</table>
{* timing-ansich
{assign var="_divisor" value=180}
{assign var="_minwidth" value=10}
<table border=1>
<tr>
<td valign="top">
<b>{$SCHEDULER->curr.year}-{$SCHEDULER->curr.month}-{$SCHEDULER->curr.day}</b></a>
{assign var="_oneday" value=$SCHEDULER->getDayTiming($SCHEDULER->curr.year, $SCHEDULER->curr.month, $SCHEDULER->curr.day)}
<table border="0" cellspacing="0" cellpadding="0">
{foreach from=$_oneday item="i"}
<tr height="{$SCHEDULER->_oneOrMore($i.length/$_divisor)}" style="font-family: monospace" valign="top">
{if is_array($i.entry)}
<td bgcolor="#ffcacb" width="600" height="{$SCHEDULER->_oneOrMore($i.length/$_divisor)}" {include file="scheduler/contextmenu.tpl"}>
{if $i.length/$_divisor > $_minwidth}
<small>
<b>{$i.entry.title}</b>
{$i.entry.start|regex_replace:"/[0-9]+T/":""}-{$i.entry.end|regex_replace:"/[0-9]+T/":""}
{$i.entry.creator}
</small>
{/if}
</td>
{else}
<td bgcolor="#97bacf" width="600" height="{$SCHEDULER->_oneOrMore($i.length/$_divisor)}">
</td>
{/if}
</tr>
{/foreach}
</table>
</td>
</tr>
</table>
*}

View file

@ -24,7 +24,7 @@
<td>&nbsp;</td>
{else}
<td width="80">
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&day={$_Day.day}')">{$_Day.day}
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=day&&day={$_Day.day}')"><b>{$_Day.day}</b>
<div><img src="img/percentage_red.png" width="{if $percentage>50}{$percentage}{elseif $percentage>0}{$percentage+2}{else}0{/if}%" height="10" border="0"><img src="img/percentage_blue.png" width="{if $percentage>50}{$null-$percentage+100}{elseif $percentage>0}{$NULL-$percentage-2+100}{else}100{/if}%" height="10" border="0"></div>
</td>
{/if}

View file

@ -7,7 +7,7 @@
<tr>
<td rowspan="2"><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&week=--')"><<</a> </td>
{foreach from=$SCHEDULER->Week item="_Weekday"}
<td>{$_Weekday.label.full}</td>
<th>{$_Weekday.label.full}</th>
{/foreach}
<td rowspan="2"><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&week=%2B%2B')">>></a></td>
</tr>
@ -17,29 +17,29 @@
<td valign="top">
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=day&day={$_Day.day}&month={$_Day.month}&year={$_Day.year}')"><b>{$_Day.day}</b></a>
{assign var="_oneday" value=$SCHEDULER->getDayTiming($_Day.year, $_Day.month, $_Day.day)}
<table border="0" cellspacing="0" cellpadding="0">
{foreach from=$_oneday item="i"}
<tr height="{$SCHEDULER->_oneOrMore($i.length/$_divisor)}" style="font-family: monospace" valign="top">
{if is_array($i.entry)}
<td bgcolor="pink" width="80" height="{$SCHEDULER->_oneOrMore($i.length/$_divisor)}">
{if $i.length/$_divisor > $_minwidth}
<small>
Start:{$i.entry.start|regex_replace:"/[0-9]+T/":""}
<br>
End:&nbsp;&nbsp;{$i.entry.end|regex_replace:"/[0-9]+T/":""}
</small>
{/if}
</td>
{else}
<td bgcolor="lightblue" width="80" height="{$SCHEDULER->_oneOrMore($i.length/$_divisor)}">
</td>
{assign var="_oneday" value=$SCHEDULER->getDayTiming($_Day.year, $_Day.month, $_Day.day)}
<table border="0" cellspacing="0" cellpadding="0">
{foreach from=$_oneday item="i"}
<tr height="{$SCHEDULER->_oneOrMore($i.length/$_divisor)}" style="font-family: monospace" valign="top">
{if is_array($i.entry)}
<td bgcolor="#ffcacb" width="100" height="{$SCHEDULER->_oneOrMore($i.length/$_divisor)}" onMouseover="" onMouseout="">
{if $i.length/$_divisor > $_minwidth}
<small>
<b>{$i.entry.title}</b>
<br>
{$i.entry.start|regex_replace:"/[0-9]+T/":""|truncate:5:""}-{$i.entry.end|regex_replace:"/[0-9]+T/":""|truncate:5:""}
<br>
{$i.entry.creator}
</small>
{/if}
</tr>
{/foreach}
</table>
</td>
{else}
<td bgcolor="#97bacf" width="100" height="{$SCHEDULER->_oneOrMore($i.length/$_divisor)}">
</td>
{/if}
</tr>
{/foreach}
</table>
</td>
{/foreach}

View file

@ -1,4 +1,4 @@
{PL->getActiveId assign=_PL_activeId}
{assign var="_PL_activeId" value=$PL->getActiveId()}
<div id="scratchpad">
<center><b>%%ScratchPad%%</b>

View file

@ -1,4 +1,4 @@
{PL->getActiveId assign=_PL_activeId}
{assign var="_PL_activeId" value=$PL->getActiveId()}
onMouseOver="highlight()"
onMouseOut="darklight()"

View file

@ -307,7 +307,7 @@ class uiBase
$data = array('id' => $id,
'gunid' => $this->gb->_gunidFromId($id),
'title' => $this->_getMDataValue($id, UI_MDATA_KEY_TITLE),
'creator' => $this->_getMDataValue($id, UI_MDATA_KEY_ARTIST),
'creator' => $this->_getMDataValue($id, UI_MDATA_KEY_CREATOR),
'duration' => $this->_niceTime($this->_getMDataValue($id, UI_MDATA_KEY_DURATION)),
'type' => $this->gb->getFileType($id),
);

View file

@ -63,12 +63,10 @@ class uiBrowse
}
## just to change limit and file-type
$form = new HTML_QuickForm('shitcher', UI_STANDARD_FORM_METHOD, UI_HANDLER);
#$mask2['browse_global']['limit']['default'] = $this->criteria['limit'];
#$mask2['browse_global']['filetype']['default'] = $this->criteria['filetype'];
$form = new HTML_QuickForm('switch', UI_STANDARD_FORM_METHOD, UI_HANDLER);
$this->Base->_parseArr2Form($form, $mask2['browse_global']);
$form->setDefaults(array('limit' => $this->criteria['limit'],
'filetype' => $this->criteria['filetype']));
'filetype' => $this->criteria['filetype']));
$renderer =& new HTML_QuickForm_Renderer_Array(true, true);
$form->accept($renderer);
$output['global']['dynform'] = $renderer->toArray();

View file

@ -379,11 +379,10 @@ class uiBrowser extends uiBase {
$form = new HTML_QuickForm('editMetaData', UI_STANDARD_FORM_METHOD, UI_HANDLER);
$this->_parseArr2Form($form, $mask['basics']);
$form->setConstants( array('id' => $id,
#!!!!!'langid' => array_pop($this->gb->getMDataValue($id, 'langid', $this->sessid))
'langid' => 'en'
)
);
$form->setConstants(array('act' => 'editMetaData',
'id' => $id,
#!!!!!'langid' => array_pop($this->gb->getMDataValue($id, 'langid', $this->sessid))
'langid' => 'en'));
## convert element names to be unique over different forms-parts, add javascript to spread values over parts, add existing values from database
foreach ($mask['pages'] as $key=>$val) {

View file

@ -99,7 +99,8 @@ class uiCalendar
$Day = new Calendar_Day ($this->curr['year'], $this->curr['month'], $this->curr['day']);
$Day->build();
while ($Hour = $Day->fetch()) {
$this->Day[] = array('hour' => $Hour->thisHour());
$this->Day[] = array('hour' => $Hour->thisHour(),
'timestamp' => $Hour->thisHour(TRUE));
}
}

View file

@ -32,7 +32,7 @@ define('UI_BROWSE_SESSNAME', 'L_BROWSE');
## Metadata Keys
define('UI_MDATA_KEY_TITLE', 'dc:title');
define('UI_MDATA_KEY_ARTIST', 'dc:creator');
define('UI_MDATA_KEY_CREATOR', 'dc:creator');
define('UI_MDATA_KEY_DURATION', 'dcterms:extent');
define('UI_MDATA_KEY_URL', 'ls:url');

View file

@ -110,10 +110,10 @@ class uiPlaylist
return $this->activeId;
}
function reportLookedPL($setMsg)
function reportLookedPL($setMsg=FALSE)
{
if(is_string($saved = $this->Base->gb->loadPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY))) {
if ($setMsg === TRUE) $this->Base->_retMsg('Found looked Playlist');
if ($setMsg == TRUE) $this->Base->_retMsg('Found looked Playlist');
return TRUE;
}
return FALSE;
@ -352,6 +352,66 @@ class uiPlaylist
return $renderer->toArray();
}
function metaDataForm($get=TRUE)
{
include dirname(__FILE__).'/formmask/metadata.inc.php';
foreach ($mask['playlist'] as $k=>$v) {
$mask['playlist'][$k]['element'] = $this->Base->_formElementEncode($v['element']);
## recive data from GreenBox
if ($get) {
$mask['playlist'][$k]['default'] = $this->Base->_getMDataValue($this->activeId, $v['element']);
}
## get data from parameter
if (is_array($data)) {
$mask['playlist'][$k]['default'] = $data[strtr($v['element'], '_', '.')];
}
}
$form = new HTML_QuickForm('editMetaData', UI_STANDARD_FORM_METHOD, UI_HANDLER);
$this->Base->_parseArr2Form($form, $mask['basics']);
$this->Base->_parseArr2Form($form, $mask['playlist']);
$this->Base->_parseArr2Form($form, $mask['buttons']);
$form->setConstants(array('act' => 'PL.editMetaData',
'id' => $this->activeId));
$renderer =& new HTML_QuickForm_Renderer_Array(true, true);
$form->accept($renderer);
$output['main'] = $renderer->toArray();
$form = new HTML_QuickForm('langswitch', UI_STANDARD_FORM_METHOD, UI_BROWSER);
$this->Base->_parseArr2Form($form, $mask['langswitch']);
$output['langswitch'] = $form->toHTML();
#print_r($output);
return $output;
}
function editMetaData(&$formdata)
{
include dirname(__FILE__).'/formmask/metadata.inc.php';
## first remove old entrys
#$this->gb->replaceMetaData($id, $this->_analyzeFile($id, 'xml'), 'string', $this->sessid);
foreach ($mask['playlist'] as $k=>$v) {
$formdata[$this->Base->_formElementEncode($v['element'])] ? $mData[$this->Base->_formElementDecode($v['element'])] = $formdata[$this->Base->_formElementEncode($v['element'])] : NULL;
}
$data = $this->Base->_dateArr2Str($mData);
foreach ($data as $key=>$val) {
$r = $this->Base->gb->setMDataValue($this->activeId, $key, $this->Base->sessid, $val);
if (PEAR::isError($r)) {
$this->Base->_retMsg('Unable to set $1: $2', $key, $val);
}
}
$this->Base->_retMsg('Metadata saved');
$this->Base->redirUrl = UI_BROWSER."?act=PL.simpleManagement&id=".$this->activeId;
}
function _plTimeToSecs($plt, $length=4)
{
$arr = split(':', $plt);

View file

@ -55,17 +55,34 @@ class uiScheduler extends uiCalendar
function _datetime2timestamp($i)
{
$formatted = $i[0].$i[1].$i[2].$i[3].'-'.$i[4].$i[5].'-'.$i[6].$i[7].strrchr($i, 'T');
#echo "iiiii: $i ffff:".$formatted;
return strtotime($formatted);
#echo "input: $i formatted:".$formatted;
return $this->_strtotime($formatted);
}
function _strtotime($input)
{
## !! bug in strtotime. zeigt 8h später an als reines datum, wenn Txx:xx:xx verwendet wird !!
if (strpos($input, 'T'))
return strtotime($input)-8*3600;
return strtotime($input);
}
function getDayUsage($year, $month, $day)
{
$day_start = $this->_datetime2timestamp($year.$month.$day.'T00:00:00');
$day_end = $this->_datetime2timestamp($year.$month.$day.'T23:59:59');
$date = $year.$month.$day;
$arr = $this->displayScheduleMethod($date.'T00:00:00', $date.'T23:59:59.999999');
if (!count($arr))
return FALSE;
foreach ($arr as $key=>$val) {
$arr[$key]['title'] = $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE);
$arr[$key]['creator'] = $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR);
$arr[$key]['timestamp'] = $this->_datetime2timestamp($val['start']);
}
#print_r($arr);
return $arr;
}
@ -84,46 +101,46 @@ class uiScheduler extends uiCalendar
function getDayTiming($year, $month, $day)
{
## !! bug in strtotime. zeigt 8h später an als reines datum, wenn Txx:xx:xx verwendet wird !!
#echo $year.$month.$day;
$day_start = $this->_datetime2timestamp($year.$month.$day.'T00:00:00');
$day_end = $this->_datetime2timestamp($year.$month.$day.'T23:59:59');
if (!$arr = $this->getDayUsage($year, $month, $day))
return array(array( ## empty day
return array(array( ## empty day
'type' => 'gap',
'length' => $day_end - $day_start
));
$curr = current($arr);
if (strtotime($curr['start']) > $day_start) ## insert gap if first entry start after 00:00:00
if ($this->_strtotime($curr['start']) > $day_start) ## insert gap if first entry start after 00:00:00
$list[] = array(
'type' => 'gap',
#'pos' => 0,
'length' => strtotime($curr['start']) - $day_start
'length' => $this->_strtotime($curr['start']) - $day_start
);
while ($curr = current($arr)) {
$list[] = array(
'type' => 'entry',
#'pos' => strtotime($curr['start']) - $day_start,
'length' => strtotime($curr['end']) - strtotime($curr['start']),
#'pos' => $this->_strtotime($curr['start']) - $day_start,
'length' => $this->_strtotime($curr['end']) - $this->_strtotime($curr['start']),
'entry' => $curr
);
if ($next = next($arr)) {
if (strtotime($next['start']) > strtotime($curr['end'])+1) ## insert gap between entrys
if ($this->_strtotime($next['start']) > $this->_strtotime($curr['end'])+1) ## insert gap between entrys
$list[] = array(
'type' => 'gap',
#'pos' => strtotime($curr['start'])-$day_start,
'length' => strtotime($next['start']) - strtotime($curr['end']),
#'pos' => $this->_strtotime($curr['start'])-$day_start,
'length' => $this->_strtotime($next['start']) - $this->_strtotime($curr['end']),
);
}
else {
if (strtotime($curr['end']) < $day_end) ## insert gap if prev entry was not until midnight
if ($this->_strtotime($curr['end']) < $day_end) ## insert gap if prev entry was not until midnight
$list[] = array(
'type' => 'gap',
#'pos' => strtotime($curr['end']) - $day_start,
'length' => $day_end - strtotime($curr['end']),
#'pos' => $this->_strtotime($curr['end']) - $day_start,
'length' => $day_end - $this->_strtotime($curr['end']),
);
}
@ -138,6 +155,7 @@ class uiScheduler extends uiCalendar
return $id < 1 ? ceil($in) : round($in);
}
function _scheduledDays($period)
{
if ($period=='month') {