From 42e2e0d40710d44643bbbd070c555a0bfa4ff3ab Mon Sep 17 00:00:00 2001 From: Naomi Date: Thu, 20 Jan 2011 18:30:53 -0500 Subject: [PATCH] working on add show screen, using subforms and jqueryUI tabs to separate adding show decisions. --- .zfproject.xml | 5 ++ .../controllers/ScheduleController.php | 30 +++++++++-- application/forms/AddShow.php | 5 +- application/forms/AddShowRepeats.php | 46 +++++++++++++++++ application/forms/AddShowStyle.php | 27 ++++++++++ application/forms/AddShowWhat.php | 26 ++++++++++ application/forms/AddShowWhen.php | 51 +++++++++++++++++++ application/forms/AddShowWho.php | 32 ++++++++++++ .../scripts/schedule/add-show-dialog.phtml | 24 ++++++++- public/css/schedule.css | 17 +++++++ public/js/airtime/schedule/schedule.js | 16 ++++-- 11 files changed, 270 insertions(+), 9 deletions(-) create mode 100644 application/forms/AddShowRepeats.php create mode 100644 application/forms/AddShowStyle.php create mode 100644 application/forms/AddShowWhat.php create mode 100644 application/forms/AddShowWhen.php create mode 100644 application/forms/AddShowWho.php diff --git a/.zfproject.xml b/.zfproject.xml index 9c7094a03..b72e76d42 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -87,6 +87,11 @@ + + + + + diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index dbc06eec2..b5e443c17 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -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(); } diff --git a/application/forms/AddShow.php b/application/forms/AddShow.php index 3bece9530..251c92752 100644 --- a/application/forms/AddShow.php +++ b/application/forms/AddShow.php @@ -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) diff --git a/application/forms/AddShowRepeats.php b/application/forms/AddShowRepeats.php new file mode 100644 index 000000000..ef954c0f0 --- /dev/null +++ b/application/forms/AddShowRepeats.php @@ -0,0 +1,46 @@ +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, + )); + } + + +} + diff --git a/application/forms/AddShowStyle.php b/application/forms/AddShowStyle.php new file mode 100644 index 000000000..1fe62e1d3 --- /dev/null +++ b/application/forms/AddShowStyle.php @@ -0,0 +1,27 @@ +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') + )); + } + + +} + diff --git a/application/forms/AddShowWhat.php b/application/forms/AddShowWhat.php new file mode 100644 index 000000000..3eba1bc39 --- /dev/null +++ b/application/forms/AddShowWhat.php @@ -0,0 +1,26 @@ +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, + )); + + } + + +} + diff --git a/application/forms/AddShowWhen.php b/application/forms/AddShowWhen.php new file mode 100644 index 000000000..11bf9dd82 --- /dev/null +++ b/application/forms/AddShowWhen.php @@ -0,0 +1,51 @@ +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, + )); + + } + + +} + diff --git a/application/forms/AddShowWho.php b/application/forms/AddShowWho.php new file mode 100644 index 000000000..43325c58a --- /dev/null +++ b/application/forms/AddShowWho.php @@ -0,0 +1,32 @@ +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); + } + + +} + diff --git a/application/views/scripts/schedule/add-show-dialog.phtml b/application/views/scripts/schedule/add-show-dialog.phtml index 3c4a8ff95..b17a83704 100644 --- a/application/views/scripts/schedule/add-show-dialog.phtml +++ b/application/views/scripts/schedule/add-show-dialog.phtml @@ -1 +1,23 @@ -

View script for controller Schedule and script/action name addShowDialog
\ No newline at end of file +
+
+ +
+ what ?> +
+
+ when ?> + repeats ?> +
+
+ who ?> +
+
+ style ?> +
+
+
diff --git a/public/css/schedule.css b/public/css/schedule.css index 7750379ca..d9114f141 100644 --- a/public/css/schedule.css +++ b/public/css/schedule.css @@ -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; +} + + diff --git a/public/js/airtime/schedule/schedule.js b/public/js/airtime/schedule/schedule.js index 282b6da85..0fa46268d 100644 --- a/public/js/airtime/schedule/schedule.js +++ b/public/js/airtime/schedule/schedule.js @@ -118,7 +118,8 @@ function makeShowDialog(json) { //main jqueryUI dialog 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}