new jjmenu for dynamic context menus. playlists in library.
need to work on javascript callback
This commit is contained in:
parent
4bdcba83e2
commit
d2b1bf0622
17 changed files with 545 additions and 318 deletions
|
@ -18,6 +18,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
->addActionContext('plupload', 'html')
|
||||
->addActionContext('upload', 'json')
|
||||
->addActionContext('delete', 'json')
|
||||
->addActionContext('context-menu', 'json')
|
||||
->initContext();
|
||||
|
||||
$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
|
||||
|
@ -27,34 +28,46 @@ class LibraryController extends Zend_Controller_Action
|
|||
public function indexAction()
|
||||
{
|
||||
$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');
|
||||
|
||||
unset($this->search_sess->md);
|
||||
unset($this->search_sess->order);
|
||||
|
||||
$this->_helper->actionStack('context-menu', 'library');
|
||||
$this->_helper->actionStack('contents', 'library');
|
||||
$this->_helper->actionStack('index', 'sideplaylist');
|
||||
}
|
||||
|
||||
public function contextMenuAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setResponseSegment('library');
|
||||
$id = $this->_getParam('id');
|
||||
$type = $this->_getParam('type');
|
||||
|
||||
$this->view->headScript()->appendFile('/js/campcaster/library/context-menu.js','text/javascript');
|
||||
$this->view->headScript()->appendFile('/js/contextmenu/jquery.contextMenu.js','text/javascript');
|
||||
$this->view->headLink()->appendStylesheet('/css/jquery.contextMenu.css');
|
||||
$callback = 'window["contextMenu"]';
|
||||
$params = '/format/json/id/#id#/type/#type#';
|
||||
|
||||
$pl_sess = $this->pl_sess;
|
||||
$contextMenu;
|
||||
|
||||
$contextMenu[] = array('action' => '/Library/delete', 'text' => 'Delete');
|
||||
|
||||
if(isset($pl_sess->id))
|
||||
$contextMenu[] = array('action' => '/Playlist/add-item', 'text' => 'Add To Playlist');
|
||||
if($type === "au") {
|
||||
|
||||
$menu[] = array('action' => '/Library/delete'.$params, 'title' => 'Delete');
|
||||
|
||||
if(isset($pl_sess->id))
|
||||
$menu[] = array('action' => '/Playlist/add-item'.$params, 'title' => 'Add To Playlist');
|
||||
|
||||
}
|
||||
else if($type === "pl") {
|
||||
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/delete'.$params, 'callback' => $callback), 'title' => 'Delete');
|
||||
|
||||
}
|
||||
|
||||
//returns format jjmenu is looking for.
|
||||
die(json_encode($menu));
|
||||
|
||||
$this->view->menu = $contextMenu;
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
|
@ -69,7 +82,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
return;
|
||||
}
|
||||
else if(is_null($file)) {
|
||||
$this->view->message = "file doesn\'t exist";
|
||||
$this->view->message = "file doesn't exist";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -81,8 +94,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
$this->view->message = "file doesn\'t exist";
|
||||
|
||||
}
|
||||
|
||||
public function contentsAction()
|
||||
|
|
|
@ -20,6 +20,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
->addActionContext('move-item', 'json')
|
||||
->addActionContext('close', 'json')
|
||||
->addActionContext('delete-active', 'json')
|
||||
->addActionContext('delete', 'json')
|
||||
->initContext();
|
||||
|
||||
$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
|
||||
|
@ -216,11 +217,17 @@ class PlaylistController extends Zend_Controller_Action
|
|||
public function deleteAction()
|
||||
{
|
||||
$id = $this->_getParam('id', null);
|
||||
$pl = Playlist::Recall($id);
|
||||
|
||||
if (!is_null($id)) {
|
||||
if ($pl !== FALSE) {
|
||||
|
||||
$this->closePlaylist();
|
||||
Playlist::Delete($id);
|
||||
|
||||
$pl_sess = $this->pl_sess;
|
||||
|
||||
if($pl_sess->id === $id){
|
||||
unset($pl_sess->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ class SearchController extends Zend_Controller_Action
|
|||
|
||||
$this->view->headScript()->appendFile('/js/campcaster/onready/search.js','text/javascript');
|
||||
|
||||
$this->_helper->actionStack('context-menu', 'library');
|
||||
$this->_helper->actionStack('display', 'search');
|
||||
$this->_helper->actionStack('contents', 'library');
|
||||
$this->_helper->actionStack('index', 'sideplaylist');
|
||||
|
@ -74,7 +73,13 @@ class SearchController extends Zend_Controller_Action
|
|||
$order = isset($this->search_sess->order) ? $this->search_sess->order : NULL;
|
||||
|
||||
$this->view->files = StoredFile::searchFiles($info, $order);
|
||||
$this->view->results = $this->view->render('library/update.phtml');
|
||||
|
||||
if (count($this->view->files) > 0) {
|
||||
$this->view->results = $this->view->render('library/update.phtml');
|
||||
}
|
||||
else {
|
||||
$this->view->results = "<tr>No Results</tr>";
|
||||
}
|
||||
unset($this->view->files);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue