2 Copyright (c) 2007, Yahoo! Inc. All rights reserved.
3 Code licensed under the BSD License:
4 http://developer.yahoo.net/yui/license.txt
10 * Config is a utility used within an Object to allow the implementer to
11 * maintain a list of local configuration properties and listen for changes
12 * to those properties dynamically using CustomEvent. The initial values are
13 * also maintained so that the configuration can be reset at any given point
14 * to its initial state.
15 * @namespace YAHOO.util
18 * @param {Object} owner The owner Object to which this Config Object belongs
20 YAHOO
.util
.Config = function (owner
) {
30 YAHOO
.log("No owner specified for Config object", "error");
37 var Lang
= YAHOO
.lang
,
38 CustomEvent
= YAHOO
.util
.CustomEvent
,
39 Config
= YAHOO
.util
.Config
;
43 * Constant representing the CustomEvent type for the config changed event.
44 * @property YAHOO.util.Config.CONFIG_CHANGED_EVENT
49 Config
.CONFIG_CHANGED_EVENT
= "configChanged";
52 * Constant representing the boolean type string
53 * @property YAHOO.util.Config.BOOLEAN_TYPE
58 Config
.BOOLEAN_TYPE
= "boolean";
63 * Object reference to the owner of this Config Object
70 * Boolean flag that specifies whether a queue is currently
72 * @property queueInProgress
75 queueInProgress
: false,
78 * Maintains the local collection of configuration property objects and
79 * their specified values
87 * Maintains the local collection of configuration property objects as
88 * they were initially applied.
89 * This object is used when resetting a property.
90 * @property initialConfig
97 * Maintains the local, normalized CustomEvent queue
98 * @property eventQueue
105 * Custom Event, notifying subscribers when Config properties are set
106 * (setProperty is called without the silent flag
107 * @event configChangedEvent
109 configChangedEvent
: null,
112 * Initializes the configuration Object and all of its local members.
114 * @param {Object} owner The owner Object to which this Config
117 init: function (owner
) {
121 this.configChangedEvent
=
122 this.createEvent(Config
.CONFIG_CHANGED_EVENT
);
124 this.configChangedEvent
.signature
= CustomEvent
.LIST
;
125 this.queueInProgress
= false;
127 this.initialConfig
= {};
128 this.eventQueue
= [];
133 * Validates that the value passed in is a Boolean.
134 * @method checkBoolean
135 * @param {Object} val The value to validate
136 * @return {Boolean} true, if the value is valid
138 checkBoolean: function (val
) {
139 return (typeof val
== Config
.BOOLEAN_TYPE
);
143 * Validates that the value passed in is a number.
144 * @method checkNumber
145 * @param {Object} val The value to validate
146 * @return {Boolean} true, if the value is valid
148 checkNumber: function (val
) {
149 return (!isNaN(val
));
153 * Fires a configuration property event using the specified value.
156 * @param {String} key The configuration property's name
157 * @param {value} Object The value of the correct type for the property
159 fireEvent: function ( key
, value
) {
160 YAHOO
.log("Firing Config event: " + key
+ "=" + value
, "info");
161 var property
= this.config
[key
];
163 if (property
&& property
.event
) {
164 property
.event
.fire(value
);
169 * Adds a property to the Config Object's private config hash.
170 * @method addProperty
171 * @param {String} key The configuration property's name
172 * @param {Object} propertyObject The Object containing all of this
173 * property's arguments
175 addProperty: function ( key
, propertyObject
) {
176 key
= key
.toLowerCase();
177 YAHOO
.log("Added property: " + key
, "info");
179 this.config
[key
] = propertyObject
;
181 propertyObject
.event
= this.createEvent(key
, { scope
: this.owner
});
182 propertyObject
.event
.signature
= CustomEvent
.LIST
;
185 propertyObject
.key
= key
;
187 if (propertyObject
.handler
) {
188 propertyObject
.event
.subscribe(propertyObject
.handler
,
192 this.setProperty(key
, propertyObject
.value
, true);
194 if (! propertyObject
.suppressEvent
) {
195 this.queueProperty(key
, propertyObject
.value
);
201 * Returns a key-value configuration map of the values currently set in
204 * @return {Object} The current config, represented in a key-value map
206 getConfig: function () {
212 for (prop
in this.config
) {
213 property
= this.config
[prop
];
214 if (property
&& property
.event
) {
215 cfg
[prop
] = property
.value
;
223 * Returns the value of specified property.
224 * @method getProperty
225 * @param {String} key The name of the property
226 * @return {Object} The value of the specified property
228 getProperty: function (key
) {
229 var property
= this.config
[key
.toLowerCase()];
230 if (property
&& property
.event
) {
231 return property
.value
;
238 * Resets the specified property's value to its initial value.
239 * @method resetProperty
240 * @param {String} key The name of the property
241 * @return {Boolean} True is the property was reset, false if not
243 resetProperty: function (key
) {
245 key
= key
.toLowerCase();
247 var property
= this.config
[key
];
249 if (property
&& property
.event
) {
251 if (this.initialConfig
[key
] &&
252 !Lang
.isUndefined(this.initialConfig
[key
])) {
254 this.setProperty(key
, this.initialConfig
[key
]);
268 * Sets the value of a property. If the silent property is passed as
269 * true, the property's event will not be fired.
270 * @method setProperty
271 * @param {String} key The name of the property
272 * @param {String} value The value to set the property to
273 * @param {Boolean} silent Whether the value should be set silently,
274 * without firing the property event.
275 * @return {Boolean} True, if the set was successful, false if it failed.
277 setProperty: function (key
, value
, silent
) {
281 key
= key
.toLowerCase();
282 YAHOO
.log("setProperty: " + key
+ "=" + value
, "info");
284 if (this.queueInProgress
&& ! silent
) {
285 // Currently running through a queue...
286 this.queueProperty(key
,value
);
290 property
= this.config
[key
];
291 if (property
&& property
.event
) {
292 if (property
.validator
&& !property
.validator(value
)) {
295 property
.value
= value
;
297 this.fireEvent(key
, value
);
298 this.configChangedEvent
.fire([key
, value
]);
309 * Sets the value of a property and queues its event to execute. If the
310 * event is already scheduled to execute, it is
311 * moved from its current position to the end of the queue.
312 * @method queueProperty
313 * @param {String} key The name of the property
314 * @param {String} value The value to set the property to
315 * @return {Boolean} true, if the set was successful, false if
318 queueProperty: function (key
, value
) {
320 key
= key
.toLowerCase();
321 YAHOO
.log("queueProperty: " + key
+ "=" + value
, "info");
323 var property
= this.config
[key
],
324 foundDuplicate
= false,
339 if (property
&& property
.event
) {
341 if (!Lang
.isUndefined(value
) && property
.validator
&&
342 !property
.validator(value
)) { // validator
346 if (!Lang
.isUndefined(value
)) {
347 property
.value
= value
;
349 value
= property
.value
;
352 foundDuplicate
= false;
353 iLen
= this.eventQueue
.length
;
355 for (i
= 0; i
< iLen
; i
++) {
356 queueItem
= this.eventQueue
[i
];
359 queueItemKey
= queueItem
[0];
360 queueItemValue
= queueItem
[1];
362 if (queueItemKey
== key
) {
365 found a dupe... push to end of queue, null
366 current item, and break
369 this.eventQueue
[i
] = null;
371 this.eventQueue
.push(
372 [key
, (!Lang
.isUndefined(value
) ?
373 value
: queueItemValue
)]);
375 foundDuplicate
= true;
381 // this is a refire, or a new property in the queue
383 if (! foundDuplicate
&& !Lang
.isUndefined(value
)) {
384 this.eventQueue
.push([key
, value
]);
388 if (property
.supercedes
) {
390 sLen
= property
.supercedes
.length
;
392 for (s
= 0; s
< sLen
; s
++) {
394 supercedesCheck
= property
.supercedes
[s
];
395 qLen
= this.eventQueue
.length
;
397 for (q
= 0; q
< qLen
; q
++) {
398 queueItemCheck
= this.eventQueue
[q
];
400 if (queueItemCheck
) {
401 queueItemCheckKey
= queueItemCheck
[0];
402 queueItemCheckValue
= queueItemCheck
[1];
404 if (queueItemCheckKey
==
405 supercedesCheck
.toLowerCase() ) {
407 this.eventQueue
.push([queueItemCheckKey
,
408 queueItemCheckValue
]);
410 this.eventQueue
[q
] = null;
419 YAHOO
.log("Config event queue: " + this.outputEventQueue(), "info");
428 * Fires the event for a property using the property's current value.
429 * @method refireEvent
430 * @param {String} key The name of the property
432 refireEvent: function (key
) {
434 key
= key
.toLowerCase();
436 var property
= this.config
[key
];
438 if (property
&& property
.event
&&
440 !Lang
.isUndefined(property
.value
)) {
442 if (this.queueInProgress
) {
444 this.queueProperty(key
);
448 this.fireEvent(key
, property
.value
);
456 * Applies a key-value Object literal to the configuration, replacing
457 * any existing values, and queueing the property events.
458 * Although the values will be set, fireQueue() must be called for their
459 * associated events to execute.
460 * @method applyConfig
461 * @param {Object} userConfig The configuration Object literal
462 * @param {Boolean} init When set to true, the initialConfig will
463 * be set to the userConfig passed in, so that calling a reset will
464 * reset the properties to the passed values.
466 applyConfig: function (userConfig
, init
) {
471 this.initialConfig
= userConfig
;
473 for (prop
in userConfig
) {
474 this.queueProperty(prop
, userConfig
[prop
]);
479 * Refires the events for all configuration properties using their
483 refresh: function () {
487 for (prop
in this.config
) {
488 this.refireEvent(prop
);
493 * Fires the normalized list of queued property change events
496 fireQueue: function () {
504 this.queueInProgress
= true;
505 for (i
= 0;i
< this.eventQueue
.length
; i
++) {
506 queueItem
= this.eventQueue
[i
];
510 value
= queueItem
[1];
511 property
= this.config
[key
];
513 property
.value
= value
;
515 this.fireEvent(key
,value
);
519 this.queueInProgress
= false;
520 this.eventQueue
= [];
524 * Subscribes an external handler to the change event for any
526 * @method subscribeToConfigEvent
527 * @param {String} key The property name
528 * @param {Function} handler The handler function to use subscribe to
529 * the property's event
530 * @param {Object} obj The Object to use for scoping the event handler
531 * (see CustomEvent documentation)
532 * @param {Boolean} override Optional. If true, will override "this"
533 * within the handler to map to the scope Object passed into the method.
534 * @return {Boolean} True, if the subscription was successful,
537 subscribeToConfigEvent: function (key
, handler
, obj
, override
) {
539 var property
= this.config
[key
.toLowerCase()];
541 if (property
&& property
.event
) {
543 if (!Config
.alreadySubscribed(property
.event
, handler
, obj
)) {
545 property
.event
.subscribe(handler
, obj
, override
);
560 * Unsubscribes an external handler from the change event for any
562 * @method unsubscribeFromConfigEvent
563 * @param {String} key The property name
564 * @param {Function} handler The handler function to use subscribe to
565 * the property's event
566 * @param {Object} obj The Object to use for scoping the event
567 * handler (see CustomEvent documentation)
568 * @return {Boolean} True, if the unsubscription was successful,
571 unsubscribeFromConfigEvent: function (key
, handler
, obj
) {
572 var property
= this.config
[key
.toLowerCase()];
573 if (property
&& property
.event
) {
574 return property
.event
.unsubscribe(handler
, obj
);
581 * Returns a string representation of the Config object
583 * @return {String} The Config object in string format.
585 toString: function () {
586 var output
= "Config";
588 output
+= " [" + this.owner
.toString() + "]";
594 * Returns a string representation of the Config object's current
596 * @method outputEventQueue
597 * @return {String} The string list of CustomEvents currently queued
600 outputEventQueue: function () {
605 nQueue
= this.eventQueue
.length
;
607 for (q
= 0; q
< nQueue
; q
++) {
608 queueItem
= this.eventQueue
[q
];
610 output
+= queueItem
[0] + "=" + queueItem
[1] + ", ";
617 * Sets all properties to null, unsubscribes all listeners from each
618 * property's change event and all listeners from the configChangedEvent.
621 destroy: function () {
623 var oConfig
= this.config
,
628 for (sProperty
in oConfig
) {
630 if (Lang
.hasOwnProperty(oConfig
, sProperty
)) {
632 oProperty
= oConfig
[sProperty
];
634 oProperty
.event
.unsubscribeAll();
635 oProperty
.event
= null;
641 this.configChangedEvent
.unsubscribeAll();
643 this.configChangedEvent
= null;
646 this.initialConfig
= null;
647 this.eventQueue
= null;
656 * Checks to determine if a particular function/Object pair are already
657 * subscribed to the specified CustomEvent
658 * @method YAHOO.util.Config.alreadySubscribed
660 * @param {YAHOO.util.CustomEvent} evt The CustomEvent for which to check
662 * @param {Function} fn The function to look for in the subscribers list
663 * @param {Object} obj The execution scope Object for the subscription
664 * @return {Boolean} true, if the function/Object pair is already subscribed
665 * to the CustomEvent passed in
667 Config
.alreadySubscribed = function (evt
, fn
, obj
) {
669 var nSubscribers
= evt
.subscribers
.length
,
673 if (nSubscribers
> 0) {
675 i
= nSubscribers
- 1;
679 subsc
= evt
.subscribers
[i
];
681 if (subsc
&& subsc
.obj
== obj
&& subsc
.fn
== fn
) {
696 YAHOO
.lang
.augmentProto(Config
, YAHOO
.util
.EventProvider
);
701 * YAHOO.widget.DateMath is used for simple date manipulation. The class is a static utility
702 * used for adding, subtracting, and comparing dates.
703 * @namespace YAHOO.widget
706 YAHOO
.widget
.DateMath
= {
708 * Constant field representing Day
717 * Constant field representing Week
726 * Constant field representing Year
735 * Constant field representing Month
744 * Constant field representing one day, in milliseconds
745 * @property ONE_DAY_MS
750 ONE_DAY_MS
: 1000*60*60*24,
753 * Adds the specified amount of time to the this instance.
755 * @param {Date} date The JavaScript Date object to perform addition on
756 * @param {String} field The field constant to be used for performing addition.
757 * @param {Number} amount The number of units (measured in the field constant) to add to the date.
758 * @return {Date} The resulting Date object
760 add : function(date
, field
, amount
) {
761 var d
= new Date(date
.getTime());
764 var newMonth
= date
.getMonth() + amount
;
769 while (newMonth
< 0) {
773 } else if (newMonth
> 11) {
774 while (newMonth
> 11) {
780 d
.setMonth(newMonth
);
781 d
.setFullYear(date
.getFullYear() + years
);
784 d
.setDate(date
.getDate() + amount
);
787 d
.setFullYear(date
.getFullYear() + amount
);
790 d
.setDate(date
.getDate() + (amount
* 7));
797 * Subtracts the specified amount of time from the this instance.
799 * @param {Date} date The JavaScript Date object to perform subtraction on
800 * @param {Number} field The this field constant to be used for performing subtraction.
801 * @param {Number} amount The number of units (measured in the field constant) to subtract from the date.
802 * @return {Date} The resulting Date object
804 subtract : function(date
, field
, amount
) {
805 return this.add(date
, field
, (amount
*-1));
809 * Determines whether a given date is before another date on the calendar.
811 * @param {Date} date The Date object to compare with the compare argument
812 * @param {Date} compareTo The Date object to use for the comparison
813 * @return {Boolean} true if the date occurs before the compared date; false if not.
815 before : function(date
, compareTo
) {
816 var ms
= compareTo
.getTime();
817 if (date
.getTime() < ms
) {
825 * Determines whether a given date is after another date on the calendar.
827 * @param {Date} date The Date object to compare with the compare argument
828 * @param {Date} compareTo The Date object to use for the comparison
829 * @return {Boolean} true if the date occurs after the compared date; false if not.
831 after : function(date
, compareTo
) {
832 var ms
= compareTo
.getTime();
833 if (date
.getTime() > ms
) {
841 * Determines whether a given date is between two other dates on the calendar.
843 * @param {Date} date The date to check for
844 * @param {Date} dateBegin The start of the range
845 * @param {Date} dateEnd The end of the range
846 * @return {Boolean} true if the date occurs between the compared dates; false if not.
848 between : function(date
, dateBegin
, dateEnd
) {
849 if (this.after(date
, dateBegin
) && this.before(date
, dateEnd
)) {
857 * Retrieves a JavaScript Date object representing January 1 of any given year.
859 * @param {Number} calendarYear The calendar year for which to retrieve January 1
860 * @return {Date} January 1 of the calendar year specified.
862 getJan1 : function(calendarYear
) {
863 return new Date(calendarYear
,0,1);
867 * Calculates the number of days the specified date is from January 1 of the specified calendar year.
868 * Passing January 1 to this function would return an offset value of zero.
869 * @method getDayOffset
870 * @param {Date} date The JavaScript date for which to find the offset
871 * @param {Number} calendarYear The calendar year to use for determining the offset
872 * @return {Number} The number of days since January 1 of the given year
874 getDayOffset : function(date
, calendarYear
) {
875 var beginYear
= this.getJan1(calendarYear
); // Find the start of the year. This will be in week 1.
877 // Find the number of days the passed in date is away from the calendar year start
878 var dayOffset
= Math
.ceil((date
.getTime()-beginYear
.getTime()) / this.ONE_DAY_MS
);
883 * Calculates the week number for the given date. This function assumes that week 1 is the
884 * week in which January 1 appears, regardless of whether the week consists of a full 7 days.
885 * The calendar year can be specified to help find what a the week number would be for a given
886 * date if the date overlaps years. For instance, a week may be considered week 1 of 2005, or
887 * week 53 of 2004. Specifying the optional calendarYear allows one to make this distinction
889 * @method getWeekNumber
890 * @param {Date} date The JavaScript date for which to find the week number
891 * @param {Number} calendarYear OPTIONAL - The calendar year to use for determining the week number. Default is
892 * the calendar year of parameter "date".
893 * @return {Number} The week number of the given date.
895 getWeekNumber : function(date
, calendarYear
) {
896 date
= this.clearTime(date
);
897 var nearestThurs
= new Date(date
.getTime() + (4 * this.ONE_DAY_MS
) - ((date
.getDay()) * this.ONE_DAY_MS
));
899 var jan1
= new Date(nearestThurs
.getFullYear(),0,1);
900 var dayOfYear
= ((nearestThurs
.getTime() - jan1
.getTime()) / this.ONE_DAY_MS
) - 1;
902 var weekNum
= Math
.ceil((dayOfYear
)/ 7);
907 * Determines if a given week overlaps two different years.
908 * @method isYearOverlapWeek
909 * @param {Date} weekBeginDate The JavaScript Date representing the first day of the week.
910 * @return {Boolean} true if the date overlaps two different years.
912 isYearOverlapWeek : function(weekBeginDate
) {
913 var overlaps
= false;
914 var nextWeek
= this.add(weekBeginDate
, this.DAY
, 6);
915 if (nextWeek
.getFullYear() != weekBeginDate
.getFullYear()) {
922 * Determines if a given week overlaps two different months.
923 * @method isMonthOverlapWeek
924 * @param {Date} weekBeginDate The JavaScript Date representing the first day of the week.
925 * @return {Boolean} true if the date overlaps two different months.
927 isMonthOverlapWeek : function(weekBeginDate
) {
928 var overlaps
= false;
929 var nextWeek
= this.add(weekBeginDate
, this.DAY
, 6);
930 if (nextWeek
.getMonth() != weekBeginDate
.getMonth()) {
937 * Gets the first day of a month containing a given date.
938 * @method findMonthStart
939 * @param {Date} date The JavaScript Date used to calculate the month start
940 * @return {Date} The JavaScript Date representing the first day of the month
942 findMonthStart : function(date
) {
943 var start
= new Date(date
.getFullYear(), date
.getMonth(), 1);
948 * Gets the last day of a month containing a given date.
949 * @method findMonthEnd
950 * @param {Date} date The JavaScript Date used to calculate the month end
951 * @return {Date} The JavaScript Date representing the last day of the month
953 findMonthEnd : function(date
) {
954 var start
= this.findMonthStart(date
);
955 var nextMonth
= this.add(start
, this.MONTH
, 1);
956 var end
= this.subtract(nextMonth
, this.DAY
, 1);
961 * Clears the time fields from a given date, effectively setting the time to 12 noon.
963 * @param {Date} date The JavaScript Date for which the time fields will be cleared
964 * @return {Date} The JavaScript Date cleared of all time fields
966 clearTime : function(date
) {
967 date
.setHours(12,0,0,0);
973 * The Calendar component is a UI control that enables users to choose one or more dates from a graphical calendar presented in a one-month or multi-month interface. Calendars are generated entirely via script and can be navigated without any page refreshes.
976 * @namespace YAHOO.widget
977 * @requires yahoo,dom,event
981 * Calendar is the base class for the Calendar widget. In its most basic
982 * implementation, it has the ability to render a calendar widget on the page
983 * that can be manipulated to select a single date, move back and forth between
985 * <p>To construct the placeholder for the calendar widget, the code is as
988 * <div id="cal1Container"></div>
991 * @namespace YAHOO.widget
994 * @param {String} id The id of the table element that will represent the calendar widget
995 * @param {String} containerId The id of the container div element that will wrap the calendar table
996 * @param {Object} config The configuration object containing the Calendar's arguments
998 YAHOO
.widget
.Calendar = function(id
, containerId
, config
) {
999 this.init(id
, containerId
, config
);
1003 * The path to be used for images loaded for the Calendar
1004 * @property YAHOO.widget.Calendar.IMG_ROOT
1006 * @deprecated You can now customize images by overriding the calclose, calnavleft and calnavright default CSS classes for the close icon, left arrow and right arrow respectively
1009 YAHOO
.widget
.Calendar
.IMG_ROOT
= null;
1012 * Type constant used for renderers to represent an individual date (M/D/Y)
1013 * @property YAHOO.widget.Calendar.DATE
1018 YAHOO
.widget
.Calendar
.DATE
= "D";
1021 * Type constant used for renderers to represent an individual date across any year (M/D)
1022 * @property YAHOO.widget.Calendar.MONTH_DAY
1027 YAHOO
.widget
.Calendar
.MONTH_DAY
= "MD";
1030 * Type constant used for renderers to represent a weekday
1031 * @property YAHOO.widget.Calendar.WEEKDAY
1036 YAHOO
.widget
.Calendar
.WEEKDAY
= "WD";
1039 * Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)
1040 * @property YAHOO.widget.Calendar.RANGE
1045 YAHOO
.widget
.Calendar
.RANGE
= "R";
1048 * Type constant used for renderers to represent a month across any year
1049 * @property YAHOO.widget.Calendar.MONTH
1054 YAHOO
.widget
.Calendar
.MONTH
= "M";
1057 * Constant that represents the total number of date cells that are displayed in a given month
1058 * @property YAHOO.widget.Calendar.DISPLAY_DAYS
1063 YAHOO
.widget
.Calendar
.DISPLAY_DAYS
= 42;
1066 * Constant used for halting the execution of the remainder of the render stack
1067 * @property YAHOO.widget.Calendar.STOP_RENDER
1072 YAHOO
.widget
.Calendar
.STOP_RENDER
= "S";
1075 * Constant used to represent short date field string formats (e.g. Tu or Feb)
1076 * @property YAHOO.widget.Calendar.SHORT
1081 YAHOO
.widget
.Calendar
.SHORT
= "short";
1084 * Constant used to represent long date field string formats (e.g. Monday or February)
1085 * @property YAHOO.widget.Calendar.LONG
1090 YAHOO
.widget
.Calendar
.LONG
= "long";
1093 * Constant used to represent medium date field string formats (e.g. Mon)
1094 * @property YAHOO.widget.Calendar.MEDIUM
1099 YAHOO
.widget
.Calendar
.MEDIUM
= "medium";
1102 * Constant used to represent single character date field string formats (e.g. M, T, W)
1103 * @property YAHOO.widget.Calendar.ONE_CHAR
1108 YAHOO
.widget
.Calendar
.ONE_CHAR
= "1char";
1111 * The set of default Config property keys and values for the Calendar
1112 * @property YAHOO.widget.Calendar._DEFAULT_CONFIG
1118 YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
= {
1119 // Default values for pagedate and selected are not class level constants - they are set during instance creation
1120 PAGEDATE
: {key
:"pagedate", value
:null},
1121 SELECTED
: {key
:"selected", value
:null},
1122 TITLE
: {key
:"title", value
:""},
1123 CLOSE
: {key
:"close", value
:false},
1124 IFRAME
: {key
:"iframe", value
:(YAHOO
.env
.ua
.ie
&& YAHOO
.env
.ua
.ie
<= 6) ? true : false},
1125 MINDATE
: {key
:"mindate", value
:null},
1126 MAXDATE
: {key
:"maxdate", value
:null},
1127 MULTI_SELECT
: {key
:"multi_select", value
:false},
1128 START_WEEKDAY
: {key
:"start_weekday", value
:0},
1129 SHOW_WEEKDAYS
: {key
:"show_weekdays", value
:true},
1130 SHOW_WEEK_HEADER
: {key
:"show_week_header", value
:false},
1131 SHOW_WEEK_FOOTER
: {key
:"show_week_footer", value
:false},
1132 HIDE_BLANK_WEEKS
: {key
:"hide_blank_weeks", value
:false},
1133 NAV_ARROW_LEFT
: {key
:"nav_arrow_left", value
:null} ,
1134 NAV_ARROW_RIGHT
: {key
:"nav_arrow_right", value
:null} ,
1135 MONTHS_SHORT
: {key
:"months_short", value
:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]},
1136 MONTHS_LONG
: {key
:"months_long", value
:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]},
1137 WEEKDAYS_1CHAR
: {key
:"weekdays_1char", value
:["S", "M", "T", "W", "T", "F", "S"]},
1138 WEEKDAYS_SHORT
: {key
:"weekdays_short", value
:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]},
1139 WEEKDAYS_MEDIUM
: {key
:"weekdays_medium", value
:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]},
1140 WEEKDAYS_LONG
: {key
:"weekdays_long", value
:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]},
1141 LOCALE_MONTHS
:{key
:"locale_months", value
:"long"},
1142 LOCALE_WEEKDAYS
:{key
:"locale_weekdays", value
:"short"},
1143 DATE_DELIMITER
:{key
:"date_delimiter", value
:","},
1144 DATE_FIELD_DELIMITER
:{key
:"date_field_delimiter", value
:"/"},
1145 DATE_RANGE_DELIMITER
:{key
:"date_range_delimiter", value
:"-"},
1146 MY_MONTH_POSITION
:{key
:"my_month_position", value
:1},
1147 MY_YEAR_POSITION
:{key
:"my_year_position", value
:2},
1148 MD_MONTH_POSITION
:{key
:"md_month_position", value
:1},
1149 MD_DAY_POSITION
:{key
:"md_day_position", value
:2},
1150 MDY_MONTH_POSITION
:{key
:"mdy_month_position", value
:1},
1151 MDY_DAY_POSITION
:{key
:"mdy_day_position", value
:2},
1152 MDY_YEAR_POSITION
:{key
:"mdy_year_position", value
:3},
1153 MY_LABEL_MONTH_POSITION
:{key
:"my_label_month_position", value
:1},
1154 MY_LABEL_YEAR_POSITION
:{key
:"my_label_year_position", value
:2},
1155 MY_LABEL_MONTH_SUFFIX
:{key
:"my_label_month_suffix", value
:" "},
1156 MY_LABEL_YEAR_SUFFIX
:{key
:"my_label_year_suffix", value
:""}
1160 * The set of Custom Event types supported by the Calendar
1161 * @property YAHOO.widget.Calendar._EVENT_TYPES
1167 YAHOO
.widget
.Calendar
._EVENT_TYPES
= {
1168 BEFORE_SELECT
: "beforeSelect",
1170 BEFORE_DESELECT
: "beforeDeselect",
1171 DESELECT
: "deselect",
1172 CHANGE_PAGE
: "changePage",
1173 BEFORE_RENDER
: "beforeRender",
1180 * The set of default style constants for the Calendar
1181 * @property YAHOO.widget.Calendar._STYLES
1187 YAHOO
.widget
.Calendar
._STYLES
= {
1188 CSS_ROW_HEADER
: "calrowhead",
1189 CSS_ROW_FOOTER
: "calrowfoot",
1190 CSS_CELL
: "calcell",
1191 CSS_CELL_SELECTOR
: "selector",
1192 CSS_CELL_SELECTED
: "selected",
1193 CSS_CELL_SELECTABLE
: "selectable",
1194 CSS_CELL_RESTRICTED
: "restricted",
1195 CSS_CELL_TODAY
: "today",
1196 CSS_CELL_OOM
: "oom",
1197 CSS_CELL_OOB
: "previous",
1198 CSS_HEADER
: "calheader",
1199 CSS_HEADER_TEXT
: "calhead",
1200 CSS_BODY
: "calbody",
1201 CSS_WEEKDAY_CELL
: "calweekdaycell",
1202 CSS_WEEKDAY_ROW
: "calweekdayrow",
1203 CSS_FOOTER
: "calfoot",
1204 CSS_CALENDAR
: "yui-calendar",
1205 CSS_SINGLE
: "single",
1206 CSS_CONTAINER
: "yui-calcontainer",
1207 CSS_NAV_LEFT
: "calnavleft",
1208 CSS_NAV_RIGHT
: "calnavright",
1209 CSS_CLOSE
: "calclose",
1210 CSS_CELL_TOP
: "calcelltop",
1211 CSS_CELL_LEFT
: "calcellleft",
1212 CSS_CELL_RIGHT
: "calcellright",
1213 CSS_CELL_BOTTOM
: "calcellbottom",
1214 CSS_CELL_HOVER
: "calcellhover",
1215 CSS_CELL_HIGHLIGHT1
: "highlight1",
1216 CSS_CELL_HIGHLIGHT2
: "highlight2",
1217 CSS_CELL_HIGHLIGHT3
: "highlight3",
1218 CSS_CELL_HIGHLIGHT4
: "highlight4"
1221 YAHOO
.widget
.Calendar
.prototype = {
1224 * The configuration object used to set up the calendars various locale and style options.
1227 * @deprecated Configuration properties should be set by calling Calendar.cfg.setProperty.
1233 * The parent CalendarGroup, only to be set explicitly by the parent group
1235 * @type CalendarGroup
1240 * The index of this item in the parent group
1247 * The collection of calendar table cells
1249 * @type HTMLTableCellElement[]
1254 * The collection of calendar cell dates that is parallel to the cells collection. The array contains dates field arrays in the format of [YYYY, M, D].
1255 * @property cellDates
1256 * @type Array[](Number[])
1261 * The id that uniquely identifies this calendar. This id should match the id of the placeholder element on the page.
1268 * The DOM element reference that points to this calendar's container element. The calendar will be inserted into this element when the shell is rendered.
1269 * @property oDomContainer
1272 oDomContainer
: null,
1275 * A Date object representing today's date.
1282 * The list of render functions, along with required parameters, used to render cells.
1283 * @property renderStack
1289 * A copy of the initial render functions created before rendering.
1290 * @property _renderStack
1294 _renderStack
: null,
1297 * The private list of initially selected dates.
1298 * @property _selectedDates
1302 _selectedDates
: null,
1305 * A map of DOM event handlers to attach to cells associated with specific CSS class names
1306 * @property domEventMap
1315 * Initializes the Calendar widget.
1317 * @param {String} id The id of the table element that will represent the calendar widget
1318 * @param {String} containerId The id of the container div element that will wrap the calendar table
1319 * @param {Object} config The configuration object containing the Calendar's arguments
1321 YAHOO
.widget
.Calendar
.prototype.init = function(id
, containerId
, config
) {
1322 this.logger
= new YAHOO
.widget
.LogWriter("Calendar " + id
);
1324 this.today
= new Date();
1325 YAHOO
.widget
.DateMath
.clearTime(this.today
);
1328 this.oDomContainer
= document
.getElementById(containerId
);
1329 if (! this.oDomContainer
) { this.logger
.log("No valid container present.", "error"); }
1332 * The Config object used to hold the configuration variables for the Calendar
1334 * @type YAHOO.util.Config
1336 this.cfg
= new YAHOO
.util
.Config(this);
1339 * The local object which contains the Calendar's options
1346 * The local object which contains the Calendar's locale settings
1354 YAHOO
.util
.Dom
.addClass(this.oDomContainer
, this.Style
.CSS_CONTAINER
);
1355 YAHOO
.util
.Dom
.addClass(this.oDomContainer
, this.Style
.CSS_SINGLE
);
1357 this.cellDates
= [];
1359 this.renderStack
= [];
1360 this._renderStack
= [];
1365 this.cfg
.applyConfig(config
, true);
1368 this.cfg
.fireQueue();
1372 * Default Config listener for the iframe property. If the iframe config property is set to true,
1373 * renders the built-in IFRAME shim if the container is relatively or absolutely positioned.
1375 * @method configIframe
1377 YAHOO
.widget
.Calendar
.prototype.configIframe = function(type
, args
, obj
) {
1378 var useIframe
= args
[0];
1381 if (YAHOO
.util
.Dom
.inDocument(this.oDomContainer
)) {
1383 var pos
= YAHOO
.util
.Dom
.getStyle(this.oDomContainer
, "position");
1385 if (pos
== "absolute" || pos
== "relative") {
1387 if (!YAHOO
.util
.Dom
.inDocument(this.iframe
)) {
1388 this.iframe
= document
.createElement("iframe");
1389 this.iframe
.src
= "javascript:false;";
1391 YAHOO
.util
.Dom
.setStyle(this.iframe
, "opacity", "0");
1393 if (YAHOO
.env
.ua
.ie
&& YAHOO
.env
.ua
.ie
<= 6) {
1394 YAHOO
.util
.Dom
.addClass(this.iframe
, "fixedsize");
1397 this.oDomContainer
.insertBefore(this.iframe
, this.oDomContainer
.firstChild
);
1402 if (this.iframe
.parentNode
) {
1403 this.iframe
.parentNode
.removeChild(this.iframe
);
1413 * Default handler for the "title" property
1414 * @method configTitle
1416 YAHOO
.widget
.Calendar
.prototype.configTitle = function(type
, args
, obj
) {
1417 var title
= args
[0];
1418 var close
= this.cfg
.getProperty(YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.CLOSE
.key
);
1422 if (title
&& title
!== "") {
1423 titleDiv
= YAHOO
.util
.Dom
.getElementsByClassName(YAHOO
.widget
.CalendarGroup
.CSS_2UPTITLE
, "div", this.oDomContainer
)[0] || document
.createElement("div");
1424 titleDiv
.className
= YAHOO
.widget
.CalendarGroup
.CSS_2UPTITLE
;
1425 titleDiv
.innerHTML
= title
;
1426 this.oDomContainer
.insertBefore(titleDiv
, this.oDomContainer
.firstChild
);
1427 YAHOO
.util
.Dom
.addClass(this.oDomContainer
, "withtitle");
1429 titleDiv
= YAHOO
.util
.Dom
.getElementsByClassName(YAHOO
.widget
.CalendarGroup
.CSS_2UPTITLE
, "div", this.oDomContainer
)[0] || null;
1432 YAHOO
.util
.Event
.purgeElement(titleDiv
);
1433 this.oDomContainer
.removeChild(titleDiv
);
1436 YAHOO
.util
.Dom
.removeClass(this.oDomContainer
, "withtitle");
1442 * Default handler for the "close" property
1443 * @method configClose
1445 YAHOO
.widget
.Calendar
.prototype.configClose = function(type
, args
, obj
) {
1446 var close
= args
[0];
1447 var title
= this.cfg
.getProperty(YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.TITLE
.key
);
1449 var DEPR_CLOSE_PATH
= "us/my/bn/x_d.gif";
1453 if (close
=== true) {
1454 linkClose
= YAHOO
.util
.Dom
.getElementsByClassName("link-close", "a", this.oDomContainer
)[0] || document
.createElement("a");
1455 linkClose
.href
= "#";
1456 linkClose
.className
= "link-close";
1457 YAHOO
.util
.Event
.addListener(linkClose
, "click", function(e
, cal
) {cal
.hide(); YAHOO
.util
.Event
.preventDefault(e
); }, this);
1459 if (YAHOO
.widget
.Calendar
.IMG_ROOT
!== null) {
1460 var imgClose
= document
.createElement("img");
1461 imgClose
.src
= YAHOO
.widget
.Calendar
.IMG_ROOT
+ DEPR_CLOSE_PATH
;
1462 imgClose
.className
= YAHOO
.widget
.CalendarGroup
.CSS_2UPCLOSE
;
1463 linkClose
.appendChild(imgClose
);
1465 linkClose
.innerHTML
= '<span class="' + YAHOO
.widget
.CalendarGroup
.CSS_2UPCLOSE
+ ' ' + this.Style
.CSS_CLOSE
+ '"></span>';
1468 this.oDomContainer
.appendChild(linkClose
);
1469 YAHOO
.util
.Dom
.addClass(this.oDomContainer
, "withtitle");
1471 linkClose
= YAHOO
.util
.Dom
.getElementsByClassName("link-close", "a", this.oDomContainer
)[0] || null;
1473 YAHOO
.util
.Event
.purgeElement(linkClose
);
1474 this.oDomContainer
.removeChild(linkClose
);
1476 if (! title
|| title
=== "") {
1477 YAHOO
.util
.Dom
.removeClass(this.oDomContainer
, "withtitle");
1483 * Initializes Calendar's built-in CustomEvents
1484 * @method initEvents
1486 YAHOO
.widget
.Calendar
.prototype.initEvents = function() {
1488 var defEvents
= YAHOO
.widget
.Calendar
._EVENT_TYPES
;
1491 * Fired before a selection is made
1492 * @event beforeSelectEvent
1494 this.beforeSelectEvent
= new YAHOO
.util
.CustomEvent(defEvents
.BEFORE_SELECT
);
1497 * Fired when a selection is made
1498 * @event selectEvent
1499 * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
1501 this.selectEvent
= new YAHOO
.util
.CustomEvent(defEvents
.SELECT
);
1504 * Fired before a selection is made
1505 * @event beforeDeselectEvent
1507 this.beforeDeselectEvent
= new YAHOO
.util
.CustomEvent(defEvents
.BEFORE_DESELECT
);
1510 * Fired when a selection is made
1511 * @event deselectEvent
1512 * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
1514 this.deselectEvent
= new YAHOO
.util
.CustomEvent(defEvents
.DESELECT
);
1517 * Fired when the Calendar page is changed
1518 * @event changePageEvent
1520 this.changePageEvent
= new YAHOO
.util
.CustomEvent(defEvents
.CHANGE_PAGE
);
1523 * Fired before the Calendar is rendered
1524 * @event beforeRenderEvent
1526 this.beforeRenderEvent
= new YAHOO
.util
.CustomEvent(defEvents
.BEFORE_RENDER
);
1529 * Fired when the Calendar is rendered
1530 * @event renderEvent
1532 this.renderEvent
= new YAHOO
.util
.CustomEvent(defEvents
.RENDER
);
1535 * Fired when the Calendar is reset
1538 this.resetEvent
= new YAHOO
.util
.CustomEvent(defEvents
.RESET
);
1541 * Fired when the Calendar is cleared
1544 this.clearEvent
= new YAHOO
.util
.CustomEvent(defEvents
.CLEAR
);
1546 this.beforeSelectEvent
.subscribe(this.onBeforeSelect
, this, true);
1547 this.selectEvent
.subscribe(this.onSelect
, this, true);
1548 this.beforeDeselectEvent
.subscribe(this.onBeforeDeselect
, this, true);
1549 this.deselectEvent
.subscribe(this.onDeselect
, this, true);
1550 this.changePageEvent
.subscribe(this.onChangePage
, this, true);
1551 this.renderEvent
.subscribe(this.onRender
, this, true);
1552 this.resetEvent
.subscribe(this.onReset
, this, true);
1553 this.clearEvent
.subscribe(this.onClear
, this, true);
1557 * The default event function that is attached to a date link within a calendar cell
1558 * when the calendar is rendered.
1559 * @method doSelectCell
1560 * @param {DOMEvent} e The event
1561 * @param {Calendar} cal A reference to the calendar passed by the Event utility
1563 YAHOO
.widget
.Calendar
.prototype.doSelectCell = function(e
, cal
) {
1564 var cell
,index
,d
,date
;
1566 var target
= YAHOO
.util
.Event
.getTarget(e
);
1567 var tagName
= target
.tagName
.toLowerCase();
1568 var defSelector
= false;
1570 while (tagName
!= "td" && ! YAHOO
.util
.Dom
.hasClass(target
, cal
.Style
.CSS_CELL_SELECTABLE
)) {
1572 if (!defSelector
&& tagName
== "a" && YAHOO
.util
.Dom
.hasClass(target
, cal
.Style
.CSS_CELL_SELECTOR
)) {
1576 target
= target
.parentNode
;
1577 tagName
= target
.tagName
.toLowerCase();
1578 if (tagName
== "html") {
1584 // Stop link href navigation for default renderer
1585 YAHOO
.util
.Event
.preventDefault(e
);
1590 if (YAHOO
.util
.Dom
.hasClass(cell
, cal
.Style
.CSS_CELL_SELECTABLE
)) {
1591 index
= cell
.id
.split("cell")[1];
1592 d
= cal
.cellDates
[index
];
1593 date
= new Date(d
[0],d
[1]-1,d
[2]);
1597 cal
.logger
.log("Selecting cell " + index
+ " via click", "info");
1598 if (cal
.Options
.MULTI_SELECT
) {
1599 link
= cell
.getElementsByTagName("a")[0];
1604 var cellDate
= cal
.cellDates
[index
];
1605 var cellDateIndex
= cal
._indexOfSelectedFieldArray(cellDate
);
1607 if (cellDateIndex
> -1) {
1608 cal
.deselectCell(index
);
1610 cal
.selectCell(index
);
1614 link
= cell
.getElementsByTagName("a")[0];
1618 cal
.selectCell(index
);
1624 * The event that is executed when the user hovers over a cell
1625 * @method doCellMouseOver
1626 * @param {DOMEvent} e The event
1627 * @param {Calendar} cal A reference to the calendar passed by the Event utility
1629 YAHOO
.widget
.Calendar
.prototype.doCellMouseOver = function(e
, cal
) {
1632 target
= YAHOO
.util
.Event
.getTarget(e
);
1637 while (target
.tagName
.toLowerCase() != "td") {
1638 target
= target
.parentNode
;
1639 if (target
.tagName
.toLowerCase() == "html") {
1644 if (YAHOO
.util
.Dom
.hasClass(target
, cal
.Style
.CSS_CELL_SELECTABLE
)) {
1645 YAHOO
.util
.Dom
.addClass(target
, cal
.Style
.CSS_CELL_HOVER
);
1650 * The event that is executed when the user moves the mouse out of a cell
1651 * @method doCellMouseOut
1652 * @param {DOMEvent} e The event
1653 * @param {Calendar} cal A reference to the calendar passed by the Event utility
1655 YAHOO
.widget
.Calendar
.prototype.doCellMouseOut = function(e
, cal
) {
1658 target
= YAHOO
.util
.Event
.getTarget(e
);
1663 while (target
.tagName
.toLowerCase() != "td") {
1664 target
= target
.parentNode
;
1665 if (target
.tagName
.toLowerCase() == "html") {
1670 if (YAHOO
.util
.Dom
.hasClass(target
, cal
.Style
.CSS_CELL_SELECTABLE
)) {
1671 YAHOO
.util
.Dom
.removeClass(target
, cal
.Style
.CSS_CELL_HOVER
);
1675 YAHOO
.widget
.Calendar
.prototype.setupConfig = function() {
1677 var defCfg
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
1680 * The month/year representing the current visible Calendar date (mm/yyyy)
1683 * @default today's date
1685 this.cfg
.addProperty(defCfg
.PAGEDATE
.key
, { value
:new Date(), handler
:this.configPageDate
} );
1688 * The date or range of dates representing the current Calendar selection
1693 this.cfg
.addProperty(defCfg
.SELECTED
.key
, { value
:[], handler
:this.configSelected
} );
1696 * The title to display above the Calendar's month header
1701 this.cfg
.addProperty(defCfg
.TITLE
.key
, { value
:defCfg
.TITLE
.value
, handler
:this.configTitle
} );
1704 * Whether or not a close button should be displayed for this Calendar
1709 this.cfg
.addProperty(defCfg
.CLOSE
.key
, { value
:defCfg
.CLOSE
.value
, handler
:this.configClose
} );
1712 * Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
1713 * This property is enabled by default for IE6 and below. It is disabled by default for other browsers for performance reasons, but can be
1714 * enabled if required.
1718 * @default true for IE6 and below, false for all other browsers
1720 this.cfg
.addProperty(defCfg
.IFRAME
.key
, { value
:defCfg
.IFRAME
.value
, handler
:this.configIframe
, validator
:this.cfg
.checkBoolean
} );
1723 * The minimum selectable date in the current Calendar (mm/dd/yyyy)
1728 this.cfg
.addProperty(defCfg
.MINDATE
.key
, { value
:defCfg
.MINDATE
.value
, handler
:this.configMinDate
} );
1731 * The maximum selectable date in the current Calendar (mm/dd/yyyy)
1736 this.cfg
.addProperty(defCfg
.MAXDATE
.key
, { value
:defCfg
.MAXDATE
.value
, handler
:this.configMaxDate
} );
1739 // Options properties
1742 * True if the Calendar should allow multiple selections. False by default.
1743 * @config MULTI_SELECT
1747 this.cfg
.addProperty(defCfg
.MULTI_SELECT
.key
, { value
:defCfg
.MULTI_SELECT
.value
, handler
:this.configOptions
, validator
:this.cfg
.checkBoolean
} );
1750 * The weekday the week begins on. Default is 0 (Sunday).
1751 * @config START_WEEKDAY
1755 this.cfg
.addProperty(defCfg
.START_WEEKDAY
.key
, { value
:defCfg
.START_WEEKDAY
.value
, handler
:this.configOptions
, validator
:this.cfg
.checkNumber
} );
1758 * True if the Calendar should show weekday labels. True by default.
1759 * @config SHOW_WEEKDAYS
1763 this.cfg
.addProperty(defCfg
.SHOW_WEEKDAYS
.key
, { value
:defCfg
.SHOW_WEEKDAYS
.value
, handler
:this.configOptions
, validator
:this.cfg
.checkBoolean
} );
1766 * True if the Calendar should show week row headers. False by default.
1767 * @config SHOW_WEEK_HEADER
1771 this.cfg
.addProperty(defCfg
.SHOW_WEEK_HEADER
.key
, { value
:defCfg
.SHOW_WEEK_HEADER
.value
, handler
:this.configOptions
, validator
:this.cfg
.checkBoolean
} );
1774 * True if the Calendar should show week row footers. False by default.
1775 * @config SHOW_WEEK_FOOTER
1779 this.cfg
.addProperty(defCfg
.SHOW_WEEK_FOOTER
.key
,{ value
:defCfg
.SHOW_WEEK_FOOTER
.value
, handler
:this.configOptions
, validator
:this.cfg
.checkBoolean
} );
1782 * True if the Calendar should suppress weeks that are not a part of the current month. False by default.
1783 * @config HIDE_BLANK_WEEKS
1787 this.cfg
.addProperty(defCfg
.HIDE_BLANK_WEEKS
.key
, { value
:defCfg
.HIDE_BLANK_WEEKS
.value
, handler
:this.configOptions
, validator
:this.cfg
.checkBoolean
} );
1790 * The image that should be used for the left navigation arrow.
1791 * @config NAV_ARROW_LEFT
1793 * @deprecated You can customize the image by overriding the default CSS class for the left arrow - "calnavleft"
1796 this.cfg
.addProperty(defCfg
.NAV_ARROW_LEFT
.key
, { value
:defCfg
.NAV_ARROW_LEFT
.value
, handler
:this.configOptions
} );
1799 * The image that should be used for the right navigation arrow.
1800 * @config NAV_ARROW_RIGHT
1802 * @deprecated You can customize the image by overriding the default CSS class for the right arrow - "calnavright"
1805 this.cfg
.addProperty(defCfg
.NAV_ARROW_RIGHT
.key
, { value
:defCfg
.NAV_ARROW_RIGHT
.value
, handler
:this.configOptions
} );
1807 // Locale properties
1810 * The short month labels for the current locale.
1811 * @config MONTHS_SHORT
1813 * @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
1815 this.cfg
.addProperty(defCfg
.MONTHS_SHORT
.key
, { value
:defCfg
.MONTHS_SHORT
.value
, handler
:this.configLocale
} );
1818 * The long month labels for the current locale.
1819 * @config MONTHS_LONG
1821 * @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
1823 this.cfg
.addProperty(defCfg
.MONTHS_LONG
.key
, { value
:defCfg
.MONTHS_LONG
.value
, handler
:this.configLocale
} );
1826 * The 1-character weekday labels for the current locale.
1827 * @config WEEKDAYS_1CHAR
1829 * @default ["S", "M", "T", "W", "T", "F", "S"]
1831 this.cfg
.addProperty(defCfg
.WEEKDAYS_1CHAR
.key
, { value
:defCfg
.WEEKDAYS_1CHAR
.value
, handler
:this.configLocale
} );
1834 * The short weekday labels for the current locale.
1835 * @config WEEKDAYS_SHORT
1837 * @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
1839 this.cfg
.addProperty(defCfg
.WEEKDAYS_SHORT
.key
, { value
:defCfg
.WEEKDAYS_SHORT
.value
, handler
:this.configLocale
} );
1842 * The medium weekday labels for the current locale.
1843 * @config WEEKDAYS_MEDIUM
1845 * @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
1847 this.cfg
.addProperty(defCfg
.WEEKDAYS_MEDIUM
.key
, { value
:defCfg
.WEEKDAYS_MEDIUM
.value
, handler
:this.configLocale
} );
1850 * The long weekday labels for the current locale.
1851 * @config WEEKDAYS_LONG
1853 * @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
1855 this.cfg
.addProperty(defCfg
.WEEKDAYS_LONG
.key
, { value
:defCfg
.WEEKDAYS_LONG
.value
, handler
:this.configLocale
} );
1858 * Refreshes the locale values used to build the Calendar.
1859 * @method refreshLocale
1862 var refreshLocale = function() {
1863 this.cfg
.refireEvent(defCfg
.LOCALE_MONTHS
.key
);
1864 this.cfg
.refireEvent(defCfg
.LOCALE_WEEKDAYS
.key
);
1867 this.cfg
.subscribeToConfigEvent(defCfg
.START_WEEKDAY
.key
, refreshLocale
, this, true);
1868 this.cfg
.subscribeToConfigEvent(defCfg
.MONTHS_SHORT
.key
, refreshLocale
, this, true);
1869 this.cfg
.subscribeToConfigEvent(defCfg
.MONTHS_LONG
.key
, refreshLocale
, this, true);
1870 this.cfg
.subscribeToConfigEvent(defCfg
.WEEKDAYS_1CHAR
.key
, refreshLocale
, this, true);
1871 this.cfg
.subscribeToConfigEvent(defCfg
.WEEKDAYS_SHORT
.key
, refreshLocale
, this, true);
1872 this.cfg
.subscribeToConfigEvent(defCfg
.WEEKDAYS_MEDIUM
.key
, refreshLocale
, this, true);
1873 this.cfg
.subscribeToConfigEvent(defCfg
.WEEKDAYS_LONG
.key
, refreshLocale
, this, true);
1876 * The setting that determines which length of month labels should be used. Possible values are "short" and "long".
1877 * @config LOCALE_MONTHS
1881 this.cfg
.addProperty(defCfg
.LOCALE_MONTHS
.key
, { value
:defCfg
.LOCALE_MONTHS
.value
, handler
:this.configLocaleValues
} );
1884 * The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
1885 * @config LOCALE_WEEKDAYS
1889 this.cfg
.addProperty(defCfg
.LOCALE_WEEKDAYS
.key
, { value
:defCfg
.LOCALE_WEEKDAYS
.value
, handler
:this.configLocaleValues
} );
1892 * The value used to delimit individual dates in a date string passed to various Calendar functions.
1893 * @config DATE_DELIMITER
1897 this.cfg
.addProperty(defCfg
.DATE_DELIMITER
.key
, { value
:defCfg
.DATE_DELIMITER
.value
, handler
:this.configLocale
} );
1900 * The value used to delimit date fields in a date string passed to various Calendar functions.
1901 * @config DATE_FIELD_DELIMITER
1905 this.cfg
.addProperty(defCfg
.DATE_FIELD_DELIMITER
.key
, { value
:defCfg
.DATE_FIELD_DELIMITER
.value
, handler
:this.configLocale
} );
1908 * The value used to delimit date ranges in a date string passed to various Calendar functions.
1909 * @config DATE_RANGE_DELIMITER
1913 this.cfg
.addProperty(defCfg
.DATE_RANGE_DELIMITER
.key
, { value
:defCfg
.DATE_RANGE_DELIMITER
.value
, handler
:this.configLocale
} );
1916 * The position of the month in a month/year date string
1917 * @config MY_MONTH_POSITION
1921 this.cfg
.addProperty(defCfg
.MY_MONTH_POSITION
.key
, { value
:defCfg
.MY_MONTH_POSITION
.value
, handler
:this.configLocale
, validator
:this.cfg
.checkNumber
} );
1924 * The position of the year in a month/year date string
1925 * @config MY_YEAR_POSITION
1929 this.cfg
.addProperty(defCfg
.MY_YEAR_POSITION
.key
, { value
:defCfg
.MY_YEAR_POSITION
.value
, handler
:this.configLocale
, validator
:this.cfg
.checkNumber
} );
1932 * The position of the month in a month/day date string
1933 * @config MD_MONTH_POSITION
1937 this.cfg
.addProperty(defCfg
.MD_MONTH_POSITION
.key
, { value
:defCfg
.MD_MONTH_POSITION
.value
, handler
:this.configLocale
, validator
:this.cfg
.checkNumber
} );
1940 * The position of the day in a month/year date string
1941 * @config MD_DAY_POSITION
1945 this.cfg
.addProperty(defCfg
.MD_DAY_POSITION
.key
, { value
:defCfg
.MD_DAY_POSITION
.value
, handler
:this.configLocale
, validator
:this.cfg
.checkNumber
} );
1948 * The position of the month in a month/day/year date string
1949 * @config MDY_MONTH_POSITION
1953 this.cfg
.addProperty(defCfg
.MDY_MONTH_POSITION
.key
, { value
:defCfg
.MDY_MONTH_POSITION
.value
, handler
:this.configLocale
, validator
:this.cfg
.checkNumber
} );
1956 * The position of the day in a month/day/year date string
1957 * @config MDY_DAY_POSITION
1961 this.cfg
.addProperty(defCfg
.MDY_DAY_POSITION
.key
, { value
:defCfg
.MDY_DAY_POSITION
.value
, handler
:this.configLocale
, validator
:this.cfg
.checkNumber
} );
1964 * The position of the year in a month/day/year date string
1965 * @config MDY_YEAR_POSITION
1969 this.cfg
.addProperty(defCfg
.MDY_YEAR_POSITION
.key
, { value
:defCfg
.MDY_YEAR_POSITION
.value
, handler
:this.configLocale
, validator
:this.cfg
.checkNumber
} );
1972 * The position of the month in the month year label string used as the Calendar header
1973 * @config MY_LABEL_MONTH_POSITION
1977 this.cfg
.addProperty(defCfg
.MY_LABEL_MONTH_POSITION
.key
, { value
:defCfg
.MY_LABEL_MONTH_POSITION
.value
, handler
:this.configLocale
, validator
:this.cfg
.checkNumber
} );
1980 * The position of the year in the month year label string used as the Calendar header
1981 * @config MY_LABEL_YEAR_POSITION
1985 this.cfg
.addProperty(defCfg
.MY_LABEL_YEAR_POSITION
.key
, { value
:defCfg
.MY_LABEL_YEAR_POSITION
.value
, handler
:this.configLocale
, validator
:this.cfg
.checkNumber
} );
1988 * The suffix used after the month when rendering the Calendar header
1989 * @config MY_LABEL_MONTH_SUFFIX
1993 this.cfg
.addProperty(defCfg
.MY_LABEL_MONTH_SUFFIX
.key
, { value
:defCfg
.MY_LABEL_MONTH_SUFFIX
.value
, handler
:this.configLocale
} );
1996 * The suffix used after the year when rendering the Calendar header
1997 * @config MY_LABEL_YEAR_SUFFIX
2001 this.cfg
.addProperty(defCfg
.MY_LABEL_YEAR_SUFFIX
.key
, { value
:defCfg
.MY_LABEL_YEAR_SUFFIX
.value
, handler
:this.configLocale
} );
2005 * The default handler for the "pagedate" property
2006 * @method configPageDate
2008 YAHOO
.widget
.Calendar
.prototype.configPageDate = function(type
, args
, obj
) {
2009 this.cfg
.setProperty(YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.PAGEDATE
.key
, this._parsePageDate(args
[0]), true);
2013 * The default handler for the "mindate" property
2014 * @method configMinDate
2016 YAHOO
.widget
.Calendar
.prototype.configMinDate = function(type
, args
, obj
) {
2018 if (YAHOO
.lang
.isString(val
)) {
2019 val
= this._parseDate(val
);
2020 this.cfg
.setProperty(YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.MINDATE
.key
, new Date(val
[0],(val
[1]-1),val
[2]));
2025 * The default handler for the "maxdate" property
2026 * @method configMaxDate
2028 YAHOO
.widget
.Calendar
.prototype.configMaxDate = function(type
, args
, obj
) {
2030 if (YAHOO
.lang
.isString(val
)) {
2031 val
= this._parseDate(val
);
2032 this.cfg
.setProperty(YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.MAXDATE
.key
, new Date(val
[0],(val
[1]-1),val
[2]));
2037 * The default handler for the "selected" property
2038 * @method configSelected
2040 YAHOO
.widget
.Calendar
.prototype.configSelected = function(type
, args
, obj
) {
2041 var selected
= args
[0];
2042 var cfgSelected
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.SELECTED
.key
;
2045 if (YAHOO
.lang
.isString(selected
)) {
2046 this.cfg
.setProperty(cfgSelected
, this._parseDates(selected
), true);
2049 if (! this._selectedDates
) {
2050 this._selectedDates
= this.cfg
.getProperty(cfgSelected
);
2055 * The default handler for all configuration options properties
2056 * @method configOptions
2058 YAHOO
.widget
.Calendar
.prototype.configOptions = function(type
, args
, obj
) {
2059 this.Options
[type
.toUpperCase()] = args
[0];
2063 * The default handler for all configuration locale properties
2064 * @method configLocale
2066 YAHOO
.widget
.Calendar
.prototype.configLocale = function(type
, args
, obj
) {
2067 var defCfg
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
2068 this.Locale
[type
.toUpperCase()] = args
[0];
2070 this.cfg
.refireEvent(defCfg
.LOCALE_MONTHS
.key
);
2071 this.cfg
.refireEvent(defCfg
.LOCALE_WEEKDAYS
.key
);
2075 * The default handler for all configuration locale field length properties
2076 * @method configLocaleValues
2078 YAHOO
.widget
.Calendar
.prototype.configLocaleValues = function(type
, args
, obj
) {
2079 var defCfg
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
2081 type
= type
.toLowerCase();
2085 case defCfg
.LOCALE_MONTHS
.key
:
2087 case YAHOO
.widget
.Calendar
.SHORT
:
2088 this.Locale
.LOCALE_MONTHS
= this.cfg
.getProperty(defCfg
.MONTHS_SHORT
.key
).concat();
2090 case YAHOO
.widget
.Calendar
.LONG
:
2091 this.Locale
.LOCALE_MONTHS
= this.cfg
.getProperty(defCfg
.MONTHS_LONG
.key
).concat();
2095 case defCfg
.LOCALE_WEEKDAYS
.key
:
2097 case YAHOO
.widget
.Calendar
.ONE_CHAR
:
2098 this.Locale
.LOCALE_WEEKDAYS
= this.cfg
.getProperty(defCfg
.WEEKDAYS_1CHAR
.key
).concat();
2100 case YAHOO
.widget
.Calendar
.SHORT
:
2101 this.Locale
.LOCALE_WEEKDAYS
= this.cfg
.getProperty(defCfg
.WEEKDAYS_SHORT
.key
).concat();
2103 case YAHOO
.widget
.Calendar
.MEDIUM
:
2104 this.Locale
.LOCALE_WEEKDAYS
= this.cfg
.getProperty(defCfg
.WEEKDAYS_MEDIUM
.key
).concat();
2106 case YAHOO
.widget
.Calendar
.LONG
:
2107 this.Locale
.LOCALE_WEEKDAYS
= this.cfg
.getProperty(defCfg
.WEEKDAYS_LONG
.key
).concat();
2111 var START_WEEKDAY
= this.cfg
.getProperty(defCfg
.START_WEEKDAY
.key
);
2113 if (START_WEEKDAY
> 0) {
2114 for (var w
=0;w
<START_WEEKDAY
;++w
) {
2115 this.Locale
.LOCALE_WEEKDAYS
.push(this.Locale
.LOCALE_WEEKDAYS
.shift());
2123 * Defines the style constants for the Calendar
2124 * @method initStyles
2126 YAHOO
.widget
.Calendar
.prototype.initStyles = function() {
2128 var defStyle
= YAHOO
.widget
.Calendar
._STYLES
;
2132 * @property Style.CSS_ROW_HEADER
2134 CSS_ROW_HEADER
: defStyle
.CSS_ROW_HEADER
,
2136 * @property Style.CSS_ROW_FOOTER
2138 CSS_ROW_FOOTER
: defStyle
.CSS_ROW_FOOTER
,
2140 * @property Style.CSS_CELL
2142 CSS_CELL
: defStyle
.CSS_CELL
,
2144 * @property Style.CSS_CELL_SELECTOR
2146 CSS_CELL_SELECTOR
: defStyle
.CSS_CELL_SELECTOR
,
2148 * @property Style.CSS_CELL_SELECTED
2150 CSS_CELL_SELECTED
: defStyle
.CSS_CELL_SELECTED
,
2152 * @property Style.CSS_CELL_SELECTABLE
2154 CSS_CELL_SELECTABLE
: defStyle
.CSS_CELL_SELECTABLE
,
2156 * @property Style.CSS_CELL_RESTRICTED
2158 CSS_CELL_RESTRICTED
: defStyle
.CSS_CELL_RESTRICTED
,
2160 * @property Style.CSS_CELL_TODAY
2162 CSS_CELL_TODAY
: defStyle
.CSS_CELL_TODAY
,
2164 * @property Style.CSS_CELL_OOM
2166 CSS_CELL_OOM
: defStyle
.CSS_CELL_OOM
,
2168 * @property Style.CSS_CELL_OOB
2170 CSS_CELL_OOB
: defStyle
.CSS_CELL_OOB
,
2172 * @property Style.CSS_HEADER
2174 CSS_HEADER
: defStyle
.CSS_HEADER
,
2176 * @property Style.CSS_HEADER_TEXT
2178 CSS_HEADER_TEXT
: defStyle
.CSS_HEADER_TEXT
,
2180 * @property Style.CSS_BODY
2182 CSS_BODY
: defStyle
.CSS_BODY
,
2184 * @property Style.CSS_WEEKDAY_CELL
2186 CSS_WEEKDAY_CELL
: defStyle
.CSS_WEEKDAY_CELL
,
2188 * @property Style.CSS_WEEKDAY_ROW
2190 CSS_WEEKDAY_ROW
: defStyle
.CSS_WEEKDAY_ROW
,
2192 * @property Style.CSS_FOOTER
2194 CSS_FOOTER
: defStyle
.CSS_FOOTER
,
2196 * @property Style.CSS_CALENDAR
2198 CSS_CALENDAR
: defStyle
.CSS_CALENDAR
,
2200 * @property Style.CSS_SINGLE
2202 CSS_SINGLE
: defStyle
.CSS_SINGLE
,
2204 * @property Style.CSS_CONTAINER
2206 CSS_CONTAINER
: defStyle
.CSS_CONTAINER
,
2208 * @property Style.CSS_NAV_LEFT
2210 CSS_NAV_LEFT
: defStyle
.CSS_NAV_LEFT
,
2212 * @property Style.CSS_NAV_RIGHT
2214 CSS_NAV_RIGHT
: defStyle
.CSS_NAV_RIGHT
,
2216 * @property Style.CSS_CLOSE
2218 CSS_CLOSE
: defStyle
.CSS_CLOSE
,
2220 * @property Style.CSS_CELL_TOP
2222 CSS_CELL_TOP
: defStyle
.CSS_CELL_TOP
,
2224 * @property Style.CSS_CELL_LEFT
2226 CSS_CELL_LEFT
: defStyle
.CSS_CELL_LEFT
,
2228 * @property Style.CSS_CELL_RIGHT
2230 CSS_CELL_RIGHT
: defStyle
.CSS_CELL_RIGHT
,
2232 * @property Style.CSS_CELL_BOTTOM
2234 CSS_CELL_BOTTOM
: defStyle
.CSS_CELL_BOTTOM
,
2236 * @property Style.CSS_CELL_HOVER
2238 CSS_CELL_HOVER
: defStyle
.CSS_CELL_HOVER
,
2240 * @property Style.CSS_CELL_HIGHLIGHT1
2242 CSS_CELL_HIGHLIGHT1
: defStyle
.CSS_CELL_HIGHLIGHT1
,
2244 * @property Style.CSS_CELL_HIGHLIGHT2
2246 CSS_CELL_HIGHLIGHT2
: defStyle
.CSS_CELL_HIGHLIGHT2
,
2248 * @property Style.CSS_CELL_HIGHLIGHT3
2250 CSS_CELL_HIGHLIGHT3
: defStyle
.CSS_CELL_HIGHLIGHT3
,
2252 * @property Style.CSS_CELL_HIGHLIGHT4
2254 CSS_CELL_HIGHLIGHT4
: defStyle
.CSS_CELL_HIGHLIGHT4
2259 * Builds the date label that will be displayed in the calendar header or
2260 * footer, depending on configuration.
2261 * @method buildMonthLabel
2262 * @return {String} The formatted calendar month label
2264 YAHOO
.widget
.Calendar
.prototype.buildMonthLabel = function() {
2265 var pageDate
= this.cfg
.getProperty(YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.PAGEDATE
.key
);
2267 var monthLabel
= this.Locale
.LOCALE_MONTHS
[pageDate
.getMonth()] + this.Locale
.MY_LABEL_MONTH_SUFFIX
;
2268 var yearLabel
= pageDate
.getFullYear() + this.Locale
.MY_LABEL_YEAR_SUFFIX
;
2270 if (this.Locale
.MY_LABEL_MONTH_POSITION
== 2 || this.Locale
.MY_LABEL_YEAR_POSITION
== 1) {
2271 return yearLabel
+ monthLabel
;
2273 return monthLabel
+ yearLabel
;
2278 * Builds the date digit that will be displayed in calendar cells
2279 * @method buildDayLabel
2280 * @param {Date} workingDate The current working date
2281 * @return {String} The formatted day label
2283 YAHOO
.widget
.Calendar
.prototype.buildDayLabel = function(workingDate
) {
2284 return workingDate
.getDate();
2288 * Renders the calendar header.
2289 * @method renderHeader
2290 * @param {Array} html The current working HTML array
2291 * @return {Array} The current working HTML array
2293 YAHOO
.widget
.Calendar
.prototype.renderHeader = function(html
) {
2294 this.logger
.log("Rendering header", "info");
2297 var DEPR_NAV_LEFT
= "us/tr/callt.gif";
2298 var DEPR_NAV_RIGHT
= "us/tr/calrt.gif";
2299 var defCfg
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
2301 if (this.cfg
.getProperty(defCfg
.SHOW_WEEK_HEADER
.key
)) {
2305 if (this.cfg
.getProperty(defCfg
.SHOW_WEEK_FOOTER
.key
)) {
2309 html
[html
.length
] = "<thead>";
2310 html
[html
.length
] = "<tr>";
2311 html
[html
.length
] = '<th colspan="' + colSpan
+ '" class="' + this.Style
.CSS_HEADER_TEXT
+ '">';
2312 html
[html
.length
] = '<div class="' + this.Style
.CSS_HEADER
+ '">';
2314 var renderLeft
, renderRight
= false;
2317 if (this.index
=== 0) {
2320 if (this.index
== (this.parent
.cfg
.getProperty("pages") -1)) {
2328 var cal
= this.parent
|| this;
2331 var leftArrow
= this.cfg
.getProperty(defCfg
.NAV_ARROW_LEFT
.key
);
2332 // Check for deprecated customization - If someone set IMG_ROOT, but didn't set NAV_ARROW_LEFT, then set NAV_ARROW_LEFT to the old deprecated value
2333 if (leftArrow
=== null && YAHOO
.widget
.Calendar
.IMG_ROOT
!== null) {
2334 leftArrow
= YAHOO
.widget
.Calendar
.IMG_ROOT
+ DEPR_NAV_LEFT
;
2336 var leftStyle
= (leftArrow
=== null) ? "" : ' style="background-image:url(' + leftArrow
+ ')"';
2337 html
[html
.length
] = '<a class="' + this.Style
.CSS_NAV_LEFT
+ '"' + leftStyle
+ ' > </a>';
2340 html
[html
.length
] = this.buildMonthLabel();
2343 var rightArrow
= this.cfg
.getProperty(defCfg
.NAV_ARROW_RIGHT
.key
);
2344 if (rightArrow
=== null && YAHOO
.widget
.Calendar
.IMG_ROOT
!== null) {
2345 rightArrow
= YAHOO
.widget
.Calendar
.IMG_ROOT
+ DEPR_NAV_RIGHT
;
2347 var rightStyle
= (rightArrow
=== null) ? "" : ' style="background-image:url(' + rightArrow
+ ')"';
2348 html
[html
.length
] = '<a class="' + this.Style
.CSS_NAV_RIGHT
+ '"' + rightStyle
+ ' > </a>';
2351 html
[html
.length
] = '</div>\n</th>\n</tr>';
2353 if (this.cfg
.getProperty(defCfg
.SHOW_WEEKDAYS
.key
)) {
2354 html
= this.buildWeekdays(html
);
2357 html
[html
.length
] = '</thead>';
2363 * Renders the Calendar's weekday headers.
2364 * @method buildWeekdays
2365 * @param {Array} html The current working HTML array
2366 * @return {Array} The current working HTML array
2368 YAHOO
.widget
.Calendar
.prototype.buildWeekdays = function(html
) {
2370 var defCfg
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
2372 html
[html
.length
] = '<tr class="' + this.Style
.CSS_WEEKDAY_ROW
+ '">';
2374 if (this.cfg
.getProperty(defCfg
.SHOW_WEEK_HEADER
.key
)) {
2375 html
[html
.length
] = '<th> </th>';
2378 for(var i
=0;i
<this.Locale
.LOCALE_WEEKDAYS
.length
;++i
) {
2379 html
[html
.length
] = '<th class="calweekdaycell">' + this.Locale
.LOCALE_WEEKDAYS
[i
] + '</th>';
2382 if (this.cfg
.getProperty(defCfg
.SHOW_WEEK_FOOTER
.key
)) {
2383 html
[html
.length
] = '<th> </th>';
2386 html
[html
.length
] = '</tr>';
2392 * Renders the calendar body.
2393 * @method renderBody
2394 * @param {Date} workingDate The current working Date being used for the render process
2395 * @param {Array} html The current working HTML array
2396 * @return {Array} The current working HTML array
2398 YAHOO
.widget
.Calendar
.prototype.renderBody = function(workingDate
, html
) {
2399 this.logger
.log("Rendering body", "info");
2400 var defCfg
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
2402 var startDay
= this.cfg
.getProperty(defCfg
.START_WEEKDAY
.key
);
2404 this.preMonthDays
= workingDate
.getDay();
2406 this.preMonthDays
-= startDay
;
2408 if (this.preMonthDays
< 0) {
2409 this.preMonthDays
+= 7;
2412 this.monthDays
= YAHOO
.widget
.DateMath
.findMonthEnd(workingDate
).getDate();
2413 this.postMonthDays
= YAHOO
.widget
.Calendar
.DISPLAY_DAYS
-this.preMonthDays
-this.monthDays
;
2414 this.logger
.log(this.preMonthDays
+ " preciding out-of-month days", "info");
2415 this.logger
.log(this.monthDays
+ " month days", "info");
2416 this.logger
.log(this.postMonthDays
+ " post-month days", "info");
2418 workingDate
= YAHOO
.widget
.DateMath
.subtract(workingDate
, YAHOO
.widget
.DateMath
.DAY
, this.preMonthDays
);
2419 this.logger
.log("Calendar page starts on " + workingDate
, "info");
2421 var weekNum
,weekClass
;
2422 var weekPrefix
= "w";
2423 var cellPrefix
= "_cell";
2424 var workingDayPrefix
= "wd";
2425 var dayPrefix
= "d";
2430 var todayYear
= this.today
.getFullYear();
2431 var todayMonth
= this.today
.getMonth();
2432 var todayDate
= this.today
.getDate();
2434 var useDate
= this.cfg
.getProperty(defCfg
.PAGEDATE
.key
);
2435 var hideBlankWeeks
= this.cfg
.getProperty(defCfg
.HIDE_BLANK_WEEKS
.key
);
2436 var showWeekFooter
= this.cfg
.getProperty(defCfg
.SHOW_WEEK_FOOTER
.key
);
2437 var showWeekHeader
= this.cfg
.getProperty(defCfg
.SHOW_WEEK_HEADER
.key
);
2438 var mindate
= this.cfg
.getProperty(defCfg
.MINDATE
.key
);
2439 var maxdate
= this.cfg
.getProperty(defCfg
.MAXDATE
.key
);
2442 mindate
= YAHOO
.widget
.DateMath
.clearTime(mindate
);
2445 maxdate
= YAHOO
.widget
.DateMath
.clearTime(maxdate
);
2448 html
[html
.length
] = '<tbody class="m' + (useDate
.getMonth()+1) + ' ' + this.Style
.CSS_BODY
+ '">';
2452 var tempDiv
= document
.createElement("div");
2453 var cell
= document
.createElement("td");
2454 tempDiv
.appendChild(cell
);
2456 var jan1
= new Date(useDate
.getFullYear(),0,1);
2458 var cal
= this.parent
|| this;
2460 for (var r
=0;r
<6;r
++) {
2462 weekNum
= YAHOO
.widget
.DateMath
.getWeekNumber(workingDate
, useDate
.getFullYear(), startDay
);
2463 weekClass
= weekPrefix
+ weekNum
;
2465 // Local OOM check for performance, since we already have pagedate
2466 if (r
!== 0 && hideBlankWeeks
=== true && workingDate
.getMonth() != useDate
.getMonth()) {
2470 html
[html
.length
] = '<tr class="' + weekClass
+ '">';
2472 if (showWeekHeader
) { html
= this.renderRowHeader(weekNum
, html
); }
2474 for (var d
=0;d
<7;d
++){ // Render actual days
2479 this.clearElement(cell
);
2480 cell
.className
= this.Style
.CSS_CELL
;
2481 cell
.id
= this.id
+ cellPrefix
+ i
;
2482 this.logger
.log("Rendering cell " + cell
.id
+ " (" + workingDate
.getFullYear() + "-" + (workingDate
.getMonth()+1) + "-" + workingDate
.getDate() + ")", "cellrender");
2484 if (workingDate
.getDate() == todayDate
&&
2485 workingDate
.getMonth() == todayMonth
&&
2486 workingDate
.getFullYear() == todayYear
) {
2487 cellRenderers
[cellRenderers
.length
]=cal
.renderCellStyleToday
;
2490 var workingArray
= [workingDate
.getFullYear(),workingDate
.getMonth()+1,workingDate
.getDate()];
2491 this.cellDates
[this.cellDates
.length
] = workingArray
; // Add this date to cellDates
2493 // Local OOM check for performance, since we already have pagedate
2494 if (workingDate
.getMonth() != useDate
.getMonth()) {
2495 cellRenderers
[cellRenderers
.length
]=cal
.renderCellNotThisMonth
;
2497 YAHOO
.util
.Dom
.addClass(cell
, workingDayPrefix
+ workingDate
.getDay());
2498 YAHOO
.util
.Dom
.addClass(cell
, dayPrefix
+ workingDate
.getDate());
2500 for (var s
=0;s
<this.renderStack
.length
;++s
) {
2502 var rArray
= this.renderStack
[s
];
2503 var type
= rArray
[0];
2510 case YAHOO
.widget
.Calendar
.DATE
:
2511 month
= rArray
[1][1];
2513 year
= rArray
[1][0];
2515 if (workingDate
.getMonth()+1 == month
&& workingDate
.getDate() == day
&& workingDate
.getFullYear() == year
) {
2516 renderer
= rArray
[2];
2517 this.renderStack
.splice(s
,1);
2520 case YAHOO
.widget
.Calendar
.MONTH_DAY
:
2521 month
= rArray
[1][0];
2524 if (workingDate
.getMonth()+1 == month
&& workingDate
.getDate() == day
) {
2525 renderer
= rArray
[2];
2526 this.renderStack
.splice(s
,1);
2529 case YAHOO
.widget
.Calendar
.RANGE
:
2530 var date1
= rArray
[1][0];
2531 var date2
= rArray
[1][1];
2533 var d1month
= date1
[1];
2534 var d1day
= date1
[2];
2535 var d1year
= date1
[0];
2537 var d1
= new Date(d1year
, d1month
-1, d1day
);
2539 var d2month
= date2
[1];
2540 var d2day
= date2
[2];
2541 var d2year
= date2
[0];
2543 var d2
= new Date(d2year
, d2month
-1, d2day
);
2545 if (workingDate
.getTime() >= d1
.getTime() && workingDate
.getTime() <= d2
.getTime()) {
2546 renderer
= rArray
[2];
2548 if (workingDate
.getTime()==d2
.getTime()) {
2549 this.renderStack
.splice(s
,1);
2553 case YAHOO
.widget
.Calendar
.WEEKDAY
:
2555 var weekday
= rArray
[1][0];
2556 if (workingDate
.getDay()+1 == weekday
) {
2557 renderer
= rArray
[2];
2560 case YAHOO
.widget
.Calendar
.MONTH
:
2562 month
= rArray
[1][0];
2563 if (workingDate
.getMonth()+1 == month
) {
2564 renderer
= rArray
[2];
2570 cellRenderers
[cellRenderers
.length
]=renderer
;
2576 if (this._indexOfSelectedFieldArray(workingArray
) > -1) {
2577 cellRenderers
[cellRenderers
.length
]=cal
.renderCellStyleSelected
;
2580 if ((mindate
&& (workingDate
.getTime() < mindate
.getTime())) ||
2581 (maxdate
&& (workingDate
.getTime() > maxdate
.getTime()))
2583 cellRenderers
[cellRenderers
.length
]=cal
.renderOutOfBoundsDate
;
2585 cellRenderers
[cellRenderers
.length
]=cal
.styleCellDefault
;
2586 cellRenderers
[cellRenderers
.length
]=cal
.renderCellDefault
;
2589 for (var x
=0; x
< cellRenderers
.length
; ++x
) {
2590 this.logger
.log("renderer[" + x
+ "] for (" + workingDate
.getFullYear() + "-" + (workingDate
.getMonth()+1) + "-" + workingDate
.getDate() + ")", "cellrender");
2591 if (cellRenderers
[x
].call(cal
, workingDate
, cell
) == YAHOO
.widget
.Calendar
.STOP_RENDER
) {
2596 workingDate
.setTime(workingDate
.getTime() + YAHOO
.widget
.DateMath
.ONE_DAY_MS
);
2598 if (i
>= 0 && i
<= 6) {
2599 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_TOP
);
2601 if ((i
% 7) === 0) {
2602 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_LEFT
);
2604 if (((i
+1) % 7) === 0) {
2605 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_RIGHT
);
2608 var postDays
= this.postMonthDays
;
2609 if (hideBlankWeeks
&& postDays
>= 7) {
2610 var blankWeeks
= Math
.floor(postDays
/7);
2611 for (var p
=0;p
<blankWeeks
;++p
) {
2616 if (i
>= ((this.preMonthDays
+postDays
+this.monthDays
)-7)) {
2617 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_BOTTOM
);
2620 html
[html
.length
] = tempDiv
.innerHTML
;
2624 if (showWeekFooter
) { html
= this.renderRowFooter(weekNum
, html
); }
2626 html
[html
.length
] = '</tr>';
2630 html
[html
.length
] = '</tbody>';
2636 * Renders the calendar footer. In the default implementation, there is
2638 * @method renderFooter
2639 * @param {Array} html The current working HTML array
2640 * @return {Array} The current working HTML array
2642 YAHOO
.widget
.Calendar
.prototype.renderFooter = function(html
) { return html
; };
2645 * Renders the calendar after it has been configured. The render() method has a specific call chain that will execute
2646 * when the method is called: renderHeader, renderBody, renderFooter.
2647 * Refer to the documentation for those methods for information on
2648 * individual render tasks.
2651 YAHOO
.widget
.Calendar
.prototype.render = function() {
2652 this.beforeRenderEvent
.fire();
2654 var defCfg
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
2656 // Find starting day of the current month
2657 var workingDate
= YAHOO
.widget
.DateMath
.findMonthStart(this.cfg
.getProperty(defCfg
.PAGEDATE
.key
));
2659 this.resetRenderers();
2660 this.cellDates
.length
= 0;
2662 YAHOO
.util
.Event
.purgeElement(this.oDomContainer
, true);
2666 html
[html
.length
] = '<table cellSpacing="0" class="' + this.Style
.CSS_CALENDAR
+ ' y' + workingDate
.getFullYear() + '" id="' + this.id
+ '">';
2667 html
= this.renderHeader(html
);
2668 html
= this.renderBody(workingDate
, html
);
2669 html
= this.renderFooter(html
);
2670 html
[html
.length
] = '</table>';
2672 this.oDomContainer
.innerHTML
= html
.join("\n");
2674 this.applyListeners();
2675 this.cells
= this.oDomContainer
.getElementsByTagName("td");
2677 this.cfg
.refireEvent(defCfg
.TITLE
.key
);
2678 this.cfg
.refireEvent(defCfg
.CLOSE
.key
);
2679 this.cfg
.refireEvent(defCfg
.IFRAME
.key
);
2681 this.renderEvent
.fire();
2685 * Applies the Calendar's DOM listeners to applicable elements.
2686 * @method applyListeners
2688 YAHOO
.widget
.Calendar
.prototype.applyListeners = function() {
2690 var root
= this.oDomContainer
;
2691 var cal
= this.parent
|| this;
2694 var mousedown
= "mousedown";
2696 var linkLeft
= YAHOO
.util
.Dom
.getElementsByClassName(this.Style
.CSS_NAV_LEFT
, anchor
, root
);
2697 var linkRight
= YAHOO
.util
.Dom
.getElementsByClassName(this.Style
.CSS_NAV_RIGHT
, anchor
, root
);
2699 if (linkLeft
&& linkLeft
.length
> 0) {
2700 this.linkLeft
= linkLeft
[0];
2701 YAHOO
.util
.Event
.addListener(this.linkLeft
, mousedown
, cal
.previousMonth
, cal
, true);
2704 if (linkRight
&& linkRight
.length
> 0) {
2705 this.linkRight
= linkRight
[0];
2706 YAHOO
.util
.Event
.addListener(this.linkRight
, mousedown
, cal
.nextMonth
, cal
, true);
2709 if (this.domEventMap
) {
2711 for (var cls
in this.domEventMap
) {
2712 if (YAHOO
.lang
.hasOwnProperty(this.domEventMap
, cls
)) {
2713 var items
= this.domEventMap
[cls
];
2715 if (! (items
instanceof Array
)) {
2719 for (var i
=0;i
<items
.length
;i
++) {
2720 var item
= items
[i
];
2721 elements
= YAHOO
.util
.Dom
.getElementsByClassName(cls
, item
.tag
, this.oDomContainer
);
2723 for (var c
=0;c
<elements
.length
;c
++) {
2725 YAHOO
.util
.Event
.addListener(el
, item
.event
, item
.handler
, item
.scope
, item
.correct
);
2732 YAHOO
.util
.Event
.addListener(this.oDomContainer
, "click", this.doSelectCell
, this);
2733 YAHOO
.util
.Event
.addListener(this.oDomContainer
, "mouseover", this.doCellMouseOver
, this);
2734 YAHOO
.util
.Event
.addListener(this.oDomContainer
, "mouseout", this.doCellMouseOut
, this);
2738 * Retrieves the Date object for the specified Calendar cell
2739 * @method getDateByCellId
2740 * @param {String} id The id of the cell
2741 * @return {Date} The Date object for the specified Calendar cell
2743 YAHOO
.widget
.Calendar
.prototype.getDateByCellId = function(id
) {
2744 var date
= this.getDateFieldsByCellId(id
);
2745 return new Date(date
[0],date
[1]-1,date
[2]);
2749 * Retrieves the Date object for the specified Calendar cell
2750 * @method getDateFieldsByCellId
2751 * @param {String} id The id of the cell
2752 * @return {Array} The array of Date fields for the specified Calendar cell
2754 YAHOO
.widget
.Calendar
.prototype.getDateFieldsByCellId = function(id
) {
2755 id
= id
.toLowerCase().split("_cell")[1];
2756 id
= parseInt(id
, 10);
2757 return this.cellDates
[id
];
2760 // BEGIN BUILT-IN TABLE CELL RENDERERS
2763 * Renders a cell that falls before the minimum date or after the maximum date.
2765 * @method renderOutOfBoundsDate
2766 * @param {Date} workingDate The current working Date object being used to generate the calendar
2767 * @param {HTMLTableCellElement} cell The current working cell in the calendar
2768 * @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
2769 * should not be terminated
2771 YAHOO
.widget
.Calendar
.prototype.renderOutOfBoundsDate = function(workingDate
, cell
) {
2772 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_OOB
);
2773 cell
.innerHTML
= workingDate
.getDate();
2774 return YAHOO
.widget
.Calendar
.STOP_RENDER
;
2778 * Renders the row header for a week.
2779 * @method renderRowHeader
2780 * @param {Number} weekNum The week number of the current row
2781 * @param {Array} cell The current working HTML array
2783 YAHOO
.widget
.Calendar
.prototype.renderRowHeader = function(weekNum
, html
) {
2784 html
[html
.length
] = '<th class="calrowhead">' + weekNum
+ '</th>';
2789 * Renders the row footer for a week.
2790 * @method renderRowFooter
2791 * @param {Number} weekNum The week number of the current row
2792 * @param {Array} cell The current working HTML array
2794 YAHOO
.widget
.Calendar
.prototype.renderRowFooter = function(weekNum
, html
) {
2795 html
[html
.length
] = '<th class="calrowfoot">' + weekNum
+ '</th>';
2800 * Renders a single standard calendar cell in the calendar widget table.
2801 * All logic for determining how a standard default cell will be rendered is
2802 * encapsulated in this method, and must be accounted for when extending the
2804 * @method renderCellDefault
2805 * @param {Date} workingDate The current working Date object being used to generate the calendar
2806 * @param {HTMLTableCellElement} cell The current working cell in the calendar
2808 YAHOO
.widget
.Calendar
.prototype.renderCellDefault = function(workingDate
, cell
) {
2809 cell
.innerHTML
= '<a href="#" class="' + this.Style
.CSS_CELL_SELECTOR
+ '">' + this.buildDayLabel(workingDate
) + "</a>";
2813 * Styles a selectable cell.
2814 * @method styleCellDefault
2815 * @param {Date} workingDate The current working Date object being used to generate the calendar
2816 * @param {HTMLTableCellElement} cell The current working cell in the calendar
2818 YAHOO
.widget
.Calendar
.prototype.styleCellDefault = function(workingDate
, cell
) {
2819 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_SELECTABLE
);
2824 * Renders a single standard calendar cell using the CSS hightlight1 style
2825 * @method renderCellStyleHighlight1
2826 * @param {Date} workingDate The current working Date object being used to generate the calendar
2827 * @param {HTMLTableCellElement} cell The current working cell in the calendar
2829 YAHOO
.widget
.Calendar
.prototype.renderCellStyleHighlight1 = function(workingDate
, cell
) {
2830 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_HIGHLIGHT1
);
2834 * Renders a single standard calendar cell using the CSS hightlight2 style
2835 * @method renderCellStyleHighlight2
2836 * @param {Date} workingDate The current working Date object being used to generate the calendar
2837 * @param {HTMLTableCellElement} cell The current working cell in the calendar
2839 YAHOO
.widget
.Calendar
.prototype.renderCellStyleHighlight2 = function(workingDate
, cell
) {
2840 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_HIGHLIGHT2
);
2844 * Renders a single standard calendar cell using the CSS hightlight3 style
2845 * @method renderCellStyleHighlight3
2846 * @param {Date} workingDate The current working Date object being used to generate the calendar
2847 * @param {HTMLTableCellElement} cell The current working cell in the calendar
2849 YAHOO
.widget
.Calendar
.prototype.renderCellStyleHighlight3 = function(workingDate
, cell
) {
2850 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_HIGHLIGHT3
);
2854 * Renders a single standard calendar cell using the CSS hightlight4 style
2855 * @method renderCellStyleHighlight4
2856 * @param {Date} workingDate The current working Date object being used to generate the calendar
2857 * @param {HTMLTableCellElement} cell The current working cell in the calendar
2859 YAHOO
.widget
.Calendar
.prototype.renderCellStyleHighlight4 = function(workingDate
, cell
) {
2860 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_HIGHLIGHT4
);
2864 * Applies the default style used for rendering today's date to the current calendar cell
2865 * @method renderCellStyleToday
2866 * @param {Date} workingDate The current working Date object being used to generate the calendar
2867 * @param {HTMLTableCellElement} cell The current working cell in the calendar
2869 YAHOO
.widget
.Calendar
.prototype.renderCellStyleToday = function(workingDate
, cell
) {
2870 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_TODAY
);
2874 * Applies the default style used for rendering selected dates to the current calendar cell
2875 * @method renderCellStyleSelected
2876 * @param {Date} workingDate The current working Date object being used to generate the calendar
2877 * @param {HTMLTableCellElement} cell The current working cell in the calendar
2878 * @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
2879 * should not be terminated
2881 YAHOO
.widget
.Calendar
.prototype.renderCellStyleSelected = function(workingDate
, cell
) {
2882 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_SELECTED
);
2886 * Applies the default style used for rendering dates that are not a part of the current
2887 * month (preceding or trailing the cells for the current month)
2888 * @method renderCellNotThisMonth
2889 * @param {Date} workingDate The current working Date object being used to generate the calendar
2890 * @param {HTMLTableCellElement} cell The current working cell in the calendar
2891 * @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
2892 * should not be terminated
2894 YAHOO
.widget
.Calendar
.prototype.renderCellNotThisMonth = function(workingDate
, cell
) {
2895 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_OOM
);
2896 cell
.innerHTML
=workingDate
.getDate();
2897 return YAHOO
.widget
.Calendar
.STOP_RENDER
;
2901 * Renders the current calendar cell as a non-selectable "black-out" date using the default
2903 * @method renderBodyCellRestricted
2904 * @param {Date} workingDate The current working Date object being used to generate the calendar
2905 * @param {HTMLTableCellElement} cell The current working cell in the calendar
2906 * @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
2907 * should not be terminated
2909 YAHOO
.widget
.Calendar
.prototype.renderBodyCellRestricted = function(workingDate
, cell
) {
2910 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL
);
2911 YAHOO
.util
.Dom
.addClass(cell
, this.Style
.CSS_CELL_RESTRICTED
);
2912 cell
.innerHTML
=workingDate
.getDate();
2913 return YAHOO
.widget
.Calendar
.STOP_RENDER
;
2916 // END BUILT-IN TABLE CELL RENDERERS
2918 // BEGIN MONTH NAVIGATION METHODS
2921 * Adds the designated number of months to the current calendar month, and sets the current
2922 * calendar page date to the new month.
2924 * @param {Number} count The number of months to add to the current calendar
2926 YAHOO
.widget
.Calendar
.prototype.addMonths = function(count
) {
2927 var cfgPageDate
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.PAGEDATE
.key
;
2928 this.cfg
.setProperty(cfgPageDate
, YAHOO
.widget
.DateMath
.add(this.cfg
.getProperty(cfgPageDate
), YAHOO
.widget
.DateMath
.MONTH
, count
));
2929 this.resetRenderers();
2930 this.changePageEvent
.fire();
2934 * Subtracts the designated number of months from the current calendar month, and sets the current
2935 * calendar page date to the new month.
2936 * @method subtractMonths
2937 * @param {Number} count The number of months to subtract from the current calendar
2939 YAHOO
.widget
.Calendar
.prototype.subtractMonths = function(count
) {
2940 var cfgPageDate
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.PAGEDATE
.key
;
2941 this.cfg
.setProperty(cfgPageDate
, YAHOO
.widget
.DateMath
.subtract(this.cfg
.getProperty(cfgPageDate
), YAHOO
.widget
.DateMath
.MONTH
, count
));
2942 this.resetRenderers();
2943 this.changePageEvent
.fire();
2947 * Adds the designated number of years to the current calendar, and sets the current
2948 * calendar page date to the new month.
2950 * @param {Number} count The number of years to add to the current calendar
2952 YAHOO
.widget
.Calendar
.prototype.addYears = function(count
) {
2953 var cfgPageDate
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.PAGEDATE
.key
;
2954 this.cfg
.setProperty(cfgPageDate
, YAHOO
.widget
.DateMath
.add(this.cfg
.getProperty(cfgPageDate
), YAHOO
.widget
.DateMath
.YEAR
, count
));
2955 this.resetRenderers();
2956 this.changePageEvent
.fire();
2960 * Subtcats the designated number of years from the current calendar, and sets the current
2961 * calendar page date to the new month.
2962 * @method subtractYears
2963 * @param {Number} count The number of years to subtract from the current calendar
2965 YAHOO
.widget
.Calendar
.prototype.subtractYears = function(count
) {
2966 var cfgPageDate
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.PAGEDATE
.key
;
2967 this.cfg
.setProperty(cfgPageDate
, YAHOO
.widget
.DateMath
.subtract(this.cfg
.getProperty(cfgPageDate
), YAHOO
.widget
.DateMath
.YEAR
, count
));
2968 this.resetRenderers();
2969 this.changePageEvent
.fire();
2973 * Navigates to the next month page in the calendar widget.
2976 YAHOO
.widget
.Calendar
.prototype.nextMonth = function() {
2981 * Navigates to the previous month page in the calendar widget.
2982 * @method previousMonth
2984 YAHOO
.widget
.Calendar
.prototype.previousMonth = function() {
2985 this.subtractMonths(1);
2989 * Navigates to the next year in the currently selected month in the calendar widget.
2992 YAHOO
.widget
.Calendar
.prototype.nextYear = function() {
2997 * Navigates to the previous year in the currently selected month in the calendar widget.
2998 * @method previousYear
3000 YAHOO
.widget
.Calendar
.prototype.previousYear = function() {
3001 this.subtractYears(1);
3004 // END MONTH NAVIGATION METHODS
3006 // BEGIN SELECTION METHODS
3009 * Resets the calendar widget to the originally selected month and year, and
3010 * sets the calendar to the initial selection(s).
3013 YAHOO
.widget
.Calendar
.prototype.reset = function() {
3014 var defCfg
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
3015 this.cfg
.resetProperty(defCfg
.SELECTED
.key
);
3016 this.cfg
.resetProperty(defCfg
.PAGEDATE
.key
);
3017 this.resetEvent
.fire();
3021 * Clears the selected dates in the current calendar widget and sets the calendar
3022 * to the current month and year.
3025 YAHOO
.widget
.Calendar
.prototype.clear = function() {
3026 var defCfg
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
3027 this.cfg
.setProperty(defCfg
.SELECTED
.key
, []);
3028 this.cfg
.setProperty(defCfg
.PAGEDATE
.key
, new Date(this.today
.getTime()));
3029 this.clearEvent
.fire();
3033 * Selects a date or a collection of dates on the current calendar. This method, by default,
3034 * does not call the render method explicitly. Once selection has completed, render must be
3035 * called for the changes to be reflected visually.
3037 * Any dates which are OOB (out of bounds, not selectable) will not be selected and the array of
3038 * selected dates passed to the selectEvent will not contain OOB dates.
3040 * If all dates are OOB, the no state change will occur; beforeSelect and select events will not be fired.
3043 * @param {String/Date/Date[]} date The date string of dates to select in the current calendar. Valid formats are
3044 * individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
3045 * Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
3046 * This method can also take a JavaScript Date object or an array of Date objects.
3047 * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
3049 YAHOO
.widget
.Calendar
.prototype.select = function(date
) {
3050 this.logger
.log("Select: " + date
, "info");
3052 var aToBeSelected
= this._toFieldArray(date
);
3053 this.logger
.log("Selection field array: " + aToBeSelected
, "info");
3055 // Filtered array of valid dates
3056 var validDates
= [];
3058 var cfgSelected
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.SELECTED
.key
;
3060 for (var a
=0; a
< aToBeSelected
.length
; ++a
) {
3061 var toSelect
= aToBeSelected
[a
];
3063 if (!this.isDateOOB(this._toDate(toSelect
))) {
3065 if (validDates
.length
=== 0) {
3066 this.beforeSelectEvent
.fire();
3067 selected
= this.cfg
.getProperty(cfgSelected
);
3070 validDates
.push(toSelect
);
3072 if (this._indexOfSelectedFieldArray(toSelect
) == -1) {
3073 selected
[selected
.length
] = toSelect
;
3078 if (validDates
.length
=== 0) { this.logger
.log("All provided dates were OOB. beforeSelect and select events not fired", "info"); }
3080 if (validDates
.length
> 0) {
3082 this.parent
.cfg
.setProperty(cfgSelected
, selected
);
3084 this.cfg
.setProperty(cfgSelected
, selected
);
3086 this.selectEvent
.fire(validDates
);
3089 return this.getSelectedDates();
3093 * Selects a date on the current calendar by referencing the index of the cell that should be selected.
3094 * This method is used to easily select a single cell (usually with a mouse click) without having to do
3095 * a full render. The selected style is applied to the cell directly.
3097 * If the cell is not marked with the CSS_CELL_SELECTABLE class (as is the case by default for out of month
3098 * or out of bounds cells), it will not be selected and in such a case beforeSelect and select events will not be fired.
3100 * @method selectCell
3101 * @param {Number} cellIndex The index of the cell to select in the current calendar.
3102 * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
3104 YAHOO
.widget
.Calendar
.prototype.selectCell = function(cellIndex
) {
3106 var cell
= this.cells
[cellIndex
];
3107 var cellDate
= this.cellDates
[cellIndex
];
3108 var dCellDate
= this._toDate(cellDate
);
3109 this.logger
.log("Select: " + dCellDate
, "info");
3111 var selectable
= YAHOO
.util
.Dom
.hasClass(cell
, this.Style
.CSS_CELL_SELECTABLE
);
3112 if (!selectable
) {this.logger
.log("The cell at cellIndex:" + cellIndex
+ " is not a selectable cell. beforeSelect, select events not fired", "info"); }
3116 this.beforeSelectEvent
.fire();
3118 var cfgSelected
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.SELECTED
.key
;
3119 var selected
= this.cfg
.getProperty(cfgSelected
);
3121 var selectDate
= cellDate
.concat();
3123 if (this._indexOfSelectedFieldArray(selectDate
) == -1) {
3124 selected
[selected
.length
] = selectDate
;
3127 this.parent
.cfg
.setProperty(cfgSelected
, selected
);
3129 this.cfg
.setProperty(cfgSelected
, selected
);
3131 this.renderCellStyleSelected(dCellDate
,cell
);
3132 this.selectEvent
.fire([selectDate
]);
3134 this.doCellMouseOut
.call(cell
, null, this);
3137 return this.getSelectedDates();
3141 * Deselects a date or a collection of dates on the current calendar. This method, by default,
3142 * does not call the render method explicitly. Once deselection has completed, render must be
3143 * called for the changes to be reflected visually.
3145 * The method will not attempt to deselect any dates which are OOB (out of bounds, and hence not selectable)
3146 * and the array of deselected dates passed to the deselectEvent will not contain any OOB dates.
3148 * If all dates are OOB, beforeDeselect and deselect events will not be fired.
3151 * @param {String/Date/Date[]} date The date string of dates to deselect in the current calendar. Valid formats are
3152 * individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
3153 * Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
3154 * This method can also take a JavaScript Date object or an array of Date objects.
3155 * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
3157 YAHOO
.widget
.Calendar
.prototype.deselect = function(date
) {
3158 this.logger
.log("Deselect: " + date
, "info");
3160 var aToBeDeselected
= this._toFieldArray(date
);
3161 this.logger
.log("Deselection field array: " + aToBeDeselected
, "info");
3163 var validDates
= [];
3165 var cfgSelected
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.SELECTED
.key
;
3167 for (var a
=0; a
< aToBeDeselected
.length
; ++a
) {
3168 var toDeselect
= aToBeDeselected
[a
];
3170 if (!this.isDateOOB(this._toDate(toDeselect
))) {
3172 if (validDates
.length
=== 0) {
3173 this.beforeDeselectEvent
.fire();
3174 selected
= this.cfg
.getProperty(cfgSelected
);
3177 validDates
.push(toDeselect
);
3179 var index
= this._indexOfSelectedFieldArray(toDeselect
);
3181 selected
.splice(index
,1);
3186 if (validDates
.length
=== 0) { this.logger
.log("All provided dates were OOB. beforeDeselect and deselect events not fired");}
3188 if (validDates
.length
> 0) {
3190 this.parent
.cfg
.setProperty(cfgSelected
, selected
);
3192 this.cfg
.setProperty(cfgSelected
, selected
);
3194 this.deselectEvent
.fire(validDates
);
3197 return this.getSelectedDates();
3201 * Deselects a date on the current calendar by referencing the index of the cell that should be deselected.
3202 * This method is used to easily deselect a single cell (usually with a mouse click) without having to do
3203 * a full render. The selected style is removed from the cell directly.
3205 * If the cell is not marked with the CSS_CELL_SELECTABLE class (as is the case by default for out of month
3206 * or out of bounds cells), the method will not attempt to deselect it and in such a case, beforeDeselect and
3207 * deselect events will not be fired.
3209 * @method deselectCell
3210 * @param {Number} cellIndex The index of the cell to deselect in the current calendar.
3211 * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
3213 YAHOO
.widget
.Calendar
.prototype.deselectCell = function(cellIndex
) {
3214 var cell
= this.cells
[cellIndex
];
3215 var cellDate
= this.cellDates
[cellIndex
];
3216 var cellDateIndex
= this._indexOfSelectedFieldArray(cellDate
);
3218 var selectable
= YAHOO
.util
.Dom
.hasClass(cell
, this.Style
.CSS_CELL_SELECTABLE
);
3219 if (!selectable
) { this.logger
.log("The cell at cellIndex:" + cellIndex
+ " is not a selectable/deselectable cell", "info"); }
3223 this.beforeDeselectEvent
.fire();
3225 var defCfg
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
3226 var selected
= this.cfg
.getProperty(defCfg
.SELECTED
.key
);
3228 var dCellDate
= this._toDate(cellDate
);
3229 var selectDate
= cellDate
.concat();
3231 if (cellDateIndex
> -1) {
3232 if (this.cfg
.getProperty(defCfg
.PAGEDATE
.key
).getMonth() == dCellDate
.getMonth() &&
3233 this.cfg
.getProperty(defCfg
.PAGEDATE
.key
).getFullYear() == dCellDate
.getFullYear()) {
3234 YAHOO
.util
.Dom
.removeClass(cell
, this.Style
.CSS_CELL_SELECTED
);
3236 selected
.splice(cellDateIndex
, 1);
3240 this.parent
.cfg
.setProperty(defCfg
.SELECTED
.key
, selected
);
3242 this.cfg
.setProperty(defCfg
.SELECTED
.key
, selected
);
3245 this.deselectEvent
.fire(selectDate
);
3248 return this.getSelectedDates();
3252 * Deselects all dates on the current calendar.
3253 * @method deselectAll
3254 * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
3255 * Assuming that this function executes properly, the return value should be an empty array.
3256 * However, the empty array is returned for the sake of being able to check the selection status
3259 YAHOO
.widget
.Calendar
.prototype.deselectAll = function() {
3260 this.beforeDeselectEvent
.fire();
3262 var cfgSelected
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.SELECTED
.key
;
3264 var selected
= this.cfg
.getProperty(cfgSelected
);
3265 var count
= selected
.length
;
3266 var sel
= selected
.concat();
3269 this.parent
.cfg
.setProperty(cfgSelected
, []);
3271 this.cfg
.setProperty(cfgSelected
, []);
3275 this.deselectEvent
.fire(sel
);
3278 return this.getSelectedDates();
3281 // END SELECTION METHODS
3283 // BEGIN TYPE CONVERSION METHODS
3286 * Converts a date (either a JavaScript Date object, or a date string) to the internal data structure
3287 * used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].
3288 * @method _toFieldArray
3290 * @param {String/Date/Date[]} date The date string of dates to deselect in the current calendar. Valid formats are
3291 * individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
3292 * Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
3293 * This method can also take a JavaScript Date object or an array of Date objects.
3294 * @return {Array[](Number[])} Array of date field arrays
3296 YAHOO
.widget
.Calendar
.prototype._toFieldArray = function(date
) {
3297 var returnDate
= [];
3299 if (date
instanceof Date
) {
3300 returnDate
= [[date
.getFullYear(), date
.getMonth()+1, date
.getDate()]];
3301 } else if (YAHOO
.lang
.isString(date
)) {
3302 returnDate
= this._parseDates(date
);
3303 } else if (YAHOO
.lang
.isArray(date
)) {
3304 for (var i
=0;i
<date
.length
;++i
) {
3306 returnDate
[returnDate
.length
] = [d
.getFullYear(),d
.getMonth()+1,d
.getDate()];
3314 * Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
3317 * @param {Number[]} dateFieldArray The date field array to convert to a JavaScript Date.
3318 * @return {Date} JavaScript Date object representing the date field array
3320 YAHOO
.widget
.Calendar
.prototype._toDate = function(dateFieldArray
) {
3321 if (dateFieldArray
instanceof Date
) {
3322 return dateFieldArray
;
3324 return new Date(dateFieldArray
[0],dateFieldArray
[1]-1,dateFieldArray
[2]);
3328 // END TYPE CONVERSION METHODS
3330 // BEGIN UTILITY METHODS
3333 * Converts a date field array [yyyy,mm,dd] to a JavaScript Date object.
3334 * @method _fieldArraysAreEqual
3336 * @param {Number[]} array1 The first date field array to compare
3337 * @param {Number[]} array2 The first date field array to compare
3338 * @return {Boolean} The boolean that represents the equality of the two arrays
3340 YAHOO
.widget
.Calendar
.prototype._fieldArraysAreEqual = function(array1
, array2
) {
3343 if (array1
[0]==array2
[0]&&array1
[1]==array2
[1]&&array1
[2]==array2
[2]) {
3351 * Gets the index of a date field array [yyyy,mm,dd] in the current list of selected dates.
3352 * @method _indexOfSelectedFieldArray
3354 * @param {Number[]} find The date field array to search for
3355 * @return {Number} The index of the date field array within the collection of selected dates.
3356 * -1 will be returned if the date is not found.
3358 YAHOO
.widget
.Calendar
.prototype._indexOfSelectedFieldArray = function(find
) {
3360 var seldates
= this.cfg
.getProperty(YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.SELECTED
.key
);
3362 for (var s
=0;s
<seldates
.length
;++s
) {
3363 var sArray
= seldates
[s
];
3364 if (find
[0]==sArray
[0]&&find
[1]==sArray
[1]&&find
[2]==sArray
[2]) {
3374 * Determines whether a given date is OOM (out of month).
3376 * @param {Date} date The JavaScript Date object for which to check the OOM status
3377 * @return {Boolean} true if the date is OOM
3379 YAHOO
.widget
.Calendar
.prototype.isDateOOM = function(date
) {
3380 return (date
.getMonth() != this.cfg
.getProperty(YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.PAGEDATE
.key
).getMonth());
3384 * Determines whether a given date is OOB (out of bounds - less than the mindate or more than the maxdate).
3387 * @param {Date} date The JavaScript Date object for which to check the OOB status
3388 * @return {Boolean} true if the date is OOB
3390 YAHOO
.widget
.Calendar
.prototype.isDateOOB = function(date
) {
3391 var defCfg
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
3393 var minDate
= this.cfg
.getProperty(defCfg
.MINDATE
.key
);
3394 var maxDate
= this.cfg
.getProperty(defCfg
.MAXDATE
.key
);
3395 var dm
= YAHOO
.widget
.DateMath
;
3398 minDate
= dm
.clearTime(minDate
);
3401 maxDate
= dm
.clearTime(maxDate
);
3404 var clearedDate
= new Date(date
.getTime());
3405 clearedDate
= dm
.clearTime(clearedDate
);
3407 return ((minDate
&& clearedDate
.getTime() < minDate
.getTime()) || (maxDate
&& clearedDate
.getTime() > maxDate
.getTime()));
3411 * Parses a pagedate configuration property value. The value can either be specified as a string of form "mm/yyyy" or a Date object
3412 * and is parsed into a Date object normalized to the first day of the month. If no value is passed in, the month and year from today's date are used to create the Date object
3413 * @method _parsePageDate
3415 * @param {Date|String} date Pagedate value which needs to be parsed
3416 * @return {Date} The Date object representing the pagedate
3418 YAHOO
.widget
.Calendar
.prototype._parsePageDate = function(date
) {
3421 var defCfg
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
3424 if (date
instanceof Date
) {
3425 parsedDate
= YAHOO
.widget
.DateMath
.findMonthStart(date
);
3427 var month
, year
, aMonthYear
;
3428 aMonthYear
= date
.split(this.cfg
.getProperty(defCfg
.DATE_FIELD_DELIMITER
.key
));
3429 month
= parseInt(aMonthYear
[this.cfg
.getProperty(defCfg
.MY_MONTH_POSITION
.key
)-1], 10)-1;
3430 year
= parseInt(aMonthYear
[this.cfg
.getProperty(defCfg
.MY_YEAR_POSITION
.key
)-1], 10);
3432 parsedDate
= new Date(year
, month
, 1);
3435 parsedDate
= new Date(this.today
.getFullYear(), this.today
.getMonth(), 1);
3440 // END UTILITY METHODS
3442 // BEGIN EVENT HANDLERS
3445 * Event executed before a date is selected in the calendar widget.
3446 * @deprecated Event handlers for this event should be susbcribed to beforeSelectEvent.
3448 YAHOO
.widget
.Calendar
.prototype.onBeforeSelect = function() {
3449 if (this.cfg
.getProperty(YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.MULTI_SELECT
.key
) === false) {
3451 this.parent
.callChildFunction("clearAllBodyCellStyles", this.Style
.CSS_CELL_SELECTED
);
3452 this.parent
.deselectAll();
3454 this.clearAllBodyCellStyles(this.Style
.CSS_CELL_SELECTED
);
3461 * Event executed when a date is selected in the calendar widget.
3462 * @param {Array} selected An array of date field arrays representing which date or dates were selected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]
3463 * @deprecated Event handlers for this event should be susbcribed to selectEvent.
3465 YAHOO
.widget
.Calendar
.prototype.onSelect = function(selected
) { };
3468 * Event executed before a date is deselected in the calendar widget.
3469 * @deprecated Event handlers for this event should be susbcribed to beforeDeselectEvent.
3471 YAHOO
.widget
.Calendar
.prototype.onBeforeDeselect = function() { };
3474 * Event executed when a date is deselected in the calendar widget.
3475 * @param {Array} selected An array of date field arrays representing which date or dates were deselected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]
3476 * @deprecated Event handlers for this event should be susbcribed to deselectEvent.
3478 YAHOO
.widget
.Calendar
.prototype.onDeselect = function(deselected
) { };
3481 * Event executed when the user navigates to a different calendar page.
3482 * @deprecated Event handlers for this event should be susbcribed to changePageEvent.
3484 YAHOO
.widget
.Calendar
.prototype.onChangePage = function() {
3489 * Event executed when the calendar widget is rendered.
3490 * @deprecated Event handlers for this event should be susbcribed to renderEvent.
3492 YAHOO
.widget
.Calendar
.prototype.onRender = function() { };
3495 * Event executed when the calendar widget is reset to its original state.
3496 * @deprecated Event handlers for this event should be susbcribed to resetEvemt.
3498 YAHOO
.widget
.Calendar
.prototype.onReset = function() { this.render(); };
3501 * Event executed when the calendar widget is completely cleared to the current month with no selections.
3502 * @deprecated Event handlers for this event should be susbcribed to clearEvent.
3504 YAHOO
.widget
.Calendar
.prototype.onClear = function() { this.render(); };
3507 * Validates the calendar widget. This method has no default implementation
3508 * and must be extended by subclassing the widget.
3509 * @return Should return true if the widget validates, and false if
3513 YAHOO
.widget
.Calendar
.prototype.validate = function() { return true; };
3515 // END EVENT HANDLERS
3517 // BEGIN DATE PARSE METHODS
3520 * Converts a date string to a date field array
3522 * @param {String} sDate Date string. Valid formats are mm/dd and mm/dd/yyyy.
3523 * @return A date field array representing the string passed to the method
3524 * @type Array[](Number[])
3526 YAHOO
.widget
.Calendar
.prototype._parseDate = function(sDate
) {
3527 var aDate
= sDate
.split(this.Locale
.DATE_FIELD_DELIMITER
);
3530 if (aDate
.length
== 2) {
3531 rArray
= [aDate
[this.Locale
.MD_MONTH_POSITION
-1],aDate
[this.Locale
.MD_DAY_POSITION
-1]];
3532 rArray
.type
= YAHOO
.widget
.Calendar
.MONTH_DAY
;
3534 rArray
= [aDate
[this.Locale
.MDY_YEAR_POSITION
-1],aDate
[this.Locale
.MDY_MONTH_POSITION
-1],aDate
[this.Locale
.MDY_DAY_POSITION
-1]];
3535 rArray
.type
= YAHOO
.widget
.Calendar
.DATE
;
3538 for (var i
=0;i
<rArray
.length
;i
++) {
3539 rArray
[i
] = parseInt(rArray
[i
], 10);
3546 * Converts a multi or single-date string to an array of date field arrays
3548 * @param {String} sDates Date string with one or more comma-delimited dates. Valid formats are mm/dd, mm/dd/yyyy, mm/dd/yyyy-mm/dd/yyyy
3549 * @return An array of date field arrays
3550 * @type Array[](Number[])
3552 YAHOO
.widget
.Calendar
.prototype._parseDates = function(sDates
) {
3555 var aDates
= sDates
.split(this.Locale
.DATE_DELIMITER
);
3557 for (var d
=0;d
<aDates
.length
;++d
) {
3558 var sDate
= aDates
[d
];
3560 if (sDate
.indexOf(this.Locale
.DATE_RANGE_DELIMITER
) != -1) {
3562 var aRange
= sDate
.split(this.Locale
.DATE_RANGE_DELIMITER
);
3564 var dateStart
= this._parseDate(aRange
[0]);
3565 var dateEnd
= this._parseDate(aRange
[1]);
3567 var fullRange
= this._parseRange(dateStart
, dateEnd
);
3568 aReturn
= aReturn
.concat(fullRange
);
3570 // This is not a range
3571 var aDate
= this._parseDate(sDate
);
3572 aReturn
.push(aDate
);
3579 * Converts a date range to the full list of included dates
3581 * @param {Number[]} startDate Date field array representing the first date in the range
3582 * @param {Number[]} endDate Date field array representing the last date in the range
3583 * @return An array of date field arrays
3584 * @type Array[](Number[])
3586 YAHOO
.widget
.Calendar
.prototype._parseRange = function(startDate
, endDate
) {
3587 var dStart
= new Date(startDate
[0],startDate
[1]-1,startDate
[2]);
3588 var dCurrent
= YAHOO
.widget
.DateMath
.add(new Date(startDate
[0],startDate
[1]-1,startDate
[2]),YAHOO
.widget
.DateMath
.DAY
,1);
3589 var dEnd
= new Date(endDate
[0], endDate
[1]-1, endDate
[2]);
3592 results
.push(startDate
);
3593 while (dCurrent
.getTime() <= dEnd
.getTime()) {
3594 results
.push([dCurrent
.getFullYear(),dCurrent
.getMonth()+1,dCurrent
.getDate()]);
3595 dCurrent
= YAHOO
.widget
.DateMath
.add(dCurrent
,YAHOO
.widget
.DateMath
.DAY
,1);
3600 // END DATE PARSE METHODS
3602 // BEGIN RENDERER METHODS
3605 * Resets the render stack of the current calendar to its original pre-render value.
3607 YAHOO
.widget
.Calendar
.prototype.resetRenderers = function() {
3608 this.renderStack
= this._renderStack
.concat();
3612 * Clears the inner HTML, CSS class and style information from the specified cell.
3613 * @method clearElement
3614 * @param {HTMLTableCellElement} The cell to clear
3616 YAHOO
.widget
.Calendar
.prototype.clearElement = function(cell
) {
3617 cell
.innerHTML
= " ";
3622 * Adds a renderer to the render stack. The function reference passed to this method will be executed
3623 * when a date cell matches the conditions specified in the date string for this renderer.
3624 * @method addRenderer
3625 * @param {String} sDates A date string to associate with the specified renderer. Valid formats
3626 * include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)
3627 * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
3629 YAHOO
.widget
.Calendar
.prototype.addRenderer = function(sDates
, fnRender
) {
3630 var aDates
= this._parseDates(sDates
);
3631 for (var i
=0;i
<aDates
.length
;++i
) {
3632 var aDate
= aDates
[i
];
3634 if (aDate
.length
== 2) { // this is either a range or a month/day combo
3635 if (aDate
[0] instanceof Array
) { // this is a range
3636 this._addRenderer(YAHOO
.widget
.Calendar
.RANGE
,aDate
,fnRender
);
3637 } else { // this is a month/day combo
3638 this._addRenderer(YAHOO
.widget
.Calendar
.MONTH_DAY
,aDate
,fnRender
);
3640 } else if (aDate
.length
== 3) {
3641 this._addRenderer(YAHOO
.widget
.Calendar
.DATE
,aDate
,fnRender
);
3647 * The private method used for adding cell renderers to the local render stack.
3648 * This method is called by other methods that set the renderer type prior to the method call.
3649 * @method _addRenderer
3651 * @param {String} type The type string that indicates the type of date renderer being added.
3652 * Values are YAHOO.widget.Calendar.DATE, YAHOO.widget.Calendar.MONTH_DAY, YAHOO.widget.Calendar.WEEKDAY,
3653 * YAHOO.widget.Calendar.RANGE, YAHOO.widget.Calendar.MONTH
3654 * @param {Array} aDates An array of dates used to construct the renderer. The format varies based
3655 * on the renderer type
3656 * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
3658 YAHOO
.widget
.Calendar
.prototype._addRenderer = function(type
, aDates
, fnRender
) {
3659 var add
= [type
,aDates
,fnRender
];
3660 this.renderStack
.unshift(add
);
3661 this._renderStack
= this.renderStack
.concat();
3665 * Adds a month to the render stack. The function reference passed to this method will be executed
3666 * when a date cell matches the month passed to this method.
3667 * @method addMonthRenderer
3668 * @param {Number} month The month (1-12) to associate with this renderer
3669 * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
3671 YAHOO
.widget
.Calendar
.prototype.addMonthRenderer = function(month
, fnRender
) {
3672 this._addRenderer(YAHOO
.widget
.Calendar
.MONTH
,[month
],fnRender
);
3676 * Adds a weekday to the render stack. The function reference passed to this method will be executed
3677 * when a date cell matches the weekday passed to this method.
3678 * @method addWeekdayRenderer
3679 * @param {Number} weekday The weekday (0-6) to associate with this renderer
3680 * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
3682 YAHOO
.widget
.Calendar
.prototype.addWeekdayRenderer = function(weekday
, fnRender
) {
3683 this._addRenderer(YAHOO
.widget
.Calendar
.WEEKDAY
,[weekday
],fnRender
);
3686 // END RENDERER METHODS
3688 // BEGIN CSS METHODS
3691 * Removes all styles from all body cells in the current calendar table.
3692 * @method clearAllBodyCellStyles
3693 * @param {style} The CSS class name to remove from all calendar body cells
3695 YAHOO
.widget
.Calendar
.prototype.clearAllBodyCellStyles = function(style
) {
3696 for (var c
=0;c
<this.cells
.length
;++c
) {
3697 YAHOO
.util
.Dom
.removeClass(this.cells
[c
],style
);
3703 // BEGIN GETTER/SETTER METHODS
3705 * Sets the calendar's month explicitly
3707 * @param {Number} month The numeric month, from 0 (January) to 11 (December)
3709 YAHOO
.widget
.Calendar
.prototype.setMonth = function(month
) {
3710 var cfgPageDate
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.PAGEDATE
.key
;
3711 var current
= this.cfg
.getProperty(cfgPageDate
);
3712 current
.setMonth(parseInt(month
, 10));
3713 this.cfg
.setProperty(cfgPageDate
, current
);
3717 * Sets the calendar's year explicitly.
3719 * @param {Number} year The numeric 4-digit year
3721 YAHOO
.widget
.Calendar
.prototype.setYear = function(year
) {
3722 var cfgPageDate
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.PAGEDATE
.key
;
3723 var current
= this.cfg
.getProperty(cfgPageDate
);
3724 current
.setFullYear(parseInt(year
, 10));
3725 this.cfg
.setProperty(cfgPageDate
, current
);
3729 * Gets the list of currently selected dates from the calendar.
3730 * @method getSelectedDates
3731 * @return {Date[]} An array of currently selected JavaScript Date objects.
3733 YAHOO
.widget
.Calendar
.prototype.getSelectedDates = function() {
3734 var returnDates
= [];
3735 var selected
= this.cfg
.getProperty(YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
.SELECTED
.key
);
3737 for (var d
=0;d
<selected
.length
;++d
) {
3738 var dateArray
= selected
[d
];
3740 var date
= new Date(dateArray
[0],dateArray
[1]-1,dateArray
[2]);
3741 returnDates
.push(date
);
3744 returnDates
.sort( function(a
,b
) { return a
-b
; } );
3748 /// END GETTER/SETTER METHODS ///
3751 * Hides the Calendar's outer container from view.
3754 YAHOO
.widget
.Calendar
.prototype.hide = function() {
3755 this.oDomContainer
.style
.display
= "none";
3759 * Shows the Calendar's outer container.
3762 YAHOO
.widget
.Calendar
.prototype.show = function() {
3763 this.oDomContainer
.style
.display
= "block";
3767 * Returns a string representing the current browser.
3768 * @deprecated As of 2.3.0, environment information is available in YAHOO.env.ua
3773 YAHOO
.widget
.Calendar
.prototype.browser = function() {
3774 var ua
= navigator
.userAgent
.toLowerCase();
3775 if (ua
.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
3777 } else if (ua
.indexOf('msie 7')!=-1) { // IE7
3779 } else if (ua
.indexOf('msie') !=-1) { // IE
3781 } else if (ua
.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
3783 } else if (ua
.indexOf('gecko') != -1) { // Gecko
3790 * Returns a string representation of the object.
3792 * @return {String} A string representation of the Calendar object.
3794 YAHOO
.widget
.Calendar
.prototype.toString = function() {
3795 return "Calendar " + this.id
;
3799 * @namespace YAHOO.widget
3800 * @class Calendar_Core
3801 * @extends YAHOO.widget.Calendar
3802 * @deprecated The old Calendar_Core class is no longer necessary.
3804 YAHOO
.widget
.Calendar_Core
= YAHOO
.widget
.Calendar
;
3806 YAHOO
.widget
.Cal_Core
= YAHOO
.widget
.Calendar
;
3809 * YAHOO.widget.CalendarGroup is a special container class for YAHOO.widget.Calendar. This class facilitates
3810 * the ability to have multi-page calendar views that share a single dataset and are
3811 * dependent on each other.
3813 * The calendar group instance will refer to each of its elements using a 0-based index.
3814 * For example, to construct the placeholder for a calendar group widget with id "cal1" and
3815 * containerId of "cal1Container", the markup would be as follows:
3817 * <div id="cal1Container_0"></div>
3818 * <div id="cal1Container_1"></div>
3820 * The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.
3821 * @namespace YAHOO.widget
3822 * @class CalendarGroup
3824 * @param {String} id The id of the table element that will represent the calendar widget
3825 * @param {String} containerId The id of the container div element that will wrap the calendar table
3826 * @param {Object} config The configuration object containing the Calendar's arguments
3828 YAHOO
.widget
.CalendarGroup = function(id
, containerId
, config
) {
3829 if (arguments
.length
> 0) {
3830 this.init(id
, containerId
, config
);
3835 * Initializes the calendar group. All subclasses must call this method in order for the
3836 * group to be initialized properly.
3838 * @param {String} id The id of the table element that will represent the calendar widget
3839 * @param {String} containerId The id of the container div element that will wrap the calendar table
3840 * @param {Object} config The configuration object containing the Calendar's arguments
3842 YAHOO
.widget
.CalendarGroup
.prototype.init = function(id
, containerId
, config
) {
3843 this.logger
= new YAHOO
.widget
.LogWriter("CalendarGroup " + id
);
3848 * The collection of Calendar pages contained within the CalendarGroup
3850 * @type YAHOO.widget.Calendar[]
3855 * The unique id associated with the CalendarGroup
3862 * The unique id associated with the CalendarGroup container
3863 * @property containerId
3866 this.containerId
= containerId
;
3869 * The outer containing element for the CalendarGroup
3870 * @property oDomContainer
3873 this.oDomContainer
= document
.getElementById(containerId
);
3875 YAHOO
.util
.Dom
.addClass(this.oDomContainer
, YAHOO
.widget
.CalendarGroup
.CSS_CONTAINER
);
3876 YAHOO
.util
.Dom
.addClass(this.oDomContainer
, YAHOO
.widget
.CalendarGroup
.CSS_MULTI_UP
);
3879 * The Config object used to hold the configuration variables for the CalendarGroup
3881 * @type YAHOO.util.Config
3883 this.cfg
= new YAHOO
.util
.Config(this);
3886 * The local object which contains the CalendarGroup's options
3893 * The local object which contains the CalendarGroup's locale settings
3902 this.cfg
.applyConfig(config
, true);
3905 this.cfg
.fireQueue();
3907 // OPERA HACK FOR MISWRAPPED FLOATS
3908 if (YAHOO
.env
.ua
.opera
){
3909 this.renderEvent
.subscribe(this._fixWidth
, this, true);
3911 this.logger
.log("Initialized " + this.pages
.length
+ "-page CalendarGroup", "info");
3915 YAHOO
.widget
.CalendarGroup
.prototype.setupConfig = function() {
3917 var defCfg
= YAHOO
.widget
.CalendarGroup
._DEFAULT_CONFIG
;
3920 * The number of pages to include in the CalendarGroup. This value can only be set once, in the CalendarGroup's constructor arguments.
3925 this.cfg
.addProperty(defCfg
.PAGES
.key
, { value
:defCfg
.PAGES
.value
, validator
:this.cfg
.checkNumber
, handler
:this.configPages
} );
3928 * The month/year representing the current visible Calendar date (mm/yyyy)
3931 * @default today's date
3933 this.cfg
.addProperty(defCfg
.PAGEDATE
.key
, { value
:new Date(), handler
:this.configPageDate
} );
3936 * The date or range of dates representing the current Calendar selection
3941 this.cfg
.addProperty(defCfg
.SELECTED
.key
, { value
:[], handler
:this.configSelected
} );
3944 * The title to display above the CalendarGroup's month header
3949 this.cfg
.addProperty(defCfg
.TITLE
.key
, { value
:defCfg
.TITLE
.value
, handler
:this.configTitle
} );
3952 * Whether or not a close button should be displayed for this CalendarGroup
3957 this.cfg
.addProperty(defCfg
.CLOSE
.key
, { value
:defCfg
.CLOSE
.value
, handler
:this.configClose
} );
3960 * Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
3961 * This property is enabled by default for IE6 and below. It is disabled by default for other browsers for performance reasons, but can be
3962 * enabled if required.
3966 * @default true for IE6 and below, false for all other browsers
3968 this.cfg
.addProperty(defCfg
.IFRAME
.key
, { value
:defCfg
.IFRAME
.value
, handler
:this.configIframe
, validator
:this.cfg
.checkBoolean
} );
3971 * The minimum selectable date in the current Calendar (mm/dd/yyyy)
3976 this.cfg
.addProperty(defCfg
.MINDATE
.key
, { value
:defCfg
.MINDATE
.value
, handler
:this.delegateConfig
} );
3979 * The maximum selectable date in the current Calendar (mm/dd/yyyy)
3984 this.cfg
.addProperty(defCfg
.MAXDATE
.key
, { value
:defCfg
.MAXDATE
.value
, handler
:this.delegateConfig
} );
3986 // Options properties
3989 * True if the Calendar should allow multiple selections. False by default.
3990 * @config MULTI_SELECT
3994 this.cfg
.addProperty(defCfg
.MULTI_SELECT
.key
, { value
:defCfg
.MULTI_SELECT
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkBoolean
} );
3997 * The weekday the week begins on. Default is 0 (Sunday).
3998 * @config START_WEEKDAY
4002 this.cfg
.addProperty(defCfg
.START_WEEKDAY
.key
, { value
:defCfg
.START_WEEKDAY
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkNumber
} );
4005 * True if the Calendar should show weekday labels. True by default.
4006 * @config SHOW_WEEKDAYS
4010 this.cfg
.addProperty(defCfg
.SHOW_WEEKDAYS
.key
, { value
:defCfg
.SHOW_WEEKDAYS
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkBoolean
} );
4013 * True if the Calendar should show week row headers. False by default.
4014 * @config SHOW_WEEK_HEADER
4018 this.cfg
.addProperty(defCfg
.SHOW_WEEK_HEADER
.key
,{ value
:defCfg
.SHOW_WEEK_HEADER
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkBoolean
} );
4021 * True if the Calendar should show week row footers. False by default.
4022 * @config SHOW_WEEK_FOOTER
4026 this.cfg
.addProperty(defCfg
.SHOW_WEEK_FOOTER
.key
,{ value
:defCfg
.SHOW_WEEK_FOOTER
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkBoolean
} );
4029 * True if the Calendar should suppress weeks that are not a part of the current month. False by default.
4030 * @config HIDE_BLANK_WEEKS
4034 this.cfg
.addProperty(defCfg
.HIDE_BLANK_WEEKS
.key
,{ value
:defCfg
.HIDE_BLANK_WEEKS
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkBoolean
} );
4037 * The image that should be used for the left navigation arrow.
4038 * @config NAV_ARROW_LEFT
4040 * @deprecated You can customize the image by overriding the default CSS class for the left arrow - "calnavleft"
4043 this.cfg
.addProperty(defCfg
.NAV_ARROW_LEFT
.key
, { value
:defCfg
.NAV_ARROW_LEFT
.value
, handler
:this.delegateConfig
} );
4046 * The image that should be used for the right navigation arrow.
4047 * @config NAV_ARROW_RIGHT
4049 * @deprecated You can customize the image by overriding the default CSS class for the right arrow - "calnavright"
4052 this.cfg
.addProperty(defCfg
.NAV_ARROW_RIGHT
.key
, { value
:defCfg
.NAV_ARROW_RIGHT
.value
, handler
:this.delegateConfig
} );
4054 // Locale properties
4057 * The short month labels for the current locale.
4058 * @config MONTHS_SHORT
4060 * @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
4062 this.cfg
.addProperty(defCfg
.MONTHS_SHORT
.key
, { value
:defCfg
.MONTHS_SHORT
.value
, handler
:this.delegateConfig
} );
4065 * The long month labels for the current locale.
4066 * @config MONTHS_LONG
4068 * @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
4070 this.cfg
.addProperty(defCfg
.MONTHS_LONG
.key
, { value
:defCfg
.MONTHS_LONG
.value
, handler
:this.delegateConfig
} );
4073 * The 1-character weekday labels for the current locale.
4074 * @config WEEKDAYS_1CHAR
4076 * @default ["S", "M", "T", "W", "T", "F", "S"]
4078 this.cfg
.addProperty(defCfg
.WEEKDAYS_1CHAR
.key
, { value
:defCfg
.WEEKDAYS_1CHAR
.value
, handler
:this.delegateConfig
} );
4081 * The short weekday labels for the current locale.
4082 * @config WEEKDAYS_SHORT
4084 * @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
4086 this.cfg
.addProperty(defCfg
.WEEKDAYS_SHORT
.key
, { value
:defCfg
.WEEKDAYS_SHORT
.value
, handler
:this.delegateConfig
} );
4089 * The medium weekday labels for the current locale.
4090 * @config WEEKDAYS_MEDIUM
4092 * @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
4094 this.cfg
.addProperty(defCfg
.WEEKDAYS_MEDIUM
.key
, { value
:defCfg
.WEEKDAYS_MEDIUM
.value
, handler
:this.delegateConfig
} );
4097 * The long weekday labels for the current locale.
4098 * @config WEEKDAYS_LONG
4100 * @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
4102 this.cfg
.addProperty(defCfg
.WEEKDAYS_LONG
.key
, { value
:defCfg
.WEEKDAYS_LONG
.value
, handler
:this.delegateConfig
} );
4105 * The setting that determines which length of month labels should be used. Possible values are "short" and "long".
4106 * @config LOCALE_MONTHS
4110 this.cfg
.addProperty(defCfg
.LOCALE_MONTHS
.key
, { value
:defCfg
.LOCALE_MONTHS
.value
, handler
:this.delegateConfig
} );
4113 * The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
4114 * @config LOCALE_WEEKDAYS
4118 this.cfg
.addProperty(defCfg
.LOCALE_WEEKDAYS
.key
, { value
:defCfg
.LOCALE_WEEKDAYS
.value
, handler
:this.delegateConfig
} );
4121 * The value used to delimit individual dates in a date string passed to various Calendar functions.
4122 * @config DATE_DELIMITER
4126 this.cfg
.addProperty(defCfg
.DATE_DELIMITER
.key
, { value
:defCfg
.DATE_DELIMITER
.value
, handler
:this.delegateConfig
} );
4129 * The value used to delimit date fields in a date string passed to various Calendar functions.
4130 * @config DATE_FIELD_DELIMITER
4134 this.cfg
.addProperty(defCfg
.DATE_FIELD_DELIMITER
.key
,{ value
:defCfg
.DATE_FIELD_DELIMITER
.value
, handler
:this.delegateConfig
} );
4137 * The value used to delimit date ranges in a date string passed to various Calendar functions.
4138 * @config DATE_RANGE_DELIMITER
4142 this.cfg
.addProperty(defCfg
.DATE_RANGE_DELIMITER
.key
,{ value
:defCfg
.DATE_RANGE_DELIMITER
.value
, handler
:this.delegateConfig
} );
4145 * The position of the month in a month/year date string
4146 * @config MY_MONTH_POSITION
4150 this.cfg
.addProperty(defCfg
.MY_MONTH_POSITION
.key
, { value
:defCfg
.MY_MONTH_POSITION
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkNumber
} );
4153 * The position of the year in a month/year date string
4154 * @config MY_YEAR_POSITION
4158 this.cfg
.addProperty(defCfg
.MY_YEAR_POSITION
.key
, { value
:defCfg
.MY_YEAR_POSITION
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkNumber
} );
4161 * The position of the month in a month/day date string
4162 * @config MD_MONTH_POSITION
4166 this.cfg
.addProperty(defCfg
.MD_MONTH_POSITION
.key
, { value
:defCfg
.MD_MONTH_POSITION
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkNumber
} );
4169 * The position of the day in a month/year date string
4170 * @config MD_DAY_POSITION
4174 this.cfg
.addProperty(defCfg
.MD_DAY_POSITION
.key
, { value
:defCfg
.MD_DAY_POSITION
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkNumber
} );
4177 * The position of the month in a month/day/year date string
4178 * @config MDY_MONTH_POSITION
4182 this.cfg
.addProperty(defCfg
.MDY_MONTH_POSITION
.key
, { value
:defCfg
.MDY_MONTH_POSITION
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkNumber
} );
4185 * The position of the day in a month/day/year date string
4186 * @config MDY_DAY_POSITION
4190 this.cfg
.addProperty(defCfg
.MDY_DAY_POSITION
.key
, { value
:defCfg
.MDY_DAY_POSITION
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkNumber
} );
4193 * The position of the year in a month/day/year date string
4194 * @config MDY_YEAR_POSITION
4198 this.cfg
.addProperty(defCfg
.MDY_YEAR_POSITION
.key
, { value
:defCfg
.MDY_YEAR_POSITION
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkNumber
} );
4201 * The position of the month in the month year label string used as the Calendar header
4202 * @config MY_LABEL_MONTH_POSITION
4206 this.cfg
.addProperty(defCfg
.MY_LABEL_MONTH_POSITION
.key
, { value
:defCfg
.MY_LABEL_MONTH_POSITION
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkNumber
} );
4209 * The position of the year in the month year label string used as the Calendar header
4210 * @config MY_LABEL_YEAR_POSITION
4214 this.cfg
.addProperty(defCfg
.MY_LABEL_YEAR_POSITION
.key
, { value
:defCfg
.MY_LABEL_YEAR_POSITION
.value
, handler
:this.delegateConfig
, validator
:this.cfg
.checkNumber
} );
4217 * The suffix used after the month when rendering the Calendar header
4218 * @config MY_LABEL_MONTH_SUFFIX
4222 this.cfg
.addProperty(defCfg
.MY_LABEL_MONTH_SUFFIX
.key
, { value
:defCfg
.MY_LABEL_MONTH_SUFFIX
.value
, handler
:this.delegateConfig
} );
4225 * The suffix used after the year when rendering the Calendar header
4226 * @config MY_LABEL_YEAR_SUFFIX
4230 this.cfg
.addProperty(defCfg
.MY_LABEL_YEAR_SUFFIX
.key
, { value
:defCfg
.MY_LABEL_YEAR_SUFFIX
.value
, handler
:this.delegateConfig
} );
4234 * Initializes CalendarGroup's built-in CustomEvents
4235 * @method initEvents
4237 YAHOO
.widget
.CalendarGroup
.prototype.initEvents = function() {
4239 var strEvent
= "Event";
4242 * Proxy subscriber to subscribe to the CalendarGroup's child Calendars' CustomEvents
4245 * @param {Function} fn The function to subscribe to this CustomEvent
4246 * @param {Object} obj The CustomEvent's scope object
4247 * @param {Boolean} bOverride Whether or not to apply scope correction
4249 var sub = function(fn
, obj
, bOverride
) {
4250 for (var p
=0;p
<me
.pages
.length
;++p
) {
4251 var cal
= me
.pages
[p
];
4252 cal
[this.type
+ strEvent
].subscribe(fn
, obj
, bOverride
);
4257 * Proxy unsubscriber to unsubscribe from the CalendarGroup's child Calendars' CustomEvents
4260 * @param {Function} fn The function to subscribe to this CustomEvent
4261 * @param {Object} obj The CustomEvent's scope object
4263 var unsub = function(fn
, obj
) {
4264 for (var p
=0;p
<me
.pages
.length
;++p
) {
4265 var cal
= me
.pages
[p
];
4266 cal
[this.type
+ strEvent
].unsubscribe(fn
, obj
);
4270 var defEvents
= YAHOO
.widget
.Calendar
._EVENT_TYPES
;
4273 * Fired before a selection is made
4274 * @event beforeSelectEvent
4276 this.beforeSelectEvent
= new YAHOO
.util
.CustomEvent(defEvents
.BEFORE_SELECT
);
4277 this.beforeSelectEvent
.subscribe
= sub
; this.beforeSelectEvent
.unsubscribe
= unsub
;
4280 * Fired when a selection is made
4281 * @event selectEvent
4282 * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
4284 this.selectEvent
= new YAHOO
.util
.CustomEvent(defEvents
.SELECT
);
4285 this.selectEvent
.subscribe
= sub
; this.selectEvent
.unsubscribe
= unsub
;
4288 * Fired before a selection is made
4289 * @event beforeDeselectEvent
4291 this.beforeDeselectEvent
= new YAHOO
.util
.CustomEvent(defEvents
.BEFORE_DESELECT
);
4292 this.beforeDeselectEvent
.subscribe
= sub
; this.beforeDeselectEvent
.unsubscribe
= unsub
;
4295 * Fired when a selection is made
4296 * @event deselectEvent
4297 * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
4299 this.deselectEvent
= new YAHOO
.util
.CustomEvent(defEvents
.DESELECT
);
4300 this.deselectEvent
.subscribe
= sub
; this.deselectEvent
.unsubscribe
= unsub
;
4303 * Fired when the Calendar page is changed
4304 * @event changePageEvent
4306 this.changePageEvent
= new YAHOO
.util
.CustomEvent(defEvents
.CHANGE_PAGE
);
4307 this.changePageEvent
.subscribe
= sub
; this.changePageEvent
.unsubscribe
= unsub
;
4310 * Fired before the Calendar is rendered
4311 * @event beforeRenderEvent
4313 this.beforeRenderEvent
= new YAHOO
.util
.CustomEvent(defEvents
.BEFORE_RENDER
);
4314 this.beforeRenderEvent
.subscribe
= sub
; this.beforeRenderEvent
.unsubscribe
= unsub
;
4317 * Fired when the Calendar is rendered
4318 * @event renderEvent
4320 this.renderEvent
= new YAHOO
.util
.CustomEvent(defEvents
.RENDER
);
4321 this.renderEvent
.subscribe
= sub
; this.renderEvent
.unsubscribe
= unsub
;
4324 * Fired when the Calendar is reset
4327 this.resetEvent
= new YAHOO
.util
.CustomEvent(defEvents
.RESET
);
4328 this.resetEvent
.subscribe
= sub
; this.resetEvent
.unsubscribe
= unsub
;
4331 * Fired when the Calendar is cleared
4334 this.clearEvent
= new YAHOO
.util
.CustomEvent(defEvents
.CLEAR
);
4335 this.clearEvent
.subscribe
= sub
; this.clearEvent
.unsubscribe
= unsub
;
4340 * The default Config handler for the "pages" property
4341 * @method configPages
4342 * @param {String} type The CustomEvent type (usually the property name)
4343 * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
4344 * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
4346 YAHOO
.widget
.CalendarGroup
.prototype.configPages = function(type
, args
, obj
) {
4347 var pageCount
= args
[0];
4349 var cfgPageDate
= YAHOO
.widget
.CalendarGroup
._DEFAULT_CONFIG
.PAGEDATE
.key
;
4351 // Define literals outside loop
4353 var groupCalClass
= "groupcal";
4355 var firstClass
= "first-of-type";
4356 var lastClass
= "last-of-type";
4358 for (var p
=0;p
<pageCount
;++p
) {
4359 var calId
= this.id
+ sep
+ p
;
4360 var calContainerId
= this.containerId
+ sep
+ p
;
4362 var childConfig
= this.cfg
.getConfig();
4363 childConfig
.close
= false;
4364 childConfig
.title
= false;
4366 var cal
= this.constructChild(calId
, calContainerId
, childConfig
);
4367 var caldate
= cal
.cfg
.getProperty(cfgPageDate
);
4368 this._setMonthOnDate(caldate
, caldate
.getMonth() + p
);
4369 cal
.cfg
.setProperty(cfgPageDate
, caldate
);
4371 YAHOO
.util
.Dom
.removeClass(cal
.oDomContainer
, this.Style
.CSS_SINGLE
);
4372 YAHOO
.util
.Dom
.addClass(cal
.oDomContainer
, groupCalClass
);
4375 YAHOO
.util
.Dom
.addClass(cal
.oDomContainer
, firstClass
);
4378 if (p
==(pageCount
-1)) {
4379 YAHOO
.util
.Dom
.addClass(cal
.oDomContainer
, lastClass
);
4385 this.pages
[this.pages
.length
] = cal
;
4390 * The default Config handler for the "pagedate" property
4391 * @method configPageDate
4392 * @param {String} type The CustomEvent type (usually the property name)
4393 * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
4394 * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
4396 YAHOO
.widget
.CalendarGroup
.prototype.configPageDate = function(type
, args
, obj
) {
4400 var cfgPageDate
= YAHOO
.widget
.CalendarGroup
._DEFAULT_CONFIG
.PAGEDATE
.key
;
4402 for (var p
=0;p
<this.pages
.length
;++p
) {
4403 var cal
= this.pages
[p
];
4405 firstPageDate
= cal
._parsePageDate(val
);
4406 cal
.cfg
.setProperty(cfgPageDate
, firstPageDate
);
4408 var pageDate
= new Date(firstPageDate
);
4409 this._setMonthOnDate(pageDate
, pageDate
.getMonth() + p
);
4410 cal
.cfg
.setProperty(cfgPageDate
, pageDate
);
4416 * The default Config handler for the CalendarGroup "selected" property
4417 * @method configSelected
4418 * @param {String} type The CustomEvent type (usually the property name)
4419 * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
4420 * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
4422 YAHOO
.widget
.CalendarGroup
.prototype.configSelected = function(type
, args
, obj
) {
4423 var cfgSelected
= YAHOO
.widget
.CalendarGroup
._DEFAULT_CONFIG
.SELECTED
.key
;
4424 this.delegateConfig(type
, args
, obj
);
4425 var selected
= (this.pages
.length
> 0) ? this.pages
[0].cfg
.getProperty(cfgSelected
) : [];
4426 this.cfg
.setProperty(cfgSelected
, selected
, true);
4431 * Delegates a configuration property to the CustomEvents associated with the CalendarGroup's children
4432 * @method delegateConfig
4433 * @param {String} type The CustomEvent type (usually the property name)
4434 * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
4435 * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
4437 YAHOO
.widget
.CalendarGroup
.prototype.delegateConfig = function(type
, args
, obj
) {
4441 for (var p
=0;p
<this.pages
.length
;p
++) {
4442 cal
= this.pages
[p
];
4443 cal
.cfg
.setProperty(type
, val
);
4449 * Adds a function to all child Calendars within this CalendarGroup.
4450 * @method setChildFunction
4451 * @param {String} fnName The name of the function
4452 * @param {Function} fn The function to apply to each Calendar page object
4454 YAHOO
.widget
.CalendarGroup
.prototype.setChildFunction = function(fnName
, fn
) {
4455 var pageCount
= this.cfg
.getProperty(YAHOO
.widget
.CalendarGroup
._DEFAULT_CONFIG
.PAGES
.key
);
4457 for (var p
=0;p
<pageCount
;++p
) {
4458 this.pages
[p
][fnName
] = fn
;
4463 * Calls a function within all child Calendars within this CalendarGroup.
4464 * @method callChildFunction
4465 * @param {String} fnName The name of the function
4466 * @param {Array} args The arguments to pass to the function
4468 YAHOO
.widget
.CalendarGroup
.prototype.callChildFunction = function(fnName
, args
) {
4469 var pageCount
= this.cfg
.getProperty(YAHOO
.widget
.CalendarGroup
._DEFAULT_CONFIG
.PAGES
.key
);
4471 for (var p
=0;p
<pageCount
;++p
) {
4472 var page
= this.pages
[p
];
4474 var fn
= page
[fnName
];
4475 fn
.call(page
, args
);
4481 * Constructs a child calendar. This method can be overridden if a subclassed version of the default
4482 * calendar is to be used.
4483 * @method constructChild
4484 * @param {String} id The id of the table element that will represent the calendar widget
4485 * @param {String} containerId The id of the container div element that will wrap the calendar table
4486 * @param {Object} config The configuration object containing the Calendar's arguments
4487 * @return {YAHOO.widget.Calendar} The YAHOO.widget.Calendar instance that is constructed
4489 YAHOO
.widget
.CalendarGroup
.prototype.constructChild = function(id
,containerId
,config
) {
4490 var container
= document
.getElementById(containerId
);
4492 container
= document
.createElement("div");
4493 container
.id
= containerId
;
4494 this.oDomContainer
.appendChild(container
);
4496 return new YAHOO
.widget
.Calendar(id
,containerId
,config
);
4501 * Sets the calendar group's month explicitly. This month will be set into the first
4502 * page of the multi-page calendar, and all other months will be iterated appropriately.
4504 * @param {Number} month The numeric month, from 0 (January) to 11 (December)
4506 YAHOO
.widget
.CalendarGroup
.prototype.setMonth = function(month
) {
4507 month
= parseInt(month
, 10);
4510 var cfgPageDate
= YAHOO
.widget
.CalendarGroup
._DEFAULT_CONFIG
.PAGEDATE
.key
;
4512 for (var p
=0; p
<this.pages
.length
; ++p
) {
4513 var cal
= this.pages
[p
];
4514 var pageDate
= cal
.cfg
.getProperty(cfgPageDate
);
4516 currYear
= pageDate
.getFullYear();
4518 pageDate
.setYear(currYear
);
4520 this._setMonthOnDate(pageDate
, month
+p
);
4521 cal
.cfg
.setProperty(cfgPageDate
, pageDate
);
4526 * Sets the calendar group's year explicitly. This year will be set into the first
4527 * page of the multi-page calendar, and all other months will be iterated appropriately.
4529 * @param {Number} year The numeric 4-digit year
4531 YAHOO
.widget
.CalendarGroup
.prototype.setYear = function(year
) {
4533 var cfgPageDate
= YAHOO
.widget
.CalendarGroup
._DEFAULT_CONFIG
.PAGEDATE
.key
;
4535 year
= parseInt(year
, 10);
4536 for (var p
=0;p
<this.pages
.length
;++p
) {
4537 var cal
= this.pages
[p
];
4538 var pageDate
= cal
.cfg
.getProperty(cfgPageDate
);
4540 if ((pageDate
.getMonth()+1) == 1 && p
>0) {
4547 * Calls the render function of all child calendars within the group.
4550 YAHOO
.widget
.CalendarGroup
.prototype.render = function() {
4551 this.renderHeader();
4552 for (var p
=0;p
<this.pages
.length
;++p
) {
4553 var cal
= this.pages
[p
];
4556 this.renderFooter();
4560 * Selects a date or a collection of dates on the current calendar. This method, by default,
4561 * does not call the render method explicitly. Once selection has completed, render must be
4562 * called for the changes to be reflected visually.
4564 * @param {String/Date/Date[]} date The date string of dates to select in the current calendar. Valid formats are
4565 * individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
4566 * Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
4567 * This method can also take a JavaScript Date object or an array of Date objects.
4568 * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
4570 YAHOO
.widget
.CalendarGroup
.prototype.select = function(date
) {
4571 for (var p
=0;p
<this.pages
.length
;++p
) {
4572 var cal
= this.pages
[p
];
4575 return this.getSelectedDates();
4579 * Selects dates in the CalendarGroup based on the cell index provided. This method is used to select cells without having to do a full render. The selected style is applied to the cells directly.
4580 * The value of the MULTI_SELECT Configuration attribute will determine the set of dates which get selected.
4582 * <li>If MULTI_SELECT is false, selectCell will select the cell at the specified index for only the last displayed Calendar page.</li>
4583 * <li>If MULTI_SELECT is true, selectCell will select the cell at the specified index, on each displayed Calendar page.</li>
4585 * @method selectCell
4586 * @param {Number} cellIndex The index of the cell to be selected.
4587 * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
4589 YAHOO
.widget
.CalendarGroup
.prototype.selectCell = function(cellIndex
) {
4590 for (var p
=0;p
<this.pages
.length
;++p
) {
4591 var cal
= this.pages
[p
];
4592 cal
.selectCell(cellIndex
);
4594 return this.getSelectedDates();
4598 * Deselects a date or a collection of dates on the current calendar. This method, by default,
4599 * does not call the render method explicitly. Once deselection has completed, render must be
4600 * called for the changes to be reflected visually.
4602 * @param {String/Date/Date[]} date The date string of dates to deselect in the current calendar. Valid formats are
4603 * individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
4604 * Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
4605 * This method can also take a JavaScript Date object or an array of Date objects.
4606 * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
4608 YAHOO
.widget
.CalendarGroup
.prototype.deselect = function(date
) {
4609 for (var p
=0;p
<this.pages
.length
;++p
) {
4610 var cal
= this.pages
[p
];
4613 return this.getSelectedDates();
4617 * Deselects all dates on the current calendar.
4618 * @method deselectAll
4619 * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
4620 * Assuming that this function executes properly, the return value should be an empty array.
4621 * However, the empty array is returned for the sake of being able to check the selection status
4624 YAHOO
.widget
.CalendarGroup
.prototype.deselectAll = function() {
4625 for (var p
=0;p
<this.pages
.length
;++p
) {
4626 var cal
= this.pages
[p
];
4629 return this.getSelectedDates();
4633 * Deselects dates in the CalendarGroup based on the cell index provided. This method is used to select cells without having to do a full render. The selected style is applied to the cells directly.
4634 * deselectCell will deselect the cell at the specified index on each displayed Calendar page.
4636 * @method deselectCell
4637 * @param {Number} cellIndex The index of the cell to deselect.
4638 * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
4640 YAHOO
.widget
.CalendarGroup
.prototype.deselectCell = function(cellIndex
) {
4641 for (var p
=0;p
<this.pages
.length
;++p
) {
4642 var cal
= this.pages
[p
];
4643 cal
.deselectCell(cellIndex
);
4645 return this.getSelectedDates();
4649 * Resets the calendar widget to the originally selected month and year, and
4650 * sets the calendar to the initial selection(s).
4653 YAHOO
.widget
.CalendarGroup
.prototype.reset = function() {
4654 for (var p
=0;p
<this.pages
.length
;++p
) {
4655 var cal
= this.pages
[p
];
4661 * Clears the selected dates in the current calendar widget and sets the calendar
4662 * to the current month and year.
4665 YAHOO
.widget
.CalendarGroup
.prototype.clear = function() {
4666 for (var p
=0;p
<this.pages
.length
;++p
) {
4667 var cal
= this.pages
[p
];
4673 * Navigates to the next month page in the calendar widget.
4676 YAHOO
.widget
.CalendarGroup
.prototype.nextMonth = function() {
4677 for (var p
=0;p
<this.pages
.length
;++p
) {
4678 var cal
= this.pages
[p
];
4684 * Navigates to the previous month page in the calendar widget.
4685 * @method previousMonth
4687 YAHOO
.widget
.CalendarGroup
.prototype.previousMonth = function() {
4688 for (var p
=this.pages
.length
-1;p
>=0;--p
) {
4689 var cal
= this.pages
[p
];
4690 cal
.previousMonth();
4695 * Navigates to the next year in the currently selected month in the calendar widget.
4698 YAHOO
.widget
.CalendarGroup
.prototype.nextYear = function() {
4699 for (var p
=0;p
<this.pages
.length
;++p
) {
4700 var cal
= this.pages
[p
];
4706 * Navigates to the previous year in the currently selected month in the calendar widget.
4707 * @method previousYear
4709 YAHOO
.widget
.CalendarGroup
.prototype.previousYear = function() {
4710 for (var p
=0;p
<this.pages
.length
;++p
) {
4711 var cal
= this.pages
[p
];
4718 * Gets the list of currently selected dates from the calendar.
4719 * @return An array of currently selected JavaScript Date objects.
4722 YAHOO
.widget
.CalendarGroup
.prototype.getSelectedDates = function() {
4723 var returnDates
= [];
4724 var selected
= this.cfg
.getProperty(YAHOO
.widget
.CalendarGroup
._DEFAULT_CONFIG
.SELECTED
.key
);
4725 for (var d
=0;d
<selected
.length
;++d
) {
4726 var dateArray
= selected
[d
];
4728 var date
= new Date(dateArray
[0],dateArray
[1]-1,dateArray
[2]);
4729 returnDates
.push(date
);
4732 returnDates
.sort( function(a
,b
) { return a
-b
; } );
4737 * Adds a renderer to the render stack. The function reference passed to this method will be executed
4738 * when a date cell matches the conditions specified in the date string for this renderer.
4739 * @method addRenderer
4740 * @param {String} sDates A date string to associate with the specified renderer. Valid formats
4741 * include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)
4742 * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
4744 YAHOO
.widget
.CalendarGroup
.prototype.addRenderer = function(sDates
, fnRender
) {
4745 for (var p
=0;p
<this.pages
.length
;++p
) {
4746 var cal
= this.pages
[p
];
4747 cal
.addRenderer(sDates
, fnRender
);
4752 * Adds a month to the render stack. The function reference passed to this method will be executed
4753 * when a date cell matches the month passed to this method.
4754 * @method addMonthRenderer
4755 * @param {Number} month The month (1-12) to associate with this renderer
4756 * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
4758 YAHOO
.widget
.CalendarGroup
.prototype.addMonthRenderer = function(month
, fnRender
) {
4759 for (var p
=0;p
<this.pages
.length
;++p
) {
4760 var cal
= this.pages
[p
];
4761 cal
.addMonthRenderer(month
, fnRender
);
4766 * Adds a weekday to the render stack. The function reference passed to this method will be executed
4767 * when a date cell matches the weekday passed to this method.
4768 * @method addWeekdayRenderer
4769 * @param {Number} weekday The weekday (1-7) to associate with this renderer. 1=Sunday, 2=Monday etc.
4770 * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
4772 YAHOO
.widget
.CalendarGroup
.prototype.addWeekdayRenderer = function(weekday
, fnRender
) {
4773 for (var p
=0;p
<this.pages
.length
;++p
) {
4774 var cal
= this.pages
[p
];
4775 cal
.addWeekdayRenderer(weekday
, fnRender
);
4780 * Renders the header for the CalendarGroup.
4781 * @method renderHeader
4783 YAHOO
.widget
.CalendarGroup
.prototype.renderHeader = function() {};
4786 * Renders a footer for the 2-up calendar container. By default, this method is
4788 * @method renderFooter
4790 YAHOO
.widget
.CalendarGroup
.prototype.renderFooter = function() {};
4793 * Adds the designated number of months to the current calendar month, and sets the current
4794 * calendar page date to the new month.
4796 * @param {Number} count The number of months to add to the current calendar
4798 YAHOO
.widget
.CalendarGroup
.prototype.addMonths = function(count
) {
4799 this.callChildFunction("addMonths", count
);
4804 * Subtracts the designated number of months from the current calendar month, and sets the current
4805 * calendar page date to the new month.
4806 * @method subtractMonths
4807 * @param {Number} count The number of months to subtract from the current calendar
4809 YAHOO
.widget
.CalendarGroup
.prototype.subtractMonths = function(count
) {
4810 this.callChildFunction("subtractMonths", count
);
4814 * Adds the designated number of years to the current calendar, and sets the current
4815 * calendar page date to the new month.
4817 * @param {Number} count The number of years to add to the current calendar
4819 YAHOO
.widget
.CalendarGroup
.prototype.addYears = function(count
) {
4820 this.callChildFunction("addYears", count
);
4824 * Subtcats the designated number of years from the current calendar, and sets the current
4825 * calendar page date to the new month.
4826 * @method subtractYears
4827 * @param {Number} count The number of years to subtract from the current calendar
4829 YAHOO
.widget
.CalendarGroup
.prototype.subtractYears = function(count
) {
4830 this.callChildFunction("subtractYears", count
);
4834 * Shows the CalendarGroup's outer container.
4837 YAHOO
.widget
.CalendarGroup
.prototype.show = function() {
4838 this.oDomContainer
.style
.display
= "block";
4839 if (YAHOO
.env
.ua
.opera
) {
4845 * Sets the month on a Date object, taking into account year rollover if the month is less than 0 or greater than 11.
4846 * The Date object passed in is modified. It should be cloned before passing it into this method if the original value needs to be maintained
4847 * @method _setMonthOnDate
4849 * @param {Date} date The Date object on which to set the month index
4850 * @param {Number} iMonth The month index to set
4852 YAHOO
.widget
.CalendarGroup
.prototype._setMonthOnDate = function(date
, iMonth
) {
4853 // Bug in Safari 1.3, 2.0 (WebKit build < 420), Date.setMonth does not work consistently if iMonth is not 0-11
4854 if (YAHOO
.env
.ua
.webkit
&& YAHOO
.env
.ua
.webkit
< 420 && (iMonth
< 0 || iMonth
> 11)) {
4855 var DM
= YAHOO
.widget
.DateMath
;
4856 var newDate
= DM
.add(date
, DM
.MONTH
, iMonth
-date
.getMonth());
4857 date
.setTime(newDate
.getTime());
4859 date
.setMonth(iMonth
);
4864 * Fixes the width of the CalendarGroup container element, to account for miswrapped floats
4868 YAHOO
.widget
.CalendarGroup
.prototype._fixWidth = function() {
4869 var startW
= this.oDomContainer
.offsetWidth
;
4871 for (var p
=0;p
<this.pages
.length
;++p
) {
4872 var cal
= this.pages
[p
];
4873 w
+= cal
.oDomContainer
.offsetWidth
;
4876 this.oDomContainer
.style
.width
= w
+ "px";
4882 * CSS class representing the container for the calendar
4883 * @property YAHOO.widget.CalendarGroup.CSS_CONTAINER
4888 YAHOO
.widget
.CalendarGroup
.CSS_CONTAINER
= "yui-calcontainer";
4891 * CSS class representing the container for the calendar
4892 * @property YAHOO.widget.CalendarGroup.CSS_MULTI_UP
4897 YAHOO
.widget
.CalendarGroup
.CSS_MULTI_UP
= "multi";
4900 * CSS class representing the title for the 2-up calendar
4901 * @property YAHOO.widget.CalendarGroup.CSS_2UPTITLE
4906 YAHOO
.widget
.CalendarGroup
.CSS_2UPTITLE
= "title";
4909 * CSS class representing the close icon for the 2-up calendar
4910 * @property YAHOO.widget.CalendarGroup.CSS_2UPCLOSE
4913 * @deprecated Along with Calendar.IMG_ROOT and NAV_ARROW_LEFT, NAV_ARROW_RIGHT configuration properties.
4914 * Calendar's <a href="YAHOO.widget.Calendar.html#Style.CSS_CLOSE">Style.CSS_CLOSE</a> property now represents the CSS class used to render the close icon
4917 YAHOO
.widget
.CalendarGroup
.CSS_2UPCLOSE
= "close-icon";
4919 YAHOO
.lang
.augmentProto(YAHOO
.widget
.CalendarGroup
, YAHOO
.widget
.Calendar
, "buildDayLabel",
4921 "renderOutOfBoundsDate",
4924 "renderCellDefault",
4926 "renderCellStyleHighlight1",
4927 "renderCellStyleHighlight2",
4928 "renderCellStyleHighlight3",
4929 "renderCellStyleHighlight4",
4930 "renderCellStyleToday",
4931 "renderCellStyleSelected",
4932 "renderCellNotThisMonth",
4933 "renderBodyCellRestricted",
4942 * The set of default Config property keys and values for the CalendarGroup
4943 * @property YAHOO.widget.CalendarGroup._DEFAULT_CONFIG
4949 YAHOO
.widget
.CalendarGroup
._DEFAULT_CONFIG
= YAHOO
.widget
.Calendar
._DEFAULT_CONFIG
;
4950 YAHOO
.widget
.CalendarGroup
._DEFAULT_CONFIG
.PAGES
= {key
:"pages", value
:2};
4953 * Returns a string representation of the object.
4955 * @return {String} A string representation of the CalendarGroup object.
4957 YAHOO
.widget
.CalendarGroup
.prototype.toString = function() {
4958 return "CalendarGroup " + this.id
;
4961 YAHOO
.widget
.CalGrp
= YAHOO
.widget
.CalendarGroup
;
4964 * @class YAHOO.widget.Calendar2up
4965 * @extends YAHOO.widget.CalendarGroup
4966 * @deprecated The old Calendar2up class is no longer necessary, since CalendarGroup renders in a 2up view by default.
4968 YAHOO
.widget
.Calendar2up = function(id
, containerId
, config
) {
4969 this.init(id
, containerId
, config
);
4972 YAHOO
.extend(YAHOO
.widget
.Calendar2up
, YAHOO
.widget
.CalendarGroup
);
4975 * @deprecated The old Calendar2up class is no longer necessary, since CalendarGroup renders in a 2up view by default.
4977 YAHOO
.widget
.Cal2up
= YAHOO
.widget
.Calendar2up
;
4979 YAHOO
.register("calendar", YAHOO
.widget
.Calendar
, {version
: "2.3.0", build
: "442"});