CC-1759
check duration is under 24 hours, colorpicker updates on drag, picker for duration without am/pm.
This commit is contained in:
parent
092b36c346
commit
48c1ce77b9
6 changed files with 55 additions and 7 deletions
|
@ -12,12 +12,26 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||||
'filters' => array('StringTrim')
|
'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
|
// Add show color input
|
||||||
$this->addElement('text', 'add_show_color', array(
|
$this->addElement('text', 'add_show_color', array(
|
||||||
'label' => 'Text Colour',
|
'label' => 'Text Colour',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$c = $this->getElement('add_show_color');
|
||||||
|
|
||||||
|
$c->setDecorators(array(array('ViewScript', array(
|
||||||
|
'viewScript' => 'form/add-show-style.phtml',
|
||||||
|
'class' => 'big'
|
||||||
|
))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
'NotEmpty',
|
'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) {
|
public function checkReliantFields($formData) {
|
||||||
|
|
||||||
|
$valid = true;
|
||||||
|
|
||||||
$now_timestamp = date("Y-m-d H:i:s");
|
$now_timestamp = date("Y-m-d H:i:s");
|
||||||
$start_timestamp = $formData['add_show_start_date']."".$formData['add_show_start_time'];
|
$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) {
|
if($start_epoch < $now_epoch) {
|
||||||
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,5 +8,8 @@
|
||||||
$this->element->getValue(),
|
$this->element->getValue(),
|
||||||
$this->element->getAttribs()
|
$this->element->getAttribs()
|
||||||
) ?>
|
) ?>
|
||||||
<?php echo $this->formErrors($this->element->getMessages()) ?>
|
<?php if($this->element->hasErrors()) {
|
||||||
|
echo $this->formErrors($this->element->getMessages());
|
||||||
|
}
|
||||||
|
?>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
16
application/views/scripts/form/add-show-style.phtml
Normal file
16
application/views/scripts/form/add-show-style.phtml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<dt id="<?php echo $this->element->getName() ?>-label" class="<?php echo $this->class ?>">
|
||||||
|
<?php echo $this->formLabel($this->element->getName(),
|
||||||
|
$this->element->getLabel()) ?>
|
||||||
|
</dt>
|
||||||
|
<dd id="<?php echo $this->element->getName() ?>-element">
|
||||||
|
<?php echo $this->{$this->element->helper}(
|
||||||
|
$this->element->getName(),
|
||||||
|
$this->element->getValue(),
|
||||||
|
$this->element->getAttribs()
|
||||||
|
) ?>
|
||||||
|
|
||||||
|
<?php if($this->element->hasErrors()) {
|
||||||
|
echo $this->formErrors($this->element->getMessages());
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</dd>
|
|
@ -77,13 +77,20 @@ function setAddShowEvents() {
|
||||||
createDateInput(end, endDpSelect);
|
createDateInput(end, endDpSelect);
|
||||||
|
|
||||||
$("#add_show_start_time").timepicker();
|
$("#add_show_start_time").timepicker();
|
||||||
|
$("#add_show_duration").timepicker({
|
||||||
|
amPmText: ['', '']
|
||||||
|
});
|
||||||
|
|
||||||
$("#add_show_hosts_autocomplete").autocomplete({
|
$("#add_show_hosts_autocomplete").autocomplete({
|
||||||
source: findHosts,
|
source: findHosts,
|
||||||
select: autoSelect
|
select: autoSelect,
|
||||||
|
delay: 200
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#schedule-show-style input").ColorPicker({
|
$("#schedule-show-style input").ColorPicker({
|
||||||
|
onChange: function (hsb, hex, rgb, el) {
|
||||||
|
$(el).val(hex);
|
||||||
|
},
|
||||||
onSubmit: function(hsb, hex, rgb, el) {
|
onSubmit: function(hsb, hex, rgb, el) {
|
||||||
$(el).val(hex);
|
$(el).val(hex);
|
||||||
$(el).ColorPickerHide();
|
$(el).ColorPickerHide();
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
setSelector(col, cal.get(0));
|
setSelector(col, cal.get(0));
|
||||||
setHue(col, cal.get(0));
|
setHue(col, cal.get(0));
|
||||||
setNewColor(col, cal.get(0));
|
setNewColor(col, cal.get(0));
|
||||||
cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
|
cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el]);
|
||||||
},
|
},
|
||||||
blur = function (ev) {
|
blur = function (ev) {
|
||||||
var cal = $(this).parent().parent();
|
var cal = $(this).parent().parent();
|
||||||
|
@ -454,6 +454,7 @@
|
||||||
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
|
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
|
||||||
col = RGBToHSB(col);
|
col = RGBToHSB(col);
|
||||||
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
|
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
|
||||||
|
|
||||||
col = fixHSB(col);
|
col = fixHSB(col);
|
||||||
} else {
|
} else {
|
||||||
return this;
|
return this;
|
||||||
|
@ -481,4 +482,4 @@
|
||||||
ColorPickerShow: ColorPicker.showPicker,
|
ColorPickerShow: ColorPicker.showPicker,
|
||||||
ColorPickerSetColor: ColorPicker.setColor
|
ColorPickerSetColor: ColorPicker.setColor
|
||||||
});
|
});
|
||||||
})(jQuery)
|
})(jQuery)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue