SOURCES: eventum-jquery.patch (NEW) - update Query ui.datepicker to 1.5.2

glen glen at pld-linux.org
Wed Oct 15 00:59:50 CEST 2008


Author: glen                         Date: Tue Oct 14 22:59:50 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- update Query ui.datepicker to 1.5.2

---- Files affected:
SOURCES:
   eventum-jquery.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/eventum-jquery.patch
diff -u /dev/null SOURCES/eventum-jquery.patch:1.1
--- /dev/null	Wed Oct 15 00:59:50 2008
+++ SOURCES/eventum-jquery.patch	Wed Oct 15 00:59:44 2008
@@ -0,0 +1,2623 @@
+Index: js/jquery/ui.datepicker.js
+===================================================================
+--- js/jquery/ui.datepicker.js	(revision 3749)
++++ js/jquery/ui.datepicker.js	(working copy)
+@@ -1,26 +1,40 @@
+-/* jQuery UI Date Picker v3.3 - previously jQuery Calendar
+-   Written by Marc Grabanski (m at marcgrabanski.com) and Keith Wood (kbwood at virginbroadband.com.au).
++/*
++ * jQuery UI Datepicker
++ *
++ * Copyright (c) 2006, 2007, 2008 Marc Grabanski
++ * Dual licensed under the MIT (MIT-LICENSE.txt)
++ * and GPL (GPL-LICENSE.txt) licenses.
++ * 
++ * http://docs.jquery.com/UI/Datepicker
++ *
++ * Depends:
++ *	ui.core.js
++ *
++ * Marc Grabanski (m at marcgrabanski.com) and Keith Wood (kbwood at virginbroadband.com.au).
++ */
++   
++(function($) { // hide the namespace
+ 
+-   Copyright (c) 2007 Marc Grabanski (http://marcgrabanski.com/code/ui-datepicker)
+-   Dual licensed under the MIT (MIT-LICENSE.txt)
+-   and GPL (GPL-LICENSE.txt) licenses.
+-   Date: 09-03-2007  */
++var PROP_NAME = 'datepicker';
+ 
+ /* Date picker manager.
+    Use the singleton instance of this class, $.datepicker, to interact with the date picker.
+-   Settings for (groups of) date pickers are maintained in an instance object
+-   (DatepickerInstance), allowing multiple different settings on the same page. */
+-   
+-(function($) { // hide the namespace
++   Settings for (groups of) date pickers are maintained in an instance object,
++   allowing multiple different settings on the same page. */
+ 
+ function Datepicker() {
+ 	this.debug = false; // Change this to true to start debugging
+-	this._nextId = 0; // Next ID for a date picker instance
+-	this._inst = []; // List of instances indexed by ID
+ 	this._curInst = null; // The current instance in use
+ 	this._disabledInputs = []; // List of date picker inputs that have been disabled
+ 	this._datepickerShowing = false; // True if the popup picker is showing , false if not
+ 	this._inDialog = false; // True if showing within a "dialog", false if not
++	this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
++	this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
++	this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
++	this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
++	this._promptClass = 'ui-datepicker-prompt'; // The name of the dialog prompt marker class
++	this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
++	this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
+ 	this.regional = []; // Available regional settings, indexed by language code
+ 	this.regional[''] = { // Default regional settings
+ 		clearText: 'Clear', // Display text for clear link
+@@ -54,6 +68,7 @@
+ 		showOn: 'focus', // 'focus' for popup on focus,
+ 			// 'button' for trigger button, or 'both' for either
+ 		showAnim: 'show', // Name of jQuery animation for popup
++		showOptions: {}, // Options for enhanced animations
+ 		defaultDate: null, // Used when field is blank: actual date,
+ 			// +/-number for offset from today, null for today
+ 		appendText: '', // Display text following the input box, e.g. showing the format
+@@ -65,11 +80,14 @@
+ 		mandatory: false, // True to hide the Clear link, false to include it
+ 		hideIfNoPrevNext: false, // True to hide next/previous month links
+ 			// if not applicable, false to just disable them
++		navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
++		gotoCurrent: false, // True if today link goes back to current selection instead
+ 		changeMonth: true, // True if month can be selected directly, false if only prev/next
+ 		changeYear: true, // True if year can be selected directly, false if only prev/next
+ 		yearRange: '-10:+10', // Range of years to display in drop-down,
+ 			// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)
+ 		changeFirstDay: true, // True to click on day name to change, false to remain as set
++		highlightWeek: false, // True to highlight the selected week
+ 		showOtherMonths: false, // True to show dates in other months, false to leave blank
+ 		showWeeks: false, // True to show week of the year, false to omit
+ 		calculateWeek: this.iso8601Week, // How to calculate the week of the year,
+@@ -82,20 +100,24 @@
+ 			// takes date and instance as parameters, returns display text
+ 		minDate: null, // The earliest selectable date, or null for no limit
+ 		maxDate: null, // The latest selectable date, or null for no limit
+-		speed: 'medium', // Speed of display/closure
++		duration: 'normal', // Duration of display/closure
+ 		beforeShowDay: null, // Function that takes a date and returns an array with
+-			// [0] = true if selectable, false if not,
+-			// [1] = custom CSS class name(s) or '', e.g. $.datepicker.noWeekends
++			// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', 
++			// [2] = cell title (optional), e.g. $.datepicker.noWeekends
+ 		beforeShow: null, // Function that takes an input field and
+ 			// returns a set of custom settings for the date picker
+ 		onSelect: null, // Define a callback function when a date is selected
++		onChangeMonthYear: null, // Define a callback function when the month or year is changed
++		onClose: null, // Define a callback function when the datepicker is closed
+ 		numberOfMonths: 1, // Number of months to show at a time
+ 		stepMonths: 1, // Number of months to step back/forward
+ 		rangeSelect: false, // Allows for selecting a date range on one date picker
+-		rangeSeparator: ' - ' // Text between two dates in a range
++		rangeSeparator: ' - ', // Text between two dates in a range
++		altField: '', // Selector for an alternate field to store selected dates into
++		altFormat: '' // The date format to use for the alternate field
+ 	};
+ 	$.extend(this._defaults, this.regional['']);
+-	this._datepickerDiv = $('<div id="datepicker_div"></div>');
++	this.dpDiv = $('<div id="' + this._mainDivId + '" style="display: none;"></div>');
+ }
+ 
+ $.extend(Datepicker.prototype, {
+@@ -104,23 +126,10 @@
+ 
+ 	/* Debug logging (if enabled). */
+ 	log: function () {
+-		if (this.debug) {
++		if (this.debug)
+ 			console.log.apply('', arguments);
+-		}
+ 	},
+ 	
+-	/* Register a new date picker instance - with custom settings. */
+-	_register: function(inst) {
+-		var id = this._nextId++;
+-		this._inst[id] = inst;
+-		return id;
+-	},
+-
+-	/* Retrieve a particular date picker instance based on its ID. */
+-	_getInst: function(id) {
+-		return this._inst[id] || id;
+-	},
+-
+ 	/* Override the default settings for all instances of the date picker. 
+ 	   @param  settings  object - the new settings to use as defaults (anonymous object)
+ 	   @return the manager object */
+@@ -129,132 +138,109 @@
+ 		return this;
+ 	},
+ 
+-	/* Handle keystrokes. */
+-	_doKeyDown: function(e) {
+-		var inst = $.datepicker._getInst(this._calId);
+-		if ($.datepicker._datepickerShowing) {
+-			switch (e.keyCode) {
+-				case 9:  $.datepicker.hideDatepicker('');
+-						break; // hide on tab out
+-				case 13: $.datepicker._selectDay(inst, inst._selectedMonth, inst._selectedYear,
+-							$('td.datepicker_daysCellOver', inst._datepickerDiv)[0]);
+-						return false; // don't submit the form
+-						break; // select the value on enter
+-				case 27: $.datepicker.hideDatepicker(inst._get('speed'));
+-						break; // hide on escape
+-				case 33: $.datepicker._adjustDate(inst,
+-							(e.ctrlKey ? -1 : -inst._get('stepMonths')), (e.ctrlKey ? 'Y' : 'M'));
+-						break; // previous month/year on page up/+ ctrl
+-				case 34: $.datepicker._adjustDate(inst,
+-							(e.ctrlKey ? +1 : +inst._get('stepMonths')), (e.ctrlKey ? 'Y' : 'M'));
+-						break; // next month/year on page down/+ ctrl
+-				case 35: if (e.ctrlKey) $.datepicker._clearDate(inst);
+-						break; // clear on ctrl+end
+-				case 36: if (e.ctrlKey) $.datepicker._gotoToday(inst);
+-						break; // current on ctrl+home
+-				case 37: if (e.ctrlKey) $.datepicker._adjustDate(inst, -1, 'D');
+-						break; // -1 day on ctrl+left
+-				case 38: if (e.ctrlKey) $.datepicker._adjustDate(inst, -7, 'D');
+-						break; // -1 week on ctrl+up
+-				case 39: if (e.ctrlKey) $.datepicker._adjustDate(inst, +1, 'D');
+-						break; // +1 day on ctrl+right
+-				case 40: if (e.ctrlKey) $.datepicker._adjustDate(inst, +7, 'D');
+-						break; // +1 week on ctrl+down
++	/* Attach the date 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 date picker instance (anonymous) */
++	_attachDatepicker: function(target, settings) {
++		// check for settings on the control itself - in namespace 'date:'
++		var inlineSettings = null;
++		for (attrName in this._defaults) {
++			var attrValue = target.getAttribute('date:' + attrName);
++			if (attrValue) {
++				inlineSettings = inlineSettings || {};
++				try {
++					inlineSettings[attrName] = eval(attrValue);
++				} catch (err) {
++					inlineSettings[attrName] = attrValue;
++				}
+ 			}
+ 		}
+-		else if (e.keyCode == 36 && e.ctrlKey) { // display the date picker on ctrl+home
+-			$.datepicker.showFor(this);
++		var nodeName = target.nodeName.toLowerCase();
++		var inline = (nodeName == 'div' || nodeName == 'span');
++		if (!target.id)
++			target.id = 'dp' + new Date().getTime();
++		var inst = this._newInst($(target), inline);
++		inst.settings = $.extend({}, settings || {}, inlineSettings || {}); 
++		if (nodeName == 'input') {
++			this._connectDatepicker(target, inst);
++		} else if (inline) {
++			this._inlineDatepicker(target, inst);
+ 		}
+ 	},
+ 
+-	/* Filter entered characters - based on date format. */
+-	_doKeyPress: function(e) {
+-		var inst = $.datepicker._getInst(this._calId);
+-		var chars = $.datepicker._possibleChars(inst._get('dateFormat'));
+-		var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode);
+-		return (chr < ' ' || !chars || chars.indexOf(chr) > -1);
++	/* Create a new instance object. */
++	_newInst: function(target, inline) {
++		return {id: target[0].id, input: target, // associated target
++			selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
++			drawMonth: 0, drawYear: 0, // month being drawn
++			inline: inline, // is datepicker inline or not
++			dpDiv: (!inline ? this.dpDiv : // presentation div
++			$('<div class="ui-datepicker-inline"></div>'))};
+ 	},
+ 
+ 	/* Attach the date picker to an input field. */
+ 	_connectDatepicker: function(target, inst) {
+ 		var input = $(target);
+-		if (this._hasClass(input, this.markerClassName)) {
++		if (input.hasClass(this.markerClassName))
+ 			return;
+-		}
+-		var appendText = inst._get('appendText');
+-		var isRTL = inst._get('isRTL');
+-		if (appendText) {
+-			if (isRTL) {
+-				input.before('<span class="datepicker_append">' + appendText + '</span>');
+-			}
+-			else {
+-				input.after('<span class="datepicker_append">' + appendText + '</span>');
+-			}
+-		}
+-		var showOn = inst._get('showOn');
+-		if (showOn == 'focus' || showOn == 'both') { // pop-up date picker when in the marked field
+-			input.focus(this.showFor);
+-		}
++		var appendText = this._get(inst, 'appendText');
++		var isRTL = this._get(inst, 'isRTL');
++		if (appendText)
++			input[isRTL ? 'before' : 'after']('<span class="' + this._appendClass + '">' + appendText + '</span>');
++		var showOn = this._get(inst, 'showOn');
++		if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
++			input.focus(this._showDatepicker);
+ 		if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
+-			var buttonText = inst._get('buttonText');
+-			var buttonImage = inst._get('buttonImage');
+-			var buttonImageOnly = inst._get('buttonImageOnly');
+-			var trigger = $(buttonImageOnly ? '<img class="datepicker_trigger" src="' +
+-				buttonImage + '" alt="' + buttonText + '" title="' + buttonText + '"/>' :
+-				'<button type="button" class="datepicker_trigger">' + (buttonImage != '' ?
+-				'<img src="' + buttonImage + '" alt="' + buttonText + '" title="' + buttonText + '"/>' :
+-				buttonText) + '</button>');
+-			input.wrap('<span class="datepicker_wrap"></span>');
+-			if (isRTL) {
+-				input.before(trigger);
+-			}
+-			else {
+-				input.after(trigger);
+-			}
+-			trigger.click(this.showFor);
++			var buttonText = this._get(inst, 'buttonText');
++			var buttonImage = this._get(inst, 'buttonImage');
++			var trigger = $(this._get(inst, 'buttonImageOnly') ? 
++				$('<img/>').addClass(this._triggerClass).
++					attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
++				$('<button type="button"></button>').addClass(this._triggerClass).
++					html(buttonImage == '' ? buttonText : $('<img/>').attr(
++					{ src:buttonImage, alt:buttonText, title:buttonText })));
++			input[isRTL ? 'before' : 'after'](trigger);
++			trigger.click(function() {
++				if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target)
++					$.datepicker._hideDatepicker();
++				else
++					$.datepicker._showDatepicker(target);
++				return false;
++			});
+ 		}
+-		input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress);
+-		input.bind("setData.datepicker", function(event, key, value){
+-			inst._settings[key] = value;
+-		}).bind("getData.datepicker", function(event, key){
+-			return inst._get(key);
+-		});
+-		input[0]._calId = inst._id;
++		input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).
++			bind("setData.datepicker", function(event, key, value) {
++				inst.settings[key] = value;
++			}).bind("getData.datepicker", function(event, key) {
++				return this._get(inst, key);
++			});
++		$.data(target, PROP_NAME, inst);
+ 	},
+ 
+ 	/* Attach an inline date picker to a div. */
+ 	_inlineDatepicker: function(target, inst) {
+ 		var input = $(target);
+-		if (this._hasClass(input, this.markerClassName)) {
++		if (input.hasClass(this.markerClassName))
+ 			return;
+-		}
+-		input.addClass(this.markerClassName).append(inst._datepickerDiv);
+-		input.bind("setData.datepicker", function(event, key, value){
+-			inst._settings[key] = value;
+-		}).bind("getData.datepicker", function(event, key){
+-			return inst._get(key);
+-		});
+-		input[0]._calId = inst._id;
++		input.addClass(this.markerClassName).append(inst.dpDiv).
++			bind("setData.datepicker", function(event, key, value){
++				inst.settings[key] = value;
++			}).bind("getData.datepicker", function(event, key){
++				return this._get(inst, key);
++			});
++		$.data(target, PROP_NAME, inst);
++		this._setDate(inst, this._getDefaultDate(inst));
+ 		this._updateDatepicker(inst);
+-		/* @todo: fix _inlineShow automatic resizing
+-			- Endless loop bug in IE6.  
+-			- inst._datepickerDiv.resize doesn't ever fire in firefox.  */
+-		// inst._datepickerDiv.resize(function() { $.datepicker._inlineShow(inst); });
+ 	},
+ 
+ 	/* Tidy up after displaying the date picker. */
+ 	_inlineShow: function(inst) {
+-		var numMonths = inst._getNumberOfMonths(); // fix width for dynamic number of date pickers
+-		inst._datepickerDiv.width(numMonths[1] * $('.datepicker', inst._datepickerDiv[0]).width());
++		var numMonths = this._getNumberOfMonths(inst); // fix width for dynamic number of date pickers
++		inst.dpDiv.width(numMonths[1] * $('.ui-datepicker', inst.dpDiv[0]).width());
+ 	}, 
+ 
+-	/* Does this element have a particular class? */
+-	_hasClass: function(element, className) {
+-		var classes = element.attr('class');
+-		return (classes && classes.indexOf(className) > -1);
+-	},
+-
+ 	/* Pop-up the date picker in a "dialog" box.
++	   @param  input     element - ignored
+ 	   @param  dateText  string - the initial date to display (in the current format)
+ 	   @param  onSelect  function - the function(dateText) to call when a date is selected
+ 	   @param  settings  object - update the dialog date picker instance's settings (anonymous object)
+@@ -262,24 +248,25 @@
+ 	                     event - with x/y coordinates or
+ 	                     leave empty for default (screen centre)
+ 	   @return the manager object */
+-	dialogDatepicker: function(dateText, onSelect, settings, pos) {
++	_dialogDatepicker: function(input, dateText, onSelect, settings, pos) {
+ 		var inst = this._dialogInst; // internal instance
+ 		if (!inst) {
+-			inst = this._dialogInst = new DatepickerInstance({}, false);
+-			this._dialogInput = $('<input type="text" size="1" style="position: absolute; top: -100px;"/>');
++			var id = 'dp' + new Date().getTime();
++			this._dialogInput = $('<input type="text" id="' + id +
++				'" size="1" style="position: absolute; top: -100px;"/>');
+ 			this._dialogInput.keydown(this._doKeyDown);
+ 			$('body').append(this._dialogInput);
+-			this._dialogInput[0]._calId = inst._id;
++			inst = this._dialogInst = this._newInst(this._dialogInput, false);
++			inst.settings = {};
++			$.data(this._dialogInput[0], PROP_NAME, inst);
+ 		}
+-		extendRemove(inst._settings, settings || {});
++		extendRemove(inst.settings, settings || {});
+ 		this._dialogInput.val(dateText);
+ 
+ 		this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
+ 		if (!this._pos) {
+-			var browserWidth = window.innerWidth || document.documentElement.clientWidth ||
+-				document.body.clientWidth;
+-			var browserHeight = window.innerHeight || document.documentElement.clientHeight ||
+-				document.body.clientHeight;
++			var browserWidth = window.innerWidth || document.documentElement.clientWidth ||	document.body.clientWidth;
++			var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
+ 			var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+ 			var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+ 			this._pos = // should use actual width/height below
+@@ -288,43 +275,176 @@
+ 
+ 		// move input on screen for focus, but hidden behind dialog
+ 		this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
+-		inst._settings.onSelect = onSelect;
++		inst.settings.onSelect = onSelect;
+ 		this._inDialog = true;
+-		this._datepickerDiv.addClass('datepicker_dialog');
+-		this.showFor(this._dialogInput[0]);
+-		if ($.blockUI) {
+-			$.blockUI(this._datepickerDiv);
+-		}
++		this.dpDiv.addClass(this._dialogClass);
++		this._showDatepicker(this._dialogInput[0]);
++		if ($.blockUI)
++			$.blockUI(this.dpDiv);
++		$.data(this._dialogInput[0], PROP_NAME, inst);
+ 		return this;
+ 	},
+ 
+-	/* Pop-up the date picker for a given input field.
+-	   @param  control  element - the input field attached to the date picker or
+-	                    string - the ID or other jQuery selector of the input field or
+-	                    object - jQuery object for input field
+-	   @return the manager object */
+-	showFor: function(control) {
+-		control = (control.jquery ? control[0] :
+-			(typeof control == 'string' ? $(control)[0] : control));
+-		var input = (control.nodeName && control.nodeName.toLowerCase() == 'input' ? control : this);
+-		if (input.nodeName.toLowerCase() != 'input') { // find from button/image trigger
+-			input = $('input', input.parentNode)[0];
++	/* Detach a datepicker from its control.
++	   @param  target    element - the target input field or division or span */
++	_destroyDatepicker: function(target) {
++		var nodeName = target.nodeName.toLowerCase();
++		var $target = $(target);
++		$.removeData(target, PROP_NAME);
++		if (nodeName == 'input') {
++			$target.siblings('.' + this._appendClass).remove().end().
++				siblings('.' + this._triggerClass).remove().end().
++				removeClass(this.markerClassName).
++				unbind('focus', this._showDatepicker).
++				unbind('keydown', this._doKeyDown).
++				unbind('keypress', this._doKeyPress);
++		} else if (nodeName == 'div' || nodeName == 'span')
++			$target.removeClass(this.markerClassName).empty();
++	},
++
++	/* Enable the date picker to a jQuery selection.
++	   @param  target    element - the target input field or division or span */
++	_enableDatepicker: function(target) {
++		target.disabled = false;
++		$(target).siblings('button.' + this._triggerClass).each(function() { this.disabled = false; }).end().
++			siblings('img.' + this._triggerClass).css({opacity: '1.0', cursor: ''});
++		this._disabledInputs = $.map(this._disabledInputs,
++			function(value) { return (value == target ? null : value); }); // delete entry
++	},
++
++	/* Disable the date picker to a jQuery selection.
++	   @param  target    element - the target input field or division or span */
++	_disableDatepicker: function(target) {
++		target.disabled = true;
++		$(target).siblings('button.' + this._triggerClass).each(function() { this.disabled = true; }).end().
++			siblings('img.' + this._triggerClass).css({opacity: '0.5', cursor: 'default'});
++		this._disabledInputs = $.map(this._disabledInputs,
++			function(value) { return (value == target ? null : value); }); // delete entry
++		this._disabledInputs[this._disabledInputs.length] = target;
++	},
++
++	/* Is the first field in a jQuery collection disabled as a datepicker?
++	   @param  target    element - the target input field or division or span
++	   @return boolean - true if disabled, false if enabled */
++	_isDisabledDatepicker: function(target) {
++		if (!target)
++			return false;
++		for (var i = 0; i < this._disabledInputs.length; i++) {
++			if (this._disabledInputs[i] == target)
++				return true;
+ 		}
+-		if ($.datepicker._lastInput == input) { // already here
+-			return;
++		return false;
++	},
++
++	/* Update the settings for a date picker attached to an input field or division.
++	   @param  target  element - the target input field or division or span
++	   @param  name    object - the new settings to update or
++	                   string - the name of the setting to change or
++	   @param  value   any - the new value for the setting (omit if above is an object) */
++	_changeDatepicker: function(target, name, value) {
++		var settings = name || {};
++		if (typeof name == 'string') {
++			settings = {};
++			settings[name] = value;
+ 		}
+-		if ($(input).isDisabledDatepicker()) {
+-			return;
++		if (inst = $.data(target, PROP_NAME)) {
++			extendRemove(inst.settings, settings);
++			this._updateDatepicker(inst);
+ 		}
+-		var inst = $.datepicker._getInst(input._calId);
+-		var beforeShow = inst._get('beforeShow');
+-		extendRemove(inst._settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
+-		$.datepicker.hideDatepicker('');
++	},
++
++	/* Set the dates for a jQuery selection.
++	   @param  target   element - the target input field or division or span
++	   @param  date     Date - the new date
++	   @param  endDate  Date - the new end date for a range (optional) */
++	_setDateDatepicker: function(target, date, endDate) {
++		var inst = $.data(target, PROP_NAME);
++		if (inst) {
++			this._setDate(inst, date, endDate);
++			this._updateDatepicker(inst);
++		}
++	},
++
++	/* Get the date(s) for the first entry in a jQuery selection.
++	   @param  target  element - the target input field or division or span
++	   @return Date - the current date or
++	           Date[2] - the current dates for a range */
++	_getDateDatepicker: function(target) {
++		var inst = $.data(target, PROP_NAME);
++		if (inst)
++			this._setDateFromField(inst); 
++		return (inst ? this._getDate(inst) : null);
++	},
++
++	/* Handle keystrokes. */
++	_doKeyDown: function(e) {
++		var inst = $.data(e.target, PROP_NAME);
++		var handled = true;
++		if ($.datepicker._datepickerShowing)
++			switch (e.keyCode) {
++				case 9:  $.datepicker._hideDatepicker(null, '');
++						break; // hide on tab out
++				case 13: $.datepicker._selectDay(e.target, inst.selectedMonth, inst.selectedYear,
++							$('td.ui-datepicker-days-cell-over', inst.dpDiv)[0]);
++						return false; // don't submit the form
++						break; // select the value on enter
++				case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
++						break; // hide on escape
++				case 33: $.datepicker._adjustDate(e.target, (e.ctrlKey ? -1 :
++							-$.datepicker._get(inst, 'stepMonths')), (e.ctrlKey ? 'Y' : 'M'));
++						break; // previous month/year on page up/+ ctrl
++				case 34: $.datepicker._adjustDate(e.target, (e.ctrlKey ? +1 :
++							+$.datepicker._get(inst, 'stepMonths')), (e.ctrlKey ? 'Y' : 'M'));
++						break; // next month/year on page down/+ ctrl
++				case 35: if (e.ctrlKey) $.datepicker._clearDate(e.target);
++						break; // clear on ctrl+end
++				case 36: if (e.ctrlKey) $.datepicker._gotoToday(e.target);
++						break; // current on ctrl+home
++				case 37: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -1, 'D');
++						break; // -1 day on ctrl+left
++				case 38: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -7, 'D');
++						break; // -1 week on ctrl+up
++				case 39: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +1, 'D');
++						break; // +1 day on ctrl+right
++				case 40: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +7, 'D');
++						break; // +1 week on ctrl+down
++				default: handled = false;
++			}
++		else if (e.keyCode == 36 && e.ctrlKey) // display the date picker on ctrl+home
++			$.datepicker._showDatepicker(this);
++		else
++			handled = false;
++		if (handled) {
++			e.preventDefault();
++			e.stopPropagation();
++		}
++	},
++
++	/* Filter entered characters - based on date format. */
++	_doKeyPress: function(e) {
++		var inst = $.data(e.target, PROP_NAME);
++		var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
++		var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode);
++		return e.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
++	},
++
++	/* Pop-up the date picker for a given input field.
++	   @param  input  element - the input field attached to the date picker or
++	                  event - if triggered by focus */
++	_showDatepicker: function(input) {
++		input = input.target || input;
++		if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
++			input = $('input', input.parentNode)[0];
++		if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
++			return;
++		var inst = $.data(input, PROP_NAME);
++		var beforeShow = $.datepicker._get(inst, 'beforeShow');
++		extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
++		$.datepicker._hideDatepicker(null, '');
+ 		$.datepicker._lastInput = input;
+-		inst._setDateFromField(input);
+-		if ($.datepicker._inDialog) { // hide cursor
++		$.datepicker._setDateFromField(inst);
++		if ($.datepicker._inDialog) // hide cursor
+ 			input.value = '';
+-		}
+ 		if (!$.datepicker._pos) { // position below input
+ 			$.datepicker._pos = $.datepicker._findPos(input);
+ 			$.datepicker._pos[1] += input.offsetHeight; // add the height
+@@ -332,150 +452,134 @@
+ 		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
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list