*** empty log message ***

This commit is contained in:
sebastian 2005-04-22 10:04:19 +00:00
parent 1b211176e8
commit f9ec998d96
34 changed files with 396 additions and 239 deletions

View file

@ -4,13 +4,16 @@ $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->assign_by_ref ('SCRATCHPAD', $uiBrowser->SCRATCHPAD);
$Smarty->register_function('str_repeat', 'S_str_repeat');
$Smarty->register_function('urlencode', 'S_urlencode');
$Smarty->register_function('htmlspecialchars', 'S_htmlspecialchars');
$Smarty->register_function('system', 'S_system');
$Smarty->register_function('tra', 'S_tra');
$Smarty->register_function('getHour', 'S_getHour');
$Smarty->register_function('getMinute', 'S_getMinute');
$Smarty->register_function('getSecond', 'S_getSecond');
// --- Smarty Extensions ---
/**
@ -60,20 +63,6 @@ function S_htmlspecialchars($param)
}
/**
* system
*
* Execute some PHP-code.
*
* @param code string, code to execute
*/
function S_system($param)
{
extract($param);
eval($code);
}
/**
* tra
*
@ -87,4 +76,29 @@ function S_tra($param)
echo tra($param[0], $param[1], $param[2], $param[3], $param[4], $param[5], $param[6], $param[7], $param[8], $param[9]);
}
function S_getHour($param)
{
## input format is HH:MM:SS.dddddd
extract ($param);
list ($h, $m, $s) = explode (':', $time);
return $h;
}
function S_getMinute($param)
{
## input format is HH:MM:SS.dddddd
extract ($param);
list ($h, $m, $s) = explode (':', $time);
return $m;
}
function S_getSecond($param)
{
## input format is HH:MM:SS.dddddd
extract ($param);
list ($h, $m, $s) = explode (':', $time);
return $s;
}
?>

View file

@ -88,7 +88,6 @@ if (is_array($_REQUEST['popup'])){
if ($uiBrowser->userid) {
$Smarty->assign('showMenuTop', TRUE);
$Smarty->assign('SCRATCHPAD', $uiBrowser->SCRATCHPAD->get());
switch ($_REQUEST['act']){
case "fileList":

View file

@ -256,6 +256,11 @@ switch($_REQUEST['act']){
$uiHandler->SCHEDULER->setReload();
break;
case "SCHEDULER.setScheduleTime":
$uiHandler->SCHEDULER->setScheduleTime($_REQUEST);
$uiHandler->SCHEDULER->setClose();
break;
case "SCHEDULER.addItem":
$uiHandler->SCHEDULER->uploadPlaylistMethod($_REQUEST);
$uiHandler->SCHEDULER->setReload();

View file

@ -486,6 +486,10 @@
<key>Item</key>
<value>Položka</value>
</item>
<item>
<key>Insert Playlist after previous</key>
<value />
</item>
<item>
<key>Label</key>
<value>Název</value>

View file

@ -486,6 +486,10 @@
<key>Item</key>
<value>Element</value>
</item>
<item>
<key>Insert Playlist after previous</key>
<value />
</item>
<item>
<key>Label</key>
<value />

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<language>
<status />
<Id>en_GB</Id>
<item>
<key>Are you sure to delete file &quot;$1&quot;?</key>
@ -485,6 +486,10 @@
<key>Insert Playlist here</key>
<value>Insert playlist here</value>
</item>
<item>
<key>Insert Playlist after previous</key>
<value />
</item>
<item>
<key>Item</key>
<value>Item</value>

View file

@ -486,6 +486,10 @@
<key>Item</key>
<value>Elemento</value>
</item>
<item>
<key>Insert Playlist after previous</key>
<value />
</item>
<item>
<key>Label</key>
<value>Sello</value>

View file

@ -486,6 +486,10 @@
<key>Item</key>
<value />
</item>
<item>
<key>Insert Playlist after previous</key>
<value />
</item>
<item>
<key>Label</key>
<value />

View file

@ -486,6 +486,10 @@
<key>Item</key>
<value>Item</value>
</item>
<item>
<key>Insert Playlist after previous</key>
<value />
</item>
<item>
<key>Label</key>
<value>Omschrijving</value>

View file

@ -486,6 +486,10 @@
<key>Item</key>
<value>Stavka</value>
</item>
<item>
<key>Insert Playlist after previous</key>
<value />
</item>
<item>
<key>Label</key>
<value />

View file

@ -33,20 +33,25 @@
</table>
</div>
<div class="footer" style="width: 535px;">
<div class="footer" style="width: 530px;">
<div class="counter">
{if $_results.prev}<a href="#" onClick="hpopup('{$UI_HANDLER}?act={$_act_prefix}.setOffset&page=prev', 'pager')" id="blue_head">##previous##</a>{/if}
{* {if $_results.prev}<a href="#" onClick="hpopup('{$UI_HANDLER}?act={$_act_prefix}.setOffset&page=prev', 'pager')" id="blue_head">##previous##</a>{/if} *}
{foreach from=$_results.pagination item=p key=k}
{if $k != $_results.page+1}
<a href="#" onClick="hpopup('{$UI_HANDLER}?act={$_act_prefix}.setOffset&page={$k}', 'pager')" id="blue_head">{$p}</a>
{else}
{$p}
{/if}
{/foreach}
{if $_results.next}<a href="#" onClick="hpopup('{$UI_HANDLER}?act={$_act_prefix}.setOffset&page=next', 'pager')" id="blue_head">##next##</a>{/if}
{* {if $_results.next}<a href="#" onClick="hpopup('{$UI_HANDLER}?act={$_act_prefix}.setOffset&page=next', 'pager')" id="blue_head">##next##</a>{/if} *}
&nbsp;&nbsp;
##Count##:&nbsp;{$_results.cnt}&nbsp;&nbsp;
##Page##:&nbsp;&nbsp;{$_results.page+1}&nbsp;&nbsp;
##Range##:&nbsp;{$_criteria.offset+1}-{if ($_criteria.offset+$_criteria.limit)>$_results.cnt}{$_results.cnt}{else}{$_criteria.offset+$_criteria.limit}{/if}
##Range##:&nbsp;{$_criteria.offset+1}-{if ($_criteria.offset+$_criteria.limit)>$_results.cnt}{$_results.cnt}{else}{$_criteria.offset+$_criteria.limit}{/if}&nbsp;
##Count##:&nbsp;{$_results.cnt}&nbsp;
{* ##Page##:&nbsp;&nbsp;{$_results.page+1}&nbsp;&nbsp; *}
</div>
<select name="SEARCHRESULTS_multiaction" onChange="collector_submit('SEARCHRESULTS', this.value)">

View file

@ -5,7 +5,7 @@
<form action="ui_handler.php" method="post" name="simplesearch" id="simplesearch"><input name="act" type="hidden" value="SEARCH.simpleSearch" />
<div>
<input size="20" maxlength="50" name="criterium" type="text" style="width: 184px;" />
<input type="button" class="button_small" value="##Go##" />
<input type="button" class="button_small" value="##Go##" onClick="submit()"/>
</div>
</form>
</div>

View file

@ -4,14 +4,17 @@
{include file="menu.tpl"}
{/if}
{*
{if $structure}
{include file="file/path.tpl"}
{/if}
*}
{if $showScheduler}
<table style="margin:0px;padding:0px;" border="0"><tr><td valign="top" style="margin:0px;padding:0px;border:0">
{if $USER.userid} {* somebody logged in? *}
{*
{if $structure}
{include file="file/path.tpl"}
{/if}
*}
{if $showScheduler}
<table style="margin:0px;padding:0px;" border="0"><tr><td valign="top" style="margin:0px;padding:0px;border:0">
<div class="content">
{include file="scheduler/calendar.tpl"}
{if $SCRATCHPAD}
@ -21,7 +24,7 @@
</td><td valign="top" style="margin:0px;padding:0px;border:0">
{include file="scheduler/main.tpl"}
</td></tr></table>
{else}
{else}
{if $fileList}
{include file="file/list.tpl"}
@ -60,4 +63,6 @@
{include file="scratchpad/main.tpl"}
{/if}
</div>
{/if}
{/if}

View file

@ -1,7 +1,7 @@
{include file="popup/header.tpl"}
<center>
<b>##Are you sure to delete active Playlist?##</b>
##Are you sure to delete active Playlist?##
<br><br>
<input type="button" class="button" onClick="window.close()" value="Cancel">
<input type="button" class="button" onClick="location.href='{$UI_HANDLER}?act=PL.deleteActive'" value="OK">

View file

@ -1,7 +1,7 @@
{include file="popup/header.tpl"}
<center>
<b>##Do you want to save changes?##</b>
##Do you want to save changes?##
<br><br>
<input type="button" class="button" onClick="window.close()" value="Cancel">
<input type="button" class="button" onClick="location.href='{$UI_HANDLER}?act=PL.revertANDclose'" value="No">

View file

@ -1,7 +1,7 @@
{include file="popup/header.tpl"}
<center>
<b>##Are you sure to discard all changes?##</b>
##Are you sure to discard all changes?##
<br><br>
<input type="button" class="button" onClick="window.close()" value="Cancel">
<input type="button" class="button" onClick="location.href='{$UI_HANDLER}?act=PL.revert'" value="OK">

View file

@ -1,6 +1,6 @@
{include file="popup/header.tpl"}
{if $SCHEDULER->_copyPlFromSP()}
{if $SCHEDULER->copyPlFromSP()}
{assign var="dynform" value=$SCHEDULER->getScheduleForm()}
<table height="100%" width="100%">
<tr>
@ -17,7 +17,7 @@
</table>
{else}
<center>
##You need to have at least one inactive playlist on ScratchPad to schedule it.##
##You need to have at least one non-open playlist on ScratchPad to schedule it.##
</center>
{/if}

View file

@ -1,7 +1,7 @@
{include file="popup/header.tpl"}
<center>
<b>{tra 0='Are you sure to remove playlist "$1"?' 1=$plname}</b>
{tra 0='Are you sure to remove playlist "$1"?' 1=$plname}
<br><br>
<input type="button" class="button" onClick="window.close()" value="Cancel">
<input type="button" class="button" onClick="location.href='{$UI_HANDLER}?act=SCHEDULER.removeItem&scheduleId={$scheduleId}'" value="OK">

View file

@ -1,7 +1,7 @@
{include file="popup/header.tpl"}
<center>
<b>{tra 0='Are you sure to delete file "$1"?' 1=$filename}</b>
{tra 0='Are you sure to delete file "$1"?' 1=$filename}
<br><br>
<input type="button" class="button" onClick="window.close()" value="Cancel">
<input type="button" class="button" onClick="location.href='{$UI_HANDLER}?act=delete&id={$id}'" value="OK">

View file

@ -1,7 +1,7 @@
{include file="popup/header.tpl"}
<center>
<b>{tra 0='Are you sure to logout $1?' 1=$USER.login}</b>
{tra 0='Are you sure to logout $1?' 1=$USER.login}
<br><br>
<input type="button" class="button" value="{tra 0=Cancel}" onclick="javascript: window.close()">
<input type="button" class="button" value="{tra 0=OK}" onclick="javascript: location.href='{$UI_HANDLER}?act={$logouttype}'">&nbsp;

View file

@ -46,7 +46,7 @@
<td class="firstrow" style="border-left: 1px solid #ccc">{$_hour}</td>
{foreach from=$SCHEDULER->Week item="_day"}
{if is_array($_entrys[$_day.day][$_hour])}
<td class="date_full" onClick="return contextmenu('year={$_day.year}&month={$_day.month}&day={$_day.day}&hour={$_hour}', 'SCHEDULER.addItem')"></td>
<td class="date_full" {include file="scheduler/context_week.tpl"}></td>
<td class="day_full">
{foreach from=$_entrys[$_day.day][$_hour] item="i"}
<div {include file="scheduler/actionhandler.tpl"}>
@ -54,11 +54,12 @@
<p>{$i.start|truncate:5:""} - {$i.end|truncate:5:""}</p>
<p>{$i.creator}</p>
</div>
<div style="background-color: #FF6F1F; height: 3px" onClick="return contextmenu('year={$_day.year}&month={$_day.month}&day={$_day.day}&hour={getHour time=$i.end}&minute={getMinute time=$i.end}&second={getSecond time=$i.end}', 'SCHEDULER.addNextItem')" ></div>
{/foreach}
</td>
{else}
<td class="date" onClick="return contextmenu('year={$_day.year}&month={$_day.month}&day={$_day.day}&hour={$_hour}', 'SCHEDULER.addItem')"></td>
<td class="day" onClick="return contextmenu('year={$_day.year}&month={$_day.month}&day={$_day.day}&hour={$_hour}', 'SCHEDULER.addItem')"></td>
<td class="date" {include file="scheduler/context_week.tpl"}></td>
<td class="day" {include file="scheduler/context_week.tpl"}></td>
{/if}
{/foreach}
</tr>

View file

@ -2,7 +2,7 @@
onClick="hidealttextnow(); return contextmenu('{$i.id}'
, 'SP.removeItem'
{if $i.type|lower == 'audioclip'}
{if $i.type === 'audioclip'}
, 'listen', '{$i.gunid}'
{if $_PL_activeId}
, 'PL.addItem'
@ -12,7 +12,7 @@ onClick="hidealttextnow(); return contextmenu('{$i.id}'
, 'edit', 'delete'
{/if}
{if $i.type|lower == 'webstream'}
{if $i.type === 'webstream'}
{if $_PL_activeId}
, 'PL.addItem'
{else}
@ -21,14 +21,14 @@ onClick="hidealttextnow(); return contextmenu('{$i.id}'
, 'edit', 'delete'
{/if}
{if $i.type|lower == 'playlist'}
{if $i.type === 'playlist'}
{if $_PL_activeId}
{if $_PL_activeId == $i.id}
{if $_PL_activeId === $i.id}
, 'PL.release'
{else}
{elseif $PL->isAvailable($i.id) === TRUE}
, 'PL.addItem', 'delete'
{/if}
{else}
{elseif $PL->isAvailable($i.id) === TRUE}
, 'PL.activate', 'PL.create', 'delete'
{/if}
{/if}

View file

@ -1,13 +1,14 @@
{assign var="_PL_activeId" value=$PL->getActiveId()}
{assign var="SCRATCHPAD" value=$SCRATCHPAD->get()}
<!-- start scratch pad -->
{if is_array($SCRATCHPAD)}
<form name="SP">
<div class="container_elements">
<h1>##ScratchPad##</h1>
<div class="head" style="width:255px; height: 21px;">&nbsp;</div>
<div class="container_table" style="width:275px;">
<table style="width:255px;">
<!-- start table header -->
<tr class="blue_head">
<td style="width: 30px"><input type="checkbox" name="all" onClick="collector_switchAll('SP')"></td>
@ -17,26 +18,43 @@
</tr>
<!-- end table header -->
{if count($SCRATCHPAD) >= 1}
{foreach from=$SCRATCHPAD item=i}
<!-- start item -->
<tr class="{cycle values='blue1, blue2'}">
<td><input type="checkbox" class="checkbox" name="{$i.id}"/></td>
<td {include file="scratchpad/actionhandler.tpl"}>
{if $_PL_activeId == $i.id}
<b>{$i.title|truncate:12}</b>
{if $i.type === "playlist"}
{if $PL->isAvailable($i.id) === FALSE}
<div style="text-decoration : line-through">
{else}
<div>
{/if}
{if $_PL_activeId === $i.id}
<div style="font-weight : bold">
{else}
<div>
{/if}
{$i.title|truncate:12}
</div></div>
{else}
{$i.title|truncate:12}
{/if}
</td>
<td {include file="scratchpad/actionhandler.tpl"}>{$i.duration}</td>
<td {include file="scratchpad/actionhandler.tpl"} style="border: 0"><img src="img/{$i.type|lower}.gif" border="0" alt="{$i.type|lower|capitalize}" /></td>
<td {include file="scratchpad/actionhandler.tpl"} style="border: 0"><img src="img/{$i.type}.gif" border="0" alt="{$i.type|capitalize}" /></td>
</tr>
{/foreach}
<!-- end item -->
{/foreach}
{else}
<tr class="blue1">
<td style="border: 0" colspan="4" align="center">##empty##</td>
</tr>
{/if}
</table>
</div>
<div class="footer" style="width:255px;">
<div class="footer" style="width:250px;">
<select name="SP_multiaction" onChange="collector_submit('SP', this.value)">
<option>##Multiple Action:##</option>
<option value="SP.removeItem">##Remove file(s)##</option>
@ -53,9 +71,9 @@
</script>
<a href="#" onClick="collector_clearAll('SP', 'SP.removeItem')" id="blue_head">##Clear##</a>
</div>
</div>
</form>
{/if}
<!-- end scratch pad -->
{assign var="_PL_activeId" value=NULL}

View file

@ -94,7 +94,11 @@
break;
case "SCHEDULER.addItem":
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href='#' onClick=\"hpopup('{$UI_HANDLER}?act=SCHEDULER.set&"+param+"'); popup('{$UI_BROWSER}?popup[]=SCHEDULER.addItem', 'Schedule', 420, 200)\"')"+oF+">&nbsp;##Insert Playlist here##&nbsp;</a></li>";
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href='#' onClick=\"hpopup('{$UI_HANDLER}?act=SCHEDULER.setScheduleTime&"+param+"'); popup('{$UI_BROWSER}?popup[]=SCHEDULER.addItem', 'Schedule', 420, 200)\"')"+oF+">&nbsp;##Insert Playlist here##&nbsp;</a></li>";
break;
case "SCHEDULER.addNextItem":
contextmenuHtml = contextmenuHtml + "<li><a class='contextmenu' href='#' onClick=\"hpopup('{$UI_HANDLER}?act=SCHEDULER.setScheduleTime&"+param+"'); popup('{$UI_BROWSER}?popup[]=SCHEDULER.addItem', 'Schedule', 420, 200)\"')"+oF+">&nbsp;##Insert Playlist after previous##&nbsp;</a></li>";
break;
case "SCHEDULER.removeItem":

View file

@ -1,5 +1,3 @@
{*Smarty template*}
{if $USER.userid}
<div class="loginname">##Signed in## : {$USER.login}</div>
<input type="button" class="button" value="{tra 0=logout}" onClick='javascript: popup("{$UI_BROWSER}?popup[]=logout", "name", "400", "50");'/>

View file

@ -326,12 +326,14 @@ class uiBase
function _getMetaInfo($id)
{
$type = strtolower($this->gb->getFileType($id));
$data = array('id' => $id,
'gunid' => $this->gb->_gunidFromId($id),
'title' => $this->_getMDataValue($id, UI_MDATA_KEY_TITLE),
'creator' => $this->_getMDataValue($id, UI_MDATA_KEY_CREATOR),
'duration' => $this->_niceTime($this->_getMDataValue($id, UI_MDATA_KEY_DURATION)),
'type' => $this->gb->getFileType($id),
'type' => $type,
#'isAvailable' => $type == 'playlist' ? $this->gb->playlistIsAvailable($id, $this->sessid) : NULL,
);
return ($data);
}

View file

@ -9,7 +9,7 @@ class uiBrowse
#$this->results =& $_SESSION[UI_BROWSE_SESSNAME]['results'];
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
$this->criteria['limit'] ? NULL : $this->criteria['limit'] = 10;
$this->criteria['limit'] ? NULL : $this->criteria['limit'] = UI_BROWSE_DEFAULT_LIMIT;
if (!is_array($this->col)) {
$this->setDefaults();
@ -21,21 +21,20 @@ class uiBrowse
$this->Base->redirUrl = $this->reloadUrl;
}
function setDefaults($reload=FALSE)
{
$this->col[1]['category'] = 'dc:type';
$this->col[1]['category'] = UI_BROWSE_DEFAULT_KEY_1;
$this->col[1]['value'][0] = '%%all%%';
$this->col[2]['category'] = 'dc:creator';
$this->col[2]['category'] = UI_BROWSE_DEFAULT_KEY_2;
$this->col[2]['value'][0] = '%%all%%';
$this->col[3]['category'] = 'dc:source';
$this->col[3]['category'] = UI_BROWSE_DEFAULT_KEY_3;
$this->col[3]['value'][0] = '%%all%%';
for ($col=1; $col<=3; $col++) {
$this->setCategory(array('col' => $col, 'category' => $this->col[$col]['category'], 'value' => array(0=>'%%all%%')));
$this->setCategory(array('col' => $col, 'category' => $this->col[$col]['category'], 'value' => array(0 => '%%all%%')));
}
$this->setValue(array('col' => 1,
'category' => 'dc:type',
'category' => UI_BROWSE_DEFAULTKEY_1,
'value' => Array(0 => '%%all%%')
)
);
@ -183,7 +182,7 @@ class uiBrowse
(
'id' => 24,
'gunid' => '1cc472228d0cb2ac',
'title' => 'Strom 10min',
'title' => 'Item '.$n,
'creator' => 'Sebastian',
'duration' => '&nbsp;&nbsp;&nbsp;10:00',
'type' => 'webstream'
@ -193,6 +192,7 @@ class uiBrowse
$this->results['cnt'] = $results['cnt'];
## end test
*/
$this->pagination($results);
#print_r($this->criteria);
#print_r($this->results);
@ -205,17 +205,31 @@ class uiBrowse
if (sizeof($this->results['items']) == 0) {
return FALSE;
}
$currp = ($this->criteria['offset']/$this->criteria['limit']) + 1; # current page
$delta = 4;
$currp = ($this->criteria['offset'] / $this->criteria['limit']) + 1; # current page
$maxp = ceil($results['cnt'] / $this->criteria['limit']); # maximum page
/*
for ($n = 1; $n <= $maxp; $n = $n+$width) {
$width = pow(10, floor(($n)/10));
$this->results['pagination'][$n] = $n;
}
*/
$deltaLower = UI_BROWSERESULTS_DELTA;
$deltaUpper = UI_BROWSERESULTS_DELTA;
$start = $currp;
if ($start+$delta-$maxp > 0) $deltaLower += $start+$delta-$maxp; ## correct lower boarder if page is near end
for ($n = $start-$deltaLower; $n <= $start+$deltaUpper; $n++) {
if ($n <= 0) $deltaUpper++; ## correct upper boarder if page is near zero
elseif ($n <= $maxp) $this->results['pagination'][$n] = $n;
}
#array_pop($this->results['pagination']);
$this->results['pagination'][1] = '|<<';
$this->results['pagination'][$maxp] = '>>|';
$this->results['pagination'][1] ? NULL : $this->results['pagination'][1] = '|<<';
$this->results['pagination'][$maxp] ? NULL : $this->results['pagination'][$maxp] = '>>|';
$this->results['next'] = $results['cnt'] > $this->criteria['offset'] + $this->criteria['limit'] ? TRUE : FALSE;
$this->results['prev'] = $this->criteria['offset'] > 0 ? TRUE : FALSE;
ksort($this->results['pagination']);
@ -263,6 +277,7 @@ class uiBrowse
function setFiletype($filetype)
{
$this->criteria['filetype'] = $filetype;
$this->criteria['offset'] = 0;
$this->setReload();
#$this->searchDB();
}

View file

@ -323,7 +323,8 @@ class uiBrowser extends uiBase {
'actions' => $this->gb->getAllowedActions($this->gb->getObjType($id)),
'subjects' => $this->gb->getSubjects(),
'id' => $id,
'loggedAs' => $this->login);
'loggedAs' => $this->login
);
}

View file

@ -7,8 +7,11 @@ define('UI_DEFAULT_LANGID', 'en_GB');
#define('UI_TIMEZONE', ' +100');
define('UI_TIMEZONEOFFSET', date('Z'));
## Basic scripts
define('UI_HANDLER', 'ui_handler.php');
define('UI_BROWSER', 'ui_browser.php');
## HTML Form stuff
define('UI_FORM_STANDARD_METHOD', 'POST');
define('UI_INPUT_STANDARD_SIZE', 20);
define('UI_INPUT_STANDARD_MAXLENGTH', 50);
@ -18,8 +21,9 @@ define('UI_BUTTON_STYLE', 'button');
define('UI_QFORM_REQUIRED', '../templates/sub/form_required.tpl');
define('UI_QFORM_REQUIREDNOTE', '../templates/sub/form_requirednote.tpl');
define('UI_QFORM_ERROR', '../templates/sub/form_error.tpl');
define('UI_SEARCH_MAX_ROWS', 8);
define('UI_REGEX_URL', '/^(ht|f)tps?:\/\/[^ ]+$/');
## DB ls_pref keys
define('UI_PL_ACCESSTOKEN_KEY', 'playlistToken');
define('UI_SCRATCHPAD_KEY', 'djBagContents');
define('UI_SCRATCHPAD_MAXLENGTH_KEY', 'djBagMaxlength');
@ -28,9 +32,9 @@ define('UI_SCRATCHPAD_MAXLENGTH_KEY', 'djBagMaxlength');
## Session Keys
define('UI_SCRATCHPAD_SESSNAME', 'SCRATCHPAD');
define('UI_STATIONINFO_SESSNAME', 'STATIONINFO');
define('UI_BROWSE_SESSNAME', 'L_BROWSE');
define('UI_SEARCH_SESSNAME', 'L_SEARCH');
define('UI_PLAYLIST_SESSNAME', 'PLAYLIST');
define('UI_BROWSE_SESSNAME', 'L_BROWSE');
define('UI_MDATA_REC_SESSNAME', 'MDATAREC');
## Metadata Keys
@ -39,14 +43,14 @@ define('UI_MDATA_KEY_CREATOR', 'dc:creator');
define('UI_MDATA_KEY_DURATION', 'dcterms:extent');
define('UI_MDATA_KEY_URL', 'ls:url');
define('UI_MDATA_KEY_FORMAT', 'dc:format');
define('UI_MDATA_KEY_DESCRIPTION','dc:description');
define('UI_MDATA_KEY_DESCRIPTION', 'dc:description');
define('UI_MDATA_VALUE_FORMAT_FILE', 'File');
define('UI_MDATA_VALUE_FORMAT_STREAM', 'live stream');
## Simple Search Preferences
## Search/Browse preferences
define('UI_SIMPLESEARCH_FILETYPE', 'File');
define('UI_SIMPLESEARCH_OPERATOR', 'OR');
define('UI_SIMPLESEARCH_LIMIT', 5);
define('UI_SIMPLESEARCH_LIMIT', 10);
define('UI_SIMPLESEARCH_ROWS', 3);
define('UI_SIMPLESEARCH_CAT1', 'dc:title');
define('UI_SIMPLESEARCH_OP1', 'partial');
@ -55,11 +59,23 @@ define('UI_SIMPLESEARCH_OP2', 'partial');
define('UI_SIMPLESEARCH_CAT3', 'dc:source');
define('UI_SIMPLESEARCH_OP3', 'partial');
define('UI_SEARCH_MAX_ROWS', 8);
define('UI_SEARCH_DEFAULT_LIMIT', 10);
define('UI_SEARCHRESULTS_DELTA', 4);
define('UI_BROWSERESULTS_DELTA', 4);
define('UI_BROWSE_DEFAULT_KEY_1', 'dc:type');
define('UI_BROWSE_DEFAULT_KEY_2', 'dc:creator');
define('UI_BROWSE_DEFAULT_KEY_3', 'dc:source');
define('UI_BROWSE_DEFAULT_LIMIT', 10);
## Scheduler / Calendar
define('UI_SCHEDULER_FIRSTWEEKDAY', 1);
## LS stuff
require_once dirname(__FILE__).'/../../storageServer/var/conf.php';
## LS classes/functions #############################################
require_once dirname(__FILE__).'/ui_base.inc.php';
require_once dirname(__FILE__).'/ui_scratchpad.class.php';
require_once dirname(__FILE__).'/ui_playlist.class.php';
@ -70,7 +86,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';
## well known classes ###############################################
## well known classes
require_once 'DB.php';
require_once 'HTML/QuickForm.php';

View file

@ -530,13 +530,13 @@ class uiHandler extends uiBase {
*/
function addPerm($subj, $permAction, $id, $allowDeny)
{
if($this->gb->checkPerm($this->userid, 'editPerms', $id)){
$this->gb->addPerm($subj, $permAction,
$id, $allowDeny);
}else{
#if($this->gb->checkPerm($this->userid, 'editPerms', $id)){
if (PEAR::isError($this->gb->addPerm($subj, $permAction, $id, $allowDeny))) {
$this->_retMsg('Access denied.');
return FALSE;
}
$this->redirUrl = UI_BROWSER.'?act=permissions&id='.$id;
return TRUE;
}
/**
@ -549,10 +549,13 @@ class uiHandler extends uiBase {
*/
function removePerm($permid, $oid)
{
if($this->gb->checkPerm($this->userid, 'editPerms', $oid))
$this->gb->removePerm($permid);
else $this->_retMsg('Access denied.');
#if($this->gb->checkPerm($this->userid, 'editPerms', $oid))
if (PEAR::isError($this->gb->removePerm($permid))) {
$this->_retMsg('Access denied.');
return FALSE;
}
$this->redirUrl = UI_BROWSER.'?act=permissions&id='.$oid;
return TRUE;
}

View file

@ -57,8 +57,8 @@ class uiPlaylist
}
$token = $this->Base->gb->lockPlaylistForEdit($plid, $this->Base->sessid);
if (PEAR::isError($token)) {
#print_r($this->token);
$this->Base->_retMsg('Unable to activate playlist "$1"'. $this->Base->_getMDataValue($plid, UI_MDATA_KEY_TITLE));
#print_r($token);
$this->Base->_retMsg('Unable to activate playlist "$1"', $this->Base->_getMDataValue($plid, UI_MDATA_KEY_TITLE));
return FALSE;
}
$this->token = $token;
@ -452,6 +452,14 @@ class uiPlaylist
}
function isAvailable($id)
{
if (strtolower($this->Base->gb->getFileType($id))==="playlist" && $this->Base->gb->playlistIsAvailable($id, $this->Base->sessid) === TRUE)
return TRUE;
return FALSE;
}
function _plTimeToSecs($plt, $length=4)
{
$arr = split(':', $plt);

View file

@ -4,6 +4,8 @@ class uiScheduler extends uiCalendar
function uiScheduler(&$uiBase)
{
$this->curr =& $_SESSION[UI_CALENDAR_SESSNAME]['current'];
$this->scheduleAt =& $_SESSION[UI_CALENDAR_SESSNAME]['schedule'];
if (!is_array($this->curr)) {
$this->curr['view'] = 'month';
$this->curr['year'] = strftime("%Y");
@ -18,6 +20,7 @@ class uiScheduler extends uiCalendar
$this->Base =& $uiBase;
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
$this->closeUrl = UI_BROWSER.'?popup[]=_close';
$this->uiCalendar();
$this->initXmlRpc();
@ -29,6 +32,13 @@ class uiScheduler extends uiCalendar
$this->Base->redirUrl = $this->reloadUrl;
}
function setClose()
{
$this->Base->redirUrl = $this->closeUrl;
}
function set($arr)
{
extract($arr);
@ -43,17 +53,17 @@ class uiScheduler extends uiCalendar
$stampNow = $this->_datetime2timestamp($this->curr['year'].$this->curr['month'].$this->curr['day'].'T'.$this->curr['hour'].':00:00');
$stampTarget = $stampNow;
if ($month=='++')
if ($month==='++')
$stampTarget = strtotime("+1 month", $stampNow);
if ($month=='--')
if ($month==='--')
$stampTarget = strtotime("-1 month", $stampNow);
if ($week=='++')
if ($week==='++')
$stampTarget = strtotime("+1 week", $stampNow);
if ($week=='--')
if ($week==='--')
$stampTarget = strtotime("-1 week", $stampNow);
if ($day=='++')
if ($day==='++')
$stampTarget = strtotime("+1 day", $stampNow);
if ($day=='--')
if ($day==='--')
$stampTarget = strtotime("-1 day", $stampNow);
if ($today)
@ -67,7 +77,7 @@ class uiScheduler extends uiCalendar
$this->curr['dayname'] = strftime("%A", $stampTarget);
$this->curr['monthname']= strftime("%B", $stampTarget);
if ($this->curr['year'] == strftime("%Y") && $this->curr['month'] == strftime("%m") && $this->curr['day'] == strftime("%d"))
if ($this->curr['year'] === strftime("%Y") && $this->curr['month'] === strftime("%m") && $this->curr['day'] === strftime("%d"))
$this->curr['isToday'] = TRUE;
else
$this->curr['isToday'] = FALSE;
@ -75,6 +85,19 @@ class uiScheduler extends uiCalendar
}
function setscheduleAt($arr)
{
extract($arr);
#print_r($arr);
if (is_numeric($year)) $this->scheduleAt['year'] = $year;
if (is_numeric($month)) $this->scheduleAt['month'] = sprintf('%02d', $month);
if (is_numeric($day)) $this->scheduleAt['day'] = sprintf('%02d', $day);
if (is_numeric($hour)) $this->scheduleAt['hour'] = sprintf('%02d', $hour);
if (is_numeric($minute)) $this->scheduleAt['minute'] = sprintf('%02d', $minute);
if (is_numeric($second)) $this->scheduleAt['second'] = sprintf('%02d', $second);
}
function getWeekEntrys()
{
## build array within all entrys of current week ##
@ -242,15 +265,19 @@ class uiScheduler extends uiCalendar
function getScheduleForm()
{
global $ui_fmask;
foreach ($this->playlists as $val)
foreach ($this->availablePlaylists as $val)
$ui_fmask['schedule']['playlist']['options'][$val['gunid']] = $val['title'];
#print_r($ui_fmask);
$form = new HTML_QuickForm('schedule', UI_STANDARD_FORM_METHOD, UI_HANDLER);
$this->Base->_parseArr2Form($form, $ui_fmask['schedule']);
$settime = array('H' => $this->curr['hour']);
$setdate = array('Y' => $this->curr['year'],
'm' => $this->curr['month'],
'd' => $this->curr['day']);
$settime = array('H' => $this->scheduleAt['hour'],
'i' => $this->scheduleAt['minute'],
's' => $this->scheduleAt['second']
);
$setdate = array('Y' => $this->scheduleAt['year'],
'm' => $this->scheduleAt['month'],
'd' => $this->scheduleAt['day']);
$form->setDefaults(array('time' => $settime,
'date' => $setdate,
'playlist' => $setplaylist));
@ -263,6 +290,19 @@ class uiScheduler extends uiCalendar
}
function copyPlFromSP()
{
foreach ($this->Base->SCRATCHPAD->get() as $val) {
if ($val['type'] === 'playlist' && $this->Base->gb->playlistIsAvailable($val['id'], $this->Base->sessid) === TRUE && $val['id'] != $this->Base->PLAYLIST->activeId)
$this->availablePlaylists[] = $val;
}
if (!count($this->availablePlaylists))
return FALSE;
return TRUE;
}
function getNowNextClip($distance=0)
{
$datetime = strftime('%Y-%m-%dT%H:%M:%S');
@ -286,18 +326,6 @@ class uiScheduler extends uiCalendar
}
function _copyPlFromSP()
{
foreach ($this->Base->SCRATCHPAD->get() as $val) {
if (strtolower($val['type'])=='playlist' && $val['id']!=$this->Base->PLAYLIST->activeId)
$this->playlists[] = $val;
}
if (!count($this->playlists))
return FALSE;
return TRUE;
}
function _datetime2timestamp($i)
{
$i = str_replace('T', ' ', $i);
@ -321,11 +349,11 @@ class uiScheduler extends uiCalendar
function _scheduledDays($period)
{
if ($period=='month') {
if ($period==='month') {
require_once 'Calendar/Month/Weekdays.php';
$Period = new Calendar_Month_Weekdays($this->curr['year'], $this->curr['month'], $this->firstDayOfWeek);
$Period->build();
} elseif ($period=='week') {
} elseif ($period==='week') {
require_once 'Calendar/Week.php';
$Period = new Calendar_Week ($this->curr['year'], $this->curr['month'], $this->curr['day'], $this->firstDayOfWeek);
$Period->build();

View file

@ -125,7 +125,7 @@ class uiSearch
$this->criteria['counter'] = UI_SIMPLESEARCH_ROWS;
$this->criteria['form']['operator'] = 'OR'; ## $criteria['form'] is used for retransfer to form ##
$this->criteria['form']['filetype'] = 'File';
$this->criteria['form']['limit'] = 5;
$this->criteria['form']['limit'] = UI_SIMPLESEARCH_LIMIT;
for ($n = 1; $n<=UI_SIMPLESEARCH_ROWS; $n++) {
$this->criteria['conditions'][$n] = array('cat' => constant('UI_SIMPLESEARCH_CAT'.$n),
@ -147,7 +147,7 @@ class uiSearch
if (count($this->criteria) === 0)
return FALSE;
$this->results = array('page' => $this->criteria['offset']/$this->criteria['limit']);
$this->results = array('page' => $this->criteria['offset'] / $this->criteria['limit']);
#print_r($this->criteria);
$results = $this->Base->gb->localSearch($this->criteria, $this->Base->sessid);
@ -167,7 +167,7 @@ class uiSearch
(
'id' => 24,
'gunid' => '1cc472228d0cb2ac',
'title' => 'Strom 10min',
'title' => 'Item '.$n,
'creator' => 'Sebastian',
'duration' => '&nbsp;&nbsp;&nbsp;10:00',
'type' => 'webstream'
@ -185,28 +185,34 @@ class uiSearch
function pagination(&$results)
{
if (sizeof($this->results) == 0) {
if (sizeof($this->results['items']) == 0) {
return FALSE;
}
$pot = 0; # potence
$lpr = 10; # links pro range
$width = 1; # width bettween pages
$currp = ($this->criteria['offset']/$this->criteria['limit']) +1 ; # current page
$maxp = ceil($results['cnt']/$this->criteria['limit']); # maximum page
$currp = ($this->criteria['offset'] / $this->criteria['limit']) + 1; # current page
$maxp = ceil($results['cnt'] / $this->criteria['limit']); # maximum page
/*
for ($n = 1; $n <= $maxp; $n = $n+$width) {
if ($n<$currp)
$width = pow($lpr, floor(log10(abs($n-$currp))));
else
$width = pow($lpr, floor(log10(abs($n-$currp)+1)));
$width = pow(10, floor(($n)/10));
$this->results['pagination'][$n] = $n;
}
*/
$deltaLower = UI_SEARCHRESULTS_DELTA;
$deltaUpper = UI_SEARCHRESULTS_DELTA;
$start = $currp;
if ($start+$delta-$maxp > 0) $deltaLower += $start+$delta-$maxp; ## correct lower boarder if page is near end
for ($n = $start-$deltaLower; $n <= $start+$deltaUpper; $n++) {
if ($n <= 0) $deltaUpper++; ## correct upper boarder if page is near zero
elseif ($n <= $maxp) $this->results['pagination'][$n] = $n;
}
#array_pop($this->results['pagination']);
$this->results['pagination'][$maxp] = '>>|';
$this->results['pagination'][1] = '|<<';
$this->results['pagination'][1] ? NULL : $this->results['pagination'][1] = '|<<';
$this->results['pagination'][$maxp] ? NULL : $this->results['pagination'][$maxp] = '>>|';
$this->results['next'] = $results['cnt'] > $this->criteria['offset'] + $this->criteria['limit'] ? TRUE : FALSE;
$this->results['prev'] = $this->criteria['offset'] > 0 ? TRUE : FALSE;
ksort($this->results['pagination']);