*** empty log message ***

This commit is contained in:
sebastian 2005-02-24 19:51:06 +00:00
parent 809cb83c49
commit c683356fd0
17 changed files with 141 additions and 34 deletions

View file

@ -3,8 +3,8 @@ class uiPlaylist
{
function uiPlaylist(&$uiBase)
{
$this->Base =& $uiBase;
$this->items =& $_SESSION[UI_PLAYLIST_SESSNAME]['content'];
$this->Base =& $uiBase;
$this->active =& $_SESSION[UI_PLAYLIST_SESSNAME]['active'];
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
}
@ -15,13 +15,45 @@ class uiPlaylist
function get()
{ #print_r($this->items);
return $this->items;
return is_array($this->active) ? $this->active : FALSE;
}
function activate($id)
function activate($plid)
{
$this->items = $this->Base->gb->getPlaylistArray($id, $this->Base->sessid);
$this->Base->_retMsg('Playlist $1 activated', $this->Base->_getMDataValue($id, 'title'));
# test if PL available
# look PL
# store access token to ls_pref
# load PL into session
if(is_string($this->Base->gb->loadPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY))) {
$this->Base->_retMsg('You have an Playlist already activated,\n first close it');
return FALSE;
}
if($this->Base->gb->playlistIsAvailable($plid, $this->Base->sessid) !== TRUE) {
$this->Base->_retMsg('Playlist is looked');
return FALSE;
}
$token = $this->Base->gb->lockPlaylistForEdit($plid, $this->Base->sessid);
$this->Base->gb->savePref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY, $token);
$this->active = $this->Base->gb->getPlaylistArray($plid, $this->Base->sessid);
$this->active['id'] = $plid;
$this->Base->_retMsg('Playlist "$1" activated', $this->Base->_getMDataValue($plid, 'title'));
}
function release()
{
# get token from ls_pref
# release PL
# delete PL from session
# remove token from ls_pref
if(!is_string($token = $this->Base->gb->loadPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY))) {
$this->Base->_retMsg('No Playlist is looked by You');
return FALSE;
}
$plgunid = $this->Base->gb->releaseLockedPlaylist($token, $this->Base->sessid);
$this->Base->_retMsg('Playlist "$1" released', $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($plgunid), 'title'));
$this->active = NULL;
$this->Base->gb->delPref($this->Base->sessid, UI_PL_ACCESSTOKEN_KEY);
return TRUE;
}
function addItem($id)
@ -35,4 +67,21 @@ class uiPlaylist
}
function newUsingItem($id)
{
# create PL
# activate
# add clip
if (!$plid = $this->Base->gb->createPlaylist($this->Base->homeid, date('Y-M-D H-i-s'), $this->Base->sessid)) {
$this->Base->_retMsg('Cannot create Playlist');
return FALSE;
}
$this->activate($plid);
if (!$this->Base->gb->addAudioClipToPlaylist($token, $id, $this->Base->sessid)) {
$this->Base_retMsg('Cannot add File to Playlist');
return FALSE;
}
return TRUE;
}
}