Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / widget / Calendar.js @ 13

History | View | Annotate | Download (19.2 KB)

1
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6

    
7

    
8
if(!dojo._hasResource["dojox.widget.Calendar"]){
9
dojo._hasResource["dojox.widget.Calendar"]=true;
10
dojo.provide("dojox.widget.Calendar");
11
dojo.experimental("dojox.widget.Calendar");
12
dojo.require("dijit.Calendar");
13
dojo.require("dijit._Container");
14
dojo.declare("dojox.widget._CalendarBase",[dijit._Widget,dijit._Templated,dijit._Container],{templateString:dojo.cache("dojox.widget","Calendar/Calendar.html","<div class=\"dojoxCalendar\">\n    <div tabindex=\"0\" class=\"dojoxCalendarContainer\" style=\"visibility: visible;\" dojoAttachPoint=\"container\">\n\t\t<div style=\"display:none\">\n\t\t\t<div dojoAttachPoint=\"previousYearLabelNode\"></div>\n\t\t\t<div dojoAttachPoint=\"nextYearLabelNode\"></div>\n\t\t\t<div dojoAttachPoint=\"monthLabelSpacer\"></div>\n\t\t</div>\n        <div class=\"dojoxCalendarHeader\">\n            <div>\n                <div class=\"dojoxCalendarDecrease\" dojoAttachPoint=\"decrementMonth\"></div>\n            </div>\n            <div class=\"\">\n                <div class=\"dojoxCalendarIncrease\" dojoAttachPoint=\"incrementMonth\"></div>\n            </div>\n            <div class=\"dojoxCalendarTitle\" dojoAttachPoint=\"header\" dojoAttachEvent=\"onclick: onHeaderClick\">\n            </div>\n        </div>\n        <div class=\"dojoxCalendarBody\" dojoAttachPoint=\"containerNode\"></div>\n        <div class=\"\">\n            <div class=\"dojoxCalendarFooter\" dojoAttachPoint=\"footer\">                        \n            </div>\n        </div>\n    </div>\n</div>\n"),_views:null,useFx:true,widgetsInTemplate:true,value:new Date(),constraints:null,footerFormat:"medium",constructor:function(){
15
this._views=[];
16
},postMixInProperties:function(){
17
var c=this.constraints;
18
if(c){
19
var _1=dojo.date.stamp.fromISOString;
20
if(typeof c.min=="string"){
21
c.min=_1(c.min);
22
}
23
if(typeof c.max=="string"){
24
c.max=_1(c.max);
25
}
26
}
27
},postCreate:function(){
28
this.displayMonth=new Date(this.get("value"));
29
var _2={parent:this,_getValueAttr:dojo.hitch(this,function(){
30
return new Date(this._internalValue||this.value);
31
}),_getDisplayMonthAttr:dojo.hitch(this,function(){
32
return new Date(this.displayMonth);
33
}),_getConstraintsAttr:dojo.hitch(this,function(){
34
return this.constraints;
35
}),getLang:dojo.hitch(this,function(){
36
return this.lang;
37
}),isDisabledDate:dojo.hitch(this,this.isDisabledDate),getClassForDate:dojo.hitch(this,this.getClassForDate),addFx:this.useFx?dojo.hitch(this,this.addFx):function(){
38
}};
39
dojo.forEach(this._views,function(_3){
40
var _4=new _3(_2,dojo.create("div"));
41
this.addChild(_4);
42
var _5=_4.getHeader();
43
if(_5){
44
this.header.appendChild(_5);
45
dojo.style(_5,"display","none");
46
}
47
dojo.style(_4.domNode,"visibility","hidden");
48
dojo.connect(_4,"onValueSelected",this,"_onDateSelected");
49
_4.attr("value",this.get("value"));
50
},this);
51
if(this._views.length<2){
52
dojo.style(this.header,"cursor","auto");
53
}
54
this.inherited(arguments);
55
this._children=this.getChildren();
56
this._currentChild=0;
57
var _6=new Date();
58
this.footer.innerHTML="Today: "+dojo.date.locale.format(_6,{formatLength:this.footerFormat,selector:"date",locale:this.lang});
59
dojo.connect(this.footer,"onclick",this,"goToToday");
60
var _7=this._children[0];
61
dojo.style(_7.domNode,"top","0px");
62
dojo.style(_7.domNode,"visibility","visible");
63
var _8=_7.getHeader();
64
if(_8){
65
dojo.style(_7.getHeader(),"display","");
66
}
67
dojo[_7.useHeader?"removeClass":"addClass"](this.container,"no-header");
68
_7.onDisplay();
69
var _9=this;
70
var _a=function(_b,_c,_d){
71
dijit.typematic.addMouseListener(_9[_b],_9,function(_e){
72
if(_e>=0){
73
_9._adjustDisplay(_c,_d);
74
}
75
},0.8,500);
76
};
77
_a("incrementMonth","month",1);
78
_a("decrementMonth","month",-1);
79
this._updateTitleStyle();
80
},addFx:function(_f,_10){
81
},_setValueAttr:function(_11){
82
if(!_11["getFullYear"]){
83
_11=dojo.date.stamp.fromISOString(_11+"");
84
}
85
if(!this.value||dojo.date.compare(_11,this.value)){
86
_11=new Date(_11);
87
this.displayMonth=new Date(_11);
88
this._internalValue=_11;
89
if(!this.isDisabledDate(_11,this.lang)&&this._currentChild==0){
90
this.value=_11;
91
this.onChange(_11);
92
}
93
this._children[this._currentChild].attr("value",this.value);
94
return true;
95
}
96
return false;
97
},isDisabledDate:function(_12,_13){
98
var c=this.constraints;
99
var _14=dojo.date.compare;
100
return c&&(c.min&&(_14(c.min,_12,"date")>0)||(c.max&&_14(c.max,_12,"date")<0));
101
},onValueSelected:function(_15){
102
},_onDateSelected:function(_16,_17,_18){
103
this.displayMonth=_16;
104
this.set("value",_16);
105
if(!this._transitionVert(-1)){
106
if(!_17&&_17!==0){
107
_17=this.get("value");
108
}
109
this.onValueSelected(_17);
110
}
111
},onChange:function(_19){
112
},onHeaderClick:function(e){
113
this._transitionVert(1);
114
},goToToday:function(){
115
this.set("value",new Date());
116
this.onValueSelected(this.get("value"));
117
},_transitionVert:function(_1a){
118
var _1b=this._children[this._currentChild];
119
var _1c=this._children[this._currentChild+_1a];
120
if(!_1c){
121
return false;
122
}
123
dojo.style(_1c.domNode,"visibility","visible");
124
var _1d=dojo.style(this.containerNode,"height");
125
_1c.attr("value",this.displayMonth);
126
if(_1b.header){
127
dojo.style(_1b.header,"display","none");
128
}
129
if(_1c.header){
130
dojo.style(_1c.header,"display","");
131
}
132
dojo.style(_1c.domNode,"top",(_1d*-1)+"px");
133
dojo.style(_1c.domNode,"visibility","visible");
134
this._currentChild+=_1a;
135
var _1e=_1d*_1a;
136
var _1f=0;
137
dojo.style(_1c.domNode,"top",(_1e*-1)+"px");
138
var _20=dojo.animateProperty({node:_1b.domNode,properties:{top:_1e},onEnd:function(){
139
dojo.style(_1b.domNode,"visibility","hidden");
140
}});
141
var _21=dojo.animateProperty({node:_1c.domNode,properties:{top:_1f},onEnd:function(){
142
_1c.onDisplay();
143
}});
144
dojo[_1c.useHeader?"removeClass":"addClass"](this.container,"no-header");
145
_20.play();
146
_21.play();
147
_1b.onBeforeUnDisplay();
148
_1c.onBeforeDisplay();
149
this._updateTitleStyle();
150
return true;
151
},_updateTitleStyle:function(){
152
dojo[this._currentChild<this._children.length-1?"addClass":"removeClass"](this.header,"navToPanel");
153
},_slideTable:function(_22,_23,_24){
154
var _25=_22.domNode;
155
var _26=_25.cloneNode(true);
156
var _27=dojo.style(_25,"width");
157
_25.parentNode.appendChild(_26);
158
dojo.style(_25,"left",(_27*_23)+"px");
159
_24();
160
var _28=dojo.animateProperty({node:_26,properties:{left:_27*_23*-1},duration:500,onEnd:function(){
161
_26.parentNode.removeChild(_26);
162
}});
163
var _29=dojo.animateProperty({node:_25,properties:{left:0},duration:500});
164
_28.play();
165
_29.play();
166
},_addView:function(_2a){
167
this._views.push(_2a);
168
},getClassForDate:function(_2b,_2c){
169
},_adjustDisplay:function(_2d,_2e,_2f){
170
var _30=this._children[this._currentChild];
171
var _31=this.displayMonth=_30.adjustDate(this.displayMonth,_2e);
172
this._slideTable(_30,_2e,function(){
173
_30.attr("value",_31);
174
});
175
}});
176
dojo.declare("dojox.widget._CalendarView",dijit._Widget,{headerClass:"",useHeader:true,cloneClass:function(_32,n,_33){
177
var _34=dojo.query(_32,this.domNode)[0];
178
var i;
179
if(!_33){
180
for(i=0;i<n;i++){
181
_34.parentNode.appendChild(_34.cloneNode(true));
182
}
183
}else{
184
var _35=dojo.query(_32,this.domNode)[0];
185
for(i=0;i<n;i++){
186
_34.parentNode.insertBefore(_34.cloneNode(true),_35);
187
}
188
}
189
},_setText:function(_36,_37){
190
if(_36.innerHTML!=_37){
191
dojo.empty(_36);
192
_36.appendChild(dojo.doc.createTextNode(_37));
193
}
194
},getHeader:function(){
195
return this.header||(this.header=this.header=dojo.create("span",{"class":this.headerClass}));
196
},onValueSelected:function(_38){
197
},adjustDate:function(_39,_3a){
198
return dojo.date.add(_39,this.datePart,_3a);
199
},onDisplay:function(){
200
},onBeforeDisplay:function(){
201
},onBeforeUnDisplay:function(){
202
}});
203
dojo.declare("dojox.widget._CalendarDay",null,{parent:null,constructor:function(){
204
this._addView(dojox.widget._CalendarDayView);
205
}});
206
dojo.declare("dojox.widget._CalendarDayView",[dojox.widget._CalendarView,dijit._Templated],{templateString:dojo.cache("dojox.widget","Calendar/CalendarDay.html","<div class=\"dijitCalendarDayLabels\" style=\"left: 0px;\" dojoAttachPoint=\"dayContainer\">\n\t<div dojoAttachPoint=\"header\">\n\t\t<div dojoAttachPoint=\"monthAndYearHeader\">\n\t\t\t<span dojoAttachPoint=\"monthLabelNode\" class=\"dojoxCalendarMonthLabelNode\"></span>\n\t\t\t<span dojoAttachPoint=\"headerComma\" class=\"dojoxCalendarComma\">,</span>\n\t\t\t<span dojoAttachPoint=\"yearLabelNode\" class=\"dojoxCalendarDayYearLabel\"></span>\n\t\t</div>\n\t</div>\n\t<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"margin: auto;\">\n\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<td class=\"dijitCalendarDayLabelTemplate\"><div class=\"dijitCalendarDayLabel\"></div></td>\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody dojoAttachEvent=\"onclick: _onDayClick\">\n\t\t\t<tr class=\"dijitCalendarWeekTemplate\">\n\t\t\t\t<td class=\"dojoxCalendarNextMonth dijitCalendarDateTemplate\">\n\t\t\t\t\t<div class=\"dijitCalendarDateLabel\"></div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</tbody>\n\t</table>\n</div>\n"),datePart:"month",dayWidth:"narrow",postCreate:function(){
207
this.cloneClass(".dijitCalendarDayLabelTemplate",6);
208
this.cloneClass(".dijitCalendarDateTemplate",6);
209
this.cloneClass(".dijitCalendarWeekTemplate",5);
210
var _3b=dojo.date.locale.getNames("days",this.dayWidth,"standAlone",this.getLang());
211
var _3c=dojo.cldr.supplemental.getFirstDayOfWeek(this.getLang());
212
dojo.query(".dijitCalendarDayLabel",this.domNode).forEach(function(_3d,i){
213
this._setText(_3d,_3b[(i+_3c)%7]);
214
},this);
215
},onDisplay:function(){
216
if(!this._addedFx){
217
this._addedFx=true;
218
this.addFx(".dijitCalendarDateTemplate div",this.domNode);
219
}
220
},_onDayClick:function(e){
221
if(typeof (e.target._date)=="undefined"){
222
return;
223
}
224
var _3e=new Date(this.get("displayMonth"));
225
var p=e.target.parentNode;
226
var c="dijitCalendar";
227
var d=dojo.hasClass(p,c+"PreviousMonth")?-1:(dojo.hasClass(p,c+"NextMonth")?1:0);
228
if(d){
229
_3e=dojo.date.add(_3e,"month",d);
230
}
231
_3e.setDate(e.target._date);
232
if(this.isDisabledDate(_3e)){
233
dojo.stopEvent(e);
234
return;
235
}
236
this.parent._onDateSelected(_3e);
237
},_setValueAttr:function(_3f){
238
this._populateDays();
239
},_populateDays:function(){
240
var _40=new Date(this.get("displayMonth"));
241
_40.setDate(1);
242
var _41=_40.getDay();
243
var _42=dojo.date.getDaysInMonth(_40);
244
var _43=dojo.date.getDaysInMonth(dojo.date.add(_40,"month",-1));
245
var _44=new Date();
246
var _45=this.get("value");
247
var _46=dojo.cldr.supplemental.getFirstDayOfWeek(this.getLang());
248
if(_46>_41){
249
_46-=7;
250
}
251
var _47=dojo.date.compare;
252
var _48=".dijitCalendarDateTemplate";
253
var _49="dijitCalendarSelectedDate";
254
var _4a=this._lastDate;
255
var _4b=_4a==null||_4a.getMonth()!=_40.getMonth()||_4a.getFullYear()!=_40.getFullYear();
256
this._lastDate=_40;
257
if(!_4b){
258
dojo.query(_48,this.domNode).removeClass(_49).filter(function(_4c){
259
return _4c.className.indexOf("dijitCalendarCurrent")>-1&&_4c._date==_45.getDate();
260
}).addClass(_49);
261
return;
262
}
263
dojo.query(_48,this.domNode).forEach(function(_4d,i){
264
i+=_46;
265
var _4e=new Date(_40);
266
var _4f,_50="dijitCalendar",adj=0;
267
if(i<_41){
268
_4f=_43-_41+i+1;
269
adj=-1;
270
_50+="Previous";
271
}else{
272
if(i>=(_41+_42)){
273
_4f=i-_41-_42+1;
274
adj=1;
275
_50+="Next";
276
}else{
277
_4f=i-_41+1;
278
_50+="Current";
279
}
280
}
281
if(adj){
282
_4e=dojo.date.add(_4e,"month",adj);
283
}
284
_4e.setDate(_4f);
285
if(!_47(_4e,_44,"date")){
286
_50="dijitCalendarCurrentDate "+_50;
287
}
288
if(!_47(_4e,_45,"date")&&!_47(_4e,_45,"month")&&!_47(_4e,_45,"year")){
289
_50=_49+" "+_50;
290
}
291
if(this.isDisabledDate(_4e,this.getLang())){
292
_50=" dijitCalendarDisabledDate "+_50;
293
}
294
var _51=this.getClassForDate(_4e,this.getLang());
295
if(_51){
296
_50+=_51+" "+_50;
297
}
298
_4d.className=_50+"Month dijitCalendarDateTemplate";
299
_4d.dijitDateValue=_4e.valueOf();
300
var _52=dojo.query(".dijitCalendarDateLabel",_4d)[0];
301
this._setText(_52,_4e.getDate());
302
_52._date=_52.parentNode._date=_4e.getDate();
303
},this);
304
var _53=dojo.date.locale.getNames("months","wide","standAlone",this.getLang());
305
this._setText(this.monthLabelNode,_53[_40.getMonth()]);
306
this._setText(this.yearLabelNode,_40.getFullYear());
307
}});
308
dojo.declare("dojox.widget._CalendarMonthYear",null,{constructor:function(){
309
this._addView(dojox.widget._CalendarMonthYearView);
310
}});
311
dojo.declare("dojox.widget._CalendarMonthYearView",[dojox.widget._CalendarView,dijit._Templated],{templateString:dojo.cache("dojox.widget","Calendar/CalendarMonthYear.html","<div class=\"dojoxCal-MY-labels\" style=\"left: 0px;\"\t\n\tdojoAttachPoint=\"myContainer\" dojoAttachEvent=\"onclick: onClick\">\n\t\t<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"margin: auto;\">\n\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr class=\"dojoxCal-MY-G-Template\">\n\t\t\t\t\t\t\t\t<td class=\"dojoxCal-MY-M-Template\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"dojoxCalendarMonthLabel\"></div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class=\"dojoxCal-MY-M-Template\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"dojoxCalendarMonthLabel\"></div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class=\"dojoxCal-MY-Y-Template\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"dojoxCalendarYearLabel\"></div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class=\"dojoxCal-MY-Y-Template\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"dojoxCalendarYearLabel\"></div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t </tr>\n\t\t\t\t\t\t <tr class=\"dojoxCal-MY-btns\">\n\t\t\t\t\t\t \t <td class=\"dojoxCal-MY-btns\" colspan=\"4\">\n\t\t\t\t\t\t \t\t <span class=\"dijitReset dijitInline dijitButtonNode ok-btn\" dojoAttachEvent=\"onclick: onOk\" dojoAttachPoint=\"okBtn\">\n\t\t\t\t\t\t \t \t \t <button\tclass=\"dijitReset dijitStretch dijitButtonContents\">OK</button>\n\t\t\t\t\t\t\t\t </span>\n\t\t\t\t\t\t\t\t <span class=\"dijitReset dijitInline dijitButtonNode cancel-btn\" dojoAttachEvent=\"onclick: onCancel\" dojoAttachPoint=\"cancelBtn\">\n\t\t\t\t\t\t \t \t\t <button\tclass=\"dijitReset dijitStretch dijitButtonContents\">Cancel</button>\n\t\t\t\t\t\t\t\t </span>\n\t\t\t\t\t\t \t </td>\n\t\t\t\t\t\t </tr>\n\t\t\t\t</tbody>\n\t\t</table>\n</div>\n"),datePart:"year",displayedYears:10,useHeader:false,postCreate:function(){
312
this.cloneClass(".dojoxCal-MY-G-Template",5,".dojoxCal-MY-btns");
313
this.monthContainer=this.yearContainer=this.myContainer;
314
var _54="dojoxCalendarYearLabel";
315
var _55="dojoxCalendarDecrease";
316
var _56="dojoxCalendarIncrease";
317
dojo.query("."+_54,this.myContainer).forEach(function(_57,idx){
318
var _58=_56;
319
switch(idx){
320
case 0:
321
_58=_55;
322
case 1:
323
dojo.removeClass(_57,_54);
324
dojo.addClass(_57,_58);
325
break;
326
}
327
});
328
this._decBtn=dojo.query("."+_55,this.myContainer)[0];
329
this._incBtn=dojo.query("."+_56,this.myContainer)[0];
330
dojo.query(".dojoxCal-MY-M-Template",this.domNode).filter(function(_59){
331
return _59.cellIndex==1;
332
}).addClass("dojoxCal-MY-M-last");
333
dojo.connect(this,"onBeforeDisplay",dojo.hitch(this,function(){
334
this._cachedDate=new Date(this.get("value").getTime());
335
this._populateYears(this._cachedDate.getFullYear());
336
this._populateMonths();
337
this._updateSelectedMonth();
338
this._updateSelectedYear();
339
}));
340
dojo.connect(this,"_populateYears",dojo.hitch(this,function(){
341
this._updateSelectedYear();
342
}));
343
dojo.connect(this,"_populateMonths",dojo.hitch(this,function(){
344
this._updateSelectedMonth();
345
}));
346
this._cachedDate=this.get("value");
347
this._populateYears();
348
this._populateMonths();
349
this.addFx(".dojoxCalendarMonthLabel,.dojoxCalendarYearLabel ",this.myContainer);
350
},_setValueAttr:function(_5a){
351
this._populateYears(_5a.getFullYear());
352
},getHeader:function(){
353
return null;
354
},_getMonthNames:function(_5b){
355
this._monthNames=this._monthNames||dojo.date.locale.getNames("months",_5b,"standAlone",this.getLang());
356
return this._monthNames;
357
},_populateMonths:function(){
358
var _5c=this._getMonthNames("abbr");
359
dojo.query(".dojoxCalendarMonthLabel",this.monthContainer).forEach(dojo.hitch(this,function(_5d,cnt){
360
this._setText(_5d,_5c[cnt]);
361
}));
362
var _5e=this.get("constraints");
363
if(_5e){
364
var _5f=new Date();
365
_5f.setFullYear(this._year);
366
var min=-1,max=12;
367
if(_5e.min){
368
var _60=_5e.min.getFullYear();
369
if(_60>this._year){
370
min=12;
371
}else{
372
if(_60==this._year){
373
min=_5e.min.getMonth();
374
}
375
}
376
}
377
if(_5e.max){
378
var _61=_5e.max.getFullYear();
379
if(_61<this._year){
380
max=-1;
381
}else{
382
if(_61==this._year){
383
max=_5e.max.getMonth();
384
}
385
}
386
}
387
dojo.query(".dojoxCalendarMonthLabel",this.monthContainer).forEach(dojo.hitch(this,function(_62,cnt){
388
dojo[(cnt<min||cnt>max)?"addClass":"removeClass"](_62,"dijitCalendarDisabledDate");
389
}));
390
}
391
var h=this.getHeader();
392
if(h){
393
this._setText(this.getHeader(),this.get("value").getFullYear());
394
}
395
},_populateYears:function(_63){
396
var _64=this.get("constraints");
397
var _65=_63||this.get("value").getFullYear();
398
var _66=_65-Math.floor(this.displayedYears/2);
399
var min=_64&&_64.min?_64.min.getFullYear():_66-10000;
400
_66=Math.max(min,_66);
401
this._displayedYear=_65;
402
var _67=dojo.query(".dojoxCalendarYearLabel",this.yearContainer);
403
var max=_64&&_64.max?_64.max.getFullYear()-_66:_67.length;
404
var _68="dijitCalendarDisabledDate";
405
_67.forEach(dojo.hitch(this,function(_69,cnt){
406
if(cnt<=max){
407
this._setText(_69,_66+cnt);
408
dojo.removeClass(_69,_68);
409
}else{
410
dojo.addClass(_69,_68);
411
}
412
}));
413
if(this._incBtn){
414
dojo[max<_67.length?"addClass":"removeClass"](this._incBtn,_68);
415
}
416
if(this._decBtn){
417
dojo[min>=_66?"addClass":"removeClass"](this._decBtn,_68);
418
}
419
var h=this.getHeader();
420
if(h){
421
this._setText(this.getHeader(),_66+" - "+(_66+11));
422
}
423
},_updateSelectedYear:function(){
424
this._year=String((this._cachedDate||this.get("value")).getFullYear());
425
this._updateSelectedNode(".dojoxCalendarYearLabel",dojo.hitch(this,function(_6a,idx){
426
return this._year!==null&&_6a.innerHTML==this._year;
427
}));
428
},_updateSelectedMonth:function(){
429
var _6b=(this._cachedDate||this.get("value")).getMonth();
430
this._month=_6b;
431
this._updateSelectedNode(".dojoxCalendarMonthLabel",function(_6c,idx){
432
return idx==_6b;
433
});
434
},_updateSelectedNode:function(_6d,_6e){
435
var sel="dijitCalendarSelectedDate";
436
dojo.query(_6d,this.domNode).forEach(function(_6f,idx,_70){
437
dojo[_6e(_6f,idx,_70)?"addClass":"removeClass"](_6f.parentNode,sel);
438
});
439
var _71=dojo.query(".dojoxCal-MY-M-Template div",this.myContainer).filter(function(_72){
440
return dojo.hasClass(_72.parentNode,sel);
441
})[0];
442
if(!_71){
443
return;
444
}
445
var _73=dojo.hasClass(_71,"dijitCalendarDisabledDate");
446
dojo[_73?"addClass":"removeClass"](this.okBtn,"dijitDisabled");
447
},onClick:function(evt){
448
var _74;
449
var _75=this;
450
var sel="dijitCalendarSelectedDate";
451
function hc(c){
452
return dojo.hasClass(evt.target,c);
453
};
454
if(hc("dijitCalendarDisabledDate")){
455
dojo.stopEvent(evt);
456
return false;
457
}
458
if(hc("dojoxCalendarMonthLabel")){
459
_74="dojoxCal-MY-M-Template";
460
this._month=evt.target.parentNode.cellIndex+(evt.target.parentNode.parentNode.rowIndex*2);
461
this._cachedDate.setMonth(this._month);
462
this._updateSelectedMonth();
463
}else{
464
if(hc("dojoxCalendarYearLabel")){
465
_74="dojoxCal-MY-Y-Template";
466
this._year=Number(evt.target.innerHTML);
467
this._cachedDate.setYear(this._year);
468
this._populateMonths();
469
this._updateSelectedYear();
470
}else{
471
if(hc("dojoxCalendarDecrease")){
472
this._populateYears(this._displayedYear-10);
473
return true;
474
}else{
475
if(hc("dojoxCalendarIncrease")){
476
this._populateYears(this._displayedYear+10);
477
return true;
478
}else{
479
return true;
480
}
481
}
482
}
483
}
484
dojo.stopEvent(evt);
485
return false;
486
},onOk:function(evt){
487
dojo.stopEvent(evt);
488
if(dojo.hasClass(this.okBtn,"dijitDisabled")){
489
return false;
490
}
491
this.onValueSelected(this._cachedDate);
492
return false;
493
},onCancel:function(evt){
494
dojo.stopEvent(evt);
495
this.onValueSelected(this.get("value"));
496
return false;
497
}});
498
dojo.declare("dojox.widget.Calendar2Pane",[dojox.widget._CalendarBase,dojox.widget._CalendarDay,dojox.widget._CalendarMonthYear],{});
499
dojo.declare("dojox.widget.Calendar",[dojox.widget._CalendarBase,dojox.widget._CalendarDay,dojox.widget._CalendarMonthYear],{});
500
dojo.declare("dojox.widget.DailyCalendar",[dojox.widget._CalendarBase,dojox.widget._CalendarDay],{});
501
dojo.declare("dojox.widget.MonthAndYearlyCalendar",[dojox.widget._CalendarBase,dojox.widget._CalendarMonthYear],{});
502
}