');
m.push(prerenderedMonth);
if( (x+1) % this.noOfMonthPerRow === 0) {
m.push("");
}
}
m.push(' ');
m.push('1?' colspan="'+this.noOfMonthPerRow+'"':''),' class="x-date-bottom" align="center">| ',widfaker,' | ',widfaker,' | ',widfaker,' |
| ');
m.push(' ');
var el = document.createElement("div");
el.className = "x-date-picker";
el.innerHTML = m.join("");
container.dom.insertBefore(el, position);
this.el = Ext.get(el);
this.eventEl = Ext.get(el.firstChild);
if (this.renderPrevNextButtons) {
var crl = new Ext.util.ClickRepeater(this.el.child("td.x-date-left a.npm"), {
handler: this.showPrevMonth,
scope: this,
preventDefault:true,
stopDefault:true
});
var crr = new Ext.util.ClickRepeater(this.el.child("td.x-date-right a.npm"), {
handler: this.showNextMonth,
scope: this,
preventDefault:true,
stopDefault:true
});
}
if (this.renderPrevNextYearButtons) {
var cryl = new Ext.util.ClickRepeater(this.el.child("td.x-date-left a.npy"), {
handler: this.showPrevYear,
scope: this,
preventDefault:true,
stopDefault:true
});
var cryr = new Ext.util.ClickRepeater(this.el.child("td.x-date-right a.npy"), {
handler: this.showNextYear,
scope: this,
preventDefault:true,
stopDefault:true
});
}
if (this.allowMouseWheel) {
this.eventEl.on("mousewheel", this.handleMouseWheel, this);
}
if (!this.disableMonthPicker) {
this.monthPicker = this.el.down('div.x-date-mp');
this.monthPicker.enableDisplayMode('block');
}
var kn = new Ext.KeyNav(this.eventEl, {
"left" : function(e){
(!this.disabled && e.ctrlKey && (!this.disableMonthPicker || this.renderPrevNextButtons) ?
this.showPrevMonth() :
this.activeDateKeyNav(-1));
},
"right" : function(e){
(!this.disabled && e.ctrlKey && (!this.disableMonthPicker || this.renderPrevNextButtons) ?
this.showNextMonth() :
this.activeDateKeyNav(1));
},
"up" : function(e){
(!this.disabled && e.ctrlKey && (!this.disableMonthPicker || this.renderPrevNextYearButtons) ?
this.showNextYear() :
this.activeDateKeyNav(-7));
},
"down" : function(e){
(!this.disabled && e.ctrlKey && (!this.disableMonthPicker || this.renderPrevNextYearButtons) ?
this.showPrevYear() :
this.activeDateKeyNav(7));
},
"pageUp" : function(e){
if (!this.disabled) {
this.update(this.activeDate.add("mo", this.pageKeyWarp*(-1)));
}
},
"pageDown" : function(e){
if (!this.disabled) {
this.update(this.activeDate.add("mo", this.pageKeyWarp));
}
},
"enter" : function(e){
e.stopPropagation();
if (!this.disabled) {
if (this.multiSelection) {
this.okClicked();
}
else {
this.finishDateSelection(this.activeDate);
}
}
return true;
},
scope : this
});
if (!this.disableSingleDateSelection) {
this.eventEl.on("click", this.handleDateClick, this, {delegate: "a.x-date-date"});
}
if (this.multiSelection && this.showWeekNumber) {
this.eventEl.on("click", this.handleWeekClick, this, {delegate: "a.x-date-weeknumber"});
}
this.eventEl.addKeyListener(Ext.EventObject.SPACE, this.spaceKeyPressed, this);
this.cellsArray = [];
this.textNodesArray = [];
this.weekNumberCellsArray = [];
this.weekNumberTextElsArray = [];
this.weekNumberHeaderCellsArray = [];
var cells,textNodes,weekNumberCells,weekNumberTextEls,weekNumberHeaderCells;
for(var xx=0,xxk=this.noOfMonth; xx< xxk; ++xx) {
cells = Ext.get(this.id+'-inner-date'+xx).select("tbody td.x-date-date-cell");
textNodes = Ext.get(this.id+'-inner-date'+xx).query("tbody td.x-date-date-cell span");
this.cellsArray[xx] = cells;
this.textNodesArray[xx] = textNodes;
if (this.showWeekNumber) {
weekNumberCells = Ext.get(this.id+'-inner-date'+xx).select("tbody td.x-date-weeknumber-cell");
weekNumberTextEls = Ext.get(this.id+'-inner-date'+xx).select("tbody td.x-date-weeknumber-cell span");
this.weekNumberCellsArray[xx] = weekNumberCells;
this.weekNumberTextElsArray[xx] = weekNumberTextEls;
weekNumberHeaderCells = Ext.get(this.id+'-inner-date'+xx).select("th.x-date-weeknumber-header");
this.weekNumberHeaderCellsArray[xx] = weekNumberHeaderCells;
}
}
//set the original monthpicker again to the first month only to be able to quickly change the startmonth
if (!this.disableMonthPicker) {
this.mbtn = new Ext.Button({
text: " ",
tooltip: this.monthYearText,
renderTo: this.el.child("td.x-date-firstMonth", true)
});
this.mbtn.on('click', this.showMonthPickerPlus, this);
this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu");
}
//showtoday from Ext 2.2
if (this.renderTodayButton || this.showToday) {
var today = new Date().dateFormat(this.format);
this.todayBtn = new Ext.Button({
renderTo: this.el.child("td.x-date-bottom .x-date-todaybtn", true),
text: String.format(this.todayText, today),
tooltip: String.format(this.todayTip, today),
handler: this.selectToday,
scope: this
});
}
if (this.multiSelection && this.renderOkUndoButtons) {
this.OKBtn = new Ext.Button({
renderTo: this.el.child("td.x-date-bottom .x-date-multiokbtn", true),
text: this.okText,
handler: this.okClicked,
scope: this
});
this.undoBtn = new Ext.Button({
renderTo: this.el.child("td.x-date-bottom .x-date-multiundobtn", true),
text: this.undoText,
handler: function() {
if (!this.disabled) {
this.fireEvent("undo", this, this.preSelectedDates);
this.preSelectedDates = [];
for (var i=0,il=this.selectedDates.length;i this.displayMask)? true: false);
if (!masked && dMask) {
this.el.mask(this.displayMaskText);
//set forcerefresh to false because new date (from old activedate) is already calculated
this.update.defer(10, this, [date,false,true]);
return false;
}
if (this.stayInAllowedRange && (this.minDate||this.maxDate)) {
if (this.minDate && (this.minDate.getFullYear() > date.getFullYear() || (this.minDate.getMonth() > date.getMonth() && this.minDate.getFullYear() == date.getFullYear()))) {
date = new Date(this.minDate.getTime());
}
else if (this.maxDate && (this.maxDate.getFullYear() < date.getFullYear() || (this.maxDate.getMonth() < date.getMonth() && this.maxDate.getFullYear() == date.getFullYear()))) {
date = new Date(this.maxDate.getTime());
}
}
var newStartMonth = date.getMonth();
var oldStartMonth = (this.activeDate ? this.activeDate.getMonth() : newStartMonth);
var newStartYear = date.getFullYear();
var oldStartYear = (this.activeDate ? this.activeDate.getFullYear() : newStartYear);
if (oldStartMonth!=newStartMonth) {
this.fireEvent("beforemonthchange", this, oldStartMonth, newStartMonth);
}
if (oldStartYear!=newStartYear) {
this.fireEvent("beforeyearchange", this, oldStartYear, newStartYear);
}
this.activeDate = date.clearTime();
this.preSelectedCells = [];
this.lastSelectedDateCell = '';
this.activeDateCell = '';
var lsd = (this.lastSelectedDate?this.lastSelectedDate:0);
var today = new Date().clearTime().getTime();
var min = this.minDate ? this.minDate.clearTime().getTime() : Number.NEGATIVE_INFINITY;
var max = this.maxDate ? this.maxDate.clearTime().getTime() : Number.POSITIVE_INFINITY;
var ddMatch = this.disabledDatesRE;
var ddText = this.disabledDatesText;
var ddays = this.disabledDays ? this.disabledDays.join("") : false;
var ddaysText = this.disabledDaysText;
var edMatch = this.eventDatesRE;
var edCls = this.eventDatesRECls;
var edText = this.eventDatesREText;
var adText = this.allowedDatesText;
var format = this.format;
var adt = this.activeDate.getTime();
this.todayMonthCell = false;
this.todayDayCell = false;
if (this.allowedDates) {
this.allowedDatesT = [];
for (var k=0, kl=this.allowedDates.length;k max) {
cell.className = " x-date-disabled";
tiptext = cal.maxText;
}
if(ddays){
if(ddays.indexOf(d.getDay()) != -1){
tiptext = ddaysText;
cell.className = " x-date-disabled";
}
}
if(ddMatch && format){
fvalue = d.dateFormat(format);
if(ddMatch.test(fvalue)){
tiptext = ddText.replace("%0", fvalue);
cell.className = " x-date-disabled";
}
}
if (cal.allowedDates && cal.allowedDatesT.indexOf(t)==-1){
cell.className = " x-date-disabled";
tiptext = adText;
}
//mark weekends
if(cal.markWeekends && cal.weekendDays.indexOf(d.getDay()) != -1 && !eCell.hasClass('x-date-disabled')) {
eCell.addClass(cal.weekendCls);
}
if(!eCell.hasClass('x-date-disabled') || cal.styleDisabledDates) {
//mark dates with specific css (still selectable) (higher priority than weekends)
if (cal.eventDatesNumbered[0].length>0) {
foundday = cal.eventDatesNumbered[0].indexOf(t);
if (foundday!=-1) {
if(cal.eventDatesNumbered[2][foundday]!==""){
eCell.addClass(cal.eventDatesNumbered[2][foundday]+(cal.eventDatesSelectable?"":"-disabled"));
tiptext = (cal.eventDatesNumbered[1][foundday]!=="" ? cal.eventDatesNumbered[1][foundday] : false);
}
}
}
//regular Expression custom CSS Dates
if(edMatch && format){
fvalue = d.dateFormat(format);
if(edMatch.test(fvalue)){
tiptext = edText.replace("%0", fvalue);
cell.className = edCls;
}
}
}
if(!eCell.hasClass('x-date-disabled')) {
//mark Holidays
if(cal.markNationalHolidays && cal.nationalHolidaysNumbered[0].length>0) {
foundday = cal.nationalHolidaysNumbered[0].indexOf(t);
if (foundday!=-1) {
eCell.addClass(cal.nationalHolidaysCls);
tiptext = (cal.nationalHolidaysNumbered[1][foundday]!=="" ? cal.nationalHolidaysNumbered[1][foundday] : false);
}
}
//finally mark already selected items as selected
if (cal.preSelectedDates.indexOf(t)!=-1) {
eCell.addClass("x-date-selected");
cal.preSelectedCells.push(cell.firstChild.monthCell+"#"+cell.firstChild.dayCell);
}
if (t == lsd) {
cal.lastSelectedDateCell = cell.firstChild.monthCell+"#"+cell.firstChild.dayCell;
}
}
else if (cal.disabledLetter){
textnode.innerHTML = cal.disabledLetter;
}
//mark today afterwards to ensure today CSS has higher priority
if(t == today){
eCell.addClass("x-date-today");
tiptext = cal.todayText;
}
//keynavigation?
if(cal.showActiveDate && t == adt && cal.activeDateCell === ''){
eCell.addClass("x-datepickerplus-activedate");
cal.activeDateCell = cell.firstChild.monthCell+"#"+cell.firstChild.dayCell;
}
//any quicktips necessary?
if (tiptext) {
if (cal.useQuickTips) {
Ext.QuickTips.register({
target: eTextNode,
text: tiptext
});
}
else {
cell.title = tiptext;
}
}
};
var cells,textEls,days,firstOfMonth,startingPos,pm,prevStart,d,sel,i,intDay,weekNumbers,weekNumbersTextEls,curWeekStart,weekNumbersHeader,monthLabel,main,w;
var summarizeHTML = [];
for(var x=0,xk=this.noOfMonth;x 1 && (x===0||x==this.noOfMonth-1)) {
summarizeHTML.push(this.monthNames[date.getMonth()]," ",date.getFullYear());
if (x===0) {
summarizeHTML.push(" - ");
}
}
cells = this.cellsArray[x].elements;
textEls = this.textNodesArray[x];
if ((this.markNationalHolidays || this.eventDates.length>0) && this.useQuickTips) {
for (var e=0,el=textEls.length;e 1) {
var topHeader = Ext.get(this.id+'-summarize');
topHeader.update(summarizeHTML.join(""));
}
this.el.unmask();
if (oldStartMonth!=newStartMonth) {
this.fireEvent("aftermonthchange", this, oldStartMonth, newStartMonth);
}
if (oldStartYear!=newStartYear) {
this.fireEvent("afteryearchange", this, oldStartYear, newStartYear);
}
},
beforeDestroy : function() {
if(this.rendered) {
if (this.mbtn) {
this.mbtn.destroy();
}
if (this.todayBtn) {
this.todayBtn.destroy();
}
if (this.OKBtn){
this.OKBtn.destroy();
}
if (this.undoBtn){
this.undoBtn.destroy();
}
}
},
handleWeekClick : function(e, t){
if (!this.disabled) {
e.stopEvent();
var startweekdate = new Date(t.dateValue).getFirstDateOfWeek(this.startDay), amount=0, startmonth, curmonth,enableUnselect;
var monthcell = t.monthCell;
var daycell = t.dayCell;
switch(t.parentNode.tagName.toUpperCase()) {
case "TH":
amount=42;
startmonth = t.monthValue;
break;
case "TD":
amount=7;
break;
}
if ((amount==42 && this.fireEvent("beforemonthclick", this, startmonth,this.lastStateWasSelected) !== false)
|| (amount==7 && this.fireEvent("beforeweekclick", this, startweekdate,this.lastStateWasSelected) !== false)) {
if (!Ext.EventObject.ctrlKey && this.multiSelectByCTRL) {
this.removeAllPreselectedClasses();
}
enableUnselect=true;
if (this.disablePartialUnselect) {
var teststartweekdate = startweekdate;
for (var k=0;k 0) {
return false;
}
this.preSelectedDates.push(t);
this.markSingleDays(monthcell,daycell,false);
this.markGhostDatesAlso(monthcell,daycell,false);
this.lastStateWasSelected = true;
}
else {
if (enableUnselect && (!this.strictRangeSelect ||
(this.strictRangeSelect &&
(
(this.preSelectedDates.indexOf(afterDate)==-1 && this.preSelectedDates.indexOf(beforeDate)!=-1 ) ||
(this.preSelectedDates.indexOf(afterDate)!=-1 && this.preSelectedDates.indexOf(beforeDate)==-1 )
)
)
)
){
this.preSelectedDates.remove(t);
this.markSingleDays(monthcell,daycell,true);
this.markGhostDatesAlso(monthcell,daycell,true);
this.lastStateWasSelected = false;
}
}
}
else {
//calling update in any case would get too slow on huge multiselect calendars, so set the class for the selected cells manually (MUCH faster if not calling update() every time!)
this.removeAllPreselectedClasses();
this.preSelectedDates = [t];
this.preSelectedCells = [];
this.markSingleDays(monthcell,daycell,false);
this.markGhostDatesAlso(monthcell,daycell,false);
this.lastStateWasSelected = true;
}
this.lastSelectedDate = t;
this.lastSelectedDateCell = monthcell+"#"+daycell;
if (this.multiSelection && !this.renderOkUndoButtons) {
this.copyPreToSelectedDays();
}
return true;
},
markSingleDays : function(monthcell,daycell,remove) {
if(!remove) {
Ext.get(this.cellsArray[monthcell].elements[daycell]).addClass("x-date-selected");
this.preSelectedCells.push((monthcell)+"#"+(daycell));
}
else {
Ext.get(this.cellsArray[monthcell].elements[daycell]).removeClass("x-date-selected");
this.preSelectedCells.remove((monthcell)+"#"+(daycell));
}
},
markGhostDatesAlso : function(monthcell,daycell,remove) {
if (this.prevNextDaysView=="mark") {
var currentGetCell = Ext.get(this.cellsArray[monthcell].elements[daycell]), dayCellDiff;
if(currentGetCell.hasClass("x-date-prevday") && monthcell>0) {
dayCellDiff = (5-Math.floor(daycell/7))*7;
if(Ext.get(this.cellsArray[monthcell-1].elements[daycell+dayCellDiff]).hasClass("x-date-nextday")) {
dayCellDiff-=7;
}
this.markSingleDays(monthcell-1,daycell+dayCellDiff,remove);
}
else if(currentGetCell.hasClass("x-date-nextday") && monthcell0) || (daycell > 27 && monthcell= 0 && this.cellsArray[monthcell].elements[daycell].firstChild.firstChild.firstChild.innerHTML == this.cellsArray[monthcell+1].elements[daycell-dayCellDiff].firstChild.firstChild.firstChild.innerHTML) {
this.markSingleDays(monthcell+1,daycell-dayCellDiff,remove);
}
}
}
}
},
removeAllPreselectedClasses : function() {
for (var e=0,el=this.preSelectedCells.length;elastVisibleDate) {
//prepare for disabledCheck
var min = this.minDate ? this.minDate.clearTime().getTime() : Number.NEGATIVE_INFINITY;
var max = this.maxDate ? this.maxDate.clearTime().getTime() : Number.POSITIVE_INFINITY;
var ddays = this.disabledDays ? this.disabledDays.join("") : "";
var ddMatch = this.disabledDatesRE;
var format = this.format;
var allowedDatesT = this.allowedDates ? this.allowedDatesT : false;
var d,ddMatchResult,fvalue;
//check, if the days would be disabled
while(startdatelastVisibleDate) {
d=new Date(startdate);
ddMatchResult = false;
if(ddMatch){
fvalue = d.dateFormat(format);
ddMatchResult = ddMatch.test(fvalue);
}
//don't use >= and <= here for datecomparison, because the dates can differ in timezone
if( !(startdate < min) &&
!(startdate > max) &&
ddays.indexOf(d.getDay()) == -1 &&
!ddMatchResult &&
( !allowedDatesT || allowedDatesT.indexOf(startdate)!=-1 )
) {
//is not disabled and can be processed
if (this.maxSelectionDays === this.preSelectedDates.length) {
if(this.fireEvent("beforemaxdays", this) !== false){
Ext.Msg.alert(this.maxSelectionDaysTitle,this.maxSelectionDaysText.replace(/%0/,this.maxSelectionDays));
}
break;
}
this.preSelectedDates.push(startdate);
}
startdate = new Date(startdate).add(Date.DAY,dayDiff).clearTime().getTime();
}
tmpMonthCell = (dayDiff>0 ? 0 : this.cellsArray.length-1);
tmpDayCell = (dayDiff>0 ? 0 : 41);
//mark left ghostdates aswell
testCell = Ext.get(this.cellsArray[tmpMonthCell].elements[tmpDayCell]);
while (testCell.hasClass("x-date-prevday") || testCell.hasClass("x-date-nextday")) {
testCell.addClass("x-date-selected");
this.preSelectedCells.push((tmpMonthCell)+"#"+(tmpDayCell));
tmpDayCell+=dayDiff;
testCell = Ext.get(this.cellsArray[tmpMonthCell].elements[tmpDayCell]);
}
}
//mark range of visible dates
while ((targetdate-startdate)*dayDiff >0 && tmpMonthCell>=0 && tmpMonthCell=7?14:7);
}
else if (tmpDayCell<0) {
tmpMonthCell--;
tmpDayCell=34;
testCell = Ext.get(this.cellsArray[tmpMonthCell].elements[tmpDayCell]);
if (testCell.hasClass("x-date-nextday") || ghostCounter==7) {
tmpDayCell=27;
}
}
}
}
this.markDateAsSelected(t.dateValue,ctrlfaker,t.monthCell,t.dayCell,true);
this.finishDateSelection(new Date(t.dateValue));
}
}
},
copyPreToSelectedDays : function() {
this.selectedDates = [];
for (var i=0,il=this.preSelectedDates.length;i2) {
//ext 3.0
Ext.menu.DateItem = Ext.ux.DatePickerPlus;
Ext.override(Ext.menu.DateMenu,{
initComponent: function(){
this.on('beforeshow', this.onBeforeShow, this);
if(this.strict = (Ext.isIE7 && Ext.isStrict)){
this.on('show', this.onShow, this, {single: true, delay: 20});
}
var PickerWidget = (this.initialConfig.usePickerPlus ? Ext.ux.DatePickerPlus : Ext.DatePicker);
Ext.apply(this, {
plain: true,
showSeparator: false,
items: this.picker = new PickerWidget(Ext.apply({
internalRender: this.strict || !Ext.isIE,
ctCls: 'x-menu-date-item'
}, this.initialConfig))
});
Ext.menu.DateMenu.superclass.initComponent.call(this);
this.relayEvents(this.picker, ["select"]);
this.on('select', this.menuHide, this);
if(this.handler){
this.on('select', this.handler, this.scope || this);
}
}
});
}
else {
//ext 2.x
Ext.menu.DateItem = function(config){
if (config && config.usePickerPlus) {
Ext.menu.DateItem.superclass.constructor.call(this, new Ext.ux.DatePickerPlus(config), config); //NEW LINE
}
else {
Ext.menu.DateItem.superclass.constructor.call(this, new Ext.DatePicker(config), config);
}
this.picker = this.component;
this.addEvents('select');
this.picker.on("render", function(picker){
picker.getEl().swallowEvent("click");
picker.container.addClass("x-menu-date-item");
});
this.picker.on("select", this.onSelect, this);
};
//this breaks in ext 3.0 (Ext.menu.Adapter and Ext.menu.DateItem do not exist in ext 3.0 anymore)
Ext.extend(Ext.menu.DateItem, Ext.menu.Adapter,{
// private
onSelect : function(picker, date){
this.fireEvent("select", this, date, picker);
Ext.menu.DateItem.superclass.handleClick.call(this);
}
});
}
if (Ext.form && Ext.form.DateField) {
Ext.ux.form.DateFieldPlus = Ext.extend(Ext.form.DateField, {
usePickerPlus: true,
showWeekNumber: true,
noOfMonth : 1,
noOfMonthPerRow : 3,
nationalHolidaysCls: 'x-datepickerplus-nationalholidays',
markNationalHolidays:true,
eventDates: function(year) {
return [];
},
eventDatesRE : false,
eventDatesRECls : '',
eventDatesREText : '',
multiSelection: false,
multiSelectionDelimiter: ',',
multiSelectByCTRL: true,
fillupRows: true,
markWeekends:true,
weekendText:'',
weekendCls: 'x-datepickerplus-weekends',
weekendDays: [6,0],
useQuickTips: true,
pageKeyWarp: 1,
maxSelectionDays: false,
resizable: false,
renderTodayButton: true,
renderOkUndoButtons: true,
tooltipType: 'qtip',
allowedDates : false,
allowedDatesText : '',
renderPrevNextButtons: true,
renderPrevNextYearButtons: false,
disableMonthPicker:false,
showActiveDate: false,
shiftSpaceSelect: true,
disabledLetter: false,
allowMouseWheel: true,
summarizeHeader: false,
stayInAllowedRange: true,
disableSingleDateSelection: false,
eventDatesSelectable: false,
styleDisabledDates: false,
allowOtherMenus: false,
onBeforeYearChange : function(picker, oldStartYear, newStartYear){
this.fireEvent("beforeyearchange", this, oldStartYear, newStartYear, picker);
},
onAfterYearChange : function(picker, oldStartYear, newStartYear){
this.fireEvent("afteryearchange", this, oldStartYear, newStartYear, picker);
},
onBeforeMonthChange : function(picker, oldStartMonth, newStartMonth){
this.fireEvent("beforemonthchange", this, oldStartMonth, newStartMonth, picker);
},
onAfterMonthChange : function(picker, oldStartMonth, newStartMonth){
this.fireEvent("aftermonthchange", this, oldStartMonth, newStartMonth, picker);
},
onAfterMonthClick : function(picker, month, wasSelected){
this.fireEvent("aftermonthclick", this, month, wasSelected, picker);
},
onAfterWeekClick : function(picker, startOfWeek, wasSelected){
this.fireEvent("afterweekclick", this, startOfWeek, wasSelected, picker);
},
onAfterDateClick : function(picker, date, wasSelected){
this.fireEvent("afterdateclick", this, date, wasSelected, picker);
},
onBeforeMouseWheel : function(picker, event){
this.fireEvent("beforemousewheel", this, event, picker);
},
onBeforeMaxDays : function(picker){
this.fireEvent("beforemaxdays", this, picker);
},
onUndo : function(picker, preSelectedDates){
this.fireEvent("undo", this, preSelectedDates, picker);
},
onTriggerClick : function(){
if(this.disabled){
return;
}
if(!this.menu){
this.menu = new Ext.menu.DateMenu({
allowOtherMenus: this.allowOtherMenus,
//is needed at initialisation
usePickerPlus:this.usePickerPlus,
noOfMonth:this.noOfMonth,
noOfMonthPerRow:this.noOfMonthPerRow,
listeners: {
'beforeyearchange': {fn:this.onBeforeYearChange,scope:this},
'afteryearchange': {fn:this.onAfterYearChange,scope:this},
'beforemonthchange': {fn:this.onBeforeMonthChange,scope:this},
'aftermonthchange': {fn:this.onAfterMonthChange,scope:this},
'afterdateclick': {fn:this.onAfterDateClick,scope:this},
'aftermonthclick': {fn:this.onAfterMonthClick,scope:this},
'afterweekclick': {fn:this.onAfterWeekClick,scope:this},
'beforemousewheel': {fn:this.onBeforeMouseWheel,scope:this},
'beforemaxdays': {fn:this.onBeforeMaxDays,scope:this},
'undo': {fn:this.onUndo,scope:this}
}
});
//do this only once!
this.relayEvents(this.menu, ["select"]);
}
if (this.menu.isVisible()) {
this.menu.hide();
return;
}
if (this.disabledDatesRE) {
this.ddMatch = this.disabledDatesRE;
}
if(typeof this.minDate == "string"){
this.minDate = this.parseDate(this.minDate);
}
if(typeof this.maxDate == "string"){
this.maxDate = this.parseDate(this.maxDate);
}
Ext.apply(this.menu.picker, {
minDate : this.minValue || this.minDate,
maxDate : this.maxValue || this.maxDate,
disabledDatesRE : this.ddMatch,
disabledDatesText : this.disabledDatesText,
disabledDays : this.disabledDays,
disabledDaysText : this.disabledDaysText,
showToday : this.showToday, //from Ext 2.2
format : this.format,
minText : String.format(this.minText, this.formatDate(this.minValue || this.minDate)),
maxText : String.format(this.maxText, this.formatDate(this.maxValue || this.maxDate)),
showWeekNumber: this.showWeekNumber,
nationalHolidaysCls: this.nationalHolidaysCls,
markNationalHolidays:this.markNationalHolidays,
multiSelectByCTRL: this.multiSelectByCTRL,
fillupRows: this.fillupRows,
multiSelection: this.multiSelection,
markWeekends:this.markWeekends,
weekendText:this.weekendText,
weekendCls: this.weekendCls,
weekendDays: this.weekendDays,
useQuickTips: this.useQuickTips,
eventDates: this.eventDates,
eventDatesRE: this.eventDatesRE,
eventDatesRECls: this.eventDatesRECls,
eventDatesREText: this.eventDatesREText,
pageKeyWarp: this.pageKeyWarp,
maxSelectionDays: this.maxSelectionDays,
resizable: this.resizable,
renderTodayButton: this.renderTodayButton,
renderOkUndoButtons: this.renderOkUndoButtons,
allowedDates : this.allowedDates,
allowedDatesText : this.allowedDatesText,
renderPrevNextButtons: this.renderPrevNextButtons,
renderPrevNextYearButtons: this.renderPrevNextYearButtons,
disableMonthPicker:this.disableMonthPicker,
showActiveDate: this.showActiveDate,
shiftSpaceSelect: this.shiftSpaceSelect,
disabledLetter: this.disabledLetter,
allowMouseWheel: this.allowMouseWheel,
summarizeHeader: this.summarizeHeader,
stayInAllowedRange: this.stayInAllowedRange,
disableSingleDateSelection: this.disableSingleDateSelection,
eventDatesSelectable: this.eventDatesSelectable,
styleDisabledDates: this.styleDisabledDates
});
//Ext 3.0
if (this.menuEvents) {
this.menuEvents('on');
}
else {
//ext 2.2.x
this.menu.on(Ext.apply({}, this.menuListeners, {
scope:this
}));
}
this.menu.picker.setValue(this.getValue() || new Date());
this.menu.show(this.el, "tl-bl?");
this.menu.focus();
},
setValue : function(date){
var field = this;
if (Ext.isArray(date)) {
var formatted = [];
for (var e=0,el=date.length;e0?dates:"");
}
else {
return Ext.ux.form.DateFieldPlus.superclass.getValue.call(this);
}
},
beforeBlur : function(){
if (this.multiSelection) {
this.setValue(this.getRawValue().split(this.multiSelectionDelimiter));
}
else {
var v = this.parseDate(this.getRawValue());
if(v){
this.setValue(v);
}
}
},
submitFormat:'Y-m-d',
submitFormatAddon: '-format',
onRender:function() {
Ext.ux.form.DateFieldPlus.superclass.onRender.apply(this, arguments);
//be sure not to have duplicate formfield names (at least IE moans about it and gets confused)
// this.name = (typeof this.name==="undefined"?this.id+this.submitFormatAddon:(this.name==this.id?this.name+this.submitFormatAddon:this.name));
var name = this.name || this.el.dom.name || (this.id+this.submitFormatAddon);
if (name==this.id) {
name+= this.submitFormatAddon;
}
this.hiddenField = this.el.insertSibling({
tag:'input',
type:'hidden',
name: name,
value:this.formatHiddenDate(this.parseDate(this.value))
});
this.hiddenName = name;
this.el.dom.removeAttribute('name');
this.el.on({
keyup:{scope:this, fn:this.updateHidden},
blur:{scope:this, fn:this.updateHidden}
});
this.setValue = this.setValue.createSequence(this.updateHidden);
if(this.tooltip){
if(typeof this.tooltip == 'object'){
Ext.QuickTips.register(Ext.apply({
target: this.trigger
}, this.tooltip));
} else {
this.trigger.dom[this.tooltipType] = this.tooltip;
}
}
},
onDisable: function(){
Ext.ux.form.DateFieldPlus.superclass.onDisable.apply(this, arguments);
if(this.hiddenField) {
this.hiddenField.dom.setAttribute('disabled','disabled');
}
},
onEnable: function(){
Ext.ux.form.DateFieldPlus.superclass.onEnable.apply(this, arguments);
if(this.hiddenField) {
this.hiddenField.dom.removeAttribute('disabled');
}
},
formatHiddenDate : function(date){
return Ext.isDate(date) ? Ext.util.Format.date(date, this.submitFormat) : date;
},
formatMultiHiddenDate : function(date) {
var field = this, formatted = [],value;
for (var e=0,el=date.length;e |