some basic form work, need to lear more about custom form validation/rendering.
This commit is contained in:
parent
381cdc11a9
commit
10d9d13993
11 changed files with 791 additions and 619 deletions
|
@ -26,6 +26,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
|
||||||
// Add end date element
|
// Add end date element
|
||||||
$this->addElement('text', 'add_show_end_date', array(
|
$this->addElement('text', 'add_show_end_date', array(
|
||||||
'label' => 'Date End:',
|
'label' => 'Date End:',
|
||||||
|
//'class' => 'input_text hasDatepicker',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
|
|
|
@ -8,12 +8,14 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||||
// Add show background-color input
|
// Add show background-color input
|
||||||
$this->addElement('text', 'add_show_background_color', array(
|
$this->addElement('text', 'add_show_background_color', array(
|
||||||
'label' => 'Background Colour:',
|
'label' => 'Background Colour:',
|
||||||
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
// 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',
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,25 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
// Add name element
|
// Add name element
|
||||||
$this->addElement('text', 'add_show_name', array(
|
$this->addElement('text', 'add_show_name', array(
|
||||||
'label' => 'Name:',
|
'label' => 'Name:',
|
||||||
|
'class' => 'input_text',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array('NotEmpty')
|
'validators' => array('NotEmpty')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$nameLabel = $this->getElement('add_show_name');
|
||||||
|
|
||||||
|
$nameLabel->setDecorators(array(array('ViewScript', array(
|
||||||
|
'viewScript' => 'testform.phtml',
|
||||||
|
'class' => 'test template'
|
||||||
|
))));
|
||||||
|
|
||||||
|
|
||||||
// Add the description element
|
// Add the description element
|
||||||
$this->addElement('textarea', 'add_show_description', array(
|
$this->addElement('textarea', 'add_show_description', array(
|
||||||
'label' => 'Description:',
|
'label' => 'Description:',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
'class' => 'input_text_area'
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
// Add start date element
|
// Add start date element
|
||||||
$this->addElement('text', 'add_show_start_date', array(
|
$this->addElement('text', 'add_show_start_date', array(
|
||||||
'label' => 'Date Start:',
|
'label' => 'Date Start:',
|
||||||
|
//'class' => 'input_text hasDatepicker',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
|
@ -19,6 +20,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
// Add start time element
|
// Add start time element
|
||||||
$this->addElement('text', 'add_show_start_time', array(
|
$this->addElement('text', 'add_show_start_time', array(
|
||||||
'label' => 'Start Time:',
|
'label' => 'Start Time:',
|
||||||
|
'class' => 'input_text',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
|
@ -30,6 +32,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
// Add duration element
|
// Add duration element
|
||||||
$this->addElement('text', 'add_show_duration', array(
|
$this->addElement('text', 'add_show_duration', array(
|
||||||
'label' => 'Duration:',
|
'label' => 'Duration:',
|
||||||
|
'class' => 'input_text',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
|
@ -46,6 +49,21 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function postValidation(array $formData) {
|
||||||
|
|
||||||
|
$now_timestamp = date("Y-m-d H:i:s");
|
||||||
|
$start_timestamp = $formData['add_show_start_date']."".$formData['add_show_start_time'];
|
||||||
|
|
||||||
|
$now_epoch = strtotime($now_timestamp);
|
||||||
|
$start_epoch = strtotime($start_timestamp);
|
||||||
|
|
||||||
|
if($start_epoch < $now_epoch) {
|
||||||
|
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
|
||||||
// Add hosts autocomplete
|
// Add hosts autocomplete
|
||||||
$this->addElement('text', 'add_show_hosts_autocomplete', array(
|
$this->addElement('text', 'add_show_hosts_autocomplete', array(
|
||||||
'label' => 'Type a Host:',
|
'label' => 'Type a Host:',
|
||||||
|
'class' => 'input_text ui-autocomplete-input',
|
||||||
'required' => false
|
'required' => false
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -384,7 +384,6 @@ class Show {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO should only delete shows that are in the future.
|
|
||||||
public function deleteShow($timestamp, $dayId=NULL) {
|
public function deleteShow($timestamp, $dayId=NULL) {
|
||||||
global $CC_DBC;
|
global $CC_DBC;
|
||||||
|
|
||||||
|
|
11
application/views/scripts/testform.phtml
Normal file
11
application/views/scripts/testform.phtml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<div class="<?php echo $this->class ?>">
|
||||||
|
<?php echo $this->formLabel($this->element->getName(),
|
||||||
|
$this->element->getLabel()) ?>
|
||||||
|
<?php echo $this->{$this->element->helper}(
|
||||||
|
$this->element->getName(),
|
||||||
|
$this->element->getValue(),
|
||||||
|
$this->element->getAttribs()
|
||||||
|
) ?>
|
||||||
|
<?php echo $this->formErrors($this->element->getMessages()) ?>
|
||||||
|
<div class="hint"><?php echo $this->element->getDescription() ?></div>
|
||||||
|
</div>
|
|
@ -1,22 +1,99 @@
|
||||||
#schedule-add-show,
|
#schedule-add-show,
|
||||||
#fullcalendar_show_display {
|
#fullcalendar_show_display {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
#schedule-add-show {
|
#schedule-add-show {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
width: 600px;
|
width: 25%;
|
||||||
}
|
min-width:340px;
|
||||||
|
}
|
||||||
#schedule-add-show textarea {
|
|
||||||
width: 100%;
|
#schedule-add-show textarea {
|
||||||
height: 100px;
|
width: 99%;
|
||||||
}
|
height: 100px;
|
||||||
|
}
|
||||||
#fullcalendar_show_display {
|
|
||||||
width: 400px;
|
#fullcalendar_show_display {
|
||||||
}
|
width: 60%;
|
||||||
|
}
|
||||||
#schedule-add-show-overlap {
|
|
||||||
clear: left;
|
#schedule-add-show-overlap {
|
||||||
}
|
clear: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
#schedule-add-show .ui-tabs-panel {
|
||||||
|
padding-top: 16px;
|
||||||
|
}
|
||||||
|
#schedule-add-show fieldset {
|
||||||
|
padding:8px;
|
||||||
|
margin-bottom:8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#schedule-add-show dl {
|
||||||
|
padding:8px;
|
||||||
|
margin-bottom:8px;
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
#schedule-add-show dd {
|
||||||
|
padding: 4px 0;
|
||||||
|
float: left;
|
||||||
|
font-size: 1.2em;
|
||||||
|
margin: 0;
|
||||||
|
padding: 4px 0 4px 15px;
|
||||||
|
}
|
||||||
|
#schedule-add-show dt, #schedule-add-show dt.big {
|
||||||
|
clear: left;
|
||||||
|
color: #666666;
|
||||||
|
float: left;
|
||||||
|
font-size: 1.2em;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 0;
|
||||||
|
padding: 4px 0;
|
||||||
|
text-align: left;
|
||||||
|
min-width:90px;
|
||||||
|
clear:left;
|
||||||
|
}
|
||||||
|
#schedule-add-show dt.big {
|
||||||
|
min-width:130px;
|
||||||
|
}
|
||||||
|
#schedule-add-show dt.block-display, #schedule-add-show dd.block-display {
|
||||||
|
display:block;
|
||||||
|
float:none;
|
||||||
|
margin-left:0;
|
||||||
|
padding-left:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#schedule-add-show dt label {
|
||||||
|
padding-right:0;
|
||||||
|
}
|
||||||
|
.wrapp-label {
|
||||||
|
padding:0;
|
||||||
|
height:16px;
|
||||||
|
display:block;
|
||||||
|
line-height:18px;
|
||||||
|
}
|
||||||
|
label.wrapp-label input[type="checkbox"] {
|
||||||
|
float:left;
|
||||||
|
margin:-1px 4px 0 0;
|
||||||
|
}
|
||||||
|
#schedule-add-show fieldset {
|
||||||
|
min-height:70px;
|
||||||
|
}
|
||||||
|
#schedule-add-show fieldset dd input[type="checkbox"] {
|
||||||
|
margin-top:2px;
|
||||||
|
}
|
||||||
|
#add_show_day_check-element.block-display {
|
||||||
|
margin-bottom:15px;
|
||||||
|
margin-top:7px;
|
||||||
|
}
|
||||||
|
#add_show_day_check-element.block-display label.wrapp-label {
|
||||||
|
font-size:12px;
|
||||||
|
float:left;
|
||||||
|
margin-right:5px;
|
||||||
|
}
|
||||||
|
#add_show_name-element .input_text {
|
||||||
|
width:99%;
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -215,7 +215,7 @@
|
||||||
background-image: url(images/ui-icons_ffffff_256x240.png);
|
background-image: url(images/ui-icons_ffffff_256x240.png);
|
||||||
}
|
}
|
||||||
.ui-widget-header .ui-icon {
|
.ui-widget-header .ui-icon {
|
||||||
background-image: url(images/ui-icons_007fb3_256x240.png);
|
background-image: url(images/ui-icons_ffffff_256x240.png);
|
||||||
}
|
}
|
||||||
.ui-state-default .ui-icon {
|
.ui-state-default .ui-icon {
|
||||||
background-image: url(images/ui-icons_ffffff_256x240.png);
|
background-image: url(images/ui-icons_ffffff_256x240.png);
|
||||||
|
|
|
@ -41,6 +41,14 @@ select {
|
||||||
z-index:1000;
|
z-index:1000;
|
||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clearfix */
|
||||||
|
.clearfix:after, li:after { content: "."; display: block; height: 0; clear: both; visibility: hidden;}
|
||||||
|
.clearfix, li { display: inline-block; }
|
||||||
|
* html .clearfix, * html li { height: 1%;}
|
||||||
|
.clearfix, li { display: block; }
|
||||||
|
|
||||||
|
|
||||||
/* Master Panel */
|
/* Master Panel */
|
||||||
|
|
||||||
#master-panel {
|
#master-panel {
|
||||||
|
@ -264,8 +272,12 @@ fieldset.plain {
|
||||||
text-indent: 3px;
|
text-indent: 3px;
|
||||||
width:auto;
|
width:auto;
|
||||||
}
|
}
|
||||||
|
.input_text_area {
|
||||||
|
background:#dddddd url("images/input_bg.png") repeat-x scroll 0 0 ;
|
||||||
|
border: 1px solid #5b5b5b;
|
||||||
|
font-size: 13px;
|
||||||
|
text-indent: 3px;
|
||||||
|
}
|
||||||
label {
|
label {
|
||||||
font-size:13px;
|
font-size:13px;
|
||||||
color:#5b5b5b;
|
color:#5b5b5b;
|
||||||
|
@ -322,7 +334,6 @@ dl.inline-list dd {
|
||||||
border: 1px solid #CCC;
|
border: 1px solid #CCC;
|
||||||
border-width: 0 0 0 1px !important;
|
border-width: 0 0 0 1px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.datatable {
|
.datatable {
|
||||||
border-color: #5b5b5b;
|
border-color: #5b5b5b;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
|
@ -338,16 +349,13 @@ dl.inline-list dd {
|
||||||
.odd {
|
.odd {
|
||||||
background-color: #d8d8d8;
|
background-color: #d8d8d8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.even {
|
.even {
|
||||||
background-color:#c7c7c7;
|
background-color:#c7c7c7;
|
||||||
}
|
}
|
||||||
|
.datatable tr.even.selected td {
|
||||||
|
|
||||||
.smartlist tr.even.selected td {
|
|
||||||
background-color: #abcfe2;
|
background-color: #abcfe2;
|
||||||
}
|
}
|
||||||
.smartlist tr.odd.selected td {
|
.datatable tr.odd.selected td {
|
||||||
background-color: #c5deeb;
|
background-color: #c5deeb;
|
||||||
}
|
}
|
||||||
.datatable tr:hover td {
|
.datatable tr:hover td {
|
||||||
|
@ -368,4 +376,24 @@ dl.inline-list dd {
|
||||||
}
|
}
|
||||||
.dataTables_scroll .datatable {
|
.dataTables_scroll .datatable {
|
||||||
border-width: 0px 1px 0 1px;
|
border-width: 0px 1px 0 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*----END Data Table----*/
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
border: 1px solid #8f8f8f;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
fieldset.plain {
|
||||||
|
border: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
input[type="checkbox"] {
|
||||||
|
margin:0;
|
||||||
|
outline:none;
|
||||||
|
padding:0;
|
||||||
|
width:13px;
|
||||||
|
height:13px;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue