diff --git a/application/forms/AddShowStyle.php b/application/forms/AddShowStyle.php index faa471f0d..b7000505f 100644 --- a/application/forms/AddShowStyle.php +++ b/application/forms/AddShowStyle.php @@ -12,12 +12,26 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm 'filters' => array('StringTrim') )); + $bg = $this->getElement('add_show_background_color'); + + $bg->setDecorators(array(array('ViewScript', array( + 'viewScript' => 'form/add-show-style.phtml', + 'class' => 'big' + )))); + // Add show color input $this->addElement('text', 'add_show_color', array( 'label' => 'Text Colour', 'class' => 'input_text', 'filters' => array('StringTrim') )); + + $c = $this->getElement('add_show_color'); + + $c->setDecorators(array(array('ViewScript', array( + 'viewScript' => 'form/add-show-style.phtml', + 'class' => 'big' + )))); } diff --git a/application/forms/AddShowWhen.php b/application/forms/AddShowWhen.php index cc37af4d8..5bfb4daeb 100644 --- a/application/forms/AddShowWhen.php +++ b/application/forms/AddShowWhen.php @@ -37,7 +37,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm 'filters' => array('StringTrim'), 'validators' => array( 'NotEmpty', - array('date', false, array('HH:mm')) + array('regex', false, array('([0-2][0-3]:[0-5][0-5])', 'messages' => 'Show must be under 24 hours')) ) )); @@ -51,6 +51,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm public function checkReliantFields($formData) { + $valid = true; + $now_timestamp = date("Y-m-d H:i:s"); $start_timestamp = $formData['add_show_start_date']."".$formData['add_show_start_time']; @@ -59,10 +61,15 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm if($start_epoch < $now_epoch) { $this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past')); - return false; + $valid = false; + } + + if(strtotime("23:59") < strtotime($formData["add_show_duration"])) { + $this->getElement('add_show_duration')->setErrors(array('Max show size: 23:59')); + $valid = false; } - return true; + return $valid; } } diff --git a/application/views/scripts/form/add-show-block.phtml b/application/views/scripts/form/add-show-block.phtml index a946a3936..001e0fea6 100644 --- a/application/views/scripts/form/add-show-block.phtml +++ b/application/views/scripts/form/add-show-block.phtml @@ -8,5 +8,8 @@ $this->element->getValue(), $this->element->getAttribs() ) ?> - formErrors($this->element->getMessages()) ?> + element->hasErrors()) { + echo $this->formErrors($this->element->getMessages()); + } + ?> diff --git a/application/views/scripts/form/add-show-style.phtml b/application/views/scripts/form/add-show-style.phtml new file mode 100644 index 000000000..7ab679a6f --- /dev/null +++ b/application/views/scripts/form/add-show-style.phtml @@ -0,0 +1,16 @@ +