playlists appear in scratchpad, can close, reopen for edit.
This commit is contained in:
parent
6d9e5028fc
commit
04e81df67c
|
@ -295,7 +295,7 @@ switch ($_REQUEST['act']) {
|
|||
|
||||
case "PL.activate":
|
||||
if ($uiHandler->PLAYLIST->activate($_REQUEST['id']) === TRUE) {
|
||||
$uiHandler->SCRATCHPAD->addItem($_REQUEST['id']);
|
||||
$uiHandler->SCRATCHPAD->addItem($_REQUEST['id'], TRUE);
|
||||
}
|
||||
$uiHandler->PLAYLIST->setRedirect();
|
||||
break;
|
||||
|
@ -306,7 +306,7 @@ switch ($_REQUEST['act']) {
|
|||
if ($ids) {
|
||||
//$uiHandler->SCRATCHPAD->addItem($ids);
|
||||
}
|
||||
//$uiHandler->SCRATCHPAD->addItem($ui_tmpid);
|
||||
$uiHandler->SCRATCHPAD->addItem($ui_tmpid, TRUE);
|
||||
}
|
||||
$uiHandler->PLAYLIST->setRedirect('_2PL.editMetaData');
|
||||
break;
|
||||
|
|
|
@ -527,27 +527,21 @@ class uiBase
|
|||
} // fn _retMsg
|
||||
|
||||
|
||||
public function getPLMetaInfo($id)
|
||||
{
|
||||
$data = array('id' => $id,
|
||||
'title' => $this->gb->getPLMetadataValue($id, UI_MDATA_KEY_TITLE),
|
||||
'creator' => $this->gb->getPLMetadataValue($id, UI_MDATA_KEY_CREATOR),
|
||||
'duration' => $this->gb->getPLMetadataValue($id, UI_MDATA_KEY_DURATION),
|
||||
'type' => 'playlist',
|
||||
);
|
||||
return ($data);
|
||||
}
|
||||
|
||||
public function getMetaInfo($id)
|
||||
{
|
||||
$type = strtolower(GreenBox::getFileType($id));
|
||||
|
||||
if($type == 'playlist') {
|
||||
require_once("../../../storageServer/var/Playlist.php");
|
||||
|
||||
$playList = new Playlist(GreenBox::GunidFromId($id));
|
||||
$playListData = $playList->export();
|
||||
|
||||
for ($i = 1; $i < count($playListData); $i++) {
|
||||
|
||||
$entry = StoredFile::RecallByGunid($playListData["".$i]["gunid"]);
|
||||
$playListEntries[] = $entry->getName();
|
||||
|
||||
}
|
||||
|
||||
$_SESSION['mdata'] = $playListEntries;
|
||||
|
||||
}
|
||||
|
||||
$data = array('id' => $id,
|
||||
'gunid' => BasicStor::GunidFromId($id),
|
||||
'title' => $this->getMetadataValue($id, UI_MDATA_KEY_TITLE),
|
||||
|
@ -557,8 +551,6 @@ class uiBase
|
|||
'source' => $type == 'audioclip' ? $this->getMetadataValue($id, UI_MDATA_KEY_SOURCE) : NULL,
|
||||
'bitRate' => $type == 'audioclip' ? $this->getMetadataValue($id, UI_MDATA_KEY_BITRATE) : NULL,
|
||||
'sampleRate' => $type == 'audioclip' ? $this->getMetadataValue($id, UI_MDATA_KEY_SAMPLERATE) : NULL,
|
||||
//'isAvailable' => $type == 'playlist' ? $this->gb->playlistIsAvailable($id, $this->sessid) : NULL,
|
||||
'content' => $type == 'playlist' ? join("/", $playListEntries) : NULL,
|
||||
);
|
||||
return ($data);
|
||||
} // fn getMetaInfo
|
||||
|
|
|
@ -224,6 +224,9 @@ class uiPlaylist
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
$this->Base->SCRATCHPAD->reloadMetadata();
|
||||
|
||||
return TRUE;
|
||||
} // fn addItem
|
||||
|
||||
|
@ -249,6 +252,9 @@ class uiPlaylist
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
$this->Base->SCRATCHPAD->reloadMetadata();
|
||||
|
||||
return TRUE;
|
||||
} // fn removeItem
|
||||
|
||||
|
@ -656,7 +662,9 @@ class uiPlaylist
|
|||
}
|
||||
if (UI_VERBOSE) {
|
||||
$this->Base->_retMsg('Metadata saved.');
|
||||
}
|
||||
}
|
||||
|
||||
$this->Base->SCRATCHPAD->reloadMetadata();
|
||||
} // fn editMetadata
|
||||
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ class uiScratchPad
|
|||
* One or more media IDs.
|
||||
* @return boolean
|
||||
*/
|
||||
public function addItem($ids)
|
||||
public function addItem($ids, $playlist=FALSE)
|
||||
{
|
||||
if (!$this->Base->STATIONPREFS[UI_SCRATCHPAD_MAXLENGTH_KEY]) {
|
||||
if (UI_WARNING) {
|
||||
|
@ -133,7 +133,10 @@ class uiScratchPad
|
|||
|
||||
$scratchpad = $this->get();
|
||||
foreach ($ids as $id) {
|
||||
$item = $this->Base->getMetaInfo($id);
|
||||
if($playlist === FALSE)
|
||||
$item = $this->Base->getMetaInfo($id);
|
||||
else
|
||||
$item = $this->Base->getPLMetaInfo($id);
|
||||
|
||||
foreach ($scratchpad as $key => $val) {
|
||||
if ($val['id'] == $item['id']) {
|
||||
|
@ -238,8 +241,12 @@ class uiScratchPad
|
|||
*/
|
||||
public function reloadMetadata()
|
||||
{
|
||||
$_SESSION['pl'] = $this->items;
|
||||
foreach ($this->items as $key => $val) {
|
||||
$this->items[$key] = $this->Base->getMetaInfo($val['id']);
|
||||
if($val['type'] === 'playlist')
|
||||
$this->items[$key] = $this->Base->getPLMetaInfo($val['id']);
|
||||
else
|
||||
$this->items[$key] = $this->Base->getMetaInfo($val['id']);
|
||||
}
|
||||
}
|
||||
} // class uiScratchPad
|
||||
|
|
Loading…
Reference in New Issue