changed schedule page to use better dynamic menu that the playlist builder page is using.
This commit is contained in:
parent
d829813c0b
commit
eaad41ef94
7 changed files with 66 additions and 160 deletions
|
@ -14,6 +14,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||||
$ajaxContext->addActionContext('event-feed', 'json')
|
$ajaxContext->addActionContext('event-feed', 'json')
|
||||||
|
->addActionContext('make-context-menu', 'json')
|
||||||
->addActionContext('add-show-dialog', 'json')
|
->addActionContext('add-show-dialog', 'json')
|
||||||
->addActionContext('add-show', 'json')
|
->addActionContext('add-show', 'json')
|
||||||
->addActionContext('move-show', 'json')
|
->addActionContext('move-show', 'json')
|
||||||
|
@ -33,24 +34,13 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$this->view->headScript()->appendFile('/js/fullcalendar/fullcalendar.min.js','text/javascript');
|
$this->view->headScript()->appendFile('/js/fullcalendar/fullcalendar.min.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile('/js/contextmenu/jquery.contextMenu.js','text/javascript');
|
$this->view->headScript()->appendFile('/js/contextmenu/jjmenu.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript');
|
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile('/js/airtime/schedule/full-calendar-functions.js','text/javascript');
|
$this->view->headScript()->appendFile('/js/airtime/schedule/full-calendar-functions.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile('/js/airtime/schedule/schedule.js','text/javascript');
|
$this->view->headScript()->appendFile('/js/airtime/schedule/schedule.js','text/javascript');
|
||||||
|
|
||||||
$this->view->headLink()->appendStylesheet('/css/jquery.contextMenu.css');
|
$this->view->headLink()->appendStylesheet('/css/contextmenu.css');
|
||||||
$this->view->headLink()->appendStylesheet('/css/fullcalendar.css');
|
$this->view->headLink()->appendStylesheet('/css/fullcalendar.css');
|
||||||
|
|
||||||
$eventDefaultMenu = array();
|
|
||||||
//$eventDefaultMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
|
|
||||||
|
|
||||||
$this->view->eventDefaultMenu = $eventDefaultMenu;
|
|
||||||
|
|
||||||
$eventHostMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
|
|
||||||
$eventHostMenu[] = array('action' => '/Schedule/schedule-show', 'text' => 'Schedule');
|
|
||||||
$eventHostMenu[] = array('action' => '/Schedule/clear-show', 'text' => 'Clear');
|
|
||||||
|
|
||||||
$this->view->eventHostMenu = $eventHostMenu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function eventFeedAction()
|
public function eventFeedAction()
|
||||||
|
@ -175,19 +165,42 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function deleteShowAction()
|
public function deleteShowAction()
|
||||||
{
|
{
|
||||||
$showId = $this->_getParam('showId');
|
$showId = $this->_getParam('id');
|
||||||
$date = $this->_getParam('date');
|
$start_timestamp = $this->_getParam('start');
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
|
||||||
$user = new User($userInfo->id, $userInfo->type);
|
$user = new User($userInfo->id, $userInfo->type);
|
||||||
$show = new Show($user, $showId);
|
$show = new Show($user, $showId);
|
||||||
$show->deleteShow($date);
|
$show->deleteShow($start_timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function makeContextMenuAction()
|
public function makeContextMenuAction()
|
||||||
{
|
{
|
||||||
// action body
|
$id = $this->_getParam('id');
|
||||||
|
$start_timestamp = $this->_getParam('start');
|
||||||
|
|
||||||
|
$today_timestamp = date("Y-m-d H:i:s");
|
||||||
|
|
||||||
|
$params = '/format/json/id/#id#/start/#start#/end/#end#';
|
||||||
|
|
||||||
|
if(strtotime($today_timestamp) < strtotime($start_timestamp)) {
|
||||||
|
|
||||||
|
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'),
|
||||||
|
'title' => 'Delete');
|
||||||
|
|
||||||
|
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/clear-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'),
|
||||||
|
'title' => 'Clear');
|
||||||
|
|
||||||
|
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/schedule-show-dialog'.$params, 'callback' => 'window["buildScheduleDialog"]'),
|
||||||
|
'title' => 'Schedule');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//returns format jjmenu is looking for.
|
||||||
|
die(json_encode($menu));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scheduleShowAction()
|
public function scheduleShowAction()
|
||||||
|
@ -221,7 +234,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
public function clearShowAction()
|
public function clearShowAction()
|
||||||
{
|
{
|
||||||
$start = $this->_getParam('start');
|
$start = $this->_getParam('start');
|
||||||
$showId = $this->_getParam('showId');
|
$showId = $this->_getParam('id');
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id, $userInfo->type);
|
$user = new User($userInfo->id, $userInfo->type);
|
||||||
|
@ -278,7 +291,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$start_timestamp = $this->_getParam('start');
|
$start_timestamp = $this->_getParam('start');
|
||||||
$end_timestamp = $this->_getParam('end');
|
$end_timestamp = $this->_getParam('end');
|
||||||
$showId = $this->_getParam('showId');
|
$showId = $this->_getParam('id');
|
||||||
|
|
||||||
$this->sched_sess->showId = $showId;
|
$this->sched_sess->showId = $showId;
|
||||||
$this->sched_sess->showStart = $start_timestamp;
|
$this->sched_sess->showStart = $start_timestamp;
|
||||||
|
|
|
@ -1,8 +1 @@
|
||||||
<div id='schedule_calendar' class="ui-widget-content block-shadow padded"></div>
|
<div id='schedule_calendar' class="ui-widget-content block-shadow padded"></div>
|
||||||
|
|
||||||
<ul id="schedule_event_default_menu" class="contextMenu">
|
|
||||||
<?php echo $this->partialLoop('library/contextMenuPartial.phtml', $this->eventDefaultMenu) ?>
|
|
||||||
</ul>
|
|
||||||
<ul id="schedule_event_host_menu" class="contextMenu">
|
|
||||||
<?php echo $this->partialLoop('library/contextMenuPartial.phtml', $this->eventHostMenu) ?>
|
|
||||||
</ul>
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ div.jjmenu {
|
||||||
border-bottom:2px solid gray;
|
border-bottom:2px solid gray;
|
||||||
border-right:1px solid gray;
|
border-right:1px solid gray;
|
||||||
padding:0px;
|
padding:0px;
|
||||||
|
z-index: 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.jj_menu_item {
|
div.jj_menu_item {
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
function contextMenu(action, el, pos) {
|
|
||||||
var method = action.split('/').pop(),
|
|
||||||
url, tr_id, id;
|
|
||||||
|
|
||||||
tr_id = $(el).attr('id');
|
|
||||||
id = tr_id.split("_").pop();
|
|
||||||
url = '/'+action;
|
|
||||||
|
|
||||||
if (method === 'delete') {
|
|
||||||
url = url + '/format/json';
|
|
||||||
url = url + '/id/' + id;
|
|
||||||
$.post(url, function(json) {
|
|
||||||
|
|
||||||
if(json.message) {
|
|
||||||
alert(json.message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#library_display tr#" +tr_id).remove();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (method === 'add-item') {
|
|
||||||
url = url + '/format/json';
|
|
||||||
url = url + '/id/' + id;
|
|
||||||
$.post(url, setSPLContent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
function contextMenu() {
|
|
||||||
alert("callback");
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
function setUpQuickSearch() {
|
|
||||||
|
|
||||||
$("#library_quick_search input").keyup(function(ev){
|
|
||||||
var url, string;
|
|
||||||
//alert(x);
|
|
||||||
|
|
||||||
url = "/Library/quick-search/format/json";
|
|
||||||
string = $(this).val();
|
|
||||||
|
|
||||||
$.post(url, {search: string}, function(json){
|
|
||||||
var html, data;
|
|
||||||
//hacky way until I can figure out paginator better.
|
|
||||||
html = json.html.replace(/quick-search\/format\/json/g, "index");
|
|
||||||
|
|
||||||
var el = $(html);
|
|
||||||
|
|
||||||
data = el.find("tr:not(:first-child)");
|
|
||||||
setLibraryContents(data);
|
|
||||||
|
|
||||||
var lib = $("#library_content");
|
|
||||||
|
|
||||||
lib.find("div.paginationControl").remove();
|
|
||||||
lib.append(el[2]);
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
|
@ -59,20 +59,22 @@ function eventRender(event, element, view) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function eventAfterRender( event, element, view ) {
|
function eventAfterRender( event, element, view ) {
|
||||||
var today = new Date();
|
|
||||||
|
|
||||||
if(event.isHost === true && event.start > today) {
|
function getStartTS() {
|
||||||
$(element).contextMenu(
|
var start = makeTimeStamp(event.start);
|
||||||
{menu: 'schedule_event_host_menu'}, eventMenu
|
return start;
|
||||||
);
|
}
|
||||||
}
|
|
||||||
else{
|
|
||||||
$(element).contextMenu(
|
|
||||||
{menu: 'schedule_event_default_menu'}, eventMenu
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$(element).data({'event': event});
|
function getEndTS() {
|
||||||
|
var start = makeTimeStamp(event.end);
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(element)
|
||||||
|
.jjmenu("rightClick",
|
||||||
|
[{get:"/Schedule/make-context-menu/format/json/id/#id#/start/#start#/end/#end#"}],
|
||||||
|
{id: event.id, start: getStartTS, end: getEndTS},
|
||||||
|
{xposition: "mouse", yposition: "mouse"});
|
||||||
}
|
}
|
||||||
|
|
||||||
function eventClick(event, jsEvent, view) {
|
function eventClick(event, jsEvent, view) {
|
||||||
|
|
|
@ -165,69 +165,29 @@ function makeScheduleDialog(dialog, json) {
|
||||||
setScheduleDialogEvents(dialog);
|
setScheduleDialogEvents(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openScheduleDialog(show) {
|
function buildScheduleDialog(json){
|
||||||
var url, start_date, end_date;
|
var dialog = $(json.dialog);
|
||||||
|
|
||||||
url = '/Schedule/schedule-show-dialog/format/json';
|
makeScheduleDialog(dialog, json);
|
||||||
|
|
||||||
start_date = makeTimeStamp(show.start);
|
dialog.dialog({
|
||||||
end_date = makeTimeStamp(show.end);
|
autoOpen: false,
|
||||||
|
title: 'Schedule Playlist',
|
||||||
|
width: 1100,
|
||||||
|
height: 500,
|
||||||
|
modal: true,
|
||||||
|
close: closeDialog,
|
||||||
|
buttons: {"Ok": function() {
|
||||||
|
dialog.remove();
|
||||||
|
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||||
|
}}
|
||||||
|
});
|
||||||
|
|
||||||
$.post(url,
|
dialog.dialog('open');
|
||||||
{start: start_date, end: end_date, showId: show.id},
|
|
||||||
function(json){
|
|
||||||
var dialog = $(json.dialog);
|
|
||||||
|
|
||||||
makeScheduleDialog(dialog, json, show);
|
|
||||||
|
|
||||||
dialog.dialog({
|
|
||||||
autoOpen: false,
|
|
||||||
title: 'Schedule Playlist',
|
|
||||||
width: 1100,
|
|
||||||
height: 500,
|
|
||||||
modal: true,
|
|
||||||
close: closeDialog,
|
|
||||||
buttons: {"Ok": function() {
|
|
||||||
dialog.remove();
|
|
||||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
|
||||||
}}
|
|
||||||
});
|
|
||||||
|
|
||||||
dialog.dialog('open');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function eventMenu(action, el, pos) {
|
function scheduleRefetchEvents() {
|
||||||
var method, event, start_timestamp, url;
|
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||||
|
|
||||||
method = action.split('/').pop();
|
|
||||||
event = $(el).data('event');
|
|
||||||
start_timestamp = makeTimeStamp(event.start);
|
|
||||||
|
|
||||||
if (method === 'delete-show') {
|
|
||||||
|
|
||||||
url = '/Schedule/delete-show';
|
|
||||||
|
|
||||||
$.post(action,
|
|
||||||
{format: "json", showId: event.id, date: start_timestamp},
|
|
||||||
function(json){
|
|
||||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (method === 'schedule-show') {
|
|
||||||
|
|
||||||
openScheduleDialog(event);
|
|
||||||
}
|
|
||||||
else if (method === 'clear-show') {
|
|
||||||
|
|
||||||
url = '/Schedule/clear-show';
|
|
||||||
|
|
||||||
$.post(url,
|
|
||||||
{format: "json", start: start_timestamp, showId: event.id},
|
|
||||||
function(json){
|
|
||||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
@ -244,7 +204,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
events: getFullCalendarEvents,
|
events: getFullCalendarEvents,
|
||||||
|
|
||||||
//callbacks (from full-calendar-functions.js
|
//callbacks (in full-calendar-functions.js)
|
||||||
dayClick: dayClick,
|
dayClick: dayClick,
|
||||||
eventRender: eventRender,
|
eventRender: eventRender,
|
||||||
eventAfterRender: eventAfterRender,
|
eventAfterRender: eventAfterRender,
|
||||||
|
@ -253,9 +213,7 @@ $(document).ready(function() {
|
||||||
eventMouseout: eventMouseout,
|
eventMouseout: eventMouseout,
|
||||||
eventDrop: eventDrop,
|
eventDrop: eventDrop,
|
||||||
eventResize: eventResize
|
eventResize: eventResize
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).load(function() {
|
$(window).load(function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue