From 581f86a1deb53863a19cb1cec9aae9ad074a0d2f Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 8 Feb 2012 12:53:46 +0100 Subject: [PATCH] CC-3174 : showbuilder show editing menu added. --- .../controllers/LibraryController.php | 1 + .../controllers/ScheduleController.php | 25 +++++++++++------- .../schedule/full-calendar-functions.js | 2 ++ .../public/js/airtime/schedule/schedule.js | 26 +++++++------------ 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index 9da7a257d..a4f1712f3 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -78,6 +78,7 @@ class LibraryController extends Zend_Controller_Action $screen = $this->_getParam('screen'); $request = $this->getRequest(); $baseUrl = $request->getBaseUrl(); + $menu = array(); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $user = new Application_Model_User($userInfo->id); diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 710a7056c..a044a3b55 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -183,6 +183,7 @@ class ScheduleController extends Zend_Controller_Action public function makeContextMenuAction() { $id = $this->_getParam('id'); + $menu = array(); $epochNow = time(); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); @@ -194,18 +195,16 @@ class ScheduleController extends Zend_Controller_Action return false; } + $showStartLocalDT = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowInstanceStart()); + $showEndLocalDT = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowInstanceEnd()); - $params = '/format/json/id/#id#'; - - $showStartDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowInstanceStart()); - $showEndDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowInstanceEnd()); - - $menu = array(); - + /* if ($epochNow < $showStartDateHelper->getTimestamp()) { if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId()) && !$show->isRecorded() && !$show->isRebroadcast()) { + //$menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}"); + $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/schedule-show-dialog'.$params, 'callback' => 'window["buildScheduleDialog"]'), 'title' => 'Add / Remove Content'); @@ -249,10 +248,16 @@ class ScheduleController extends Zend_Controller_Action } } - if ($epochNow < $showStartDateHelper->getTimestamp()) { + */ + + if ($epochNow < $showStartLocalDT->getTimestamp()) { if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { + //callback window["beginEditShow"] /format/json/id/{$id} + $menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show"); + + /* $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/edit-show/format/json/id/'.$id, 'callback' => 'window["beginEditShow"]'), 'title' => 'Edit Show'); $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params, @@ -261,11 +266,11 @@ class ScheduleController extends Zend_Controller_Action $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/cancel-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance and All Following'); } + */ } } - //returns format jjmenu is looking for. - die(json_encode($menu)); + $this->view->items = $menu; } public function scheduleShowAction() diff --git a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js index 978b55523..ef6cee5e1 100644 --- a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js +++ b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js @@ -212,6 +212,8 @@ function viewDisplay( view ) { } function eventRender(event, element, view) { + + $(element).data("event", event); //only put progress bar on shows that aren't being recorded. if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 0) { diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index 726bd3c4e..42e4f22a8 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -268,12 +268,6 @@ function buildContentDialog(json){ }); dialog.dialog('open'); - - $('#show_content_dialog tbody tr') - .jjmenu("click", - [{get:"/Schedule/content-context-menu/format/json/id/#id#"}], - {id: getId}, - {xposition: "mouse", yposition: "mouse"}); } function buildScheduleDialog(json){ @@ -379,30 +373,30 @@ $(window).load(function() { ignoreRightClick: true, build: function($el, e) { - var x, request, data, screen, items, callback, $tr; + var request, data, items, callback; - $tr = $el.parent(); - data = $tr.data("aData"); - screen = $tr.data("screen"); + data = $el.data("event"); function processMenuItems(oItems) { - //define a download callback. - if (oItems.download !== undefined) { + //define an edit callback. + if (oItems.edit !== undefined) { callback = function() { - document.location.href = oItems.download.url; + $.get(oItems.edit.url, {format: "json", id: data.id}, function(json){ + beginEditShow(json); + }); }; - oItems.download.callback = callback; + oItems.edit.callback = callback; } items = oItems; } request = $.ajax({ - url: "/library/context-menu", + url: "/schedule/make-context-menu", type: "GET", - data: {id : data.id, type: data.ftype, format: "json", "screen": screen}, + data: {id : data.id, format: "json"}, dataType: "json", async: false, success: function(json){