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

@ -65,7 +65,7 @@ $pages = array(
'label' => 'Search',
'module' => 'default',
'controller' => 'Search',
'action' => 'display',
'action' => 'index',
'resource' => 'search'
)
)

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;

View file

@ -10,8 +10,8 @@
<body>
<div id="nav"><?php echo $this->navigation()->menu()->setRenderInvisible(true) ?></div>
<div id="content"><?php echo $this->layout()->content ?></div>
<div id="library_content"><?php echo $this->layout()->library ?></div>
<div id="side_playlist"><?php echo $this->layout()->spl ?></div>

View file

@ -0,0 +1,21 @@
<!-- application/layouts/scripts/layout.phtml -->
<?php echo $this->doctype() ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Campcaster</title>
<?php echo $this->headScript() ?>
<?php echo $this->headLink() ?>
</head>
<body>
<div id="nav"><?php echo $this->navigation()->menu()->setRenderInvisible(true) ?></div>
<div id="search"><?php echo $this->layout()->search ?></div>
<div id="library_content"><?php echo $this->layout()->library ?></div>
<div id="side_playlist"><?php echo $this->layout()->spl ?></div>
</body>
</html>

View file

@ -0,0 +1,2 @@
<?php
echo $this->partialLoop('library/libraryTablePartial.phtml', $this->files);

View file

@ -1,29 +1,6 @@
<?php
$this->form->setAction($this->url());
echo $this->form;
?>
<span id="search_add">Add</span>
<span id="search_submit">Submit</span>
<?php
if($this->files) {
?>
<table id="library_display">
<tr>
<th><span class="title">Title</span></th>
<th><span class="artist">Artist</span></th>
<th><span class="album">Album</span></th>
<th><span class="track">Track</span></th>
<th><span class="length">Length</span></th>
</tr>
<?php
echo $this->partialLoop('library/libraryTablePartial.phtml', $this->files);
?>
</table>
<?php
}
else {
echo "<div>No Results</div>";
}
?>