working on add show screen, using subforms and jqueryUI tabs to separate adding show decisions.

This commit is contained in:
Naomi 2011-01-20 18:30:53 -05:00
parent dc2208d9ee
commit 42e2e0d407
11 changed files with 270 additions and 9 deletions

View file

@ -87,6 +87,11 @@
<formFile formName="ScheduleShow"/>
<formFile formName="AddUser"/>
<formFile formName="AdvancedSearchGroup"/>
<formFile formName="AddShowWhen"/>
<formFile formName="AddShowWho"/>
<formFile formName="AddShowStyle"/>
<formFile formName="AddShowWhat"/>
<formFile formName="AddShowRepeats"/>
</formsDirectory>
<layoutsDirectory enabled="false"/>
<modelsDirectory/>

View file

@ -34,11 +34,14 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headScript()->appendFile('/js/fullcalendar/fullcalendar.min.js','text/javascript');
$this->view->headScript()->appendFile('/js/contextmenu/jquery.contextMenu.js','text/javascript');
$this->view->headScript()->appendFile('/js/qtip/jquery.qtip-1.0.0.min.js','text/javascript');
$this->view->headScript()->appendFile('/js/colorpicker/js/colorpicker.js','text/javascript');
$this->view->headScript()->appendFile('/js/airtime/schedule/schedule.js','text/javascript');
$this->view->headLink()->appendStylesheet('/css/jquery.contextMenu.css');
$this->view->headLink()->appendStylesheet('/css/fullcalendar.css');
$this->view->headLink()->appendStylesheet('/css/colorpicker/css/colorpicker.css');
$this->view->headLink()->appendStylesheet('/css/schedule.css');
@ -74,10 +77,28 @@ class ScheduleController extends Zend_Controller_Action
public function addShowDialogAction()
{
$request = $this->getRequest();
$form = new Application_Form_AddShow();
$formWhat = new Application_Form_AddShowWhat();
$formWhat->removeDecorator('DtDdWrapper');
$formWho = new Application_Form_AddShowWho();
$formWho->removeDecorator('DtDdWrapper');
$formWhen = new Application_Form_AddShowWhen();
$formWhen->removeDecorator('DtDdWrapper');
$formRepeats = new Application_Form_AddShowRepeats();
$formRepeats->removeDecorator('DtDdWrapper');
$formStyle = new Application_Form_AddShowStyle();
$formStyle->removeDecorator('DtDdWrapper');
$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
$data = $request->getPost();
if ($formWhat->isValid($data) && $formWhen->isValid($data) && $formWho->isValid($data) && $formStyle->isValid($data)) {
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
@ -86,13 +107,14 @@ class ScheduleController extends Zend_Controller_Action
if(isset($overlap)) {
$this->view->overlap = $overlap;
$this->view->form = $form->__toString();
$this->view->form = $this->view->render('schedule/add-show-dialog.phtml');
}
return;
}
}
$this->view->form = $form->__toString();
$this->view->content = $this->view->render('schedule/add-show-dialog.phtml');
$this->view->hosts = User::getHosts();
}

View file

