cc-2359: record check box is disabled after update show

-fixed
This commit is contained in:
martin 2011-06-03 14:01:58 -04:00
parent 308efaeadc
commit e969baee1c
2 changed files with 49 additions and 84 deletions

View file

@ -53,34 +53,8 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css'); $this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css'); $this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css'); $this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css');
$formWhat = new Application_Form_AddShowWhat(); Schedule::createNewFormSections($this->view);
$formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats();
$formStyle = new Application_Form_AddShowStyle();
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formWhat->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper');
$formRepeats->removeDecorator('DtDdWrapper');
$formStyle->removeDecorator('DtDdWrapper');
$formRecord->removeDecorator('DtDdWrapper');
$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
$this->view->rr = $formRecord;
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$this->view->rebroadcast = $formRebroadcast;
$this->view->addNewShow = true;
$formWhat->populate(array('add_show_id' => '-1'));
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id); $user = new User($userInfo->id);
@ -510,35 +484,8 @@ class ScheduleController extends Zend_Controller_Action
$this->view->entries = 5; $this->view->entries = 5;
} }
public function getFormAction(){ public function getFormAction(){
$formWhat = new Application_Form_AddShowWhat(); Schedule::createNewFormSections($this->view);
$formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats();
$formStyle = new Application_Form_AddShowStyle();
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formWhat->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper');
$formRepeats->removeDecorator('DtDdWrapper');
$formStyle->removeDecorator('DtDdWrapper');
$formRecord->removeDecorator('DtDdWrapper');
$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
$this->view->rr = $formRecord;
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$this->view->rebroadcast = $formRebroadcast;
$this->view->addNewShow = true;
$formWhat->populate(array('add_show_id' => '-1'));
$this->view->form = $this->view->render('schedule/add-show-form.phtml'); $this->view->form = $this->view->render('schedule/add-show-form.phtml');
} }
@ -587,16 +534,6 @@ class ScheduleController extends Zend_Controller_Action
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper'); $formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
$formRebroadcast->removeDecorator('DtDdWrapper'); $formRebroadcast->removeDecorator('DtDdWrapper');
$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
$this->view->rr = $formRecord;
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$this->view->rebroadcast = $formRebroadcast;
$this->view->addNewShow = true;
$what = $formWhat->isValid($data); $what = $formWhat->isValid($data);
$when = $formWhen->isValid($data); $when = $formWhen->isValid($data);
if($when) { if($when) {
@ -662,27 +599,23 @@ class ScheduleController extends Zend_Controller_Action
if ($user->isAdmin()) { if ($user->isAdmin()) {
Show::create($data); Show::create($data);
} }
//send back a new form for the user. //send back a new form for the user.
$formWhat->reset(); Schedule::createNewFormSections($this->view);
$formWhat->populate(array('add_show_id' => '-1'));
$formWho->reset();
$formWhen->reset();
$formWhen->populate(array('add_show_start_date' => date("Y-m-d"),
'add_show_start_time' => '0:00',
'add_show_duration' => '1:00'));
$formRepeats->reset();
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
$formStyle->reset();
$formRecord->reset();
$formAbsoluteRebroadcast->reset();
$formRebroadcast->reset();
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml'); $this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
} }
else { else {
$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
$this->view->rr = $formRecord;
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$this->view->rebroadcast = $formRebroadcast;
$this->view->addNewShow = true;
//the form still needs to be "update" since //the form still needs to be "update" since
//the validity test failed. //the validity test failed.
if ($data['add_show_id'] != -1){ if ($data['add_show_id'] != -1){

View file

@ -725,5 +725,37 @@ class Schedule {
global $CC_CONFIG, $CC_DBC; global $CC_CONFIG, $CC_DBC;
$CC_DBC->query("TRUNCATE TABLE ".$CC_CONFIG["scheduleTable"]); $CC_DBC->query("TRUNCATE TABLE ".$CC_CONFIG["scheduleTable"]);
} }
public static function createNewFormSections($p_view){
$formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats();
$formStyle = new Application_Form_AddShowStyle();
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formWhat->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper');
$formRepeats->removeDecorator('DtDdWrapper');
$formStyle->removeDecorator('DtDdWrapper');
$formRecord->removeDecorator('DtDdWrapper');
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
$formRebroadcast->removeDecorator('DtDdWrapper');
$p_view->what = $formWhat;
$p_view->when = $formWhen;
$p_view->repeats = $formRepeats;
$p_view->who = $formWho;
$p_view->style = $formStyle;
$p_view->rr = $formRecord;
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$p_view->rebroadcast = $formRebroadcast;
$p_view->addNewShow = true;
$formWhat->populate(array('add_show_id' => '-1'));
}
} }