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

-in progress
This commit is contained in:
Martin Konecny 2012-04-05 14:45:16 -04:00
parent cf2813a545
commit 8050a1ce29
3 changed files with 33 additions and 10 deletions

View file

@ -444,6 +444,10 @@ class ScheduleController extends Zend_Controller_Action
// repeating shows. It's value is either "instance","rebroadcast", or "all" // repeating shows. It's value is either "instance","rebroadcast", or "all"
$type = $this->_getParam('type'); $type = $this->_getParam('type');
if ($type == "instance"){
$this->view->action = "edit-show-instance";
}
try{ try{
$showInstance = new Application_Model_ShowInstance($showInstanceId); $showInstance = new Application_Model_ShowInstance($showInstanceId);
}catch(Exception $e){ }catch(Exception $e){
@ -607,7 +611,26 @@ class ScheduleController extends Zend_Controller_Action
Application_Model_Schedule::createNewFormSections($this->view); Application_Model_Schedule::createNewFormSections($this->view);
$this->view->form = $this->view->render('schedule/add-show-form.phtml'); $this->view->form = $this->view->render('schedule/add-show-form.phtml');
} }
public function editShowInstanceAction(){
$js = $this->_getParam('data');
$data = array();
//need to convert from serialized jQuery array.
foreach($js as $j){
$data[$j["name"]] = $j["value"];
}
}
//for 2.2
/*
public function editShowAction(){
}
*/
public function addShowAction() public function addShowAction()
{ {
$js = $this->_getParam('data'); $js = $this->_getParam('data');
@ -619,13 +642,6 @@ class ScheduleController extends Zend_Controller_Action
} }
$show = new Application_Model_Show($data['add_show_id']); $show = new Application_Model_Show($data['add_show_id']);
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$isDJ = $user->isHost($show->getId());
$startDateModified = true; $startDateModified = true;
if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){ if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){
//show is being updated and changing the start date was disabled, since the //show is being updated and changing the start date was disabled, since the
@ -642,6 +658,11 @@ class ScheduleController extends Zend_Controller_Action
if($data['add_show_day_check'] == "") { if($data['add_show_day_check'] == "") {
$data['add_show_day_check'] = null; $data['add_show_day_check'] = null;
} }
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$isDJ = $user->isHost($show->getId());
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$record = false; $record = false;
@ -785,7 +806,7 @@ class ScheduleController extends Zend_Controller_Action
if (!$startDateModified){ if (!$startDateModified){
$formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true)); $formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true));
} }
$this->view->form = $this->view->render('schedule/add-show-form.phtml'); $this->view->form = $this->view->render('schedule/add-show-form.phtml');
} }

View file

@ -1,7 +1,7 @@
<div id="schedule-add-show" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded"> <div id="schedule-add-show" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded">
<div class="button-bar"> <div class="button-bar">
<a href="#" id="add-show-close" class="icon-link"><span class="ui-icon ui-icon-circle-close"></span>Close</a> <a href="#" id="add-show-close" class="icon-link"><span class="ui-icon ui-icon-circle-close"></span>Close</a>
<button aria-disabled="false" role="button" class="add-show-submit right-floated ui-button ui-widget ui-state-default ui-button-text-icon-primary"> <button data-action="<?php echo isset($this->action) ? $this->action : "add-show" ?>" aria-disabled="false" role="button" class="add-show-submit right-floated ui-button ui-widget ui-state-default ui-button-text-icon-primary">
<span class="ui-icon ui-icon-plusthick"></span> <span class="ui-icon ui-icon-plusthick"></span>
<span class="ui-button-text"><?php echo ($this->addNewShow ? "Add this show" : "Update show"); ?></span> <span class="ui-button-text"><?php echo ($this->addNewShow ? "Add this show" : "Update show"); ?></span>
</button> </button>

View file

@ -320,8 +320,10 @@ function setAddShowEvents() {
message: null, message: null,
applyPlatformOpacityRules: false applyPlatformOpacityRules: false
}); });
var action = "/Schedule/"+addShowButton.attr("data-type");
$.post("/Schedule/add-show", {format: "json", data: data, hosts: hosts, days: days}, function(json){ $.post(action, {format: "json", data: data, hosts: hosts, days: days}, function(json){
//addShowButton.removeClass("disabled"); //addShowButton.removeClass("disabled");
$('#schedule-add-show').unblock(); $('#schedule-add-show').unblock();
if(json.form) { if(json.form) {