CC-3174 : showbuilder

changing show context menus
This commit is contained in:
Naomi Aro 2012-02-08 13:12:08 +01:00
parent 581f86a1de
commit a2f38b94a2
2 changed files with 34 additions and 4 deletions

View file

@ -189,7 +189,7 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
try{ try{
$show = new Application_Model_ShowInstance($id); $instance = new Application_Model_ShowInstance($id);
}catch(Exception $e){ }catch(Exception $e){
$this->view->show_error = true; $this->view->show_error = true;
return false; return false;
@ -257,12 +257,31 @@ class ScheduleController extends Zend_Controller_Action
//callback window["beginEditShow"] /format/json/id/{$id} //callback window["beginEditShow"] /format/json/id/{$id}
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show"); $menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show");
if ($instance->getShow()->isRepeating()) {
//create delete sub menu.
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "items" => array());
//window["scheduleRefetchEvents"]
$menu["del"]["items"]["single"] = array("name"=> "Delete", "icon" => "delete", "url" => "/schedule/delete-show");
//window["scheduleRefetchEvents"]
$menu["del"]["items"]["following"] = array("name"=> "Delete", "icon" => "delete", "url" => "/schedule/cancel-show");
}
else {
//window["scheduleRefetchEvents"]'
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/schedule/delete-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, $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params,
'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance'); 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance');
if ($show->getShow()->isRepeating() || $show->getShow()->isRebroadcast()) {
if ($show->getShow()->isRepeating()) {
//create delete sub menu.
//$menu["del"] = array("name"=> "Delete", "icon" => "delete", "items" => array());
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/cancel-show'.$params, $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/cancel-show'.$params,
'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance and All Following'); 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance and All Following');
} }

View file

@ -390,6 +390,17 @@ $(window).load(function() {
oItems.edit.callback = callback; oItems.edit.callback = callback;
} }
//define a delete callback.
if (oItems.del !== undefined) {
callback = function() {
$.get(oItems.edit.url, {format: "json", id: data.id}, function(json){
beginEditShow(json);
});
};
oItems.del.callback = callback;
}
items = oItems; items = oItems;
} }