From 707539f3cf3d118b7cb0a3b08e6d4dd98db46947 Mon Sep 17 00:00:00 2001 From: Keith Wood Date: Wed, 2 Dec 2009 00:33:56 +0000 Subject: [PATCH] Datepicker - Fixed #4704 - Datepicker global variable isn't unique --- ui/jquery.ui.datepicker.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index 92585547f..b81f0ee29 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -16,6 +16,7 @@ $.extend($.ui, { datepicker: { version: "@VERSION" } }); var PROP_NAME = 'datepicker'; +var dpuuid = new Date().getTime(); /* Date picker manager. Use the singleton instance of this class, $.datepicker, to interact with the date picker. @@ -1357,7 +1358,8 @@ $.extend(Datepicker.prototype, { this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst))); var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? - '' + prevText + '' : (hideIfNoPrevNext ? '' : '' + prevText + '')); var nextText = this._get(inst, 'nextText'); @@ -1365,16 +1367,19 @@ $.extend(Datepicker.prototype, { this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst))); var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? - '' + nextText + '' : (hideIfNoPrevNext ? '' : '' + nextText + '')); var currentText = this._get(inst, 'currentText'); var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); - var controls = (!inst.inline ? '' : ''); + var controls = (!inst.inline ? '' : ''); var buttonPanel = (showButtonPanel) ? '
' + (isRTL ? controls : '') + - (this._isInRange(inst, gotoDate) ? '' : '') + (isRTL ? '' : controls) + '
' : ''; var firstDay = parseInt(this._get(inst, 'firstDay'),10); firstDay = (isNaN(firstDay) ? 0 : firstDay); @@ -1447,7 +1452,7 @@ $.extend(Datepicker.prototype, { (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different) ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title - (unselectable ? '' : ' onclick="DP_jQuery.datepicker._selectDay(\'#' + + (unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' + inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions (otherMonth && !showOtherMonths ? ' ' : // display for other months (unselectable ? '' + printDate.getDate() + '' : ''; for (var month = 0; month < 12; month++) { if ((!inMinYear || month >= minDate.getMonth()) && @@ -1524,8 +1529,8 @@ $.extend(Datepicker.prototype, { year = (minDate ? Math.max(year, minDate.getFullYear()) : year); endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); html += '