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 = '
' +
+ '
' +
+ '
' +
+ this._get(inst, 'hourText') +
+ '
' +
+ '
';
+
+ // AM
+ html += '
' + amPmText[0] + '
';
+ 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 += '
' + amPmText[1] + '
';
+ 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 += '
' + // Close the hours cells table
+ '
' + // Close the Hour td
+ '
' + // 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 = '