CC-3174 : showbuilder

show editing menu added.
This commit is contained in:
Naomi Aro 2012-02-08 12:53:46 +01:00
parent 216ce80ceb
commit 581f86a1de
4 changed files with 28 additions and 26 deletions

View File

@ -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);

View File

@ -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()

View File

@ -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) {

View File

@ -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){