still old context menus for schedule, wondering why they aren't popping up.

This commit is contained in:
naomiaro 2010-12-30 13:32:59 -05:00
parent d2b1bf0622
commit fc2e407ad0
9 changed files with 387 additions and 49 deletions

View file

@ -29,7 +29,6 @@ class LibraryController extends Zend_Controller_Action
{
$this->view->headScript()->appendFile('/js/campcaster/onready/library.js','text/javascript');
$this->view->headScript()->appendFile('/js/contextmenu/jjmenu.js','text/javascript');
$this->view->headScript()->appendFile('/js/campcaster/library/context-menu.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/contextmenu.css');
$this->_helper->layout->setLayout('library');
@ -46,22 +45,33 @@ class LibraryController extends Zend_Controller_Action
$id = $this->_getParam('id');
$type = $this->_getParam('type');
$callback = 'window["contextMenu"]';
$params = '/format/json/id/#id#/type/#type#';
$pl_sess = $this->pl_sess;
if($type === "au") {
$menu[] = array('action' => '/Library/delete'.$params, 'title' => 'Delete');
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Library/delete'.$params, 'callback' => 'window["deleteAudioClip"]'),
'title' => 'Delete');
if(isset($pl_sess->id))
$menu[] = array('action' => '/Playlist/add-item'.$params, 'title' => 'Add To Playlist');
if(isset($pl_sess->id)) {
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/add-item'.$params, 'callback' => 'window["setSPLContent"]'),
'title' => 'Add to Playlist');
}
}
else if($type === "pl") {
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/delete'.$params, 'callback' => $callback), 'title' => 'Delete');
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/delete'.$params, 'callback' => 'window["deletePlaylist"]'),
'title' => 'Delete');
if(!isset($pl_sess->id) || $pl_sess->id !== $id) {
$menu[] = array('action' =>
array('type' => 'ajax',
'url' => '/Playlist/edit/view/spl'.$params,
'callback' => 'window["openDiffSPL"]'),
'title' => 'Edit');
}
}
@ -93,7 +103,8 @@ class LibraryController extends Zend_Controller_Action
return;
}
}
$this->view->id = $id;
}
public function contentsAction()

View file

@ -19,6 +19,7 @@ class PlaylistController extends Zend_Controller_Action
->addActionContext('set-cue', 'json')
->addActionContext('move-item', 'json')
->addActionContext('close', 'json')
->addActionContext('edit', 'json')
->addActionContext('delete-active', 'json')
->addActionContext('delete', 'json')
->initContext();
@ -44,6 +45,28 @@ class PlaylistController extends Zend_Controller_Action
$this->_helper->redirector('index');
}
private function changePlaylist($pl_id){
$pl_sess = $this->pl_sess;
if(isset($pl_sess->id)) {
$pl = Playlist::Recall($pl_sess->id);
if($pl !== FALSE) {
$this->closePlaylist($pl);
}
}
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$pl = Playlist::Recall($pl_id);
if($pl === FALSE) {
return FALSE;
}
$pl->lock($userInfo->id);
$pl_sess->id = $pl_id;
}
private function closePlaylist($pl)
{
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
@ -68,10 +91,9 @@ class PlaylistController extends Zend_Controller_Action
$pl = new Playlist();
$pl_id = $pl->create("Test Zend Auth");
$pl->setPLMetaData('dc:creator', $userInfo->login);
$pl->lock($userInfo->id);
//set this playlist as active id.
$pl_sess->id = $pl_id;
$this->changePlaylist($pl_id);
$this->_helper->redirector('metadata');
}
@ -102,12 +124,22 @@ class PlaylistController extends Zend_Controller_Action
public function editAction()
{
$this->view->headScript()->appendFile('/js/campcaster/playlist/playlist.js','text/javascript');
$this->view->headScript()->appendFile('/js/campcaster/playlist/playlist.js','text/javascript');
$pl_id = $this->_getParam('id', null);
$display = $this->_getParam('view', null);
if(!is_null($pl_id)) {
$this->changePlaylist($pl_id);
}
$pl = $this->getPlaylist();
$this->view->pl = $pl;
$this->view->playlistcontents = $pl->getContents();
if($display === 'spl') {
$this->view->html = $this->view->render('sideplaylist/index.phtml');
unset($this->view->pl);
}
}
public function addItemAction()
@ -138,6 +170,7 @@ class PlaylistController extends Zend_Controller_Action
{
$oldPos = $this->_getParam('oldPos');
$newPos = $this->_getParam('newPos');
$display = $this->_getParam('view');
$pl = $this->getPlaylist();
@ -229,6 +262,8 @@ class PlaylistController extends Zend_Controller_Action
unset($pl_sess->id);
}
}
$this->view->id = $id;
}
public function deleteActiveAction()

View file

@ -27,6 +27,8 @@ class SearchController extends Zend_Controller_Action
$this->_helper->layout->setLayout('search');
$this->view->headScript()->appendFile('/js/campcaster/onready/search.js','text/javascript');
$this->view->headScript()->appendFile('/js/contextmenu/jjmenu.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/contextmenu.css');
$this->_helper->actionStack('display', 'search');
$this->_helper->actionStack('contents', 'library');