show will open dialog properly showing scheduled content if there is any

This commit is contained in:
naomiaro 2011-01-13 18:27:44 -05:00
parent a8f24952bd
commit f312ea0d60
6 changed files with 34 additions and 16 deletions

View file

@ -146,6 +146,11 @@ class ScheduleController extends Zend_Controller_Action
$end = $this->_getParam('end'); $end = $this->_getParam('end');
$showId = $this->_getParam('showId'); $showId = $this->_getParam('showId');
$day = $this->_getParam('day'); $day = $this->_getParam('day');
$search = $this->_getParam('search', null);
if($search == "") {
$search = null;
}
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
@ -159,7 +164,7 @@ class ScheduleController extends Zend_Controller_Action
$show->scheduleShow($start, array($plId)); $show->scheduleShow($start, array($plId));
} }
$this->view->playlists = $show->searchPlaylistsForShow($day); $this->view->playlists = $show->searchPlaylistsForShow($day, $search);
$this->view->showContent = $show->getShowContent($start); $this->view->showContent = $show->getShowContent($start);
$this->view->choice = $this->view->render('schedule/find-playlists.phtml'); $this->view->choice = $this->view->render('schedule/find-playlists.phtml');

View file

@ -2,4 +2,7 @@
if(count($this->playlists) > 0) { if(count($this->playlists) > 0) {
echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists); echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists);
} }
else {
echo "No Playlists Fit Duration";
}
?> ?>

View file

@ -2,4 +2,7 @@
if(count($this->playlists) > 0) { if(count($this->playlists) > 0) {
echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists); echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists);
} }
else {
echo "No Playlists Fit Duration";
}
?> ?>

View file

@ -1,9 +1,5 @@
<div id="schedule_playlist_dialog"> <div id="schedule_playlist_dialog">
<input id="schedule_playlist_search" type="text"></input> <input id="schedule_playlist_search" type="text"></input>
<ul id="schedule_playlist_choice"> <ul id="schedule_playlist_choice"></ul>
<?php <ul id="schedule_playlist_chosen"></ul>
echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists);
?>
</ul>
<ul id="schedule_playlist_chosen">No Playlists</ul>
</div> </div>

View file

@ -20,5 +20,7 @@
</div> </div>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
<?php else : ?>
<li>No Playlists</li>
<?php endif; ?> <?php endif; ?>

View file

@ -159,7 +159,7 @@ function openShowDialog() {
}); });
} }
function makeScheduleDialog(dialog, show) { function makeScheduleDialog(dialog, json, show) {
dialog.find("#schedule_playlist_search").keyup(function(){ dialog.find("#schedule_playlist_search").keyup(function(){
var url, string, day; var url, string, day;
@ -172,20 +172,29 @@ function makeScheduleDialog(dialog, show) {
$("#schedule_playlist_choice") $("#schedule_playlist_choice")
.empty() .empty()
.append(html); .append(html)
.find('li')
.draggable({
helper: 'clone'
});
}); });
}); });
dialog.find('#schedule_playlist_choice li') dialog.find('#schedule_playlist_choice')
.draggable({ .append(json.choice)
helper: 'clone' .find('li')
}); .draggable({
helper: 'clone'
});
dialog.find("#schedule_playlist_chosen") dialog.find("#schedule_playlist_chosen")
.append(json.chosen)
.droppable({ .droppable({
drop: function(event, ui) { drop: function(event, ui) {
var li, pl_id, url, start_date, end_date, day; var li, pl_id, url, start_date, end_date, day, search;
search = $("#schedule_playlist_search").val();
pl_id = $(ui.helper).attr("id").split("_").pop(); pl_id = $(ui.helper).attr("id").split("_").pop();
day = show.start.getDay(); day = show.start.getDay();
@ -196,7 +205,7 @@ function makeScheduleDialog(dialog, show) {
url = '/Schedule/schedule-show/format/json'; url = '/Schedule/schedule-show/format/json';
$.post(url, $.post(url,
{plId: pl_id, start: start_date, end: end_date, showId: show.id, day: day}, {plId: pl_id, start: start_date, end: end_date, showId: show.id, day: day, search: search},
function(json){ function(json){
var x; var x;
@ -231,7 +240,7 @@ function openScheduleDialog(show) {
function(json){ function(json){
var dialog = $(json.dialog); var dialog = $(json.dialog);
makeScheduleDialog(dialog, show); makeScheduleDialog(dialog, json, show);
dialog.dialog({ dialog.dialog({
autoOpen: false, autoOpen: false,