From 954fa2bceb97033750c96f333ffa7029056ca526 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 5 Apr 2012 16:01:27 -0400 Subject: [PATCH] CC-3444: Ability to edit currently playing show (end time and permissions) - handling in better way. we created separate action for this. --- .../controllers/ScheduleController.php | 25 +++++++++++++++++++ .../forms/AddShowAbsoluteRebroadcastDates.php | 3 +-- airtime_mvc/application/forms/AddShowRR.php | 3 +-- .../forms/AddShowRebroadcastDates.php | 3 +-- .../application/forms/AddShowRepeats.php | 3 +-- .../application/forms/AddShowStyle.php | 3 +-- airtime_mvc/application/forms/AddShowWhat.php | 3 +-- airtime_mvc/application/forms/AddShowWhen.php | 6 ++--- airtime_mvc/application/forms/AddShowWho.php | 3 +-- airtime_mvc/application/models/Show.php | 24 ++++++++++++++++++ .../scripts/schedule/add-show-form.phtml | 2 +- .../public/js/airtime/schedule/add-show.js | 15 ++++++++++- 12 files changed, 73 insertions(+), 20 deletions(-) diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index b85a45780..23f4933b0 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -28,6 +28,8 @@ class ScheduleController extends Zend_Controller_Action ->addActionContext('content-context-menu', 'json') ->addActionContext('set-time-scale', 'json') ->addActionContext('set-time-interval', 'json') + ->addActionContext('edit-show-instance', 'json') + ->addActionContext('dj-edit-show', 'json') ->initContext(); $this->sched_sess = new Zend_Session_Namespace("schedule"); @@ -461,6 +463,10 @@ class ScheduleController extends Zend_Controller_Action if(!($isAdminOrPM || $isDJ)) { return; } + + if($isDJ){ + $this->view->action = "dj-edit-show"; + } $formWhat = new Application_Form_AddShowWhat(); $formWho = new Application_Form_AddShowWho(); @@ -624,6 +630,25 @@ class ScheduleController extends Zend_Controller_Action } + public function djEditShowAction(){ + $js = $this->_getParam('data'); + $data = array(); + + //need to convert from serialized jQuery array. + foreach($js as $j){ + $data[$j["name"]] = $j["value"]; + } + + //update cc_show + $show = new Application_Model_Show($data["add_show_id"]); + $show->setAirtimeAuthFlag($data["cb_airtime_auth"]); + $show->setCustomAuthFlag($data["cb_custom_auth"]); + $show->setCustomUsername($data["custom_username"]); + $show->setCustomPassword($data["custom_password"]); + + $this->view->edit = true; + } + //for 2.2 /* public function editShowAction(){ diff --git a/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php b/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php index 8e1601819..b936960fc 100644 --- a/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php +++ b/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php @@ -36,8 +36,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm { if ($element->getType() != 'Zend_Form_Element_Hidden') { - $element->setAttrib('readonly',true); - $element->setAttribs(array('style' => 'color: #B1B1B1; ')); + $element->setAttrib('disabled','disabled'); } } } diff --git a/airtime_mvc/application/forms/AddShowRR.php b/airtime_mvc/application/forms/AddShowRR.php index 4c6e5b4b2..9f3778df1 100644 --- a/airtime_mvc/application/forms/AddShowRR.php +++ b/airtime_mvc/application/forms/AddShowRR.php @@ -24,8 +24,7 @@ class Application_Form_AddShowRR extends Zend_Form_SubForm { if ($element->getType() != 'Zend_Form_Element_Hidden') { - $element->setAttrib('readonly',true); - $element->setAttribs(array('style' => 'color: #B1B1B1; ')); + $element->setAttrib('disabled','disabled'); } } } diff --git a/airtime_mvc/application/forms/AddShowRebroadcastDates.php b/airtime_mvc/application/forms/AddShowRebroadcastDates.php index b4b352624..58afa7f0c 100644 --- a/airtime_mvc/application/forms/AddShowRebroadcastDates.php +++ b/airtime_mvc/application/forms/AddShowRebroadcastDates.php @@ -41,8 +41,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm { if ($element->getType() != 'Zend_Form_Element_Hidden') { - $element->setAttrib('readonly',true); - $element->setAttribs(array('style' => 'color: #B1B1B1; ')); + $element->setAttrib('disabled','disabled'); } } } diff --git a/airtime_mvc/application/forms/AddShowRepeats.php b/airtime_mvc/application/forms/AddShowRepeats.php index d92662e0c..2315147fb 100644 --- a/airtime_mvc/application/forms/AddShowRepeats.php +++ b/airtime_mvc/application/forms/AddShowRepeats.php @@ -62,8 +62,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm { if ($element->getType() != 'Zend_Form_Element_Hidden') { - $element->setAttrib('readonly',true); - $element->setAttribs(array('style' => 'color: #B1B1B1; ')); + $element->setAttrib('disabled','disabled'); } } } diff --git a/airtime_mvc/application/forms/AddShowStyle.php b/airtime_mvc/application/forms/AddShowStyle.php index 1e9b968ce..4f43159e5 100644 --- a/airtime_mvc/application/forms/AddShowStyle.php +++ b/airtime_mvc/application/forms/AddShowStyle.php @@ -40,8 +40,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm { if ($element->getType() != 'Zend_Form_Element_Hidden') { - $element->setAttrib('readonly',true); - $element->setAttribs(array('style' => 'color: #B1B1B1; ')); + $element->setAttrib('disabled','disabled'); } } } diff --git a/airtime_mvc/application/forms/AddShowWhat.php b/airtime_mvc/application/forms/AddShowWhat.php index 54707c461..10ed22415 100644 --- a/airtime_mvc/application/forms/AddShowWhat.php +++ b/airtime_mvc/application/forms/AddShowWhat.php @@ -66,8 +66,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm { if ($element->getType() != 'Zend_Form_Element_Hidden') { - $element->setAttrib('readonly',true); - $element->setAttribs(array('style' => 'color: #B1B1B1; ')); + $element->setAttrib('disabled','disabled'); } } } diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php index cbae215cf..1493c4ace 100644 --- a/airtime_mvc/application/forms/AddShowWhen.php +++ b/airtime_mvc/application/forms/AddShowWhen.php @@ -119,8 +119,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm { if ($element->getType() != 'Zend_Form_Element_Hidden') { - $element->setAttrib('readonly',true); - $element->setAttribs(array('style' => 'color: #B1B1B1; ')); + $element->setAttrib('disabled','disabled'); } } } @@ -129,8 +128,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $element = $this->getElement('add_show_repeats'); if ($element->getType() != 'Zend_Form_Element_Hidden') { - $element->setAttrib('readonly',true); - $element->setAttribs(array('style' => 'color: #B1B1B1; ')); + $element->setAttrib('disabled','disabled'); } } } diff --git a/airtime_mvc/application/forms/AddShowWho.php b/airtime_mvc/application/forms/AddShowWho.php index 7f0508c93..35b2aa52f 100644 --- a/airtime_mvc/application/forms/AddShowWho.php +++ b/airtime_mvc/application/forms/AddShowWho.php @@ -33,8 +33,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm { if ($element->getType() != 'Zend_Form_Element_Hidden') { - $element->setAttrib('readonly',true); - $element->setAttribs(array('style' => 'color: #B1B1B1; ')); + $element->setAttrib('disabled','disabled'); } } } diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 1260781c4..161048bb8 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -21,6 +21,30 @@ class Application_Model_Show { $show->setDbName($name); Application_Model_RabbitMq::PushSchedule(); } + + public function setAirtimeAuthFlag($flag){ + $show = CcShowQuery::create()->findPK($this->_showId); + $show->setDbLiveStreamUsingAirtimeAuth($flag); + $show->save(); + } + + public function setCustomAuthFlag($flag){ + $show = CcShowQuery::create()->findPK($this->_showId); + $show->setDbLiveStreamUsingCustomAuth($flag); + $show->save(); + } + + public function setCustomUsername($username){ + $show = CcShowQuery::create()->findPK($this->_showId); + $show->setDbLiveStreamUser($username); + $show->save(); + } + + public function setCustomPassword($password){ + $show = CcShowQuery::create()->findPK($this->_showId); + $show->setDbLiveStreamPass($password); + $show->save(); + } public function getDescription() { diff --git a/airtime_mvc/application/views/scripts/schedule/add-show-form.phtml b/airtime_mvc/application/views/scripts/schedule/add-show-form.phtml index c573aabf0..be1c5d694 100644 --- a/airtime_mvc/application/views/scripts/schedule/add-show-form.phtml +++ b/airtime_mvc/application/views/scripts/schedule/add-show-form.phtml @@ -37,7 +37,7 @@ style; ?>
- diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index baba8ed6b..eb2213d38 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -321,7 +321,7 @@ function setAddShowEvents() { applyPlatformOpacityRules: false }); - var action = "/Schedule/"+addShowButton.attr("data-type"); + var action = "/Schedule/"+addShowButton.attr("data-action"); $.post(action, {format: "json", data: data, hosts: hosts, days: days}, function(json){ //addShowButton.removeClass("disabled"); @@ -336,6 +336,19 @@ function setAddShowEvents() { $("#add_show_end_date").val(end_date); $("#add_show_start_date").val(start_date); showErrorSections(); + }else if(json.edit){ + $("#schedule_calendar").removeAttr("style") + .fullCalendar('render'); + + $("#add-show-form").hide(); + $.get("/Schedule/get-form", {format:"json"}, function(json){ + $("#add-show-form") + .empty() + .append(json.form); + + setAddShowEvents(); + }); + makeAddShowButton(); } else { $("#add-show-form")