all windows are implemented yet

This commit is contained in:
sebastian 2005-03-08 17:16:06 +00:00
parent 0fca5f27cd
commit a49bac6b5c
16 changed files with 292 additions and 80 deletions

View File

@ -1,4 +1,3 @@
<?php
require_once dirname(__FILE__).'/var/conf.php';
header('LOCATION: var/html/'.UI_BROWSER);
header('LOCATION: var/html/ui_browser.php');
?>

View File

@ -1,4 +1,4 @@
body {
body {
background-color : ThreedLightShadow;
font-family : monospace;
}

View File

@ -222,7 +222,7 @@ switch($_REQUEST['act']){
$uiHandler->SCHEDULER->setReload();
break;
case "SCHEDULER.uploadPlaylistMethod":
case "SCHEDULER.uploadPlaylistMethod":
$uiHandler->SCHEDULER->uploadPlaylistMethod($_REQUEST);
$uiHandler->SCHEDULER->setReload();
break;
@ -240,4 +240,6 @@ if (ob_get_contents()) {
}
ob_end_clean
?>
<meta http-equiv="refresh" content="<?php echo $ui_wait ? $ui_wait : 0; ?>; URL=<?php echo $uiHandler->redirUrl; ?>">
<meta http-equiv="refresh" content="<?php echo $ui_wait ? $ui_wait : 0; ?>; URL=<?php echo $uiHandler->redirUrl; ?>">
</body>
</html>

View File

@ -1,4 +1,3 @@
<?php
require_once dirname(__FILE__).'/conf.php';
header('LOCATION: html/'.UI_BROWSER);
header('LOCATION: html/ui_browser.php');
?>

View File

@ -8,7 +8,7 @@
<tr bgcolor="{cycle values='#eeeeee, #dadada"'}">
<th>Title</th>
<th>Type</th>
<td align="right" width='70%'> &nbsp;
<td align="right" width='70%'> &nbsp;
{if $START.pid}<a href="{$UI_BROWSER}?act=fileList&id={$START.pid}">[go up]</a>{/if}
</td>
</tr>

View File

@ -1,33 +1,63 @@
{$SCHEDULER->buildDecade()}
{$SCHEDULER->buildYear()}
{$SCHEDULER->buildMonth()}
{$SCHEDULER->buildWeek()}
<table border=1>
<tr><th colspan="8">{$SCHEDULER->curr.year}-{$SCHEDULER->curr.month}-{$SCHEDULER->curr.day}</th></tr>
<tr> <td>&nbsp;</td>
{foreach from=$SCHEDULER->Week item="_Weekday"}
<td>{$_Weekday.label.short}</td>
{/foreach}
</tr>
{foreach from=$SCHEDULER->Month item="_Day"}
{if $_Day.isFirst}
<tr>
<th><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=week&day={$_Day.day}&month={$_Day.month}')">{$_Day.week}</a></th>
{/if}
<td>
<tr><th colspan="8">{$SCHEDULER->curr.year}-{$SCHEDULER->curr.month}-{$SCHEDULER->curr.day}</th></tr>
{if $_Day.isEmpty}
<div>
{elseif $_Day.isSelected}
<div style="background-color: lightblue">
{else}
<div style="background-color: white">
{/if}
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&day={$_Day.day}&month={$_Day.month}')">{$_Day.day}</a>
</div>
</td>
{if $_Day.isLast}
</tr>
{/if}
{/foreach}
<tr>
<th><a href="#" onCLick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&month=--')"><<</a></th>
<th colspan="4">
<form name="calendar_month">
<select name="month" onChange="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&month=' + document.forms['calendar_month'].month.value)">
{foreach from=$SCHEDULER->Year item="_Month"}
<option value="{$_Month.month}">{$_Month.label.full}</option>
{/foreach}
</select>
</form>
</th>
<th colspan="2">
<form name="calendar_year">
<select name="year" onChange="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&year=' + document.forms['calendar_year'].year.value)">
{foreach from=$SCHEDULER->Decade item="_Year"}
<option value="{$_Year.year}" {if $_Year.isSelected}selected{/if}>{$_Year.year}</option>
{/foreach}
</select>
</form>
<script type="text/javascript">
document.forms['calendar_month'].month.value = '{$SCHEDULER->curr.month}';
document.forms['calendar_year'].year.value = '{$SCHEDULER->curr.year}';
</script>
</th>
<th><a href="#" onCLick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&month=%2B%2B')">>></a></th>
</tr>
<tr> <td>&nbsp;</td>
{foreach from=$SCHEDULER->Week item="_Weekday"}
<td>{$_Weekday.label.short}</td>
{/foreach}
</tr>
{foreach from=$SCHEDULER->Month item="_Day"}
{if $_Day.isFirst}
<tr>
<th><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=week&day={$_Day.day}&month={$_Day.month}')">{$_Day.week}</a></th>
{/if}
<td>
{if $_Day.isEmpty}
<div>
{elseif $_Day.isSelected}
<div style="background-color: lightblue">
{else}
<div style="background-color: white">
{/if}
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&day={$_Day.day}&month={$_Day.month}&year={$_Day.year}')">{$_Day.day}</a>
</div>
</td>
{if $_Day.isLast}
</tr>
{/if}
{/foreach}
</table>

View File

@ -1,7 +1,5 @@
{$SCHEDULER->buildDay()}
Day View
<table border=1>
{foreach from=$SCHEDULER->Day item="_Hour"}

View File

@ -1,21 +0,0 @@
{SEARCH->getResult assign=_results}
{if $_results.cnt > 0}
<table border="0" width="50%">
{foreach from=$_results.items item=i}
<tr style="background-color: {cycle values='#eeeeee, #dadada'}" {assign var="moreContextBefore" value=", 'SP.addItem'"}{include file="sub/contextmenu.tpl"}>
<td align="center">
{if $PLAYLIST.id == $i.id}
<b>{$i.title|truncate:30}</b>
{else}
{$i.title|truncate:30}
{/if}
</td>
<td align="center">{$i.type}</td>
<td><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.uploadPlaylistMethod&gunid={$i.gunid}')">{$i.gunid}</td>
</tr>
{/foreach}
</table>
{else}
No match found.
{/if}

View File

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

View File

@ -1,8 +1,6 @@
{$SCHEDULER->buildMonth()}
{$SCHEDULER->buildWeek()}
Month View
<table border=1>
<tr>

View File

@ -0,0 +1,108 @@
{$SCHEDULER->copyPlFromSP()}
<form name="schedule_it">
<select name="gunid">
{foreach from=$SCHEDULER->playlists item="_pl"}
<option value="{$_pl.gunid}">{$_pl.title}</option>
{/foreach}
</select>
<input type="hidden" name="sc_last">
<input value="00" type="text" size="2" name="hour" onClick="sc_act(this)" onChange="sc_checkrange(); sc_twodigits()" onBlur="sc_check_int(this)"> :
<input value="00" type="text" size="2" name="min" onClick="sc_act(this)" onChange="sc_checkrange(); sc_twodigits()" onBlur="sc_check_int(this)"> :
<input value="00" type="text" size="2" name="sec" onClick="sc_act(this)" onChange="sc_checkrange(); sc_twodigits()" onBlur="sc_check_int(this)">
<a href="#" onMouseDown="sc_start('-')" onMouseUp="sc_stop()" onMouseOut="sc_stop()">-</a>
<a href="#" onMouseDown="sc_start('+')" onMouseUp="sc_stop()" onMouseOut="sc_stop()">+</a>
<br>
<input type="button" value="schedule" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.uploadPlaylistMethod&gunid='+schedule_it.gunid.value+'&time='+schedule_it.hour.value+':'+schedule_it.min.value+':'+schedule_it.sec.value)">
</form>
<script type="text/javascript">
{literal}
var sc_loop;
function sc_start(direction)
{
sc_loop = setInterval("sc_change('" + direction + "')", 80);
}
function sc_stop()
{
clearInterval(sc_loop);
}
function sc_act(element)
{
document.forms['schedule_it'].elements['sc_last'].value = element.name;
element.select();
}
function sc_change(direction)
{
if (document.forms['schedule_it'].elements['sc_last'].value) {
if (direction == '+') {
document.forms['schedule_it'].elements[document.forms['schedule_it'].elements['sc_last'].value].value++;
}
if (direction == '-') {
document.forms['schedule_it'].elements[document.forms['schedule_it'].elements['sc_last'].value].value--;
}
sc_checkrange();
sc_twodigits();
document.forms['schedule_it'].elements[document.forms['schedule_it'].elements['sc_last'].value].select();
}
}
function sc_checkrange()
{
// switch out of range
if (document.forms['schedule_it'].elements['sec'].value >= 60) {
document.forms['schedule_it'].elements['sec'].value = 0;
document.forms['schedule_it'].elements['min'].value++;
}
if (document.forms['schedule_it'].elements['min'].value >= 60) {
document.forms['schedule_it'].elements['min'].value = 0;
document.forms['schedule_it'].elements['hour'].value++;
}
if (document.forms['schedule_it'].elements['hour'].value >= 24) {
document.forms['schedule_it'].elements['hour'].value = 0;
}
if (document.forms['schedule_it'].elements['sec'].value < 0) {
document.forms['schedule_it'].elements['sec'].value = 59;
document.forms['schedule_it'].elements['min'].value--;
}
if (document.forms['schedule_it'].elements['min'].value < 0) {
document.forms['schedule_it'].elements['min'].value = 59;
document.forms['schedule_it'].elements['hour'].value--;
}
if (document.forms['schedule_it'].elements['hour'].value < 0) {
document.forms['schedule_it'].elements['hour'].value = 23;
}
}
function sc_twodigits()
{
if (document.forms['schedule_it'].elements['hour'].value < 10) document.forms['schedule_it'].elements['hour'].value = '0' + Math.round(document.forms['schedule_it'].elements['hour'].value);
if (document.forms['schedule_it'].elements['min'].value < 10) document.forms['schedule_it'].elements['min'].value = '0' + Math.round(document.forms['schedule_it'].elements['min'].value);
if (document.forms['schedule_it'].elements['sec'].value < 10) document.forms['schedule_it'].elements['sec'].value = '0' + Math.round(document.forms['schedule_it'].elements['sec'].value);
}
function sc_check_int(element)
{
var regex = /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;
if (element.value != '' && !regex.test(element.value)) {
alert('must be numeric');
element.value='00';
element.focus();
element.select();
return false;
}
return true;
}
{/literal}
</script>

View File

@ -1,7 +1,5 @@
{$SCHEDULER->buildWeek()}
Week View
<table border=1>
<tr>
@ -18,7 +16,21 @@ Week View
{if $_Day.isEmpty}
<td>&nbsp;</td>
{else}
<td><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&day={$_Day.day}')">{$_Day.day}</td>
<td valign="top">
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&day={$_Day.day}&month={$_Day.month}&year={$_Day.year}')"><b>{$_Day.day}</b></a>
{assign var="_oneday" value=$SCHEDULER->getDayUsage($_Day.year, $_Day.month, $_Day.day)}
{if is_array($_oneday)}
<table border="1" style="font-family : monospace">
{foreach from=$_oneday item="i"}
<tr><td>
Start:{$i.start|regex_replace:"/[0-9]+T/":""}
<br>
End:&nbsp;&nbsp;{$i.end|regex_replace:"/[0-9]+T/":""}
</td></tr>
{/foreach}
</table>
{/if}
</td>
{/if}
{if $_Day.isLast}

View File

@ -7,6 +7,38 @@ class uiCalendar
$this->firstDayOfWeek = 1;
}
function buildDecade()
{
for ($Year=$this->curr['year']-3; $Year<=$this->curr['year']+5; $Year++) {
$this->Decade[] = array(
'year' => $Year,
'isSelected' => $Year==$this->curr['year'] ? TRUE : FALSE
);
}
}
function buildYear()
{
require_once 'Calendar/Year.php';
require_once 'Calendar/Month.php';
$Year = new Calendar_Year($this->curr['year']);
# mark current month
$sel = new Calendar_Month($this->curr['year'], $this->curr['month']);
$selections = array($sel);
$Year->build($selections, $this->firstDayOfWeek);
while ($Month = $Year->fetch()) {
$this->Year[] = array(
'month' => $this->Base->_twoDigits($Month->thisMonth()),
'label' => $this->_getMonthName($Month),
'isSelected' => $Month->isSelected()
);
}
}
function buildMonth()
{
@ -19,15 +51,16 @@ class uiCalendar
$Month = new Calendar_Month_Weekdays($this->curr['year'], $this->curr['month'], $this->firstDayOfWeek);
# mark today #
$sel = new Calendar_Day($this->curr['year'], $this->curr['month'], $this->curr['day']);
$selection = array($sel);
$selections = array($sel);
$Month->build($selection);
$Month->build($selections);
while ($Day = $Month->fetch()) {
$this->Month[] = array(
'day' => $this->Base->_twoDigits($Day->thisDay()),
'week' => $this->_getWeekNr($Day),
'month' => $this->Base->_twoDigits($Day->thisMonth()),
'year' => $Day->thisYear(),
'month' => $Day->thisMonth()<=12 ? $this->Base->_twoDigits($Day->thisMonth()) : '01', ## due to bug in
'year' => $Day->thisMonth()<=12 ? $Day->thisYear() : $Day->thisYear()+1, ## Calendar_Month_Weekdays
'label' => $this->_getDayName($Day),
'isEmpty' => $Day->isEmpty(),
'isFirst' => $Day->isFirst(),
'isLast' => $Day->isLast(),
@ -48,6 +81,9 @@ class uiCalendar
while ($Day = $Week->fetch()) {
$this->Week[] = array(
'day' => $this->Base->_twoDigits($Day->thisDay()),
'week' => $this->_getWeekNr($Day),
'month' => $this->Base->_twoDigits($Day->thisMonth()),
'year' => $Day->thisYear(),
'label' => $this->_getDayName($Day),
);
}
@ -81,10 +117,20 @@ class uiCalendar
}
}
## some data which PEAR::Calendar does not provide ##########################################################################################
function _getMonthName(&$date) {
$timestamp = mktime($date->thisHour(), $date->thisMinute(), $date->thisSecond(), $date->thisMonth(), $date->thisDay(), $date->thisYear());
#echo $date->thisHour().$date->thisMinute().$date->thisSecond().$date->thisYear().$date->thisMonth().$date->thisDay().$timestamp."<br>";
return array('short' => strftime("%b", $timestamp),
'full' => strftime("%B", $timestamp));
}
function _getWeekNr(&$date) {
$timestamp = mktime($date->thisHour(), $date->thisMinute(), $date->thisSecond(), $date->thisMonth(), $date->thisDay(), $date->thisYear());
#echo $date->thisHour().$date->thisMinute().$date->thisSecond().$date->thisYear().$date->thisMonth().$date->thisDay().$timestamp."<br>";
return date("W", $timestamp);
return strftime("%V", $timestamp);
}

View File

@ -52,7 +52,9 @@ class uiHandler extends uiBase {
$this->redirUrl = UI_BROWSER.'?popup[]=login';
return FALSE;
}
setcookie($this->config['authCookieName'], $sessid);
#setcookie($this->config['authCookieName'], $sessid);
echo "<meta http-equiv='set-cookie' content='".$this->config['authCookieName']."=".$sessid.";'>";
ob_flush();
$id = $this->gb->getObjId($formdata['login'], $this->gb->storId);
if(PEAR::isError($id)) {
$this->_retMsg('Login failed');
@ -76,7 +78,9 @@ class uiHandler extends uiBase {
function logout($trigger_login = FALSE)
{
$this->gb->logout($this->sessid);
setcookie($this->config['authCookieName'], '');
#setcookie($this->config['authCookieName'], '');
echo "<meta http-equiv='set-cookie' content='".$this->config['authCookieName']."=;'>";
ob_clean();
session_destroy();
if ($trigger_login)

View File

@ -8,6 +8,11 @@ require_once dirname(__FILE__).'/ui_handler.class.php';
## initialize objects ###############################################
$uiHandler =& new uiHandler($config);
$uiBase =& $uiHandler;
?>
<html>
<link rel="stylesheet" href="styles.css">
<body>
Your request is processed...
<?php
ob_start();
?>

View File

@ -29,7 +29,23 @@ class uiScheduler extends uiCalendar
extract($arr);
if ($view) $this->curr['view'] = $view;
if ($year) $this->curr['year'] = $year;
if ($month) $this->curr['month']= $month;
if (is_numeric($month)) $this->curr['month'] = $month;
if ($month=='++') {
if ($this->curr['month']==12) {
$this->curr['month'] = '01';
$this->curr['year']++;
} else {
$this->curr['month'] = $this->Base->_twoDigits(++$this->curr['month']);
}
}
if ($month=='--') {
if ($this->curr['month']=='01') {
$this->curr['month'] = 12;
$this->curr['year']--;
} else {
$this->curr['month'] = $this->Base->_twoDigits(--$this->curr['month']);
}
}
if ($day) $this->curr['day'] = $day;
if ($hour) $this->curr['hour'] = $hour;
}
@ -43,14 +59,21 @@ class uiScheduler extends uiCalendar
}
function getDayUsagePercentage($year, $month, $day)
function getDayUsage($year, $month, $day)
{
$duration = 0;
$date = $year.$month.$day;
$arr = $this->displayScheduleMethod($date.'T00:00:00', $date.'T23:59:59.999999');
if (!count($arr)) {
if (!count($arr))
return FALSE;
}
#print_r($arr);
return $arr;
}
function getDayUsagePercentage($year, $month, $day)
{
$duration = 0;
if (!$arr = $this->getDayUsage($year, $month, $day))
return false;
foreach ($arr as $val) {
$duration =+ $this->_datetime2timestamp($val['end'])-$this->_datetime2timestamp($val['start']);
@ -58,6 +81,15 @@ class uiScheduler extends uiCalendar
return $duration/86400*100;
}
function copyPlFromSP()
{
foreach ($this->Base->SCRATCHPAD->get() as $val) {
if (strtolower($val['type'])=='playlist')
$this->playlists[] = $val;
}
}
## XML-RPC methods ############################################################################################
function initXmlRpc()
{
@ -69,10 +101,10 @@ class uiScheduler extends uiCalendar
function uploadPlaylistMethod(&$formdata)
{
$gunid = $formdata['gunid'];
$datetime = $formdate['datetime'];
$r = $this->spc->UploadPlaylistMethod($this->Base->sessid, $gunid, '20050308T04:44:00.000000'.UI_TIMEZONE);
var_dump($r);
$datetime = $this->curr['year'].$this->curr['month'].$this->curr['day'].'T'.$formdata['time'];
echo $datetime;
$r = $this->spc->UploadPlaylistMethod($this->Base->sessid, $gunid, $datetime.UI_TIMEZONE);
#var_dump($r);
}