CC-3548: Schedule: Separate repeate show template and single instance on

'When' section

- UI portion of the feature
This commit is contained in:
James 2012-04-04 14:53:26 -04:00
parent 3be1944fa4
commit 5da7d42290
4 changed files with 69 additions and 10 deletions

View file

@ -258,7 +258,13 @@ class ScheduleController extends Zend_Controller_Action
$menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete"); $menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete");
} }
} else { } else {
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show"); if($instance->isRepeating()){
$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "items" => array());
$menu["edit"]["items"]["instance"] = array("name"=> "Edit Show Instance", "icon" => "edit", "url" => "/Schedule/edit-show");
$menu["edit"]["items"]["all"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show");
}else{
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show");
}
if($isAdminOrPM){ if($isAdminOrPM){
$menu["cancel"] = array("name"=> "Cancel Current Show", "icon" => "delete"); $menu["cancel"] = array("name"=> "Cancel Current Show", "icon" => "delete");
} }
@ -269,7 +275,13 @@ class ScheduleController extends Zend_Controller_Action
if ($isAdminOrPM || $isDJ) { if ($isAdminOrPM || $isDJ) {
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show"); if($instance->isRepeating()){
$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "items" => array());
$menu["edit"]["items"]["instance"] = array("name"=> "Edit Show Instance", "icon" => "edit", "url" => "/Schedule/edit-show");
$menu["edit"]["items"]["all"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show");
}else{
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show");
}
if ($instance->getShow()->isRepeating() && $isAdminOrPM) { if ($instance->getShow()->isRepeating() && $isAdminOrPM) {
@ -420,6 +432,9 @@ class ScheduleController extends Zend_Controller_Action
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
// $type is used to determine if this edit is for the specific instance or for all
// repeating shows. It's value is either "instance" or "all"
$type = $this->_getParam('type');
try{ try{
$showInstance = new Application_Model_ShowInstance($showInstanceId); $showInstance = new Application_Model_ShowInstance($showInstanceId);
@ -549,7 +564,7 @@ class ScheduleController extends Zend_Controller_Action
$i++; $i++;
} }
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues); $formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
if(!$isAdminOrPM){ if(!$isAdminOrPM || $type == "instance"){
$formRecord->disable(); $formRecord->disable();
$formAbsoluteRebroadcast->disable(); $formAbsoluteRebroadcast->disable();
$formRebroadcast->disable(); $formRebroadcast->disable();
@ -563,6 +578,14 @@ class ScheduleController extends Zend_Controller_Action
$formRepeats->disable(); $formRepeats->disable();
$formStyle->disable(); $formStyle->disable();
} }
if($type == "instance"){
$formWhat->disable();
$formWho->disable();
$formWhen->disableRepeatCheckbox();
$formRepeats->disable();
$formStyle->disable();
}
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml'); $this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
$this->view->entries = 5; $this->view->entries = 5;

View file

@ -124,5 +124,14 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
} }
} }
} }
public function disableRepeatCheckbox(){
$element = $this->getElement('add_show_repeats');
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
}
}
} }

View file

@ -743,4 +743,12 @@ class Application_Model_ShowInstance {
return $CC_DBC->GetAll($sql); return $CC_DBC->GetAll($sql);
} }
function isRepeating(){
if ($this->getShow()->isRepeating()){
return true;
}else{
return false;
}
}
} }

View file

@ -297,13 +297,32 @@ $(document).ready(function() {
//define an edit callback. //define an edit callback.
if (oItems.edit !== undefined) { if (oItems.edit !== undefined) {
if(oItems.edit.items !== undefined){
callback = function() { var edit = oItems.edit.items;
$.get(oItems.edit.url, {format: "json", id: data.id}, function(json){
beginEditShow(json); //edit a single instance
}); callback = function() {
}; $.get(edit.instance.url, {format: "json", id: data.id, type: "instance"}, function(json){
oItems.edit.callback = callback; beginEditShow(json);
});
};
edit.instance.callback = callback;
//edit this instance and all
callback = function() {
$.get(edit.all.url, {format: "json", id: data.id, type: "all"}, function(json){
beginEditShow(json);
});
};
edit.all.callback = callback;
}else{
callback = function() {
$.get(oItems.edit.url, {format: "json", id: data.id, type: "all"}, function(json){
beginEditShow(json);
});
};
oItems.edit.callback = callback;
}
} }
//define a content callback. //define a content callback.