Debian Codegraph @

dojox/date/tests/test_DateTextBoxNewPersianGreg.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4 <head>
5 <title>Date Conversions for Persian Widget</title>
6
7 <style type="text/css">
8 @import "../../../dojo/resources/dojo.css";
9
10 @import "../../../dijit/tests/css/dijitTests.css";
11 </style>
12
13 <!-- required: the default dijit theme: -->
14 <link id="themeStyles" rel="stylesheet"
15 href="../../../dijit/themes/tundra/tundra.css">
16
17 <!-- required: dojo.js -->
18 <script type="text/javascript" src="../../../dojo/dojo.js"
19 djConfig=" isDebug: true, parseOnLoad: true, extraLocale: ['en-us', 'fa-ir']"></script>
20 <script>
21 dojo.require("dijit/form/Form");
22 dojo.require("dojo/date");
23 dojo.require("dojo/date/locale");
24 dojo.require("dojox/date/persian");
25 dojo.require("dojox/date/persian/locale");
26 dojo.require("dijit/form/DateTextBox");
27 dojo.require("dojo/parser");
28 /**
29 * @param actualFormat -- current format
30 * @param requiredformat-- converted Format
31 * @param source -- Source control
32 * @param destination -- Destination control
33 * @return
34 */
35 function convertPersianToGregorianDate(actualFormat, requiredformat,
36 source, destination) {
37 var value = dijit.byId(source).attr('DisplayedValue');
38 var options = {
39 datePattern : actualFormat,
40 selector : 'date'
41 };
42 var date = dojox.date.persian.locale.parse(value, options);
43 date = date.toGregorian();
44 options.datePattern = requiredformat;
45 var convertedDate = dojo.date.locale.format(date, options);
46 dojo.byId(destination).value = convertedDate;
47 }
48
49 /**
50 * @param actualFormat -- current format
51 * @param requiredformat-- converted Format
52 * @param source -- Source control
53 * @param destination -- Destination control
54 * @return
55 */
56 function convertGregorianToPersianDate(actualFormat, requiredformat,
57 source, destination) {
58 var value = dijit.byId(source).attr('DisplayedValue');
59 var options = {
60 datePattern : actualFormat,
61 selector : 'date'
62 };
63 var date = dojo.date.locale.parse(value, options);
64 date = new dojox.date.persian.Date(new Date(date));
65 options.datePattern = requiredformat;
66 var convertedDate = dojox.date.persian.locale.format(date, options);
67 dojo.byId(destination).value = convertedDate;
68
69 }
70 </script>
71 </head>
72
73 <body class=" tundra ">
74 <h1 class="testTitle">Test DateTextBoxNew Persian and Gregorian Widget:</h1>
75 <form id="form1" dojoType='dijit.form.Form' action="" name="Persian" method="">
76
77 <div class="dojoTitlePaneLabel"><label for="q1"> Persian
78 Calendar </label> <span class="noticeMessage">DateTextBox class,
79 datePackage = "dojox.date.persian"</span></div>
80
81 <table>
82 <tr>
83 <td><label id="lpdat1"> Persian Date :</label></td>
84 <td><input type="combo" id="pDate1" name="dob"
85 dojoType="dijit.form.DateTextBox"
86 constraints="{datePattern:'yyyy/MM/dd'}" lang="fa"
87 datePackage="dojox.date.persian"
88 onchange="convertPersianToGregorianDate('yyyy/MM/dd','yyyy/MM/dd','pDate1','gDate1')"
89 value="2007-12-25" /></td>
90 <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
91 <td><label id="lgdat1"> Gregorian Date(yyyy/MM/dd) :</label></td>
92
93 <td><input id="gDate1" size="34" disabled value="not fired yet!"
94 autocomplete="off"></td>
95 <tr rows="3"></tr>
96 </tr>
97 <tr></tr>
98 <tr></tr>
99 <tr></tr>
100 <tr></tr>
101 <tr>
102 <td><label id="lgdat2">Gregorian Date :</label></td>
103
104 <td><input type="combo" id="gDate2" name="dob"
105 dojoType="dijit.form.DateTextBox"
106 constraints="{datePattern:'yyyy/MM/dd'}"
107 onchange="convertGregorianToPersianDate('yyyy/MM/dd','yyyy/MM/dd','gDate2','pDate2')"
108 value="2007-12-25" /></td>
109 <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
110 <td><label id="lpdat2"> Persian Date (yyyy/MM/dd) :</label></td>
111
112 <td><input id="pDate2" size="34" disabled value="not fired yet!"
113 autocomplete="off"></td>
114
115 </tr>
116 <tr></tr>
117 <tr></tr>
118 <tr></tr>
119 <tr></tr>
120 <tr>
121 <td><label id="lgdat3">Persian Date :</label></td>
122
123 <td><input type="combo" id="gDate3" name="dob"
124 dojoType="dijit.form.DateTextBox"
125 constraints="{datePattern:'yyyy/MMM/dd'}"
126 onchange="convertGregorianToPersianDate('yyyy/MMM/dd','yyyy/MMM/dd','gDate3','pDate3')"
127 value="2007-12-25" /></td>
128 <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
129 <td><label id="lpdat3"> Gregorian Date (yyyy/MMM/dd):</label></td>
130 <td><input id="pDate3" size="34" disabled value="not fired yet!"
131 autocomplete="off"></td>
132 </tr>
133 <tr></tr>
134 <tr></tr>
135 <tr></tr>
136 <tr></tr>
137 <tr>
138 <td><label id="lgdat4"> Persian Date :</label></td>
139
140 <td><input type="combo" id="gDate4" name="dob"
141 dojoType="dijit.form.DateTextBox"
142 constraints="{datePattern:'yyyy/MMM/dd'}"
143 datePackage="dojox.date.persian"
144 onchange="convertPersianToGregorianDate('yyyy/MMM/dd','yyyy/MMM/dd','gDate4','pDate4')"
145 value="2007-12-25" /></td>
146
147 <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
148 <td><label id="lpdat4"> Gregorian Date(yyyy/MMM/dd) </label></td>
149
150
151 <td><input id="pDate4" size="34" disabled value="not fired yet!"
152 autocomplete="off"></td>
153
154 </tr>
155 <tr></tr>
156 <tr></tr>
157 <tr></tr>
158 <tr></tr>
159 <tr>
160 <td><label id="lgdat5">Gregorian Date :</label></td>
161
162
163 <td><input type="combo" id="gDate5" name="dob"
164 dojoType="dijit.form.DateTextBox"
165 constraints="{datePattern:'yyyy/MMM/dd'}"
166 datePackage="dojox.date.persian"
167 onchange="convertPersianToGregorianDate('yyyy/MMM/dd','dd/MM/yyyy','gDate5','pDate5')"
168 value="2007-12-25" /></td>
169
170 <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
171 <td><label id="lpdat4"> Persian Date (dd/MM/yyyy):</label></td>
172
173
174 <td><input id="pDate5" size="34" disabled value="not fired yet!"
175 autocomplete="off"></td>
176
177
178 </tr>
179 </table>
180 </form>
181
182 </body>
183
184 </html>