layout has more widget-like setup now. side playlist reused in search.

This commit is contained in:
naomiaro 2010-12-21 23:33:58 -05:00
parent 565d789baa
commit 5795871bcc
12 changed files with 196 additions and 141 deletions

View file

@ -24,16 +24,23 @@ class LibraryController extends Zend_Controller_Action
public function indexAction()
{
$this->view->headScript()->appendFile('/js/contextmenu/jquery.contextMenu.js','text/javascript');
$this->view->headScript()->appendFile('/js/campcaster/library/library.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/jquery.contextMenu.css');
$this->_helper->layout->setLayout('library');
$this->_helper->actionStack('context-menu', 'library');
$this->_helper->actionStack('contents', 'library');
$this->_helper->actionStack('index', 'sideplaylist');
}
public function contextMenuAction()
{
$this->_helper->viewRenderer->setResponseSegment('library');
$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');
$pl_sess = $this->pl_sess;
$contextMenu;
@ -43,8 +50,6 @@ class LibraryController extends Zend_Controller_Action
$contextMenu[] = array('action' => '/Playlist/add-item', 'text' => 'Add To Playlist');
$this->view->menu = $contextMenu;
$this->_helper->actionStack('contents', 'library');
}
public function deleteAction()
@ -77,12 +82,12 @@ class LibraryController extends Zend_Controller_Action
public function contentsAction()
{
$this->_helper->viewRenderer->setResponseSegment('library');
$query["category"] = $this->_getParam('ob', "dc:creator");
$query["order"] = $this->_getParam('order', "asc");
$this->view->files = StoredFile::getFiles($query);
$this->_helper->actionStack('index', 'sideplaylist');
}
public function searchAction()

View file

@ -14,6 +14,7 @@ class SearchController extends Zend_Controller_Action
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('newfield', 'html')
->addActionContext('display', 'json')
->initContext();
$this->form = new Application_Form_AdvancedSearch();
@ -21,7 +22,12 @@ class SearchController extends Zend_Controller_Action
public function indexAction()
{
// action body
$this->_helper->layout->setLayout('search');
$this->_helper->actionStack('context-menu', 'library');
$this->_helper->actionStack('display', 'search');
$this->_helper->actionStack('contents', 'library');
$this->_helper->actionStack('index', 'sideplaylist');
}
public function displayAction()
@ -29,11 +35,15 @@ class SearchController extends Zend_Controller_Action
$this->view->headScript()->appendFile('/js/campcaster/library/advancedsearch.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/library_search.css');
$this->_helper->viewRenderer->setResponseSegment('search');
$request = $this->getRequest();
$this->form = new Application_Form_AdvancedSearch();
$form = $this->form;
// Form has not been submitted - pass to view and return
if (!$this->getRequest()->isPost()) {
// Form has not been submitted - displayed using layouts
if (!$request->isPost()) {
$sub = new Application_Form_AdvancedSearchRow(1);
$form->addSubForm($sub, 'row_1');
$form->getSubForm('row_1')->removeDecorator('DtDdWrapper');
@ -43,18 +53,20 @@ class SearchController extends Zend_Controller_Action
}
// Form has been submitted - run data through preValidation()
$form->preValidation($_POST);
$form->preValidation($request->getPost());
if (!$form->isValid($_POST)) {
$this->view->form = $form;
if (!$form->isValid($request->getPost())) {
$this->view->form = $form->__toString();
return;
}
// Form is valid
$this->view->form = $form;
// form was submitted, send back strings to json response.
//$this->view->form = $form->__toString();
$info = $form->getValues();
$info = $form->getValues();
$this->view->files = StoredFile::searchFiles($info);
$this->view->results = $this->view->render('library/update.phtml');
unset($this->view->files);
}
public function newfieldAction()

View file

@ -17,7 +17,8 @@ class SideplaylistController extends Zend_Controller_Action
public function indexAction()
{
$this->_helper->layout->setLayout('sidebar');
$this->view->headScript()->appendFile('/js/campcaster/library/spl.js','text/javascript');
$this->_helper->viewRenderer->setResponseSegment('spl');
$pl_sess = $this->pl_sess;