CC-2137: Playlist builder doesnt work. Shows blank page

Fixed bug with new return type from Playlist::create() in the PlaylistController.
This commit is contained in:
Paul Baranowski 2011-03-31 14:40:55 -04:00
parent 403b08351c
commit c34b25883f
1 changed files with 26 additions and 26 deletions

View File

@ -28,7 +28,7 @@ class PlaylistController extends Zend_Controller_Action
private function getPlaylist() private function getPlaylist()
{ {
$pl_sess = $this->pl_sess; $pl_sess = $this->pl_sess;
if(isset($pl_sess->id)) { if(isset($pl_sess->id)) {
$pl = Playlist::Recall($pl_sess->id); $pl = Playlist::Recall($pl_sess->id);
@ -43,7 +43,7 @@ class PlaylistController extends Zend_Controller_Action
private function changePlaylist($pl_id) private function changePlaylist($pl_id)
{ {
$pl_sess = $this->pl_sess; $pl_sess = $this->pl_sess;
if(isset($pl_sess->id)) { if(isset($pl_sess->id)) {
$pl = Playlist::Recall($pl_sess->id); $pl = Playlist::Recall($pl_sess->id);
@ -51,13 +51,13 @@ class PlaylistController extends Zend_Controller_Action
$this->closePlaylist($pl); $this->closePlaylist($pl);
} }
} }
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$pl = Playlist::Recall($pl_id); $pl = Playlist::Recall($pl_id);
if($pl === FALSE) { if($pl === FALSE) {
return FALSE; return FALSE;
} }
$pl->lock($userInfo->id); $pl->lock($userInfo->id);
$pl_sess->id = $pl_id; $pl_sess->id = $pl_id;
} }
@ -78,7 +78,7 @@ class PlaylistController extends Zend_Controller_Action
$this->view->headScript()->appendFile('/js/airtime/library/spl.js','text/javascript'); $this->view->headScript()->appendFile('/js/airtime/library/spl.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/playlist_builder.css'); $this->view->headLink()->appendStylesheet('/css/playlist_builder.css');
$this->_helper->viewRenderer->setResponseSegment('spl'); $this->_helper->viewRenderer->setResponseSegment('spl');
$this->view->pl = $this->getPlaylist(); $this->view->pl = $this->getPlaylist();
} }
@ -88,10 +88,10 @@ class PlaylistController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$pl = new Playlist(); $pl = new Playlist();
$pl_id = $pl->create("Untitled Playlist"); $pl->create("Untitled Playlist");
$pl->setPLMetaData('dc:creator', $userInfo->login); $pl->setPLMetaData('dc:creator', $userInfo->login);
$this->changePlaylist($pl_id); $this->changePlaylist($pl->getId());
$form = new Application_Form_PlaylistMetadata(); $form = new Application_Form_PlaylistMetadata();
$this->view->fieldset = $form; $this->view->fieldset = $form;
$this->view->form = $this->view->render('playlist/new.phtml'); $this->view->form = $this->view->render('playlist/new.phtml');
@ -105,25 +105,25 @@ class PlaylistController extends Zend_Controller_Action
$pl_id = $this->_getParam('id', null); $pl_id = $this->_getParam('id', null);
//not a new playlist //not a new playlist
if(!is_null($pl_id)) { if(!is_null($pl_id)) {
$this->changePlaylist($pl_id); $this->changePlaylist($pl_id);
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$title = $pl->getPLMetaData(UI_MDATA_KEY_TITLE); $title = $pl->getPLMetaData(UI_MDATA_KEY_TITLE);
$desc = $pl->getPLMetaData(UI_MDATA_KEY_DESCRIPTION); $desc = $pl->getPLMetaData(UI_MDATA_KEY_DESCRIPTION);
$data = array( 'title' => $title, 'description' => $desc); $data = array( 'title' => $title, 'description' => $desc);
$form->populate($data); $form->populate($data);
} }
if ($request->isPost()) { if ($request->isPost()) {
$title = $this->_getParam('title', null); $title = $this->_getParam('title', null);
$description = $this->_getParam('description', null); $description = $this->_getParam('description', null);
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
if($title) if($title)
$pl->setName($title); $pl->setName($title);
if(isset($description)) { if(isset($description)) {
$pl->setPLMetaData(UI_MDATA_KEY_DESCRIPTION, $description); $pl->setPLMetaData(UI_MDATA_KEY_DESCRIPTION, $description);
} }
@ -132,7 +132,7 @@ class PlaylistController extends Zend_Controller_Action
$this->view->html = $this->view->render('playlist/index.phtml'); $this->view->html = $this->view->render('playlist/index.phtml');
unset($this->view->pl); unset($this->view->pl);
} }
$this->view->fieldset = $form; $this->view->fieldset = $form;
$this->view->form = $this->view->render('playlist/new.phtml'); $this->view->form = $this->view->render('playlist/new.phtml');
} }
@ -140,13 +140,13 @@ class PlaylistController extends Zend_Controller_Action
public function editAction() public function editAction()
{ {
$pl_id = $this->_getParam('id', null); $pl_id = $this->_getParam('id', null);
if(!is_null($pl_id)) { if(!is_null($pl_id)) {
$this->changePlaylist($pl_id); $this->changePlaylist($pl_id);
} }
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$this->view->pl = $pl; $this->view->pl = $pl;
$this->view->html = $this->view->render('playlist/index.phtml'); $this->view->html = $this->view->render('playlist/index.phtml');
unset($this->view->pl); unset($this->view->pl);
@ -158,7 +158,7 @@ class PlaylistController extends Zend_Controller_Action
$pos = $this->_getParam('pos', null); $pos = $this->_getParam('pos', null);
if (!is_null($id)) { if (!is_null($id)) {
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$res = $pl->addAudioClip($id, $pos); $res = $pl->addAudioClip($id, $pos);
@ -181,7 +181,7 @@ class PlaylistController extends Zend_Controller_Action
{ {
$oldPos = $this->_getParam('oldPos'); $oldPos = $this->_getParam('oldPos');
$newPos = $this->_getParam('newPos'); $newPos = $this->_getParam('newPos');
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$pl->moveAudioClip($oldPos, $newPos); $pl->moveAudioClip($oldPos, $newPos);
@ -197,7 +197,7 @@ class PlaylistController extends Zend_Controller_Action
public function deleteItemAction() public function deleteItemAction()
{ {
$positions = $this->_getParam('pos', array()); $positions = $this->_getParam('pos', array());
if (!is_array($positions)) if (!is_array($positions))
$positions = array($positions); $positions = array($positions);
@ -208,7 +208,7 @@ class PlaylistController extends Zend_Controller_Action
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
foreach ($positions as $pos) { foreach ($positions as $pos) {
$pl->delAudioClip($pos); $pl->delAudioClip($pos);
} }
$this->view->pl = $pl; $this->view->pl = $pl;
@ -274,7 +274,7 @@ class PlaylistController extends Zend_Controller_Action
{ {
$id = $this->_getParam('id', null); $id = $this->_getParam('id', null);
$pl = Playlist::Recall($id); $pl = Playlist::Recall($id);
if ($pl !== FALSE) { if ($pl !== FALSE) {
Playlist::Delete($id); Playlist::Delete($id);
@ -291,7 +291,7 @@ class PlaylistController extends Zend_Controller_Action
public function deleteActiveAction() public function deleteActiveAction()
{ {
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
Playlist::Delete($pl->getId()); Playlist::Delete($pl->getId());
$pl_sess = $this->pl_sess; $pl_sess = $this->pl_sess;
@ -304,7 +304,7 @@ class PlaylistController extends Zend_Controller_Action
{ {
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$this->closePlaylist($pl); $this->closePlaylist($pl);
$this->view->html = $this->view->render('playlist/index.phtml'); $this->view->html = $this->view->render('playlist/index.phtml');
} }