1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
---|
5 | <title>Calendar Widget Test</title> |
---|
6 | |
---|
7 | <!-- for tests --> |
---|
8 | <style type="text/css"> |
---|
9 | @import "../themes/claro/document.css"; |
---|
10 | @import "css/dijitTests.css"; |
---|
11 | </style> |
---|
12 | |
---|
13 | <style> |
---|
14 | #calendar5 .dijitCalendarDateTemplate { height: 50px; width: 50px; border: 1px solid #ccc; vertical-align: top } |
---|
15 | #calendar5 .dijitCalendarDateLabel, #calendar5 .dijitCalendarDateTemplate { text-align: inherit } |
---|
16 | #calendar5 .dijitCalendarDayLabel { font-weight: bold } |
---|
17 | #calendar5 .dijitCalendarSelectedYear { font-size: 1.5em } |
---|
18 | #calendar5 .dijitCalendarMonthLabel { font-family: serif; letter-spacing: 0.2em; font-size: 2em } |
---|
19 | .blue { color: blue } |
---|
20 | </style> |
---|
21 | |
---|
22 | <!-- required: a default dijit theme: --> |
---|
23 | <link id="themeStyles" rel="stylesheet" href="../../dijit/themes/claro/claro.css"/> |
---|
24 | |
---|
25 | <!-- required: dojo.js --> |
---|
26 | <script type="text/javascript" src="../../dojo/dojo.js" |
---|
27 | data-dojo-config="parseOnLoad: true, isDebug: true"></script> |
---|
28 | |
---|
29 | <!-- not needed, for testing alternate themes --> |
---|
30 | <script type="text/javascript" src="_testCommon.js"></script> |
---|
31 | |
---|
32 | <script type="text/javascript"> |
---|
33 | dojo.require("dijit.dijit"); // optimize: load dijit layer |
---|
34 | dojo.require("dijit.Calendar"); |
---|
35 | dojo.require("dojo.date.locale"); |
---|
36 | dojo.require("dojo.parser"); // scan page for widgets |
---|
37 | |
---|
38 | dojo.ready(function(){ |
---|
39 | //Need to declare BigCalendar here in an addOnLoad block so that it works |
---|
40 | //with xdomain loading, where the dojo.require for dijit.Calendar |
---|
41 | //may load asynchronously. This also means we cannot have HTML |
---|
42 | //markup in the body tag for BigCalendar, but instead inject it in this |
---|
43 | //onload handler after BigCalendar is defined. |
---|
44 | dojo.declare("BigCalendar", dijit.Calendar, { |
---|
45 | templateString: dojo.cache("dijit.tests", "_altCalendar.html"), |
---|
46 | isDisabledDate: dojo.date.locale.isWeekend, |
---|
47 | getClassForDate: function(date){ |
---|
48 | if(!(date.getDate() % 10)){ return "blue"; } // apply special style to all days divisible by 10 |
---|
49 | } |
---|
50 | }); |
---|
51 | |
---|
52 | var bigCalendar = dojo.byId("calendar5"); |
---|
53 | bigCalendar.setAttribute("data-dojo-type", "BigCalendar"); |
---|
54 | dojo.parser.parse(bigCalendar.parentNode); |
---|
55 | }); |
---|
56 | |
---|
57 | function myHandler(id,newValue){ |
---|
58 | console.debug("onChange for id = " + id + ", value: " + newValue); |
---|
59 | } |
---|
60 | </script> |
---|
61 | </head> |
---|
62 | <body class="claro"> |
---|
63 | |
---|
64 | <h1 class="testTitle">Dijit Calendar Test</h1> |
---|
65 | |
---|
66 | <input value="input before" id="before"/> |
---|
67 | <input id="calendar1" data-dojo-type="dijit.Calendar" data-dojo-props='onChange:function(v){ myHandler(this.id, v) }'/> |
---|
68 | <input value="input after" id="after"/> |
---|
69 | <p> |
---|
70 | <a href="#" |
---|
71 | onClick="dijit.registry.forEach(function(c){ |
---|
72 | if(c.isDisabledDate){ |
---|
73 | c.isDisabledDate = dojo.date.locale.isWeekend; |
---|
74 | c._populateGrid(); |
---|
75 | } |
---|
76 | });">disable weekends</a> |
---|
77 | </p> |
---|
78 | |
---|
79 | <p>Customized template with "today" button</p> |
---|
80 | <div> |
---|
81 | <!-- Parent div used so we have a handle to use for dojo.parser.parse after BigCalendar gets defined. --> |
---|
82 | <!-- The input below will be replaced by BigCalendar which is defined in a dojo.ready block. --> |
---|
83 | <input id="calendar5" data-dojo-props='dayWidth:"abbr"' value="2008-03-14"/> |
---|
84 | </div> |
---|
85 | </body> |
---|
86 | </html> |
---|