calendar-base-debug.js revision af588160cda24eb5a49cf49c51ae048cc5fdf664
/**
* The Calendar component is a UI widget that allows users
* to view dates in a two-dimensional month grid, as well as
* to select one or more dates, or ranges of dates. Calendar
* is generated dynamically.
*
* @module calendar
* @submodule calendar-base
*/
/** Create a calendar view to represent a single or multiple
* month range of dates, rendered as a grid with date and
* weekday labels.
*
* @class CalendarBase
* @extends Widget
* @param config {Object} Configuration object (see Configuration attributes)
* @constructor
*/
CALENDAR = 'calendar',
L = Y.Lang,
substitute = Y.substitute,
function CalendarBase(config) {
};
}
_cutoffColumn : 0,
_daysInMonth : 31,
_daysInPrevMonth : 0,
_selectedDate : null,
initializer : function () {
},
renderUI : function () {
this._renderSelectedDates();
},
bindUI : function () {
this._bindCalendarEvents();
},
syncUI : function () {
if (this.get('showPrevMonth')) {
this._afterShowPrevMonthChange();
}
if (this.get('showNextMonth')) {
this._afterShowNextMonthChange();
}
},
isSelected : function (oDate) {
if (oDate instanceof Date) {
return (oDate == this._selectedDate);
}
}
else {
return false;
}
},
if (oDate instanceof Date) {
}
if (curDate == null) {
return;
}
}
this._selectedDate = curDate;
this._renderSelectedDates();
},
if (oDate instanceof Date) {
}
if (curDate == null) {
return;
}
}
this._selectedDate = null;
this._renderSelectedDates();
},
_renderSelectedDates : function () {
// Refactor as "DateMath.datesInRange"
if (this._selectedDate != null && this.get("date").getFullYear() == this._selectedDate.getFullYear() && this.get("date").getMonth() == this._selectedDate.getMonth()) {
}
},
_dateToNode : function (oDate) {
var col = 0;
switch (daymod) {
case (0):
if (this._cutoffColumn >= 6) {
col = 12;
}
else {
col = 5;
}
break;
case (1):
col = 6;
break;
case (2):
if (this._cutoffColumn > 0) {
col = 7;
}
else {
col = 0;
}
break;
case (3):
if (this._cutoffColumn > 1) {
col = 8;
}
else {
col = 1;
}
break;
case (4):
if (this._cutoffColumn > 2) {
col = 9;
}
else {
col = 2;
}
break;
case (5):
if (this._cutoffColumn > 3) {
col = 10;
}
else {
col = 3;
}
break;
case (6):
if (this._cutoffColumn > 4) {
col = 11;
}
else {
col = 4;
}
break;
}
},
_nodeToDate : function (oNode) {
console.log("Got node " + oNode.get("id") + ", which resulted in " + year + "/" + month + "/" + day);
},
_bindCalendarEvents : function () {
},
return cutOffColumn;
},
_afterShowNextMonthChange : function () {
if (this.get('showNextMonth')) {
var dayCounter = 1;
{
contentBox.one("#calendar_" + cell + "_" + (cell+23)).setContent(dayCounter++).addClass(CAL_NEXTMONTH_DAY);
}
var startingCell = this._cutoffColumn;
startingCell = 2;
}
startingCell = 1;
}
contentBox.one("#calendar_" + cell + "_" + (cell+30)).setContent(dayCounter++).addClass(CAL_NEXTMONTH_DAY);
}
}
else {
{
}
var startingCell = 0;
startingCell = 2;
}
startingCell = 1;
}
}
}
},
_afterShowPrevMonthChange : function () {
if (this.get('showPrevMonth')) {
if (daysInPrevMonth != this._daysInPrevMonth) {
this._daysInPrevMonth = daysInPrevMonth;
{
}
}
}
else {
this._daysInPrevMonth = 0;
{
}
}
},
_afterDateChange : function () {
this._cutoffColumn = cutoffCol;
this._daysInMonth = daysInMonth;
}
else {
switch(column)
{
case 0:
case 1:
case 6:
case 7:
case 8:
}
}
}
if (this.get('showPrevMonth')) {
this._afterShowPrevMonthChange();
}
if (this.get('showNextMonth')) {
this._afterShowNextMonthChange();
}
this._renderSelectedDates();
},
_initCalendarHTML : function (baseDate) {
startDate.getFullYear()},
calString = '',
this._cutoffColumn = cutoffCol;
this._daysInMonth = daysInMonth;
var partials = {};
partials["weekday_row"] +=
}
date = "";
}
var calendar_day_class = CAL_DAY;
if (id_date < 1) {
}
else if (id_date > daysInMonth) {
}
{day_content: date,
}
}
{calday_row: v});
});
return output;
}
}, {
// Y.CalendarBase static properties
},
CONTENT_TEMPLATE: '<table class="{calendar_grid_class}" id="{calendar_id}">' +
'<thead>' +
'{header_template}' +
'{weekday_row_template}' +
'</thead>' +
'<tbody>' +
'{body_template}' +
'</tbody>' +
'</table>',
HEADER_TEMPLATE: '<tr>' +
'<th colspan="7" class="{calendar_hd_class}">' +
'<span id="calheader" class="{calendar_hd_wrapper_class}">' +
'{calheader}' +
'</span>' +
'</th>' +
'</tr>',
WEEKDAY_ROW_TEMPLATE: '<tr class="{calendar_weekdayrow_class}">' +
'{weekday_row}' +
'</tr>',
CALDAY_ROW_TEMPLATE: '<tr class="{calendar_row_class}">' +
'{calday_row}' +
'</tr>',
WEEKDAY_TEMPLATE: '<th class="{calendar_weekday_class}">{weekdayname}</th>',
CALDAY_TEMPLATE: '<td class="{calendar_col_class} {calendar_day_class} {calendar_col_visibility_class}" id="{calendar_day_id}">' +
'{day_content}' +
'</td>',
NAME: 'calendarBase',
ATTRS: {
date: {
value: new Date(),
}
},
month: Number,
year: Number,
value: false
},
value: false
},
strings : {
},
headerRenderer: String
}
});
}, '@VERSION@' ,{lang:['en', 'ru'], requires:['widget', 'substitute', 'datatype-date', 'datatype-date-math']});