some basic form work, need to lear more about custom form validation/rendering.

This commit is contained in:
Naomi 2011-01-28 17:37:31 -05:00
parent 381cdc11a9
commit 10d9d13993
11 changed files with 791 additions and 619 deletions

View file

@ -26,6 +26,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
// Add end date element
$this->addElement('text', 'add_show_end_date', array(
'label' => 'Date End:',
//'class' => 'input_text hasDatepicker',
'required' => false,
'filters' => array('StringTrim'),
'validators' => array(

View file

@ -8,12 +8,14 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
// Add show background-color input
$this->addElement('text', 'add_show_background_color', array(
'label' => 'Background Colour:',
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add show color input
$this->addElement('text', 'add_show_color', array(
'label' => 'Text Colour',
'class' => 'input_text',
'filters' => array('StringTrim')
));
}

View file

@ -8,15 +8,25 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
// Add name element
$this->addElement('text', 'add_show_name', array(
'label' => 'Name:',
'class' => 'input_text',
'required' => true,
'filters' => array('StringTrim'),
'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
$this->addElement('textarea', 'add_show_description', array(
'label' => 'Description:',
'required' => false,
'class' => 'input_text_area'
));
}

View file

@ -8,6 +8,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
// Add start date element
$this->addElement('text', 'add_show_start_date', array(
'label' => 'Date Start:',
//'class' => 'input_text hasDatepicker',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
@ -19,6 +20,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
// Add start time element
$this->addElement('text', 'add_show_start_time', array(
'label' => 'Start Time:',
'class' => 'input_text',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
@ -30,6 +32,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
// Add duration element
$this->addElement('text', 'add_show_duration', array(
'label' => 'Duration:',
'class' => 'input_text',
'required' => true,
'filters' => array('StringTrim'),
'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;
}
}

View file

@ -8,6 +8,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
// Add hosts autocomplete
$this->addElement('text', 'add_show_hosts_autocomplete', array(
'label' => 'Type a Host:',
'class' => 'input_text ui-autocomplete-input',
'required' => false
));

View file

@ -384,7 +384,6 @@ class Show {
}
}
//TODO should only delete shows that are in the future.
public function deleteShow($timestamp, $dayId=NULL) {
global $CC_DBC;

View 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>

View file

@ -5,18 +5,95 @@
#schedule-add-show {
font-size: 12px;
width: 600px;
width: 25%;
min-width:340px;
}
#schedule-add-show textarea {
width: 100%;
width: 99%;
height: 100px;
}
#fullcalendar_show_display {
width: 400px;
width: 60%;
}
#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%;
}

View file

@ -16,7 +16,7 @@
.fc,
.fc .fc-header,
.fc .fc-content {
font-size: 1em;
font-size: 12px;
}
.fc {
@ -95,19 +95,20 @@ table.fc-header {
}
.fc-header .fc-state-default {
border-width: 1px 0;
padding: 0 1px;
border-width: 1px;
padding: 0;
}
.fc-header .fc-state-default,
.fc-header .fc-state-default a {
border-style: solid;
font-size:13px;
}
.fc-header .fc-state-default a {
display: block;
border-width: 0 1px;
margin: 0 -1px;
border-width:0;
margin: 0;
width: 100%;
text-decoration: none;
}
@ -115,8 +116,8 @@ table.fc-header {
.fc-header .fc-state-default span {
display: block;
border-style: solid;
border-width: 1px 0 1px 1px;
padding: 3px 5px;
border-width: 0;
padding: 3px 10px 4px 10px;
}
.fc-header .ui-state-default {
@ -146,12 +147,12 @@ table.fc-header {
/* for fake rounded corners */
.fc-header .fc-corner-left {
margin-left: 1px;
margin-left: 0;
padding-left: 0;
}
.fc-header .fc-corner-right {
margin-right: 1px;
margin-right: 0;
padding-right: 0;
}
@ -159,13 +160,30 @@ table.fc-header {
.fc-header .fc-state-default,
.fc-header .fc-state-default a {
border-color: #777; /* outer border */
color: #333;
border-color: #5b5b5b; /* outer border */
color: #fff;
}
.fc-header .fc-state-default span {
border-color: #fff #fff #d1d1d1; /* inner border */
background: #e8e8e8;
background-color: #6e6e6e;
background: -moz-linear-gradient(top, #868686 0, #6e6e6e 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #868686), color-stop(100%, #6e6e6e));
}
/* HOVER button COLORS */
.fc-header .fc-state-hover,
.fc-header .fc-state-hover a {
border-color: #282828; /* outer border */
color: #fff;
}
.fc-header .fc-state-hover span {
background-color: #282828;
background: -moz-linear-gradient(top, #3b3b3b 0, #282828 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #3b3b3b), color-stop(100%, #282828));
}
/* PRESSED button COLORS (down and active) */
@ -183,17 +201,17 @@ table.fc-header {
/* DISABLED button COLORS */
.fc-header .fc-state-disabled a {
color: #999;
color: #a1a1a1;
}
.fc-header .fc-state-disabled,
.fc-header .fc-state-disabled a {
border-color: #ccc; /* outer border */
border-color: #a1a1a1; /* outer border */
}
.fc-header .fc-state-disabled span {
border-color: #fff #fff #f0f0f0; /* inner border */
background: #f0f0f0;
background: #bdbdbd;
}
@ -202,7 +220,8 @@ table.fc-header {
------------------------------------------------------------------------*/
.fc-widget-content {
border: 1px solid #ccc; /* outer border color */
border: 1px solid #5b5b5b; /* outer border color */
background:#d8d8d8;
}
.fc-content {
@ -211,11 +230,11 @@ table.fc-header {
.fc-content .fc-state-default {
border-style: solid;
border-color: #ccc; /* inner border color */
border-color: #a5a5a5; /* inner border color */
}
.fc-content .fc-state-highlight { /* today */
background: #ffc;
background: #efdac6;
}
.fc-content .fc-not-today { /* override jq-ui highlight (TODO: ui-widget-content) */
@ -583,4 +602,10 @@ table.fc-header {
cursor: s-resize;
}
/* added january 26th, 2011 - fritz */
.fc-agenda-head tr.fc-last th, .fc-agenda-head tr.fc-first th {
padding:3px 0;
background-color: #b9b9b9;
background: -moz-linear-gradient(top, #cdcdcd 0, #b9b9b9 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #cdcdcd), color-stop(100%, #b9b9b9));
}

View file

@ -215,7 +215,7 @@
background-image: url(images/ui-icons_ffffff_256x240.png);
}
.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 {
background-image: url(images/ui-icons_ffffff_256x240.png);

View file

@ -41,6 +41,14 @@ select {
z-index:1000;
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 {
@ -264,8 +272,12 @@ fieldset.plain {
text-indent: 3px;
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 {
font-size:13px;
color:#5b5b5b;
@ -322,7 +334,6 @@ dl.inline-list dd {
border: 1px solid #CCC;
border-width: 0 0 0 1px !important;
}
.datatable {
border-color: #5b5b5b;
border-style: solid;
@ -338,16 +349,13 @@ dl.inline-list dd {
.odd {
background-color: #d8d8d8;
}
.even {
background-color:#c7c7c7;
}
.smartlist tr.even.selected td {
.datatable tr.even.selected td {
background-color: #abcfe2;
}
.smartlist tr.odd.selected td {
.datatable tr.odd.selected td {
background-color: #c5deeb;
}
.datatable tr:hover td {
@ -369,3 +377,23 @@ dl.inline-list dd {
.dataTables_scroll .datatable {
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;
}