*** empty log message ***

This commit is contained in:
sebastian 2005-02-25 20:44:39 +00:00
parent f858f935c2
commit a8d5505d51
12 changed files with 211 additions and 76 deletions

View File

@ -42,8 +42,9 @@ if (is_array($_REQUEST['popup'])){
if ($uiBrowser->userid) {
$Smarty->assign('showMenuTop', TRUE);
$Smarty->assign('SCRATCHPAD', $uiBrowser->SCRATCHPAD->get());
$Smarty->assign('PLAYLIST', $uiBrowser->PLAYLIST->get());
$Smarty->assign('SCRATCHPAD', $uiBrowser->SCRATCHPAD->get());
$Smarty->assign('PLid', $uiBrowser->PLAYLIST->activeId);
$Smarty->register_object('PL', $uiBrowser->PLAYLIST);
switch ($_REQUEST['act']){
case "fileBrowse":
@ -147,8 +148,11 @@ if ($uiBrowser->userid) {
$Smarty->assign('changeStationPrefs', TRUE);
break;
case "PL.simpleManagement":
$uiBrowser->PLAYLIST->testNew();
case "PL.simpleManagement": print_r($uiBrowser->PLAYLIST->get());
if ($_REQUEST['createNew']) {
$uiBrowser->PLAYLIST->testNew();
#$Smarty->assign('PLAYLIST', $uiBrowser->PLAYLIST->get());
}
$Smarty->assign('PL_simpleManagement', TRUE);
break;
}

View File

@ -11,28 +11,17 @@
</tr>
{if count($structure.listdata)}
{foreach from=$structure.listdata item=i}
<tr bgcolor="{cycle values='#eeeeee, #dadada"'}"
onMouseOver="highlight()" onMouseOut="darklight()"
onContextmenu="return menu('{$i.id}'
{if ($i.type == 'audioclip' || $i.type == 'webstream')}
,'PL.addItem', 'PL.newUsingItem', 'SP.addItem', 'delete'
{/if}
{if ($i.type == 'playlist')}
,'PL.activate'
{if $PLAYLIST.id == $i.id}
,'PL.release'
{else}
,'PL.addItem', 'SP.addItem', 'delete'
{/if}
{/if}
)"
>
<tr bgcolor="{cycle values='#eeeeee, #dadada"'}" {assign var="moreContextBefore" value=", 'SP.addItem'"}{include file="sub/contextmenu.tpl"}>
<td align="center">
<span id="ID{$i.id}">
{if $i.type eq 'Folder'}
<a href="{$UI_BROWSER}?act=fileBrowse&id={$i.id}" >[{$i.title|truncate:30}]</b>
{else}
{$i.title|truncate:30}
{if $PLid == $i.id}
<b>{$i.title|truncate:30}</b>
{else}
{$i.title|truncate:30}
{/if}
{/if}
</span>
</td>

View File

@ -5,7 +5,7 @@
<link rel="stylesheet" href="styles.css">
{include file="script/basics.js.tpl"}
{include file="script/myKontextMenue.js.tpl"}
{include file="script/contextMenue.js.tpl"}
</head>
<body>

View File

@ -6,13 +6,18 @@
<div align="center"><b>Simple Playlist Management</b></div>
<br>
{if is_array($PLAYLIST) && count($PLAYLIST)} {* already activated Playlist *}
{foreach from=$PLAYLIST item=pl}
{PL->get assign='PL'}
{if is_array($PL)} {* already activated Playlist *}
active Playlist: {$PL.children.0.children.0.content}
<br>
{foreach from=$PL item=pl}
{$pl}
<br>
{/foreach}
{else} {* no active Playlist *}
No Playlist
No active Playlist!
<br>
<input type="button" value="Make new Playlist" onClick="location.href='{$UI_BRWOSER}?act=PL.simpleManagement&createNew=1'">
{/if}

View File

@ -1,9 +1,9 @@
{*Smarty template*}
{include file="script/scratchPad.js.tpl"}
<div id="scratchpad">
<center><b>%%ScratchPad%%</b>
{if is_array($SCRATCHPAD)}
<form name="SP">
<input type="hidden" name="act">
@ -17,24 +17,15 @@
</tr>
{foreach from=$SCRATCHPAD item=i}
<tr style="background-color: {cycle values='#eeeeee, #dadada'}"
onMouseOver="highlight()" onMouseOut="darklight()"
onContextmenu="return menu('{$i.id}'
{if ($i.type == 'audioclip' || $i.type == 'webstream')}
,'PL.addItem', 'PL.newUsingItem', 'SP.removeItem', 'delete'
{/if}
{if ($i.type == 'playlist')}
,'PL.activate'
{if $PLAYLIST.id == $i.id}
,'PL.release'
{else}
,'PL.addItem', 'SP.removeItem', 'delete'
{/if}
{/if}
)"
>
<tr style="background-color: {cycle values='#eeeeee, #dadada'}" {assign var="moreContextBefore" value=", 'SP.removeItem'"} {include file="sub/contextmenu.tpl"}>
<td><input type="checkbox" name="{$i.id}"></td>
<td>{$i.title|truncate:10}</a></td>
<td>
{if $PLid == $i.id}
<b>{$i.title|truncate:30}</b>
{else}
{$i.title|truncate:30}
{/if}
</td>
<td>{$i.duration}</td>
<td>{$i.type} </td>
<th><a href="#" onclick="hpopup('{$UI_HANDLER}?act=SP.removeItem&id={$i.id}', 'SP')">X</th>

View File

@ -0,0 +1,110 @@
{literal}
<script type="text/javascript">
// www.jjam.de - Kontextmenü mit JavaScript - Version 15.12.2002
// Nur für IE 5+ und NN 6+
ie5=(document.getElementById && document.all && document.styleSheets)?1:0;
nn6=(document.getElementById && !document.all)?1:0;
menuStatus = 0;
document.onmouseup = hideMenu;
document.write('<div id="menucontainer"></div>');
menuWidth = 180,
menuHeight = 0;
function menu(id) {
var menuHeader = "<div id='menu' style='position:absolute;top:-250;left:0;z-index:100'>"+
"<table cellpadding='5' cellspacing='0' width='"+menuWidth+"' height='"+menuHeight+"' style='border-style:outset;border-width:1;border-color:#3a6c96;background-color:#4682B4'>";
var menuFooter = "</table></div>";
var menuHtml = '';
var sp2 = "&nbsp;&nbsp;";
var sp5 = sp2+sp2+"&nbsp;"; // Leerzeichen als Abstandshalter (flexibler und code-sparender als eine aufwendige Tabellenkonstruktion) ;
var oF = "onfocus='if(this.blur)this.blur()'"; // Um hässlichen Linkrahmen in einigen Browsern zu vermeiden;
var entry = new Array();
//menuStatus = 0;
for (var i = 1; i < menu.arguments.length; ++i) {
switch (menu.arguments[i]) {
case "PL.display":
menuHtml = menuHtml + "<tr><td><a class='menu' href=\"{/literal}{$UI_BROWSER}{literal}?act=PL.display&id="+id+"\" "+oF+">&nbsp;Display this Playlist&nbsp;</a></td></tr>";
break;
case "PL.release":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.release')\" "+oF+">&nbsp;Release Playlist&nbsp;</a></td></tr>";
break;
case "PL.addItem":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.addItem&id="+id+"')\" "+oF+">&nbsp;Add to active Playlist&nbsp;</a></td></tr>";
break;
case "PL.activate":
menuHtml = menuHtml + "<tr><td><a class='menu' href=\"javascript: hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.activate&id="+id+"')\" "+oF+">&nbsp;Activate this Playlist&nbsp;</a></td></tr>";
break;
case "PL.newUsingItem":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=PL.newUsingItem&id="+id+"')\" "+oF+">&nbsp;New Playlist using Item&nbsp;</a></td></tr>";
break;
case "SP.addItem":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=SP.addItem&id="+id+"')\" "+oF+">&nbsp;Add to ScratchPad&nbsp;</a></td></tr>";
break;
case "SP.removeItem":
menuHtml = menuHtml + "<tr><td><a class='menu' href='#' onClick=\"hpopup('{/literal}{$UI_HANDLER}{literal}?act=SP.removeItem&id="+id+"')\" "+oF+">&nbsp;Remove from Scratchpad&nbsp;</a></td></tr>";
break;
case "delete":
menuHtml = menuHtml + "<tr><td><a class='menu' href='{/literal}{$UI_HANDLER}{literal}?act=delete&id="+id+"'"+oF+">&nbsp;!Delete Item!&nbsp;</a></td></tr>";
break;
}
}
document.getElementById('menucontainer').innerHTML = menuHeader + menuHtml + menuFooter;
document.oncontextmenu = showMenu;
return false;
}
function showMenu(e) {
if(ie5) {
if(event.clientX>menuWidth) xPos=event.clientX-menuWidth+document.body.scrollLeft;
else xPos=event.clientX+document.body.scrollLeft;
if (event.clientY>menuHeight) yPos=event.clientY-menuHeight+document.body.scrollTop;
else yPos=event.clientY+document.body.scrollTop;
}
else {
if(e.pageX>menuWidth+window.pageXOffset) xPos=e.pageX-menuWidth;
else xPos=e.pageX;
if(e.pageY>menuHeight+window.pageYOffset) yPos=e.pageY-menuHeight;
else yPos=e.pageY;
}
document.getElementById("menu").style.left=xPos;
document.getElementById("menu").style.top=yPos;
menuStatus=1;
document.oncontextmenu = null;
}
function hideMenu(e) {
if (menuStatus==1) {
setTimeout("document.getElementById('menu').style.top=-250", 100);
menuStatus=0;
}
}
var passed=false;
function highlight()
{
//if (!passed) alert('try rightclick in lists...');
passed = true;
}
function darklight()
{
}
</script>
<style type="text/css">
a.menu {text-decoration:none;font-family:Verdana,Arial;font-size:80%}
a.menu:link,a.menu:visited {text-decoration:none;color:#F0F8FF}
a.menu:hover,a.menu:active {text-decoration:none;background-color:#F0F8FF;color:#000040}
hr.menu {border:0px;height:1px;background-color:#B0C4DE;color:#B0C4DE}
</style>
{/literal}

View File

@ -2,7 +2,6 @@
<div id="searchres">
<center>
{if $searchres.count > 0}
<table border="0" width="50%">
<tr style="background-color: {cycle values='#eeeeee, #dadada'}">
@ -12,23 +11,14 @@
<td align="center"><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SEARCH.reOrder&by=type', 'order');">{tra 0=Type}</a></td>
</tr>
{foreach from=$searchres.items item=i}
<tr style="background-color: {cycle values='#eeeeee, #dadada'}"
onMouseOver="highlight()" onMouseOut="darklight()"
onContextmenu="return menu('{$i.id}'
{if ($i.type == 'audioclip' || $i.type == 'webstream')}
,'PL.addItem', 'PL.newUsingItem', 'SP.addItem', 'delete'
{/if}
{if ($i.type == 'playlist')}
,'PL.activate'
{if $PLAYLIST.id == $i.id}
,'PL.release'
{else}
,'PL.addItem', 'SP.addItem', 'delete'
{/if}
{/if}
)"
>
<td align="center">{$i.title}</td>
<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.creator}</td>
<td align="center">{$i.duration}</td>
<td align="center">{$i.type}</td>
@ -60,7 +50,6 @@
{else}
No match found.
{/if}
</center>
</div>

View File

@ -0,0 +1,30 @@
onMouseOver="highlight()"
onMouseOut="darklight()"
onContextmenu="return menu('{$i.id}'
{$moreContextBefore}
{if ($i.type == 'audioclip' || $i.type == 'webstream')}
{if $PLid}
,'PL.addItem',
{else}
'PL.newUsingItem',
{/if}
'delete'
{/if}
{if ($i.type == 'playlist')}
{if $PLid}
{if $PLid == $i.id}
,'PL.release'
{else}
,'PL.addItem', 'delete'
{/if}
{else}
,'PL.activate', 'PL.newUsingItem', 'delete'
{/if}
{/if}
{$moreContextAfter}
)"
{assign var="moreContextBefore" value=""}
{assign var="moreContextAfter" value=""}

View File

@ -358,13 +358,22 @@ class uiBase
function _getMDataValue($id, $key)
{
if (is_array($arr = $this->gb->getMDataValue($id, $key, $this->sessid))) {
$value = array_pop($arr);
$value = current($arr);
return $value['value'];
}
return FALSE;
}
function _setMDataValue($id, $key, $value)
{
if ($this->gb->setMDataValue($id, $key, $this->sessid, $value)) {
return TRUE;
}
return FALSE;
}
function _getFileTitle($id)
{
if (is_array($arr = $this->gb->getPath($id))) {

View File

@ -50,7 +50,7 @@ class uiBrowser extends uiBase {
function getAlertMsg()
{
{
if ($_SESSION['alertMsg']) {
$this->alertMsg = $_SESSION['alertMsg'];
unset($_SESSION['alertMsg']);

View File

@ -35,7 +35,7 @@ $uiBase =& $uiBrowser;
## load Smarty+filters ##############################################
require_once dirname(__FILE__).'/SmartyExtensions.inc.php';
#$Smarty->load_filter('output', 'trimwhitespace');
$Smarty->load_filter('post', 'template_marker');
#$Smarty->load_filter('post', 'template_marker');
$Smarty->load_filter('post', 'localizer');

View File

@ -3,9 +3,9 @@ class uiPlaylist
{
function uiPlaylist(&$uiBase)
{
$this->Base =& $uiBase;
$this->active =& $_SESSION[UI_PLAYLIST_SESSNAME]['active'];
$this->token =& $_SESSION[UI_PLAYLIST_SESSNAME]['token'];
$this->Base =& $uiBase;
$this->activeId =& $_SESSION[UI_PLAYLIST_SESSNAME]['activeId'];
$this->token =& $_SESSION[UI_PLAYLIST_SESSNAME]['token'];
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
}
@ -16,7 +16,10 @@ class uiPlaylist
function get()
{
return is_array($this->active) ? $this->active : FALSE;
if (!$this->activeId) {
return FALSE;
}
return $this->Base->gb->getPlaylistArray($this->activeId, $this->Base->sessid);
}
function activate($plid)
@ -35,8 +38,8 @@ class uiPlaylist
}
$this->token = $this->Base->gb->lockPlaylistForEdit($plid, $this->Base->sessid);
$this->Base->gb->savePref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY, $this->token);
$this->active = $this->Base->gb->getPlaylistArray($plid, $this->Base->sessid);
$this->active['id'] = $plid;
#$this->active = $this->Base->gb->getPlaylistArray($plid, $this->Base->sessid);
$this->activeId = $plid;
$this->Base->_retMsg('Playlist "$1" activated', $this->Base->_getMDataValue($plid, 'title'));
return TRUE;
}
@ -53,8 +56,8 @@ class uiPlaylist
}
$plgunid = $this->Base->gb->releaseLockedPlaylist($this->token, $this->Base->sessid);
$this->Base->_retMsg('Playlist "$1" released', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($plgunid), 'title'));
$this->active = NULL;
$this->token = NULL;
$this->activeId = NULL;
$this->token = NULL;
$this->Base->gb->delPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY);
return TRUE;
}
@ -104,17 +107,22 @@ class uiPlaylist
$this->Base->_retMsg('Cannot create Playlist');
return FALSE;
}
$this->Base->_setMDataValue($plid, 'dc:title', 'empty');
return $plid;
}
function testNew()
{
# if not exists -> create new
if (is_array($this->active)) {
# if exists -> return false
# else
# create empty
# activate
if (is_array($this->activeId)) {
return FALSE;
}
$plid = $this->createEmpty();
$this->activate($plid);
$this->activate($plid);
return TRUE;
}
}