@ -58,6 +58,7 @@ class Application_Form_AddShow extends Zend_Form
'required' => false,
));
// Add days checkboxes
$this->addElement(
'multiCheckbox',
'day_check',
@ -86,12 +87,13 @@ class Application_Form_AddShow extends Zend_Form
)
));
// Add no end element
$this->addElement('checkbox', 'no_end', array(
'label' => 'no end',
'required' => false,
));
// Add end date element
// Add hosts autocomplete
$this->addElement('text', 'hosts_autocomplete', array(
'label' => 'Type a Host:',
'required' => false
@ -104,6 +106,7 @@ class Application_Form_AddShow extends Zend_Form
$options[$host['id']] = $host['login'];
}
//Add hosts selection
$hosts = new Zend_Form_Element_MultiCheckbox('hosts');
$hosts->setLabel('Hosts:')
->setMultiOptions($options)

View file

@ -0,0 +1,46 @@
<?php
class Application_Form_AddShowRepeats extends Zend_Form_SubForm
{
public function init()
{
// Add days checkboxes
$this->addElement(
'multiCheckbox',
'day_check',
array(
'label' => 'Select Days:',
'required' => false,
'multiOptions' => array(
"0" => "Sun",
"1" => "Mon",
"2" => "Tue",
"3" => "Wed",
"4" => "Thu",
"5" => "Fri",
"6" => "Sat",
),
));
// Add end date element
$this->addElement('text', 'end_date', array(
'label' => 'Date End:',
'required' => false,
'filters' => array('StringTrim'),
'validators' => array(
'NotEmpty',
array('date', false, array('YYYY-MM-DD'))
)
));
// Add no end element
$this->addElement('checkbox', 'no_end', array(
'label' => 'no end',
'required' => false,
));
}
}

View file

@ -0,0 +1,27 @@
<?php
class Application_Form_AddShowStyle extends Zend_Form_SubForm
{
public function init()
{
// Add show background-color input
$this->addElement('text', 'show-background-color', array(
'label' => 'Background Colour:',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty')
));
// Add show color input
$this->addElement('text', 'show-color', array(
'label' => 'Text Colour',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty')
));
}
}

View file

@ -0,0 +1,26 @@
<?php
class Application_Form_AddShowWhat extends Zend_Form_SubForm
{
public function init()
{
// Add name element
$this->addElement('text', 'add_show_name', array(
'label' => 'Name:',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty')
));
// Add the description element
$this->addElement('textarea', 'add_show_description', array(
'label' => 'Description:',
'required' => false,
));
}
}

View file

@ -0,0 +1,51 @@
<?php
class Application_Form_AddShowWhen extends Zend_Form_SubForm
{
public function init()
{
// Add start date element
$this->addElement('text', 'start_date', array(
'label' => 'Date Start:',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
'NotEmpty',
array('date', false, array('YYYY-MM-DD'))
)
));
// Add start time element
$this->addElement('text', 'start_time', array(
'label' => 'Start Time:',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
'NotEmpty',
array('date', false, array('HH:mm'))
)
));
// Add duration element
$this->addElement('text', 'duration', array(
'label' => 'Duration:',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
'NotEmpty',
array('date', false, array('HH:mm'))
)
));
// Add repeats element
$this->addElement('checkbox', 'repeats', array(
'label' => 'repeats',
'required' => false,
));
}
}

View file

@ -0,0 +1,32 @@
<?php
class Application_Form_AddShowWho extends Zend_Form_SubForm
{
public function init()
{
// Add hosts autocomplete
$this->addElement('text', 'hosts_autocomplete', array(
'label' => 'Type a Host:',
'required' => false
));
$options = array();
$hosts = User::getHosts();
foreach ($hosts as $host) {
$options[$host['id']] = $host['login'];
}
//Add hosts selection
$hosts = new Zend_Form_Element_MultiCheckbox('hosts');
$hosts->setLabel('Hosts:')
->setMultiOptions($options)
->setRequired(true);
$this->addElement($hosts);
}
}

View file

@ -1 +1,23 @@
<br /><br /><center>View script for controller <b>Schedule</b> and script/action name <b>addShowDialog</b></center>
<form>
<div id="tabs">
<ul>
<li><a href="#schedule-show-what"><span>What</span></a></li>
<li><a href="#schedule-show-when"><span>When</span></a></li>
<li><a href="#schedule-show-who"><span>Who</span></a></li>
<li><a href="#schedule-show-style"><span>Style</span></a></li>
</ul>
<div id="schedule-show-what">
<?php echo $this->what ?>
</div>
<div id="schedule-show-when">
<?php echo $this->when ?>
<?php echo $this->repeats ?>
</div>
<div id="schedule-show-who">
<?php echo $this->who ?>
</div>
<div id="schedule-show-style">
<?php echo $this->style ?>
</div>
</div>
</form>

View file

@ -104,3 +104,20 @@ div.ui-datepicker {
margin: 5px;
text-align: center;
}
/* Add show Dialog----------------------------------------------------------------------------------------------------
*
*
*
*/
#add_show_name {
}
#add_show_description {
width: 400px;
height: 200px;
}

View file

@ -118,7 +118,8 @@ function makeShowDialog(json) {
//main jqueryUI dialog
dialog = $('<div id="schedule_add_event_dialog" />');
dialog.append(json.form);
dialog.append(json.content);
dialog.find("#tabs").tabs();
var start = dialog.find("#start_date");
var end = dialog.find("#end_date");
@ -135,12 +136,21 @@ function makeShowDialog(json) {
select: autoSelect
});
dialog.find("#schedule-show-style input").ColorPicker({
onSubmit: function(hsb, hex, rgb, el) {
$(el).val(hex);
$(el).ColorPickerHide();
},
onBeforeShow: function () {
$(this).ColorPickerSetColor(this.value);
}
});
dialog.dialog({
autoOpen: false,
title: 'Add Show',
width: 950,
height: 400,
width: 1100,
height: 500,
modal: true,
close: closeDialog,
buttons: { "Cancel": closeDialog, "Ok": submitShow}