Debian Codegraph @

dojox/widget/_CalendarMonthView.js

raw symbols SCIP
1 define([
2 "dojo/_base/declare",
3 "./_CalendarView",
4 "dijit/_TemplatedMixin",
5 "./_CalendarMonthYearView",
6 "dojo/dom-class",
7 "dojo/_base/event",
8 "dojo/text!./Calendar/CalendarMonth.html"
9 ], function(declare, _CalendarView, _TemplatedMixin, _CalendarMonthYearView, domClass, event, template){
10 return declare("dojox.widget._CalendarMonthView", [_CalendarView, _TemplatedMixin], {
11 // summary:
12 // A Calendar view listing the 12 months of the year
13
14 // templateString: String
15 // The template to be used to construct the widget.
16 templateString: template,
17
18 // datePart: String
19 // Specifies how much to increment the displayed date when the user
20 // clicks the array button to increment of decrement the view.
21 datePart: "year",
22
23 // headerClass: String
24 // Specifies the CSS class to apply to the header node for this view.
25 headerClass: "dojoxCalendarMonthHeader",
26
27 // displayedYear: String
28 // The current year being displayed
29 displayedYear: "",
30
31 postCreate: function(){
32 // summary:
33 // Constructs the view
34 this.cloneClass(".dojoxCalendarMonthTemplate", 3);
35 this.cloneClass(".dojoxCalendarMonthGroupTemplate", 2);
36 this._populateMonths();
37
38 // Add visual effects to the view, if any have been mixed in
39 this.addFx(".dojoxCalendarMonthLabel", this.domNode);
40 },
41
42 _setValueAttr: function(value){
43 var year = this.header.innerHTML = value.getFullYear();
44 // We should be keeping this info around, might as well expose it too.
45 // Added while patching http://bugs.dojotoolkit.org/ticket/15520
46 this.set("displayedYear", year);
47 this._populateMonths();
48 },
49
50 _getMonthNames: _CalendarMonthYearView.prototype._getMonthNames,
51
52 _populateMonths: _CalendarMonthYearView.prototype._populateMonths,
53
54 onClick: function(evt){
55 // summary:
56 // Handles clicks on month names
57 if(!domClass.contains(evt.target, "dojoxCalendarMonthLabel")){event.stop(evt); return;}
58 var parentNode = evt.target.parentNode;
59 var month = parentNode.cellIndex + (parentNode.parentNode.rowIndex * 4);
60 var date = this.get("value");
61 // Seeing a really strange bug in FF3.6 where this has to be called twice
62 // in order to take affect
63 date.setMonth(month);
64 date.setMonth(month);
65 date.setYear(this.displayedYear);
66 this.onValueSelected(date, month);
67 }
68 });
69 });