calendar-base-debug.js revision 528126a57f0c28ce4de35bb3c4c4cbfbb52a36e7
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'AmoreYUI.add('calendar-base', function(Y) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore/**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The CalendarBase submodule is a basic UI calendar view that displays
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * a range of dates in a two-dimensional month grid, with one or more
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * months visible at a single time. CalendarBase supports custom date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * rendering, multiple calendar panes, and selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @module calendar
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @submodule calendar-base
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amorevar getCN = Y.ClassNameManager.getClassName,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CALENDAR = 'calendar',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_GRID = getCN(CALENDAR, 'grid'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_LEFT_GRID = getCN(CALENDAR, 'left-grid'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_RIGHT_GRID = getCN(CALENDAR, 'right-grid'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_BODY = getCN(CALENDAR, 'body'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_HD = getCN(CALENDAR, 'header'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_HD_LABEL = getCN(CALENDAR, 'header-label'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_WDAYROW = getCN(CALENDAR, 'weekdayrow'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_WDAY = getCN(CALENDAR, 'weekday'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_COL_HIDDEN = getCN(CALENDAR, 'column-hidden'),
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer CAL_DAY_SELECTED = getCN(CALENDAR, 'day-selected'),
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok SELECTION_DISABLED = getCN(CALENDAR, 'selection-disabled'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_ROW = getCN(CALENDAR, 'row'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_DAY = getCN(CALENDAR, 'day'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_PREVMONTH_DAY = getCN(CALENDAR, 'prevmonth-day'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_NEXTMONTH_DAY = getCN(CALENDAR, 'nextmonth-day'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_ANCHOR = getCN(CALENDAR, 'anchor'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_PANE = getCN(CALENDAR, 'pane'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CAL_STATUS = getCN(CALENDAR, 'status'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore L = Y.Lang,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore node = Y.Node,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore create = node.create,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore substitute = Y.substitute,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore each = Y.each,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore hasVal = Y.Array.hasValue,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore iOf = Y.Array.indexOf,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore hasKey = Y.Object.hasKey,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore setVal = Y.Object.setValue,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore owns = Y.Object.owns,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore isEmpty = Y.Object.isEmpty,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore ydate = Y.DataType.Date;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore/** Create a calendar view to represent a single or multiple
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * month range of dates, rendered as a grid with date and
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * weekday labels.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @class CalendarBase
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @extends Widget
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param config {Object} Configuration object (see Configuration
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * attributes)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @constructor
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amorefunction CalendarBase(config) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CalendarBase.superclass.constructor.apply ( this, arguments );
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore}
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'AmoreY.CalendarBase = Y.extend( CalendarBase, Y.Widget, {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A storage for various properties of individual month
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * panes.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property _paneProperties
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Object
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _paneProperties : {},
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The number of month panes in the calendar, deduced
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * from the CONTENT_TEMPLATE's number of {calendar_grid}
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * tokens.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property _paneNumber
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Number
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _paneNumber : 1,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The unique id used to prefix various elements of this
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * calendar instance.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property _calendarId
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _calendarId : null,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * The hash map of selected dates, populated with
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * selectDates() and deselectDates() methods
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer *
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * @property _selectedDates
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * @type Object
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _selectedDates : {},
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * A private copy of the rules object, populated
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * by setting the customRenderer attribute.
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore *
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @property _rules
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @type Object
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @private
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _rules : {},
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A private copy of the filterFunction, populated
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * by setting the customRenderer attribute.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property _filterFunction
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Function
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _filterFunction : null,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Storage for calendar cells modified by any custom
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * formatting. The storage is cleared, used to restore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * cells to the original state, and repopulated accordingly
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * when the calendar is rerendered.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property _storedDateCells
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Object
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _storedDateCells : {},
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Designated initializer
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Initializes instance-level properties of
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method initializer
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore initializer : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties = {};
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._calendarId = Y.guid('calendar');
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._selectedDates = {};
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._rules = {};
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._storedDateCells = {};
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * renderUI implementation
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Creates a visual representation of the calendar based on existing parameters.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method renderUI
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore renderUI : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var contentBox = this.get('contentBox');
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore contentBox.appendChild(this._initCalendarHTML(this.get('date')));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (this.get('showPrevMonth')) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._afterShowPrevMonthChange();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (this.get('showNextMonth')) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._afterShowNextMonthChange();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._renderCustomRules();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._renderSelectedDates();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.get("boundingBox").setAttribute("aria-labelledby", this._calendarId + "_header");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * bindUI implementation
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Assigns listeners to relevant events that change the state
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * of the calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method bindUI
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore bindUI : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('dateChange', this._afterDateChange);
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer this.after('showPrevMonthChange', this._afterShowPrevMonthChange);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('showNextMonthChange', this._afterShowNextMonthChange);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('headerRendererChange', this._afterHeaderRendererChange);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('customRendererChange', this._afterCustomRendererChange);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('enabledDatesRuleChange', this._afterCustomRendererChange);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('disabledDatesRuleChange', this._afterCustomRendererChange);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.after('focusedChange', this._afterFocusedChange);
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer this._bindCalendarEvents();
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer },
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer /**
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * syncUI implementation
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer *
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * Update the scroll position, based on the current value of scrollY
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * @method syncUI
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer */
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore syncUI : function () {
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore if (this.get('showPrevMonth')) {
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore this._afterShowPrevMonthChange();
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore }
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore if (this.get('showNextMonth')) {
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore this._afterShowNextMonthChange();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _afterFocusedChange : function (ev) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (ev.newVal) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CalendarBase.updateStatus("Calendar with two month panes, currently set to " + ydate.format(this.get("date"), {format:"%B %Y"}));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * An internal utility method that generates a list of selected dates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * from the hash storage.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _getSelectedDatesList
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Array} The array of `Date`s that are currently selected.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _getSelectedDatesList : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var output = [];
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore each (this._selectedDates, function (year) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore each (year, function (month) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore each (month, function (day) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore output.push (day);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }, this);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }, this);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }, this);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return output;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that returns all dates selected in a specific month.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _getSelectedDatesInMonth
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate corresponding to the month for which selected dates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * are requested.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Array} The array of `Date`s in a given month that are currently selected.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _getSelectedDatesInMonth : function (oDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var year = oDate.getFullYear(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore month = oDate.getMonth();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (hasKey(this._selectedDates, year) && hasKey(this._selectedDates[year], month)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return Y.Object.values(this._selectedDates[year][month]);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return [];
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * An internal rendering method that modifies a date cell to have the
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * selected CSS class if the date cell is visible.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _renderSelectedDate
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date corresponding to a specific date cell.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _renderSelectedDate : function (oDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (this._isDateVisible(oDate)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._dateToNode(oDate).addClass(CAL_DAY_SELECTED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * An internal rendering method that modifies a date cell to remove the
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * selected CSS class if the date cell is visible.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _renderUnelectedDate
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date corresponding to a specific date cell.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _renderUnselectedDate : function (oDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (this._isDateVisible(oDate)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._dateToNode(oDate).removeClass(CAL_DAY_SELECTED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * An internal utility method that checks whether a particular date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * is in the current view of the calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _isDateVisible
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date corresponding to a specific date cell.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {boolean} Returns true if the given date is in the current
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * view of the calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _isDateVisible : function (oDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var minDate = this.get("date"),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore maxDate = ydate.addMonths(minDate, this._paneNumber - 1),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore oDateTime = this._normalizeDate(oDate).getTime();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (minDate.getTime() <= oDateTime && oDateTime <= maxDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return true;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return false;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * An internal parsing method that receives a String list of numbers
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * and number ranges (of the form "1,2,3,4-6,7-9,10,11" etc.) and checks
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * whether a specific number is included in this list. Used for looking
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * up dates in the customRenderer rule set.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _isNumInList
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Number} num The number to look for in a list.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {String} strList The list of numbers of the form "1,2,3,4-6,7-8,9", etc.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {boolean} Returns true if the given number is in the given list.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _isNumInList : function (num, strList) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (strList == "all") {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return true;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var elements = strList.split(",");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var val = 0, len = elements.length; val < len; val++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var range = elements[val].split("-");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (range.length == 2 && num >= parseInt(range[0], 10) && num <= parseInt(range[1], 10)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return true;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else if (range.length == 1 && (parseInt(elements[val], 10) == num)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return true;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return false;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Given a specific date, returns an array of rules (from the customRenderer rule set)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * that the given date matches.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _getRulesForDate
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date for which an array of rules is needed
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Array} Returns an array of `String`s, each containg the name of
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * a rule that the given date matches.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _getRulesForDate : function (oDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var year = oDate.getFullYear(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore month = oDate.getMonth(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore date = oDate.getDate(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore wday = oDate.getDay(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore rules = this._rules,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore outputRules = [],
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore years, months, dates, days;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (years in rules) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (this._isNumInList(year, years)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (L.isString(rules[years])) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore outputRules.push(rules[years]);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (months in rules[years]) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (this._isNumInList(month, months)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (L.isString(rules[years][months])) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore outputRules.push(rules[years][months]);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (dates in rules[years][months]) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (this._isNumInList(date, dates)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (L.isString(rules[years][months][dates])) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore outputRules.push(rules[years][months][dates]);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (days in rules[years][months][dates]) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (this._isNumInList(wday, days)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (L.isString(rules[years][months][dates][days])) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore outputRules.push(rules[years][months][dates][days]);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore }
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return outputRules;
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method which, given a specific date and a name of the rule,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * checks whether the date matches the given rule.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _matchesRule
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date to check
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @param {String} rule The name of the rule that the date should match.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {boolean} Returns true if the date matches the given rule.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _matchesRule : function (oDate, rule) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return (iOf(this._getRulesForDate(oDate), rule) >= 0);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method which checks whether a given date matches the `enabledDatesRule`
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * or does not match the `disabledDatesRule` and therefore whether it can be selected.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _canBeSelected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date to check
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {boolean} Returns true if the date can be selected; false otherwise.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _canBeSelected : function (oDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore var enabledDatesRule = this.get("enabledDatesRule"),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore disabledDatesRule = this.get("disabledDatesRule");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (enabledDatesRule) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return this._matchesRule(oDate, enabledDatesRule);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else if (disabledDatesRule) {
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore return !this._matchesRule(oDate, disabledDatesRule);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return true;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Selects a given date or array of dates.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method selectDates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date|Array} dates A `Date` or `Array` of `Date`s.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore selectDates : function (dates) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (ydate.isValidDate(dates)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._addDateToSelection(dates);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else if (L.isArray(dates)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._addDatesToSelection(dates);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Deselects a given date or array of dates, or deselects
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * all dates if no argument is specified.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method deselectDates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date|Array} [dates] A `Date` or `Array` of `Date`s, or no
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * argument if all dates should be deselected.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore deselectDates : function (dates) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (dates == null) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._clearSelection();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore else if (ydate.isValidDate(dates)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._removeDateFromSelection(dates);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else if (L.isArray(dates)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._removeDatesFromSelection(dates);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that adds a given date to selection..
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _addDateToSelection
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date to add to selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Number} [index] An optional parameter that is used
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * to differentiate between individual date selections and multiple
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * date selections.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _addDateToSelection : function (oDate, index) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (this._canBeSelected(oDate)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var year = oDate.getFullYear(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore month = oDate.getMonth(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore day = oDate.getDate();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (hasKey(this._selectedDates, year)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (hasKey(this._selectedDates[year], month)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._selectedDates[year][month][day] = oDate;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._selectedDates[year][month] = {};
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._selectedDates[year][month][day] = oDate;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._selectedDates[year] = {};
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore this._selectedDates[year][month] = {};
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore this._selectedDates[year][month][day] = oDate;
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore }
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore this._selectedDates = setVal(this._selectedDates, [year, month, day], oDate);
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore this._renderSelectedDate(oDate);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (index == null) {
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore this._fireSelectionChange();
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore }
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore }
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore },
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that adds a given list of dates to selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _addDatesToSelection
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @param {Array} datesArray The list of dates to add to selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _addDatesToSelection : function (datesArray) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore each(datesArray, this._addDateToSelection, this);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._fireSelectionChange();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that adds a given range of dates to selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _addDateRangeToSelection
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} startDate The first date of the given range.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} endDate The last date of the given range.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _addDateRangeToSelection : function (startDate, endDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var timezoneDifference = (endDate.getTimezoneOffset() - startDate.getTimezoneOffset())*60000,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore startTime = startDate.getTime(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore endTime = endDate.getTime();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (startTime > endTime) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var tempTime = startTime;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore startTime = endTime;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore endTime = tempTime + timezoneDifference;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore endTime = endTime - timezoneDifference;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var time = startTime; time <= endTime; time += 86400000) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var addedDate = new Date(time);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore addedDate.setHours(12);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._addDateToSelection(addedDate, time);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._fireSelectionChange();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that removes a given date from selection..
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @method _removeDateFromSelection
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @param {Date} oDate The date to remove from selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Number} [index] An optional parameter that is used
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * to differentiate between individual date selections and multiple
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * date selections.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _removeDateFromSelection : function (oDate, index) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var year = oDate.getFullYear(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore month = oDate.getMonth(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore day = oDate.getDate();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (hasKey(this._selectedDates, year) &&
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore hasKey(this._selectedDates[year], month) &&
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore hasKey(this._selectedDates[year][month], day)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore delete this._selectedDates[year][month][day];
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._renderUnselectedDate(oDate);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (index == null) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._fireSelectionChange();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that removes a given list of dates from selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _removeDatesFromSelection
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Array} datesArray The list of dates to remove from selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _removeDatesFromSelection : function (datesArray) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore each(datesArray, this._removeDateDromSelection);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._fireSelectionChange();
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore },
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that removes a given range of dates from selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _removeDateRangeFromSelection
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} startDate The first date of the given range.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} endDate The last date of the given range.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _removeDateRangeFromSelection : function (startDate, endDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var startTime = startDate.getTime(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore endTime = endDate.getTime();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var time = startTime; time <= endTime; time += 86400000) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._removeDateFromSelection(new Date(time), time);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._fireSelectionChange();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that removes all dates from selection.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _clearSelection
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {boolean} noevent A Boolean specifying whether a selectionChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * event should be fired.
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _clearSelection : function (noevent) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._selectedDates = {};
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.get("contentBox").all("." + CAL_DAY_SELECTED).removeClass(CAL_DAY_SELECTED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (!noevent) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._fireSelectionChange();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that fires a selectionChange event.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _fireSelectionChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _fireSelectionChange : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Fired when the set of selected dates changes. Contains a payload with
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * a `newSelection` property with an array of selected dates.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @event selectionChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.fire("selectionChange", {newSelection: this._getSelectedDatesList()});
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that restores cells modified by custom formatting.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _restoreModifiedCells
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _restoreModifiedCells : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var contentbox = this.get("contentBox"),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore id;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (id in this._storedDateCells) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore contentbox.one("#" + id).replace(this._storedDateCells[id]);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore delete this._storedDateCells[id];
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that renders all cells modified by the customRenderer
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * rules, as well as the enabledDatesRule and disabledDatesRule.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _renderCustomRules
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _renderCustomRules : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.get("contentBox").all("." + CAL_DAY + ",." + CAL_NEXTMONTH_DAY).removeClass(SELECTION_DISABLED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (!isEmpty(this._rules)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var enRule = this.get("enabledDatesRule"),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore disRule = this.get("disabledDatesRule");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var paneNum = 0; paneNum < this._paneNumber; paneNum++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var paneDate = ydate.addMonths(this.get("date"), paneNum);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var dateArray = ydate.listOfDatesInMonth(paneDate);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore each(dateArray, function (date) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var matchingRules = this._getRulesForDate(date);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (matchingRules.length > 0) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var dateNode = this._dateToNode(date);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if ((enRule && iOf(matchingRules, enRule) < 0) || (!enRule && disRule && iOf(matchingRules, disRule) >= 0)) {
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore dateNode.addClass(SELECTION_DISABLED);
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore }
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore if (L.isFunction(this._filterFunction)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._storedDateCells[dateNode.get("id")] = dateNode.cloneNode(true);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._filterFunction (date, dateNode, matchingRules);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else if (enRule) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var dateNode = this._dateToNode(date);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore dateNode.addClass(SELECTION_DISABLED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore }
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that renders all cells that are currently selected.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _renderSelectedDates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _renderSelectedDates : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this.get("contentBox").all("." + CAL_DAY_SELECTED).removeClass(CAL_DAY_SELECTED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var paneNum = 0; paneNum < this._paneNumber; paneNum++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var paneDate = ydate.addMonths(this.get("date"), paneNum);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var dateArray = this._getSelectedDatesInMonth(paneDate);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore each(dateArray, function (date) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._dateToNode(date).addClass(CAL_DAY_SELECTED);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that converts a date to the node wrapping the calendar cell
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * the date corresponds to..
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _dateToNode
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date to convert to Node
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Node} The node wrapping the DOM element of the cell the date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * corresponds to.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _dateToNode : function (oDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var day = oDate.getDate(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 0,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore daymod = day%7,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore paneNum = (12 + oDate.getMonth() - this.get("date").getMonth()) % 12,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore paneId = this._calendarId + "_pane_" + paneNum,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore cutoffCol = this._paneProperties[paneId].cutoffCol;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore switch (daymod) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore case (0):
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (cutoffCol >= 6) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 12;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 5;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore break;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore case (1):
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 6;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore break;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore case (2):
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (cutoffCol > 0) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 7;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 0;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore break;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore case (3):
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (cutoffCol > 1) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 8;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 1;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore break;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore case (4):
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (cutoffCol > 2) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 9;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 2;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore break;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore case (5):
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (cutoffCol > 3) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 10;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 3;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore break;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore case (6):
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (cutoffCol > 4) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 11;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore col = 4;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore break;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return(this.get("contentBox").one("#" + this._calendarId + "_pane_" + paneNum + "_" + col + "_" + day));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that converts a node corresponding to the DOM element of
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * the cell for a particular date to that date.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _nodeToDate
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} oNode The Node wrapping the DOM element of a particular date cell.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Date} The date corresponding to the DOM element that the given node wraps.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _nodeToDate : function (oNode) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var idParts = oNode.get("id").split("_").reverse(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore paneNum = parseInt(idParts[2], 10),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore day = parseInt(idParts[0], 10);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var shiftedDate = ydate.addMonths(this.get("date"), paneNum),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore year = shiftedDate.getFullYear(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore month = shiftedDate.getMonth();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return new Date(year, month, day, 12, 0, 0, 0);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A placeholder method, called from bindUI, to bind the Calendar events.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _bindCalendarEvents
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _bindCalendarEvents : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A utility method that normalizes a given date by converting it to the 1st
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * day of the month the date is in, with the time set to noon.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _normalizeDate
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} oDate The date to normalize
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Date} The normalized date, set to the first of the month, with time
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * set to noon.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _normalizeDate : function (date) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (date != null) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return new Date(date.getFullYear(), date.getMonth(), 1, 12, 0, 0, 0);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return null;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A render assist utility method that computes the cutoff column for the calendar
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * rendering mask.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _getCutoffColumn
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} date The date of the month grid to compute the cutoff column for.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Number} firstday The first day of the week (modified by internationalized calendars)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @return {Number} The number of the cutoff column.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _getCutoffColumn : function (date, firstday) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var distance = this._normalizeDate(date).getDay() - firstday;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var cutOffColumn = 6 - (distance + 7)%7;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return cutOffColumn;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A render assist method that turns on the view of the previous month's dates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * in a given calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _turnPrevMonthOn
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} pane The calendar pane that needs its previous month's dates view
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * modified.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _turnPrevMonthOn : function (pane) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var pane_id = pane.get("id"),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane_date = this._paneProperties[pane_id].paneDate,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore daysInPrevMonth = ydate.daysInMonth(ydate.addMonths(pane_date, -1));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (!this._paneProperties[pane_id].hasOwnProperty("daysInPrevMonth")) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[pane_id].daysInPrevMonth = 0;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (daysInPrevMonth != this._paneProperties[pane_id].daysInPrevMonth) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[pane_id].daysInPrevMonth = daysInPrevMonth;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var cell = 5; cell >= 0; cell--)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_" + cell + "_" + (cell-5)).set('text', daysInPrevMonth--);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A render assist method that turns off the view of the previous month's dates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * in a given calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _turnPrevMonthOff
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} pane The calendar pane that needs its previous month's dates view
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * modified.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _turnPrevMonthOff : function (pane) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var pane_id = pane.get("id");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[pane_id].daysInPrevMonth = 0;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var cell = 5; cell >= 0; cell--)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_" + cell + "_" + (cell-5)).setContent("&nbsp;");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A render assist method that cleans up the last few cells in the month grid
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * when the number of days in the month changes.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _cleanUpNextMonthCells
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} pane The calendar pane that needs the last date cells cleaned up.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _cleanUpNextMonthCells : function (pane) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var pane_id = pane.get("id");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_6_29").removeClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_7_30").removeClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_8_31").removeClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_0_30").removeClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_1_31").removeClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A render assist method that turns on the view of the next month's dates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * in a given calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _turnNextMonthOn
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} pane The calendar pane that needs its next month's dates view
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * modified.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer */
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer _turnNextMonthOn : function (pane) {
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer var dayCounter = 1,
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer pane_id = pane.get("id"),
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer daysInMonth = this._paneProperties[pane_id].daysInMonth,
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer cutoffCol = this._paneProperties[pane_id].cutoffCol;
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer for (var cell = daysInMonth - 22; cell < cutoffCol + 7; cell++)
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer {
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer pane.one("#" + pane_id + "_" + cell + "_" + (cell+23)).set("text", dayCounter++).addClass(CAL_NEXTMONTH_DAY);
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer }
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer var startingCell = cutoffCol;
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer if (daysInMonth == 31 && (cutoffCol <= 1)) {
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer startingCell = 2;
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer }
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer else if (daysInMonth== 30 && cutoffCol == 0) {
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer startingCell = 1;
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer }
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer for (var cell = startingCell ; cell < cutoffCol + 7; cell++) {
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer pane.one("#" + pane_id + "_" + cell + "_" + (cell+30)).set("text", dayCounter++).addClass(CAL_NEXTMONTH_DAY);
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer }
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer },
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer /**
ace3c3ff753a94432e3a936c2931b81a66cd03d1Venugopal Iyer * A render assist method that turns off the view of the next month's dates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * in a given calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _turnNextMonthOff
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} pane The calendar pane that needs its next month's dates view
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * modified.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _turnNextMonthOff : function (pane) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var pane_id = pane.get("id"),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore daysInMonth = this._paneProperties[pane_id].daysInMonth,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore cutoffCol = this._paneProperties[pane_id].cutoffCol;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var cell = daysInMonth - 22; cell <= 12; cell++)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_" + cell + "_" + (cell+23)).setContent("&nbsp;").addClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var startingCell = 0;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (daysInMonth == 31 && (cutoffCol <= 1)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore startingCell = 2;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else if (daysInMonth == 30 && cutoffCol == 0) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore startingCell = 1;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var cell = startingCell ; cell <= 12; cell++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.one("#" + pane_id + "_" + cell + "_" + (cell+30)).setContent("&nbsp;").addClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The handler for the change in the showNextMonth attribute.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _afterShowNextMonthChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _afterShowNextMonthChange : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var contentBox = this.get('contentBox'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore lastPane = contentBox.one("#" + this._calendarId + "_pane_" + (this._paneNumber - 1));
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok this._cleanUpNextMonthCells(lastPane);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (this.get('showNextMonth')) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._turnNextMonthOn(lastPane);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore this._turnNextMonthOff(lastPane);
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore }
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The handler for the change in the showPrevMonth attribute.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _afterShowPrevMonthChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _afterShowPrevMonthChange : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var contentBox = this.get('contentBox'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore firstPane = contentBox.one("#" + this._calendarId + "_pane_" + 0);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (this.get('showPrevMonth')) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._turnPrevMonthOn(firstPane);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._turnPrevMonthOff(firstPane);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The handler for the change in the headerRenderer attribute.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _afterHeaderRendererChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _afterHeaderRendererChange : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var headerCell = this.get('contentBox').one("." + CAL_HD);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerCell.setContent(this._updateCalendarHeader(this.get('date')));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The handler for the change in the customRenderer attribute.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _afterCustomRendererChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _afterCustomRendererChange : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._restoreModifiedCells();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._renderCustomRules();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok * The handler for the change in the date attribute. Modifies the calendar
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * view by shifting the calendar grid mask and running custom rendering and
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * selection rendering as necessary.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _afterDateChange
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _afterDateChange : function () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var contentBox = this.get('contentBox'),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerCell = contentBox.one("." + CAL_HD).one("." + CAL_HD_LABEL),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendarPanes = contentBox.all("." + CAL_GRID),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore currentDate = this.get("date"),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore counter = 0;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore contentBox.setStyle("visibility", "hidden");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerCell.setContent(this._updateCalendarHeader(currentDate));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._restoreModifiedCells();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendarPanes.each(function (curNode) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._rerenderCalendarPane(ydate.addMonths(currentDate, counter++),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curNode);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }, this);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._afterShowPrevMonthChange();
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok this._afterShowNextMonthChange();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._renderCustomRules();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._renderSelectedDates();
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore contentBox.setStyle("visibility", "visible");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that initializes the HTML for a single
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _initCalendarPane
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} baseDate The date corresponding to the month of the given
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {String} pane_id The id of the pane, to be used as a prefix for
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * element ids in the given pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _initCalendarPane : function (baseDate, pane_id) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Initialize final output HTML string
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var calString = '',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Get a list of short weekdays from the internationalization package, or else use default English ones.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore weekdays = this.get('strings.very_short_weekdays') || ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore fullweekdays = this.get('strings.weekdays') || ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok // Get the first day of the week from the internationalization package, or else use Sunday as default.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore firstday = this.get('strings.first_weekday') || 0,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Compute the cutoff column of the masked calendar table, based on the start date and the first day of week.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore cutoffCol = this._getCutoffColumn(baseDate, firstday),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Compute the number of days in the month based on starting date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore daysInMonth = ydate.daysInMonth(baseDate),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Initialize the array of individual row HTML strings
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore row_array = ['','','','','',''],
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Initialize the partial templates object
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials = {};
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Initialize the partial template for the weekday row cells.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["weekday_row"] = '';
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Populate the partial template for the weekday row cells with weekday names
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var day = firstday; day <= firstday + 6; day++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["weekday_row"] +=
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore substitute(CalendarBase.WEEKDAY_TEMPLATE,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore {weekdayname: weekdays[day%7],
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore full_weekdayname: fullweekdays[day%7]});
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Populate the partial template for the weekday row container with the weekday row cells
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["weekday_row_template"] = substitute(CalendarBase.WEEKDAY_ROW_TEMPLATE, partials);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Populate the array of individual row HTML strings
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var row = 0; row <= 5; row++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var column = 0; column <= 12; column++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Compute the value of the date that needs to populate the cell
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var date = 7*row - 5 + column;
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Compose the value of the unique id of the current calendar cell
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var id_date = pane_id + "_" + column + "_" + date;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Set the calendar day class to one of three possible values
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var calendar_day_class = CAL_DAY;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (date < 1) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_day_class = CAL_PREVMONTH_DAY;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else if (date > daysInMonth) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_day_class = CAL_NEXTMONTH_DAY;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Cut off dates that fall before the first and after the last date of the month
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (date < 1 || date > daysInMonth) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore date = "&nbsp;";
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Decide on whether a column in the masked table is visible or not based on the value of the cutoff column.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var column_visibility = (column >= cutoffCol && column < (cutoffCol + 7)) ? '' : CAL_COL_HIDDEN;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Substitute the values into the partial calendar day template and add it to the current row HTML string
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore row_array[row] += substitute (CalendarBase.CALDAY_TEMPLATE,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore {day_content: date,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_col_class: "calendar_col" + column,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_col_visibility_class: column_visibility,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_day_class: calendar_day_class,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_day_id: id_date});
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Instantiate the partial calendar pane body template
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["body_template"] = '';
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Populate the body template with the rows templates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore each (row_array, function (v) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["body_template"] += substitute(CalendarBase.CALDAY_ROW_TEMPLATE,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore {calday_row: v});
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore });
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Populate the calendar grid id
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["calendar_pane_id"] = pane_id;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Populate the calendar pane tabindex
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["calendar_pane_tabindex"] = this.get("tabIndex");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["pane_arialabel"] = ydate.format(baseDate, {format:"%B %Y"});
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Generate final output by substituting class names.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var output = substitute(substitute (CalendarBase.CALENDAR_GRID_TEMPLATE, partials),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CalendarBase.CALENDAR_STRINGS);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Store the initialized pane information
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[pane_id] = {cutoffCol: cutoffCol, daysInMonth: daysInMonth, paneDate: baseDate};
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return output;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that rerenders a specified calendar pane, based
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * on a new Date.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _rerenderCalendarPane
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} newDate The date corresponding to the month of the given
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * calendar pane.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Node} pane The node corresponding to the calendar pane to be rerenders.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _rerenderCalendarPane : function (newDate, pane) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Get the first day of the week from the internationalization package, or else use Sunday as default.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var firstday = this.get('strings.first_weekday') || 0,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Compute the cutoff column of the masked calendar table, based on the start date and the first day of week.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore cutoffCol = this._getCutoffColumn(newDate, firstday),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Compute the number of days in the month based on starting date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore daysInMonth = ydate.daysInMonth(newDate),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Get pane id for easier reference
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore paneId = pane.get("id");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Hide the pane before making DOM changes to speed them up
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.setStyle("visibility", "hidden");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.setAttribute("aria-label", ydate.format(newDate, {format:"%B %Y"}));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Go through all columns, and flip their visibility setting based on whether they are within the unmasked range.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore for (var column = 0; column <= 12; column++) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var currentColumn = pane.all("." + "calendar_col" + column);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore currentColumn.removeClass(CAL_COL_HIDDEN);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (column < cutoffCol || column >= (cutoffCol + 7)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore currentColumn.addClass(CAL_COL_HIDDEN);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Clean up dates in visible columns to account for the correct number of days in a month
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore switch(column)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore case 0:
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var curCell = pane.one("#" + paneId + "_0_30");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (daysInMonth >= 30) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.set("text", "30");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_NEXTMONTH_DAY).addClass(CAL_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.setContent("&nbsp;");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.addClass(CAL_NEXTMONTH_DAY).addClass(CAL_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore break;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore case 1:
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var curCell = pane.one("#" + paneId + "_1_31");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (daysInMonth >= 31) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.set("text", "31");
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok curCell.removeClass(CAL_NEXTMONTH_DAY).addClass(CAL_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.setContent("&nbsp;");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_DAY).addClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore break;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore case 6:
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var curCell = pane.one("#" + paneId + "_6_29");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (daysInMonth >= 29) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.set("text", "29");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_NEXTMONTH_DAY).addClass(CAL_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.setContent("&nbsp;");
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok curCell.removeClass(CAL_DAY).addClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore break;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore case 7:
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var curCell = pane.one("#" + paneId + "_7_30");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (daysInMonth >= 30) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.set("text", "30");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_NEXTMONTH_DAY).addClass(CAL_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.setContent("&nbsp;");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_DAY).addClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore break;
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok case 8:
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var curCell = pane.one("#" + paneId + "_8_31");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (daysInMonth >= 31) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.set("text", "31");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_NEXTMONTH_DAY).addClass(CAL_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.setContent("&nbsp;");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore curCell.removeClass(CAL_DAY).addClass(CAL_NEXTMONTH_DAY);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore break;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Update stored pane properties
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[paneId].cutoffCol = cutoffCol;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[paneId].daysInMonth = daysInMonth;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneProperties[paneId].paneDate = newDate;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Bring the pane visibility back after all DOM changes are done
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore pane.setStyle("visibility", "visible");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that updates the calendar header based
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * on a given date and potentially the provided headerRenderer.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _updateCalendarHeader
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} baseDate The date with which to update the calendar header.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _updateCalendarHeader : function (baseDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var headerString = "",
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerRenderer = this.get("headerRenderer");
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (Y.Lang.isString(headerRenderer)) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerString = ydate.format(baseDate, {format:headerRenderer});
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else if (headerRenderer instanceof Function) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerString = headerRenderer.call(this, baseDate);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return headerString;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that initializes the calendar header HTML
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok * based on a given date and potentially the provided headerRenderer.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _updateCalendarHeader
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} baseDate The date with which to initialize the calendar header.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _initCalendarHeader : function (baseDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return substitute(substitute(CalendarBase.HEADER_TEMPLATE,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore {calheader: this._updateCalendarHeader(baseDate),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_id: this._calendarId}),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CalendarBase.CALENDAR_STRINGS);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A rendering assist method that initializes the calendar HTML
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * based on a given date.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @method _initCalendarHTML
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @param {Date} baseDate The date with which to initialize the calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @private
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore _initCalendarHTML : function (baseDate) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Instantiate the partials holder
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var partials = {},
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Counter for iterative template replacement.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore counter = 0;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Generate the template for the header
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["header_template"] = this._initCalendarHeader(baseDate);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["calendar_id"] = this._calendarId;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore partials["body_template"] = substitute(substitute (CalendarBase.CONTENT_TEMPLATE, partials),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CalendarBase.CALENDAR_STRINGS);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Instantiate the iterative template replacer function
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore function paneReplacer () {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var singlePane = this._initCalendarPane(ydate.addMonths(baseDate, counter), partials["calendar_id"]+"_pane_"+counter);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore counter++;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return singlePane;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Go through all occurrences of the calendar_grid_template token and replace it with an appropriate calendar grid.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var output = partials["body_template"].replace(/\{calendar_grid_template\}/g, Y.bind(paneReplacer, this));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore // Update the paneNumber count
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._paneNumber = counter;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return output;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore}, {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The CSS classnames for the calendar templates.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property CALENDAR_STRINGS
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Object
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @readOnly
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @static
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CALENDAR_STRINGS: {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_grid_class : CAL_GRID,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_body_class : CAL_BODY,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_hd_class : CAL_HD,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_hd_label_class : CAL_HD_LABEL,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_weekdayrow_class : CAL_WDAYROW,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_weekday_class : CAL_WDAY,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_row_class : CAL_ROW,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_day_class : CAL_DAY,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_dayanchor_class : CAL_ANCHOR,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_pane_class : CAL_PANE,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_right_grid_class : CAL_RIGHT_GRID,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_left_grid_class : CAL_LEFT_GRID,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore calendar_status_class : CAL_STATUS
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore ARIA_STATUS_TEMPLATE: '<div role="status" aria-atomic="true" class="{calendar_status_class}"></div>',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore AriaStatus : null,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore updateStatus : function (statusString) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (!CalendarBase.AriaStatus) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CalendarBase.AriaStatus = create(
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore substitute (CalendarBase.ARIA_STATUS_TEMPLATE,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CalendarBase.CALENDAR_STRINGS));
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore Y.one("body").append(CalendarBase.AriaStatus);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CalendarBase.AriaStatus.set("text", statusString);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The main content template for calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property CONTENT_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @static
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CONTENT_TEMPLATE: '<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{header_template}' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '<div class="yui3-u-1">' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '{calendar_grid_template}' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '</div>' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '</div>',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A single pane template for calendar (same as default CONTENT_TEMPLATE)
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property ONE_PANE_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @readOnly
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @static
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore ONE_PANE_TEMPLATE: '<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{header_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class="yui3-u-1">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A two pane template for calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property TWO_PANE_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @readOnly
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @static
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore TWO_PANE_TEMPLATE: '<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{header_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class="yui3-u-1-2">'+
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class = "{calendar_left_grid_class}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class="yui3-u-1-2">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class = "{calendar_right_grid_class}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A three pane template for calendar.
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok * @property THREE_PANE_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @readOnly
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @static
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore THREE_PANE_TEMPLATE: '<div class="yui3-g {calendar_pane_class}" id="{calendar_id}">' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '{header_template}' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '<div class="yui3-u-1-3">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class = "{calendar_left_grid_class}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class="yui3-u-1-3">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class="yui3-u-1-3">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class = "{calendar_right_grid_class}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calendar_grid_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A template for the calendar grid.
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @property CALENDAR_GRID_TEMPLATE
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @type String
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @protected
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore * @static
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CALENDAR_GRID_TEMPLATE: '<table class="{calendar_grid_class}" id="{calendar_pane_id}" role="grid" aria-readonly="true" aria-label="{pane_arialabel}" tabindex="{calendar_pane_tabindex}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<thead>' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '{weekday_row_template}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</thead>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<tbody>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{body_template}' +
bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2ebGarrett D'Amore '</tbody>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</table>',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A template for the calendar header.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property HEADER_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @static
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore HEADER_TEMPLATE: '<div class="yui3-g {calendar_hd_class}">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '<div class="yui3-u {calendar_hd_label_class}" id="{calendar_id}_header" aria-role="heading">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calheader}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</div>',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A template for the row of weekday names.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property WEEKDAY_ROW_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @static
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore WEEKDAY_ROW_TEMPLATE: '<tr class="{calendar_weekdayrow_class}" role="row">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{weekday_row}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</tr>',
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A template for a single row of calendar days.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property CALDAY_ROW_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @static
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CALDAY_ROW_TEMPLATE: '<tr class="{calendar_row_class}" role="row">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{calday_row}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</tr>',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A template for a single cell with a weekday name.
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok * @property CALDAY_ROW_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @static
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore WEEKDAY_TEMPLATE: '<th class="{calendar_weekday_class}" role="columnheader" aria-label="{full_weekdayname}">{weekdayname}</th>',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A template for a single cell with a calendar day.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property CALDAY_TEMPLATE
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @static
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore CALDAY_TEMPLATE: '<td class="{calendar_col_class} {calendar_day_class} {calendar_col_visibility_class}" id="{calendar_day_id}" role="gridcell">' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '{day_content}' +
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore '</td>',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The identity of the widget.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property NAME
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @default 'calendarBase'
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @readOnly
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @static
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore NAME: 'calendarBase',
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Static property used to define the default attribute configuration of
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * the Widget.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @property ATTRS
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type {Object}
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @static
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore ATTRS: {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore tabIndex: {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore value: 1
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The date corresponding to the current calendar view. Always
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * normalized to the first of the month that contains the date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * at assignment time. Used as the first date visible in the
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Date
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @default The first of the month containing today's date, as
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * set on the end user's system.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore date: {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore value: new Date(),
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore setter: function (val) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore var newDate = this._normalizeDate(val);
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore if (ydate.areEqual(newDate, this.get('date'))) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return this.get('date');
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore else {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return newDate;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A setting specifying whether to shows days from the previous
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * month in the visible month's grid, if there are empty preceding
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * cells available.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute showPrevMonth
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type boolean
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @default false
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore showPrevMonth: {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore value: false
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A setting specifying whether to shows days from the next
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * month in the visible month's grid, if there are empty
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * cells available at the end.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute showNextMonth
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type boolean
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @default false
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore showNextMonth: {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore value: false
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Strings and properties derived from the internationalization packages
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * for the calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute strings
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Object
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @protected
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore strings : {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore valueFn: function() { return Y.Intl.get("calendar-base"); }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Custom header renderer for the calendar.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute headerRenderer
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String | Function
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore headerRenderer: {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore value: "%B %Y"
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The name of the rule which all enabled dates should match.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Either disabledDatesRule or enabledDatesRule should be specified,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * or neither, but not both.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute enabledDatesRule
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @default null
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore enabledDatesRule: {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore value: null
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * The name of the rule which all disabled dates should match.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * Either disabledDatesRule or enabledDatesRule should be specified,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * or neither, but not both.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute disabledDatesRule
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type String
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @default null
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore disabledDatesRule: {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore value: null
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * A read-only attribute providing a list of currently selected dates.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute selectedDates
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @readOnly
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @type Array
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore selectedDates : {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore readOnly: true,
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore getter: function (val) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore return (this._getSelectedDatesList());
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore },
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore /**
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * An object of the form {rules:Object, filterFunction:Function},
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * providing set of rules and a custom rendering function for
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * customizing specific calendar cells.
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore *
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @attribute customRenderer
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore * @readOnly
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok * @type Object
2c6a6ad1e812de6043502f2f52d21711033ab43eIlya Yanok * @default {}
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore */
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore customRenderer : {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore value: {},
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore setter: function (val) {
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._rules = val.rules;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore this._filterFunction = val.filterFunction;
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore }
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore});
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore}, '@VERSION@' ,{lang:['de', 'en', 'fr', 'ja', 'pt-BR', 'ru', 'zh-HANT-TW'], requires:['widget', 'substitute', 'datatype-date', 'datatype-date-math', 'cssgrids']});
cde2885fdf538266ee2a3b08dee2d5075ce8fa2bGarrett D'Amore