CC-3548: Schedule: Separate repeate show template and single instance on
'When' section - UI portion of the feature
This commit is contained in:
parent
3be1944fa4
commit
5da7d42290
airtime_mvc
application
public/js/airtime/schedule
|
@ -258,7 +258,13 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete");
|
||||
}
|
||||
} 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){
|
||||
$menu["cancel"] = array("name"=> "Cancel Current Show", "icon" => "delete");
|
||||
}
|
||||
|
@ -269,7 +275,13 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
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) {
|
||||
|
||||
|
@ -420,6 +432,9 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
|
||||
$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{
|
||||
$showInstance = new Application_Model_ShowInstance($showInstanceId);
|
||||
|
@ -549,7 +564,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$i++;
|
||||
}
|
||||
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
|
||||
if(!$isAdminOrPM){
|
||||
if(!$isAdminOrPM || $type == "instance"){
|
||||
$formRecord->disable();
|
||||
$formAbsoluteRebroadcast->disable();
|
||||
$formRebroadcast->disable();
|
||||
|
@ -563,6 +578,14 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$formRepeats->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->entries = 5;
|
||||
|
|
|
@ -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; '));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -743,4 +743,12 @@ class Application_Model_ShowInstance {
|
|||
|
||||
return $CC_DBC->GetAll($sql);
|
||||
}
|
||||
|
||||
function isRepeating(){
|
||||
if ($this->getShow()->isRepeating()){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,13 +297,32 @@ $(document).ready(function() {
|
|||
|
||||
//define an edit callback.
|
||||
if (oItems.edit !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
$.get(oItems.edit.url, {format: "json", id: data.id}, function(json){
|
||||
beginEditShow(json);
|
||||
});
|
||||
};
|
||||
oItems.edit.callback = callback;
|
||||
if(oItems.edit.items !== undefined){
|
||||
var edit = oItems.edit.items;
|
||||
|
||||
//edit a single instance
|
||||
callback = function() {
|
||||
$.get(edit.instance.url, {format: "json", id: data.id, type: "instance"}, function(json){
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue