From 10d9d139932c2b8cd3e02c4c20b784ac77ddad0c Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 28 Jan 2011 17:37:31 -0500 Subject: [PATCH 1/3] some basic form work, need to lear more about custom form validation/rendering. --- application/forms/AddShowRepeats.php | 1 + application/forms/AddShowStyle.php | 2 + application/forms/AddShowWhat.php | 10 + application/forms/AddShowWhen.php | 18 + application/forms/AddShowWho.php | 1 + application/models/Shows.php | 1 - application/views/scripts/testform.phtml | 11 + public/css/add-show.css | 121 +- public/css/fullcalendar.css | 1197 +++++++++-------- public/css/redmond/jquery-ui-1.8.8.custom.css | 2 +- public/css/styles.css | 46 +- 11 files changed, 791 insertions(+), 619 deletions(-) create mode 100644 application/views/scripts/testform.phtml diff --git a/application/forms/AddShowRepeats.php b/application/forms/AddShowRepeats.php index 79e8b6179..4c640d4c1 100644 --- a/application/forms/AddShowRepeats.php +++ b/application/forms/AddShowRepeats.php @@ -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( diff --git a/application/forms/AddShowStyle.php b/application/forms/AddShowStyle.php index 6a1e94025..faa471f0d 100644 --- a/application/forms/AddShowStyle.php +++ b/application/forms/AddShowStyle.php @@ -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') )); } diff --git a/application/forms/AddShowWhat.php b/application/forms/AddShowWhat.php index 3eba1bc39..419427efb 100644 --- a/application/forms/AddShowWhat.php +++ b/application/forms/AddShowWhat.php @@ -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' )); } diff --git a/application/forms/AddShowWhen.php b/application/forms/AddShowWhen.php index b4afdbd7d..0440529ea 100644 --- a/application/forms/AddShowWhen.php +++ b/application/forms/AddShowWhen.php @@ -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; + } } diff --git a/application/forms/AddShowWho.php b/application/forms/AddShowWho.php index 55656c95f..86981a28d 100644 --- a/application/forms/AddShowWho.php +++ b/application/forms/AddShowWho.php @@ -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 )); diff --git a/application/models/Shows.php b/application/models/Shows.php index 7313d9711..47a35477e 100644 --- a/application/models/Shows.php +++ b/application/models/Shows.php @@ -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; diff --git a/application/views/scripts/testform.phtml b/application/views/scripts/testform.phtml new file mode 100644 index 000000000..78aaecb88 --- /dev/null +++ b/application/views/scripts/testform.phtml @@ -0,0 +1,11 @@ +
+ formLabel($this->element->getName(), + $this->element->getLabel()) ?> + {$this->element->helper}( + $this->element->getName(), + $this->element->getValue(), + $this->element->getAttribs() + ) ?> + formErrors($this->element->getMessages()) ?> +
element->getDescription() ?>
+
diff --git a/public/css/add-show.css b/public/css/add-show.css index 8761f4b2a..7bc42bc35 100644 --- a/public/css/add-show.css +++ b/public/css/add-show.css @@ -1,22 +1,99 @@ -#schedule-add-show, -#fullcalendar_show_display { - float: left; -} - -#schedule-add-show { - font-size: 12px; - width: 600px; -} - -#schedule-add-show textarea { - width: 100%; - height: 100px; -} - -#fullcalendar_show_display { - width: 400px; -} - -#schedule-add-show-overlap { - clear: left; -} +#schedule-add-show, +#fullcalendar_show_display { + float: left; +} + +#schedule-add-show { + font-size: 12px; + width: 25%; + min-width:340px; +} + +#schedule-add-show textarea { + width: 99%; + height: 100px; +} + +#fullcalendar_show_display { + 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%; +} \ No newline at end of file diff --git a/public/css/fullcalendar.css b/public/css/fullcalendar.css index 2f3b71cdf..26c6979c2 100644 --- a/public/css/fullcalendar.css +++ b/public/css/fullcalendar.css @@ -1,586 +1,611 @@ -/* - * FullCalendar v1.4.10 Stylesheet - * - * Feel free to edit this file to customize the look of FullCalendar. - * When upgrading to newer versions, please upgrade this file as well, - * porting over any customizations afterwards. - * - * Date: Sat Jan 1 23:46:27 2011 -0800 - * - */ - - -/* TODO: make font sizes look the same in all doctypes */ - - -.fc, -.fc .fc-header, -.fc .fc-content { - font-size: 1em; - } - -.fc { - direction: ltr; - text-align: left; - } - -.fc table { - border-collapse: collapse; - border-spacing: 0; - } - -.fc td, .fc th { - padding: 0; - vertical-align: top; - } - - - -/* Header -------------------------------------------------------------------------*/ - -table.fc-header { - width: 100%; - } - -.fc-header-left { - width: 25%; - } - -.fc-header-left table { - float: left; - } - -.fc-header-center { - width: 50%; - text-align: center; - } - -.fc-header-center table { - margin: 0 auto; - } - -.fc-header-right { - width: 25%; - } - -.fc-header-right table { - float: right; - } - -.fc-header-title { - margin-top: 0; - white-space: nowrap; - } - -.fc-header-space { - padding-left: 10px; - } - -/* right-to-left */ - -.fc-rtl .fc-header-title { - direction: rtl; - } - - - -/* Buttons -------------------------------------------------------------------------*/ - -.fc-header .fc-state-default, -.fc-header .ui-state-default { - margin-bottom: 1em; - cursor: pointer; - } - -.fc-header .fc-state-default { - border-width: 1px 0; - padding: 0 1px; - } - -.fc-header .fc-state-default, -.fc-header .fc-state-default a { - border-style: solid; - } - -.fc-header .fc-state-default a { - display: block; - border-width: 0 1px; - margin: 0 -1px; - width: 100%; - text-decoration: none; - } - -.fc-header .fc-state-default span { - display: block; - border-style: solid; - border-width: 1px 0 1px 1px; - padding: 3px 5px; - } - -.fc-header .ui-state-default { - padding: 4px 6px; - } - -.fc-header .fc-state-default span, -.fc-header .ui-state-default span { - white-space: nowrap; - } - -/* for adjacent buttons */ - -.fc-header .fc-no-right { - padding-right: 0; - } - -.fc-header .fc-no-right a { - margin-right: 0; - border-right: 0; - } - -.fc-header .ui-no-right { - border-right: 0; - } - -/* for fake rounded corners */ - -.fc-header .fc-corner-left { - margin-left: 1px; - padding-left: 0; - } - -.fc-header .fc-corner-right { - margin-right: 1px; - padding-right: 0; - } - -/* DEFAULT button COLORS */ - -.fc-header .fc-state-default, -.fc-header .fc-state-default a { - border-color: #777; /* outer border */ - color: #333; - } - -.fc-header .fc-state-default span { - border-color: #fff #fff #d1d1d1; /* inner border */ - background: #e8e8e8; - } - -/* PRESSED button COLORS (down and active) */ - -.fc-header .fc-state-active a { - color: #fff; - } - -.fc-header .fc-state-down span, -.fc-header .fc-state-active span { - background: #888; - border-color: #808080 #808080 #909090; /* inner border */ - } - -/* DISABLED button COLORS */ - -.fc-header .fc-state-disabled a { - color: #999; - } - -.fc-header .fc-state-disabled, -.fc-header .fc-state-disabled a { - border-color: #ccc; /* outer border */ - } - -.fc-header .fc-state-disabled span { - border-color: #fff #fff #f0f0f0; /* inner border */ - background: #f0f0f0; - } - - - -/* Content Area & Global Cell Styles -------------------------------------------------------------------------*/ - -.fc-widget-content { - border: 1px solid #ccc; /* outer border color */ - } - -.fc-content { - clear: both; - } - -.fc-content .fc-state-default { - border-style: solid; - border-color: #ccc; /* inner border color */ - } - -.fc-content .fc-state-highlight { /* today */ - background: #ffc; - } - -.fc-content .fc-not-today { /* override jq-ui highlight (TODO: ui-widget-content) */ - background: none; - } - -.fc-cell-overlay { /* semi-transparent rectangle while dragging */ - background: #9cf; - opacity: .2; - filter: alpha(opacity=20); /* for IE */ - } - -.fc-view { /* prevents dragging outside of widget */ - width: 100%; - overflow: hidden; - } - - - - - -/* Global Event Styles -------------------------------------------------------------------------*/ - -.fc-event, -.fc-agenda .fc-event-time, -.fc-event a { - border-style: solid; - border-color: #36c; /* default BORDER color (probably the same as background-color) */ - background-color: #36c; /* default BACKGROUND color */ - color: #fff; /* default TEXT color */ - } - - /* Use the 'className' CalEvent property and the following - * example CSS to change event color on a per-event basis: - * - * .myclass, - * .fc-agenda .myclass .fc-event-time, - * .myclass a { - * background-color: black; - * border-color: black; - * color: red; - * } - */ - -.fc-event { - text-align: left; - } - -.fc-event a { - overflow: hidden; - font-size: .85em; - text-decoration: none; - cursor: pointer; - } - -.fc-event-editable { - cursor: pointer; - } - -.fc-event-time, -.fc-event-title { - padding: 0 1px; - } - -/* for fake rounded corners */ - -.fc-event a { - display: block; - position: relative; - width: 100%; - height: 100%; - } - -/* right-to-left */ - -.fc-rtl .fc-event a { - text-align: right; - } - -/* resizable */ - -.fc .ui-resizable-handle { /*** TODO: don't use ui-resizable anoymore, change class ***/ - display: block; - position: absolute; - z-index: 99999; - border: 0 !important; /* important overrides pre jquery ui 1.7 styles */ - background: url(data:image/gif;base64,AAAA) !important; /* hover fix for IE */ - } - - - -/* Horizontal Events -------------------------------------------------------------------------*/ - -.fc-event-hori { - border-width: 1px 0; - margin-bottom: 1px; - } - -.fc-event-hori a { - border-width: 0; - } - -/* for fake rounded corners */ - -.fc-content .fc-corner-left { - margin-left: 1px; - } - -.fc-content .fc-corner-left a { - margin-left: -1px; - border-left-width: 1px; - } - -.fc-content .fc-corner-right { - margin-right: 1px; - } - -.fc-content .fc-corner-right a { - margin-right: -1px; - border-right-width: 1px; - } - -/* resizable */ - -.fc-event-hori .ui-resizable-e { - top: 0 !important; /* importants override pre jquery ui 1.7 styles */ - right: -3px !important; - width: 7px !important; - height: 100% !important; - cursor: e-resize; - } - -.fc-event-hori .ui-resizable-w { - top: 0 !important; - left: -3px !important; - width: 7px !important; - height: 100% !important; - cursor: w-resize; - } - -.fc-event-hori .ui-resizable-handle { - _padding-bottom: 14px; /* IE6 had 0 height */ - } - - - - -/* Month View, Basic Week View, Basic Day View -------------------------------------------------------------------------*/ - -.fc-grid table { - width: 100%; - } - -.fc .fc-grid th { - border-width: 0 0 0 1px; - text-align: center; - } - -.fc .fc-grid td { - border-width: 1px 0 0 1px; - } - -.fc-grid th.fc-leftmost, -.fc-grid td.fc-leftmost { - border-left: 0; - } - -.fc-grid .fc-day-number { - float: right; - padding: 0 2px; - } - -.fc-grid .fc-other-month .fc-day-number { - opacity: 0.3; - filter: alpha(opacity=30); /* for IE */ - /* opacity with small font can sometimes look too faded - might want to set the 'color' property instead - making day-numbers bold also fixes the problem */ - } - -.fc-grid .fc-day-content { - clear: both; - padding: 2px 2px 0; /* distance between events and day edges */ - } - -/* event styles */ - -.fc-grid .fc-event-time { - font-weight: bold; - } - -/* right-to-left */ - -.fc-rtl .fc-grid { - direction: rtl; - } - -.fc-rtl .fc-grid .fc-day-number { - float: left; - } - -.fc-rtl .fc-grid .fc-event-time { - float: right; - } - -/* Agenda Week View, Agenda Day View -------------------------------------------------------------------------*/ - -.fc .fc-agenda th, -.fc .fc-agenda td { - border-width: 1px 0 0 1px; - } - -.fc .fc-agenda .fc-leftmost { - border-left: 0; - } - -.fc-agenda tr.fc-first th, -.fc-agenda tr.fc-first td { - border-top: 0; - } - -.fc-agenda-head tr.fc-last th { - border-bottom-width: 1px; - } - -.fc .fc-agenda-head td, -.fc .fc-agenda-body td { - background: none; - } - -.fc-agenda-head th { - text-align: center; - } - -/* the time axis running down the left side */ - -.fc-agenda .fc-axis { - width: 50px; - padding: 0 4px; - vertical-align: middle; - white-space: nowrap; - text-align: right; - font-weight: normal; - } - -/* all-day event cells at top */ - -.fc-agenda-head tr.fc-all-day th { - height: 35px; - } - -.fc-agenda-head td { - padding-bottom: 10px; - } - -.fc .fc-divider div { - font-size: 1px; /* for IE6/7 */ - height: 2px; - } - -.fc .fc-divider .fc-state-default { - background: #eee; /* color for divider between all-day and time-slot events */ - } - -/* body styles */ - -.fc .fc-agenda-body td div { - height: 20px; /* slot height */ - } - -.fc .fc-agenda-body tr.fc-minor th, -.fc .fc-agenda-body tr.fc-minor td { - border-top-style: dotted; - } - -.fc-agenda .fc-day-content { - padding: 2px 2px 0; /* distance between events and day edges */ - } - -/* vertical background columns */ - -.fc .fc-agenda-bg .ui-state-highlight { - background-image: none; /* tall column, don't want repeating background image */ - } - - - -/* Vertical Events -------------------------------------------------------------------------*/ - -.fc-event-vert { - border-width: 0 1px; - } - -.fc-event-vert a { - border-width: 0; - } - -/* for fake rounded corners */ - -.fc-content .fc-corner-top { - margin-top: 1px; - } - -.fc-content .fc-corner-top a { - margin-top: -1px; - border-top-width: 1px; - } - -.fc-content .fc-corner-bottom { - margin-bottom: 1px; - } - -.fc-content .fc-corner-bottom a { - margin-bottom: -1px; - border-bottom-width: 1px; - } - -/* event content */ - -.fc-event-vert span { - display: block; - position: relative; - z-index: 2; - } - -.fc-event-vert span.fc-event-time { - white-space: nowrap; - _white-space: normal; - overflow: hidden; - border: 0; - font-size: 10px; - } - -.fc-event-vert span.fc-event-title { - line-height: 13px; - } - -.fc-event-vert span.fc-event-bg { /* makes the event lighter w/ a semi-transparent overlay */ - position: absolute; - z-index: 1; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: #fff; - opacity: .3; - filter: alpha(opacity=30); /* for IE */ - } - -/* resizable */ - -.fc-event-vert .ui-resizable-s { - bottom: 0 !important; /* importants override pre jquery ui 1.7 styles */ - width: 100% !important; - height: 8px !important; - line-height: 8px !important; - font-size: 11px !important; - font-family: monospace; - text-align: center; - cursor: s-resize; - } - - +/* + * FullCalendar v1.4.10 Stylesheet + * + * Feel free to edit this file to customize the look of FullCalendar. + * When upgrading to newer versions, please upgrade this file as well, + * porting over any customizations afterwards. + * + * Date: Sat Jan 1 23:46:27 2011 -0800 + * + */ + + +/* TODO: make font sizes look the same in all doctypes */ + + +.fc, +.fc .fc-header, +.fc .fc-content { + font-size: 12px; + } + +.fc { + direction: ltr; + text-align: left; + } + +.fc table { + border-collapse: collapse; + border-spacing: 0; + } + +.fc td, .fc th { + padding: 0; + vertical-align: top; + } + + + +/* Header +------------------------------------------------------------------------*/ + +table.fc-header { + width: 100%; + } + +.fc-header-left { + width: 25%; + } + +.fc-header-left table { + float: left; + } + +.fc-header-center { + width: 50%; + text-align: center; + } + +.fc-header-center table { + margin: 0 auto; + } + +.fc-header-right { + width: 25%; + } + +.fc-header-right table { + float: right; + } + +.fc-header-title { + margin-top: 0; + white-space: nowrap; + } + +.fc-header-space { + padding-left: 10px; + } + +/* right-to-left */ + +.fc-rtl .fc-header-title { + direction: rtl; + } + + + +/* Buttons +------------------------------------------------------------------------*/ + +.fc-header .fc-state-default, +.fc-header .ui-state-default { + margin-bottom: 1em; + cursor: pointer; + } + +.fc-header .fc-state-default { + 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; + margin: 0; + width: 100%; + text-decoration: none; + } + +.fc-header .fc-state-default span { + display: block; + border-style: solid; + border-width: 0; + padding: 3px 10px 4px 10px; + } + +.fc-header .ui-state-default { + padding: 4px 6px; + } + +.fc-header .fc-state-default span, +.fc-header .ui-state-default span { + white-space: nowrap; + } + +/* for adjacent buttons */ + +.fc-header .fc-no-right { + padding-right: 0; + } + +.fc-header .fc-no-right a { + margin-right: 0; + border-right: 0; + } + +.fc-header .ui-no-right { + border-right: 0; + } + +/* for fake rounded corners */ + +.fc-header .fc-corner-left { + margin-left: 0; + padding-left: 0; + } + +.fc-header .fc-corner-right { + margin-right: 0; + padding-right: 0; + } + +/* DEFAULT button COLORS */ + +.fc-header .fc-state-default, +.fc-header .fc-state-default a { + border-color: #5b5b5b; /* outer border */ + color: #fff; + } + +.fc-header .fc-state-default span { + border-color: #fff #fff #d1d1d1; /* inner border */ + 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) */ + +.fc-header .fc-state-active a { + color: #fff; + } + +.fc-header .fc-state-down span, +.fc-header .fc-state-active span { + background: #888; + border-color: #808080 #808080 #909090; /* inner border */ + } + +/* DISABLED button COLORS */ + +.fc-header .fc-state-disabled a { + color: #a1a1a1; + } + +.fc-header .fc-state-disabled, +.fc-header .fc-state-disabled a { + border-color: #a1a1a1; /* outer border */ + } + +.fc-header .fc-state-disabled span { + border-color: #fff #fff #f0f0f0; /* inner border */ + background: #bdbdbd; + } + + + +/* Content Area & Global Cell Styles +------------------------------------------------------------------------*/ + +.fc-widget-content { + border: 1px solid #5b5b5b; /* outer border color */ + background:#d8d8d8; + } + +.fc-content { + clear: both; + } + +.fc-content .fc-state-default { + border-style: solid; + border-color: #a5a5a5; /* inner border color */ + } + +.fc-content .fc-state-highlight { /* today */ + background: #efdac6; + } + +.fc-content .fc-not-today { /* override jq-ui highlight (TODO: ui-widget-content) */ + background: none; + } + +.fc-cell-overlay { /* semi-transparent rectangle while dragging */ + background: #9cf; + opacity: .2; + filter: alpha(opacity=20); /* for IE */ + } + +.fc-view { /* prevents dragging outside of widget */ + width: 100%; + overflow: hidden; + } + + + + + +/* Global Event Styles +------------------------------------------------------------------------*/ + +.fc-event, +.fc-agenda .fc-event-time, +.fc-event a { + border-style: solid; + border-color: #36c; /* default BORDER color (probably the same as background-color) */ + background-color: #36c; /* default BACKGROUND color */ + color: #fff; /* default TEXT color */ + } + + /* Use the 'className' CalEvent property and the following + * example CSS to change event color on a per-event basis: + * + * .myclass, + * .fc-agenda .myclass .fc-event-time, + * .myclass a { + * background-color: black; + * border-color: black; + * color: red; + * } + */ + +.fc-event { + text-align: left; + } + +.fc-event a { + overflow: hidden; + font-size: .85em; + text-decoration: none; + cursor: pointer; + } + +.fc-event-editable { + cursor: pointer; + } + +.fc-event-time, +.fc-event-title { + padding: 0 1px; + } + +/* for fake rounded corners */ + +.fc-event a { + display: block; + position: relative; + width: 100%; + height: 100%; + } + +/* right-to-left */ + +.fc-rtl .fc-event a { + text-align: right; + } + +/* resizable */ + +.fc .ui-resizable-handle { /*** TODO: don't use ui-resizable anoymore, change class ***/ + display: block; + position: absolute; + z-index: 99999; + border: 0 !important; /* important overrides pre jquery ui 1.7 styles */ + background: url(data:image/gif;base64,AAAA) !important; /* hover fix for IE */ + } + + + +/* Horizontal Events +------------------------------------------------------------------------*/ + +.fc-event-hori { + border-width: 1px 0; + margin-bottom: 1px; + } + +.fc-event-hori a { + border-width: 0; + } + +/* for fake rounded corners */ + +.fc-content .fc-corner-left { + margin-left: 1px; + } + +.fc-content .fc-corner-left a { + margin-left: -1px; + border-left-width: 1px; + } + +.fc-content .fc-corner-right { + margin-right: 1px; + } + +.fc-content .fc-corner-right a { + margin-right: -1px; + border-right-width: 1px; + } + +/* resizable */ + +.fc-event-hori .ui-resizable-e { + top: 0 !important; /* importants override pre jquery ui 1.7 styles */ + right: -3px !important; + width: 7px !important; + height: 100% !important; + cursor: e-resize; + } + +.fc-event-hori .ui-resizable-w { + top: 0 !important; + left: -3px !important; + width: 7px !important; + height: 100% !important; + cursor: w-resize; + } + +.fc-event-hori .ui-resizable-handle { + _padding-bottom: 14px; /* IE6 had 0 height */ + } + + + + +/* Month View, Basic Week View, Basic Day View +------------------------------------------------------------------------*/ + +.fc-grid table { + width: 100%; + } + +.fc .fc-grid th { + border-width: 0 0 0 1px; + text-align: center; + } + +.fc .fc-grid td { + border-width: 1px 0 0 1px; + } + +.fc-grid th.fc-leftmost, +.fc-grid td.fc-leftmost { + border-left: 0; + } + +.fc-grid .fc-day-number { + float: right; + padding: 0 2px; + } + +.fc-grid .fc-other-month .fc-day-number { + opacity: 0.3; + filter: alpha(opacity=30); /* for IE */ + /* opacity with small font can sometimes look too faded + might want to set the 'color' property instead + making day-numbers bold also fixes the problem */ + } + +.fc-grid .fc-day-content { + clear: both; + padding: 2px 2px 0; /* distance between events and day edges */ + } + +/* event styles */ + +.fc-grid .fc-event-time { + font-weight: bold; + } + +/* right-to-left */ + +.fc-rtl .fc-grid { + direction: rtl; + } + +.fc-rtl .fc-grid .fc-day-number { + float: left; + } + +.fc-rtl .fc-grid .fc-event-time { + float: right; + } + +/* Agenda Week View, Agenda Day View +------------------------------------------------------------------------*/ + +.fc .fc-agenda th, +.fc .fc-agenda td { + border-width: 1px 0 0 1px; + } + +.fc .fc-agenda .fc-leftmost { + border-left: 0; + } + +.fc-agenda tr.fc-first th, +.fc-agenda tr.fc-first td { + border-top: 0; + } + +.fc-agenda-head tr.fc-last th { + border-bottom-width: 1px; + } + +.fc .fc-agenda-head td, +.fc .fc-agenda-body td { + background: none; + } + +.fc-agenda-head th { + text-align: center; + } + +/* the time axis running down the left side */ + +.fc-agenda .fc-axis { + width: 50px; + padding: 0 4px; + vertical-align: middle; + white-space: nowrap; + text-align: right; + font-weight: normal; + } + +/* all-day event cells at top */ + +.fc-agenda-head tr.fc-all-day th { + height: 35px; + } + +.fc-agenda-head td { + padding-bottom: 10px; + } + +.fc .fc-divider div { + font-size: 1px; /* for IE6/7 */ + height: 2px; + } + +.fc .fc-divider .fc-state-default { + background: #eee; /* color for divider between all-day and time-slot events */ + } + +/* body styles */ + +.fc .fc-agenda-body td div { + height: 20px; /* slot height */ + } + +.fc .fc-agenda-body tr.fc-minor th, +.fc .fc-agenda-body tr.fc-minor td { + border-top-style: dotted; + } + +.fc-agenda .fc-day-content { + padding: 2px 2px 0; /* distance between events and day edges */ + } + +/* vertical background columns */ + +.fc .fc-agenda-bg .ui-state-highlight { + background-image: none; /* tall column, don't want repeating background image */ + } + + + +/* Vertical Events +------------------------------------------------------------------------*/ + +.fc-event-vert { + border-width: 0 1px; + } + +.fc-event-vert a { + border-width: 0; + } + +/* for fake rounded corners */ + +.fc-content .fc-corner-top { + margin-top: 1px; + } + +.fc-content .fc-corner-top a { + margin-top: -1px; + border-top-width: 1px; + } + +.fc-content .fc-corner-bottom { + margin-bottom: 1px; + } + +.fc-content .fc-corner-bottom a { + margin-bottom: -1px; + border-bottom-width: 1px; + } + +/* event content */ + +.fc-event-vert span { + display: block; + position: relative; + z-index: 2; + } + +.fc-event-vert span.fc-event-time { + white-space: nowrap; + _white-space: normal; + overflow: hidden; + border: 0; + font-size: 10px; + } + +.fc-event-vert span.fc-event-title { + line-height: 13px; + } + +.fc-event-vert span.fc-event-bg { /* makes the event lighter w/ a semi-transparent overlay */ + position: absolute; + z-index: 1; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: #fff; + opacity: .3; + filter: alpha(opacity=30); /* for IE */ + } + +/* resizable */ + +.fc-event-vert .ui-resizable-s { + bottom: 0 !important; /* importants override pre jquery ui 1.7 styles */ + width: 100% !important; + height: 8px !important; + line-height: 8px !important; + font-size: 11px !important; + font-family: monospace; + text-align: center; + 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)); + } diff --git a/public/css/redmond/jquery-ui-1.8.8.custom.css b/public/css/redmond/jquery-ui-1.8.8.custom.css index 48ab2a02d..e7e1eb3c0 100644 --- a/public/css/redmond/jquery-ui-1.8.8.custom.css +++ b/public/css/redmond/jquery-ui-1.8.8.custom.css @@ -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); diff --git a/public/css/styles.css b/public/css/styles.css index 6a05c0759..b0ff065a3 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -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 { @@ -368,4 +376,24 @@ dl.inline-list dd { } .dataTables_scroll .datatable { border-width: 0px 1px 0 1px; -} \ No newline at end of file +} + +/*----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; +} \ No newline at end of file From 476cf99019c28865f7b4cc3fbce49058608773ad Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 28 Jan 2011 18:24:52 -0500 Subject: [PATCH 2/3] added timepicker to add show form. --- .../controllers/ScheduleController.php | 4 +- application/forms/AddShowWhen.php | 2 + public/css/jquery-ui-timepicker.css | 28 + public/js/airtime/schedule/add-show.js | 2 + .../timepicker/jquery.ui.timepicker-0.0.6.js | 849 ++++++++++++++++++ 5 files changed, 884 insertions(+), 1 deletion(-) create mode 100644 public/css/jquery-ui-timepicker.css create mode 100644 public/js/timepicker/jquery.ui.timepicker-0.0.6.js diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index b23dd0744..f03fb0e32 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -77,11 +77,13 @@ class ScheduleController extends Zend_Controller_Action public function addShowDialogAction() { $this->view->headScript()->appendFile('/js/fullcalendar/fullcalendar.min.js','text/javascript'); + $this->view->headScript()->appendFile('/js/timepicker/jquery.ui.timepicker-0.0.6.js','text/javascript'); $this->view->headScript()->appendFile('/js/colorpicker/js/colorpicker.js','text/javascript'); $this->view->headScript()->appendFile('/js/airtime/schedule/full-calendar-functions.js','text/javascript'); $this->view->headScript()->appendFile('/js/airtime/schedule/add-show.js','text/javascript'); - $this->view->headLink()->appendStylesheet('/css/fullcalendar.css'); + $this->view->headLink()->appendStylesheet('/css/jquery-ui-timepicker.css.css'); + $this->view->headLink()->appendStylesheet('/css/fullcalendar.css'); $this->view->headLink()->appendStylesheet('/css/colorpicker/css/colorpicker.css'); $this->view->headLink()->appendStylesheet('/css/add-show.css'); $this->view->headLink()->appendStylesheet('/css/pro_dropdown_3.css'); diff --git a/application/forms/AddShowWhen.php b/application/forms/AddShowWhen.php index 0440529ea..23c9ffd9d 100644 --- a/application/forms/AddShowWhen.php +++ b/application/forms/AddShowWhen.php @@ -49,6 +49,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm } + /* public function postValidation(array $formData) { $now_timestamp = date("Y-m-d H:i:s"); @@ -64,6 +65,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm return true; } + */ } diff --git a/public/css/jquery-ui-timepicker.css b/public/css/jquery-ui-timepicker.css new file mode 100644 index 000000000..32a644bc4 --- /dev/null +++ b/public/css/jquery-ui-timepicker.css @@ -0,0 +1,28 @@ +/* + * Timepicker stylesheet + * Highly inspired from datepicker + * FG - Nov 2010 - Web3R + * + * version 0.0.3 : Fixed some settings, more dynamic + * version 0.0.4 : Removed width:100% on tables + */ + +.ui-timepicker-inline { display: inline; } + +#ui-timepicker-div { padding: 0.2em } +.ui-timepicker-table { display: inline-table } +.ui-timepicker-table table { margin:0.15em 0 0 0; border-collapse: collapse; } + +.ui-timepicker-hours, .ui-timepicker-minutes { padding: 0.2em; } + +.ui-timepicker-table .ui-timepicker-title { line-height: 1.8em; text-align: center; } +.ui-timepicker-table td { padding: 0.1em; width: 2.2em; } +.ui-timepicker-table th.periods { padding: 0.1em; width: 2.2em; } +.ui-timepicker-table td a { + display:block; + padding:0.2em 0.3em 0.2em 0.5em; + width: 1.2em; + + text-align:right; + text-decoration:none; +} \ No newline at end of file diff --git a/public/js/airtime/schedule/add-show.js b/public/js/airtime/schedule/add-show.js index da3dd615d..2eb8d3a76 100644 --- a/public/js/airtime/schedule/add-show.js +++ b/public/js/airtime/schedule/add-show.js @@ -68,6 +68,8 @@ function setAddShowEvents() { createDateInput(start, startDpSelect); createDateInput(end, endDpSelect); + $("#add_show_start_time").timepicker(); + $("#add_show_hosts_autocomplete").autocomplete({ source: findHosts, select: autoSelect diff --git a/public/js/timepicker/jquery.ui.timepicker-0.0.6.js b/public/js/timepicker/jquery.ui.timepicker-0.0.6.js new file mode 100644 index 000000000..a7a0d2b07 --- /dev/null +++ b/public/js/timepicker/jquery.ui.timepicker-0.0.6.js @@ -0,0 +1,849 @@ +/* + * jQuery UI Timepicker 0.0.5 + * + * Copyright 2010-2011, Francois Gelinas + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://fgelinas.com + * + * Depends: + * jquery.ui.core.js + */ + + /* + * As it is a timepicker, I inspired most of the code from the datepicker + * Francois Gelinas - Nov 2010 + */ + + /* + * Release 0.0.2 - Jan 6, 2011 + * Updated to include common display options for USA users + * Stephen Commisso - Jan 2011 + */ + + /* + * release 0.0.3 - Jan 8, 2011 + * Re-added a display:none on the main div (fix a small empty div visible at the bottom of the page before timepicker is called) (Thanks Gertjan van Roekel) + * Fixed a problem where the timepicker was never displayed with jquery ui 1.8.7 css, + * the problem was the class ui-helper-hidden-accessible, witch I removed. + * Thanks Alexander Fietz and StackOverflow : http://stackoverflow.com/questions/4522274/jquery-timepicker-and-jqueryui-1-8-7-conflict + */ + + /* + * Release 0.0.4 - jan 10, 2011 + * changed showLeadingZero to affect only hours, added showMinutesLeadingZero for minutes display + * Removed width:100% for tables in css + */ + + /* + * Release 0.0.5 - Jan 18, 2011 + * Now updating time picker selected value when manually typing in the text field (thanks Rasmus Schultz) + * Fixed : with showPeriod: true and showLeadingZero: true, PM hours did not show leading zeros (thanks Chandler May) + * Fixed : with showPeriod: true and showLeadingZero: true, Selecting 12 AM shows as 00 AM in the input field, also parsing 12AM did not work correctly (thanks Rasmus Schultz) + */ + + /* + * Release 0.0.6 - Jan 19, 2011 + * Added standard "change" event being triggered on the input when the content changes. (Thanks Rasmus Schultz) + * Added support for inline timePicker, attached to div or span + * Added altField that receive the parsed time value when selected time changes + * Added defaultTime value to use when input field is missing (inline) or input value is empty + * if defaultTime is missing, current time is used + * + */ + +(function ($, undefined) { + + $.extend($.ui, { timepicker: { version: "0.0.1"} }); + + var PROP_NAME = 'timepicker'; + var tpuuid = new Date().getTime(); + + /* Time picker manager. + Use the singleton instance of this class, $.timepicker, to interact with the time picker. + Settings for (groups of) time pickers are maintained in an instance object, + allowing multiple different settings on the same page. */ + + function Timepicker() { + this.debug = true; // Change this to true to start debugging + this._curInst = null; // The current instance in use + this._isInline = false; // true if the instance is displayed inline + this._disabledInputs = []; // List of time picker inputs that have been disabled + this._timepickerShowing = false; // True if the popup picker is showing , false if not + this._inDialog = false; // True if showing within a "dialog", false if not + this._dialogClass = 'ui-timepicker-dialog'; // The name of the dialog marker class + this._mainDivId = 'ui-timepicker-div'; // The ID of the main timepicker division + this._inlineClass = 'ui-timepicker-inline'; // The name of the inline marker class + this._currentClass = 'ui-timepicker-current'; // The name of the current hour / minutes marker class + this._dayOverClass = 'ui-timepicker-days-cell-over'; // The name of the day hover marker class + + this.regional = []; // Available regional settings, indexed by language code + this.regional[''] = { // Default regional settings + hourText: 'Hour', // Display text for hours section + minuteText: 'Minute', // Display text for minutes link + amPmText: ['AM', 'PM'] // Display text for AM PM + }; + this._defaults = { // Global defaults for all the time picker instances + showOn: 'focus', // 'focus' for popup on focus, + // 'button' for trigger button, or 'both' for either (not yet implemented) + showAnim: 'fadeIn', // Name of jQuery animation for popup + showOptions: {}, // Options for enhanced animations + appendText: '', // Display text following the input box, e.g. showing the format + onSelect: null, // Define a callback function when a hour / minutes is selected + onClose: null, // Define a callback function when the timepicker is closed + timeSeparator: ':', // The caracter to use to separate hours and minutes. + showPeriod: false, // Define whether or not to show AM/PM with selected time + showLeadingZero: true, // Define whether or not to show a leading zero for hours < 10. [true/false] + showMinutesLeadingZero: true, // Define whether or not to show a leading zero for minutes < 10. + altField: '', // Selector for an alternate field to store selected time into + defaultTime: '' // Used as default time when input field is empty or for inline timePicker + }; + $.extend(this._defaults, this.regional['']); + + this.tpDiv = $(''); + } + + $.extend(Timepicker.prototype, { + /* Class name added to elements to indicate already configured with a time picker. */ + markerClassName: 'hasTimepicker', + + /* Debug logging (if enabled). */ + log: function () { + if (this.debug) + console.log.apply('', arguments); + }, + + // TODO rename to "widget" when switching to widget factory + _widgetTimepicker: function () { + return this.tpDiv; + }, + + /* Override the default settings for all instances of the time picker. + @param settings object - the new settings to use as defaults (anonymous object) + @return the manager object */ + setDefaults: function (settings) { + extendRemove(this._defaults, settings || {}); + return this; + }, + + /* Attach the time picker to a jQuery selection. + @param target element - the target input field or division or span + @param settings object - the new settings to use for this time picker instance (anonymous) */ + _attachTimepicker: function (target, settings) { + // check for settings on the control itself - in namespace 'time:' + var inlineSettings = null; + for (var attrName in this._defaults) { + var attrValue = target.getAttribute('time:' + attrName); + if (attrValue) { + inlineSettings = inlineSettings || {}; + try { + inlineSettings[attrName] = eval(attrValue); + } catch (err) { + inlineSettings[attrName] = attrValue; + } + } + } + var nodeName = target.nodeName.toLowerCase(); + var inline = (nodeName == 'div' || nodeName == 'span'); + + if (!target.id) { + this.uuid += 1; + target.id = 'tp' + this.uuid; + } + var inst = this._newInst($(target), inline); + inst.settings = $.extend({}, settings || {}, inlineSettings || {}); + if (nodeName == 'input') { + this._connectTimepicker(target, inst); + } else if (inline) { + this._inlineTimepicker(target, inst); + } + }, + + /* Create a new instance object. */ + _newInst: function (target, inline) { + var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars + return { id: id, input: target, // associated target + selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection + drawMonth: 0, drawYear: 0, // month being drawn + inline: inline, // is timepicker inline or not : + tpDiv: (!inline ? this.tpDiv : // presentation div + $('
')) + }; + }, + + /* Attach the time picker to an input field. */ + _connectTimepicker: function (target, inst) { + var input = $(target); + inst.append = $([]); + inst.trigger = $([]); + if (input.hasClass(this.markerClassName)) { return; } + this._attachments(input, inst); + input.addClass(this.markerClassName). + keydown(this._doKeyDown). + keyup(this._doKeyUp). + bind("setData.timepicker", function (event, key, value) { + inst.settings[key] = value; + }). + bind("getData.timepicker", function (event, key) { + return this._get(inst, key); + }); + //this._autoSize(inst); + $.data(target, PROP_NAME, inst); + }, + + /* Handle keystrokes. */ + _doKeyDown: function (event) { + var inst = $.timepicker._getInst(event.target); + var handled = true; + inst._keyEvent = true; + if ($.timepicker._timepickerShowing) { + switch (event.keyCode) { + case 9: $.timepicker._hideTimepicker(); + handled = false; + break; // hide on tab out + case 27: $.timepicker._hideTimepicker(); + break; // hide on escape + default: handled = false; + } + } + else if (event.keyCode == 36 && event.ctrlKey) { // display the time picker on ctrl+home + $.timepicker._showTimepicker(this); + } + else { + handled = false; + } + if (handled) { + event.preventDefault(); + event.stopPropagation(); + } + }, + + /* Update selected time on keyUp */ + /* Added verion 0.0.5 */ + _doKeyUp: function (event) { + var inst = $.timepicker._getInst(event.target); + $.timepicker._setTimeFromField(inst); + $.timepicker._updateTimepicker(inst); + }, + + /* Make attachments based on settings. */ + _attachments: function (input, inst) { + var appendText = this._get(inst, 'appendText'); + var isRTL = this._get(inst, 'isRTL'); + if (inst.append) { inst.append.remove(); } + if (appendText) { + inst.append = $('' + appendText + ''); + input[isRTL ? 'before' : 'after'](inst.append); + } + input.unbind('focus', this._showTimepicker); + if (inst.trigger) { inst.trigger.remove(); } + var showOn = this._get(inst, 'showOn'); + if (showOn == 'focus' || showOn == 'both') { // pop-up time picker when in the marked field + input.focus(this._showTimepicker); + } + if (showOn == 'button' || showOn == 'both') { // pop-up time picker when button clicked + var buttonText = this._get(inst, 'buttonText'); + var buttonImage = this._get(inst, 'buttonImage'); + inst.trigger = $(this._get(inst, 'buttonImageOnly') ? + $('').addClass(this._triggerClass). + attr({ src: buttonImage, alt: buttonText, title: buttonText }) : + $('').addClass(this._triggerClass). + html(buttonImage == '' ? buttonText : $('').attr( + { src: buttonImage, alt: buttonText, title: buttonText }))); + input[isRTL ? 'before' : 'after'](inst.trigger); + inst.trigger.click(function () { + if ($.timepicker._timepickerShowing && $.timepicker._lastInput == input[0]) { $.timepicker._hideTimepicker(); } + else { $.timepicker._showTimepicker(input[0]); } + return false; + }); + } + }, + + + /* Attach an inline time picker to a div. */ + _inlineTimepicker: function(target, inst) { + var divSpan = $(target); + if (divSpan.hasClass(this.markerClassName)) + return; + divSpan.addClass(this.markerClassName).append(inst.tpDiv). + bind("setData.timepicker", function(event, key, value){ + inst.settings[key] = value; + }).bind("getData.timepicker", function(event, key){ + return this._get(inst, key); + }); + $.data(target, PROP_NAME, inst); + this._setTimeFromField(inst); + this._updateTimepicker(inst); + inst.tpDiv.show(); + }, + + /* Pop-up the time picker for a given input field. + @param input element - the input field attached to the time picker or + event - if triggered by focus */ + _showTimepicker: function (input) { + input = input.target || input; + if (input.nodeName.toLowerCase() != 'input') { input = $('input', input.parentNode)[0]; } // find from button/image trigger + if ($.timepicker._isDisabledTimepicker(input) || $.timepicker._lastInput == input) { return; } // already here + + var inst = $.timepicker._getInst(input); + if ($.timepicker._curInst && $.timepicker._curInst != inst) { + $.timepicker._curInst.tpDiv.stop(true, true); + } + var beforeShow = $.timepicker._get(inst, 'beforeShow'); + extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {})); + inst.lastVal = null; + $.timepicker._lastInput = input; + + $.timepicker._setTimeFromField(inst); + if ($.timepicker._inDialog) { input.value = ''; } // hide cursor + if (!$.timepicker._pos) { // position below input + $.timepicker._pos = $.timepicker._findPos(input); + $.timepicker._pos[1] += input.offsetHeight; // add the height + } + var isFixed = false; + $(input).parents().each(function () { + isFixed |= $(this).css('position') == 'fixed'; + return !isFixed; + }); + if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled + $.timepicker._pos[0] -= document.documentElement.scrollLeft; + $.timepicker._pos[1] -= document.documentElement.scrollTop; + } + var offset = { left: $.timepicker._pos[0], top: $.timepicker._pos[1] }; + $.timepicker._pos = null; + // determine sizing offscreen + inst.tpDiv.css({ position: 'absolute', display: 'block', top: '-1000px' }); + $.timepicker._updateTimepicker(inst); + + // reset clicked state + inst._hoursClicked = false; + inst._minutesClicked = false; + + // fix width for dynamic number of time pickers + // and adjust position before showing + offset = $.timepicker._checkOffset(inst, offset, isFixed); + inst.tpDiv.css({ position: ($.timepicker._inDialog && $.blockUI ? + 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', + left: offset.left + 'px', top: offset.top + 'px' + }); + if (!inst.inline) { + var showAnim = $.timepicker._get(inst, 'showAnim'); + var duration = $.timepicker._get(inst, 'duration'); + var postProcess = function () { + $.timepicker._timepickerShowing = true; + var borders = $.timepicker._getBorders(inst.tpDiv); + inst.tpDiv.find('iframe.ui-timepicker-cover'). // IE6- only + css({ left: -borders[0], top: -borders[1], + width: inst.tpDiv.outerWidth(), height: inst.tpDiv.outerHeight() + }); + }; + inst.tpDiv.zIndex($(input).zIndex() + 1); + if ($.effects && $.effects[showAnim]) { + inst.tpDiv.show(showAnim, $.timepicker._get(inst, 'showOptions'), duration, postProcess); + } + else { + inst.tpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess); + } + if (!showAnim || !duration) { postProcess(); } + if (inst.input.is(':visible') && !inst.input.is(':disabled')) { inst.input.focus(); } + $.timepicker._curInst = inst; + } + }, + + /* Generate the time picker content. */ + _updateTimepicker: function (inst) { + var self = this; + var borders = $.timepicker._getBorders(inst.tpDiv); + inst.tpDiv.empty().append(this._generateHTML(inst)) + .find('iframe.ui-timepicker-cover') // IE6- only + .css({ left: -borders[0], top: -borders[1], + width: inst.tpDiv.outerWidth(), height: inst.tpDiv.outerHeight() + }) + .end() + .find('.ui-timepicker td a') + .bind('mouseout', function () { + $(this).removeClass('ui-state-hover'); + if (this.className.indexOf('ui-timepicker-prev') != -1) $(this).removeClass('ui-timepicker-prev-hover'); + if (this.className.indexOf('ui-timepicker-next') != -1) $(this).removeClass('ui-timepicker-next-hover'); + }) + .bind('mouseover', function () { + if (!self._isDisabledTimepicker(inst.inline ? inst.tpDiv.parent()[0] : inst.input[0])) { + $(this).parents('.ui-timepicker-calendar').find('a').removeClass('ui-state-hover'); + $(this).addClass('ui-state-hover'); + if (this.className.indexOf('ui-timepicker-prev') != -1) $(this).addClass('ui-timepicker-prev-hover'); + if (this.className.indexOf('ui-timepicker-next') != -1) $(this).addClass('ui-timepicker-next-hover'); + } + }) + .end() + .find('.' + this._dayOverClass + ' a') + .trigger('mouseover') + .end(); + }, + + /* Generate the HTML for the current state of the date picker. */ + _generateHTML: function (inst) { + var h, m, html = ''; + var showPeriod = (this._get(inst, 'showPeriod') == true); + var showLeadingZero = (this._get(inst, 'showLeadingZero') == true); + var showMinutesLeadingZero = (this._get(inst, 'showMinutesLeadingZero') == true); + var amPmText = this._get(inst, 'amPmText'); + + + html = '' + + '' + // Close the Hour td + '
' + + '
' + + this._get(inst, 'hourText') + + '
' + + ''; + + // AM + html += ''; + for (h = 0; h <= 5; h++) { + html += this._generateHTMLHourCell(inst, h, showPeriod, showLeadingZero); + } + + html += ''; + for (h = 6; h <= 11; h++) { + html += this._generateHTMLHourCell(inst, h, showPeriod, showLeadingZero); + } + + // PM + html += ''; + for (h = 12; h <= 17; h++) { + html += this._generateHTMLHourCell(inst, h, showPeriod, showLeadingZero); + } + + html += ''; + for (h = 18; h <= 23; h++) { + html += this._generateHTMLHourCell(inst, h, showPeriod, showLeadingZero); + } + html += '
' + amPmText[0] + '
' + amPmText[1] + '
' + // Close the hours cells table + '
' + // open minutes td + /* Add the minutes */ + '
' + + this._get(inst, 'minuteText') + + '
' + + '' + + ''; + for (m = 0; m < 15; m += 5) { + html += this._generateHTMLMinuteCell(inst, m, (m < 10) && showMinutesLeadingZero ? "0" + m.toString() : m.toString()); + } + html += ''; + for (m = 15; m < 30; m += 5) { + html += this._generateHTMLMinuteCell(inst, m, m.toString()); + } + html += ''; + for (m = 30; m < 45; m += 5) { + html += this._generateHTMLMinuteCell(inst, m, m.toString()); + } + html += ''; + for (m = 45; m < 60; m += 5) { + html += this._generateHTMLMinuteCell(inst, m, m.toString()); + } + html += '
' + + '
'; + return html; + }, + + /* Generate the content of a "Hour" cell */ + _generateHTMLHourCell: function (inst, hour, showPeriod, showLeadingZero) { + + var displayHour = hour; + if ((hour > 12) && showPeriod) { + displayHour = hour - 12; + } + if ((displayHour == 0) && showPeriod) { + displayHour = 12; + } + if ((displayHour < 10) && showLeadingZero) { + displayHour = '0' + displayHour; + } + + + var html = '' + + '' + + displayHour.toString() + + ''; + return html; + }, + /* Generate the content of a "Hour" cell */ + _generateHTMLMinuteCell: function (inst, minute, displayText) { + var html = '' + + '' + + displayText + + ''; + return html; + }, + + /* Is the first field in a jQuery collection disabled as a timepicker? + @param target element - the target input field or division or span + @return boolean - true if disabled, false if enabled */ + _isDisabledTimepicker: function (target) { + if (!target) { return false; } + for (var i = 0; i < this._disabledInputs.length; i++) { + if (this._disabledInputs[i] == target) { return true; } + } + return false; + }, + + /* Check positioning to remain on screen. */ + _checkOffset: function (inst, offset, isFixed) { + var tpWidth = inst.tpDiv.outerWidth(); + var tpHeight = inst.tpDiv.outerHeight(); + var inputWidth = inst.input ? inst.input.outerWidth() : 0; + var inputHeight = inst.input ? inst.input.outerHeight() : 0; + var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft(); + var viewHeight = document.documentElement.clientHeight + $(document).scrollTop(); + + offset.left -= (this._get(inst, 'isRTL') ? (tpWidth - inputWidth) : 0); + offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; + offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; + + // now check if datepicker is showing outside window viewport - move to a better place if so. + offset.left -= Math.min(offset.left, (offset.left + tpWidth > viewWidth && viewWidth > tpWidth) ? + Math.abs(offset.left + tpWidth - viewWidth) : 0); + offset.top -= Math.min(offset.top, (offset.top + tpHeight > viewHeight && viewHeight > tpHeight) ? + Math.abs(tpHeight + inputHeight) : 0); + + return offset; + }, + + /* Find an object's position on the screen. */ + _findPos: function (obj) { + var inst = this._getInst(obj); + var isRTL = this._get(inst, 'isRTL'); + while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) { + obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; + } + var position = $(obj).offset(); + return [position.left, position.top]; + }, + + /* Retrieve the size of left and top borders for an element. + @param elem (jQuery object) the element of interest + @return (number[2]) the left and top borders */ + _getBorders: function (elem) { + var convert = function (value) { + return { thin: 1, medium: 2, thick: 3}[value] || value; + }; + return [parseFloat(convert(elem.css('border-left-width'))), + parseFloat(convert(elem.css('border-top-width')))]; + }, + + + /* Close time picker if clicked elsewhere. */ + _checkExternalClick: function (event) { + if (!$.timepicker._curInst) { return; } + var $target = $(event.target); + if ($target[0].id != $.timepicker._mainDivId && + $target.parents('#' + $.timepicker._mainDivId).length == 0 && + !$target.hasClass($.timepicker.markerClassName) && + !$target.hasClass($.timepicker._triggerClass) && + $.timepicker._timepickerShowing && !($.timepicker._inDialog && $.blockUI)) + $.timepicker._hideTimepicker(); + }, + + /* Hide the time picker from view. + @param input element - the input field attached to the time picker */ + _hideTimepicker: function (input) { + var inst = this._curInst; + if (!inst || (input && inst != $.data(input, PROP_NAME))) { return; } + if (this._timepickerShowing) { + var showAnim = this._get(inst, 'showAnim'); + var duration = this._get(inst, 'duration'); + var postProcess = function () { + $.timepicker._tidyDialog(inst); + this._curInst = null; + }; + if ($.effects && $.effects[showAnim]) { + inst.tpDiv.hide(showAnim, $.timepicker._get(inst, 'showOptions'), duration, postProcess); + } + else { + inst.tpDiv[(showAnim == 'slideDown' ? 'slideUp' : + (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess); + } + if (!showAnim) { postProcess(); } + var onClose = this._get(inst, 'onClose'); + if (onClose) { + onClose.apply( + (inst.input ? inst.input[0] : null), + [(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback + } + this._timepickerShowing = false; + this._lastInput = null; + if (this._inDialog) { + this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); + if ($.blockUI) { + $.unblockUI(); + $('body').append(this.tpDiv); + } + } + this._inDialog = false; + } + }, + + /* Tidy up after a dialog display. */ + _tidyDialog: function (inst) { + inst.tpDiv.removeClass(this._dialogClass).unbind('.ui-timepicker'); + }, + + /* Retrieve the instance data for the target control. + @param target element - the target input field or division or span + @return object - the associated instance data + @throws error if a jQuery problem getting data */ + _getInst: function (target) { + try { + return $.data(target, PROP_NAME); + } + catch (err) { + throw 'Missing instance data for this timepicker'; + } + }, + + /* Get a setting value, defaulting if necessary. */ + _get: function (inst, name) { + return inst.settings[name] !== undefined ? + inst.settings[name] : this._defaults[name]; + }, + + /* Parse existing time and initialise time picker. */ + _setTimeFromField: function (inst) { + if (inst.input.val() == inst.lastVal) { return; } + var defaultTime = this._get(inst, 'defaultTime'); + + + var timeToParse = this._getCurrentTimeRounded(inst); + if (defaultTime != '') { timeToParse = defaultTime } + if ((inst.inline == false) && (inst.input.val() != '')) { timeToParse = inst.input.val() } + + //var timeVal = inst.lastVal = inst.inline == false ? inst.input.val() : + // defaultTime ? defaultTime : + // getHours(new Date()) + timeSeparator + getMinutes(new Date()); + var timeVal = inst.lastVal = timeToParse; + //alert ('inst.input ' + inst.input.attr('id')); + var time = this.parseTime(inst, timeVal); + inst.hours = time.hours; + inst.minutes = time.minutes; + }, + + /* Return the current time, ready to be parsed, rounded to the closest 5 minute */ + _getCurrentTimeRounded: function (inst) { + var currentTime = new Date(); + var timeSeparator = this._get(inst, 'timeSeparator'); + // setting selected time , least priority first + var currentMinutes = currentTime.getMinutes() + // round to closest 5 + currentMinutes = Math.round( currentMinutes / 5 ) * 5; + + return currentTime.getHours().toString() + timeSeparator + currentMinutes.toString(); + }, + + /* + * Pase a time string into hours and minutes + */ + parseTime: function (inst, timeVal) { + var retVal = new Object(); + retVal.hours = -1; + retVal.minutes = -1; + + var timeSeparator = this._get(inst, 'timeSeparator'); + var amPmText = this._get(inst, 'amPmText'); + var p = timeVal.indexOf(timeSeparator); + if (p == -1) { return retVal; } + + retVal.hours = parseInt(timeVal.substr(0, p), 10); + retVal.minutes = parseInt(timeVal.substr(p + 1), 10); + + var showPeriod = (this._get(inst, 'showPeriod') == true); + var timeValUpper = timeVal.toUpperCase(); + if ((retVal.hours < 12) && (showPeriod) && (timeValUpper.indexOf(amPmText[1].toUpperCase()) != -1)) { + retVal.hours += 12; + } + // fix for 12 AM + if ((retVal.hours == 12) && (showPeriod) && (timeValUpper.indexOf(amPmText[0].toUpperCase()) != -1)) { + retVal.hours = 0; + } + + return retVal; + }, + + + + selectHours: function (id, newHours, td, fromDoubleClick) { + var target = $(id); + var inst = this._getInst(target[0]); + $(td).parents('.ui-timepicker-hours:first').find('a').removeClass('ui-state-active'); + //inst.tpDiv.children('.ui-timepicker-hours a').removeClass('ui-state-active'); + $(td).children('a').addClass('ui-state-active'); + + inst.hours = newHours; + this._updateSelectedValue(inst); + + inst._hoursClicked = true; + if ((inst._minutesClicked) || (fromDoubleClick)) { $.timepicker._hideTimepicker(); } + }, + + selectMinutes: function (id, newMinutes, td, fromDoubleClick) { + var target = $(id); + var inst = this._getInst(target[0]); + $(td).parents('.ui-timepicker-minutes:first').find('a').removeClass('ui-state-active'); + $(td).children('a').addClass('ui-state-active'); + + inst.minutes = newMinutes; + this._updateSelectedValue(inst); + + inst._minutesClicked = true; + if ((inst._hoursClicked) || (fromDoubleClick)) { $.timepicker._hideTimepicker(); } + }, + + _updateSelectedValue: function (inst) { + if ((inst.hours < 0) || (inst.hours > 23)) { inst.hours = 12; } + if ((inst.minutes < 0) || (inst.minutes > 59)) { inst.minutes = 0; } + + var period = ""; + var showPeriod = (this._get(inst, 'showPeriod') == true); + var showLeadingZero = (this._get(inst, 'showLeadingZero') == true); + var amPmText = this._get(inst, 'amPmText'); + var selectedHours = inst.hours ? inst.hours : 0; + var selectedMinutes = inst.minutes ? inst.minutes : 0; + + var displayHours = selectedHours; + if ( ! displayHours) { + displayHoyrs = 0; + } + + + if (showPeriod) { + if (inst.hours == 0) { + displayHours = 12; + } + if (inst.hours < 12) { + period = amPmText[0]; + } + else { + period = amPmText[1]; + if (displayHours > 12) { + displayHours -= 12; + } + } + } + + var h = displayHours.toString(); + if (showLeadingZero && (displayHours < 10)) { h = '0' + h; } + + + var m = selectedMinutes.toString(); + if (selectedMinutes < 10) { m = '0' + m; } + + var newTime = h + this._get(inst, 'timeSeparator') + m; + if (period.length > 0) { newTime += " " + period; } + + if (inst.input) { + inst.input.val(newTime); + inst.input.trigger('change'); + } + + var onSelect = this._get(inst, 'onSelect'); + if (onSelect) { onSelect.apply((inst.input ? inst.input[0] : null), [newTime, inst]); } // trigger custom callback + + this._updateAlternate(inst, newTime); + + return newTime; + }, + + /* Update any alternate field to synchronise with the main field. */ + _updateAlternate: function(inst, newTime) { + var altField = this._get(inst, 'altField'); + if (altField) { // update alternate field too + $(altField).each(function() { $(this).val(newTime); }); + } + } + }); + + + + /* Invoke the timepicker functionality. + @param options string - a command, optionally followed by additional parameters or + Object - settings for attaching new datepicker functionality + @return jQuery object */ + $.fn.timepicker = function (options) { + + /* Initialise the date picker. */ + if (!$.timepicker.initialized) { + $(document).mousedown($.timepicker._checkExternalClick). + find('body').append($.timepicker.tpDiv); + $.timepicker.initialized = true; + } + + var otherArgs = Array.prototype.slice.call(arguments, 1); + if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) + return $.timepicker['_' + options + 'Datepicker']. + apply($.timepicker, [this[0]].concat(otherArgs)); + if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') + return $.timepicker['_' + options + 'Datepicker']. + apply($.timepicker, [this[0]].concat(otherArgs)); + return this.each(function () { + typeof options == 'string' ? + $.timepicker['_' + options + 'Datepicker']. + apply($.timepicker, [this].concat(otherArgs)) : + $.timepicker._attachTimepicker(this, options); + }); + }; + + /* jQuery extend now ignores nulls! */ + function extendRemove(target, props) { + $.extend(target, props); + for (var name in props) + if (props[name] == null || props[name] == undefined) + target[name] = props[name]; + return target; + }; + + $.timepicker = new Timepicker(); // singleton instance + $.timepicker.initialized = false; + $.timepicker.uuid = new Date().getTime(); + $.timepicker.version = "1.8.6"; + + // Workaround for #4055 + // Add another global to avoid noConflict issues with inline event handlers + window['TP_jQuery_' + tpuuid] = $; + +})(jQuery); + +/* + ____ + ___ .-~. /_"-._ + `-._~-. / /_ "~o\ :Y + \ \ / : \~x. ` ') + ] Y / | Y< ~-.__j + / ! _.--~T : l l< /.-~ + / / ____.--~ . ` l /~\ \<|Y + / / .-~~" /| . ',-~\ \L| + / / / .^ \ Y~Y \.^>/l_ "--' + / Y .-"( . l__ j_j l_/ /~_.-~ . + Y l / \ ) ~~~." / `/"~ / \.__/l_ + | \ _.-" ~-{__ l : l._Z~-.___.--~ + | ~---~ / ~~"---\_ ' __[> + l . _.^ ___ _>-y~ + \ \ . .-~ .-~ ~>--" / + \ ~---" / ./ _.-' + "-.,_____.,_ _.--~\ _.-~ + ~~ ( _} -Row + `. ~( + ) \ + /,`--'~\--'~\ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ->T-Rex<- +*/ \ No newline at end of file From c0144fb0bef88993c8b2f65da30093f3dea3ab57 Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Fri, 28 Jan 2011 18:29:53 -0500 Subject: [PATCH 3/3] CC-1826 Restarting Pulseaudio kills liquidsoap player Daemontools doesnt do an adequate job of killing the liquidsoap process. Added a "killall" to make sure the process is really killed. --- pypo/install/pypo-stop.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pypo/install/pypo-stop.py b/pypo/install/pypo-stop.py index 0f3ce5db5..a27032313 100644 --- a/pypo/install/pypo-stop.py +++ b/pypo/install/pypo-stop.py @@ -11,12 +11,13 @@ if os.geteuid() != 0: try: print "Stopping daemontool script pypo-fetch" os.system("svc -dx /etc/service/pypo-fetch 2>/dev/null") - + print "Stopping daemontool script pypo-push" os.system("svc -dx /etc/service/pypo-push 2>/dev/null") print "Stopping daemontool script pypo-liquidsoap" os.system("svc -dx /etc/service/pypo-liquidsoap 2>/dev/null") + os.system("killall liquidsoap") except Exception, e: print "exception:" + str(e)