admin_module 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Gemfile +2 -0
- data/README.md +7 -0
- data/admin_module.gemspec +3 -1
- data/{bin → exe}/admin_module +0 -0
- data/lib/admin_module.rb +9 -0
- data/lib/admin_module/command/config.rb +20 -0
- data/lib/admin_module/command/gdl.rb +15 -0
- data/lib/admin_module/guideline.rb +8 -0
- data/lib/admin_module/page_factory.rb +43 -2
- data/lib/admin_module/pages.rb +38 -81
- data/lib/admin_module/pages/guideline_page.rb +54 -1
- data/lib/admin_module/pages/guideline_page_400.rb +87 -0
- data/lib/admin_module/pages/guideline_version_page.rb +9 -5
- data/lib/admin_module/pages/guidelines_page.rb +40 -34
- data/lib/admin_module/pages/guidelines_page_400.rb +65 -0
- data/lib/admin_module/pages/guidelines_version_all_page.rb +79 -72
- data/lib/admin_module/pages/guidelines_version_all_page_400.rb +122 -0
- data/lib/admin_module/pages/login_page.rb +2 -2
- data/lib/admin_module/pages/login_page_400.rb +73 -0
- data/lib/admin_module/version.rb +1 -1
- data/spec/data/config/no_ams_version.admin_module +11 -0
- data/spec/data/html/guideline-400.html +2713 -0
- data/spec/data/html/guideline-400_files/BindChildren.js +852 -0
- data/spec/data/html/guideline-400_files/CVlogo.jpg +0 -0
- data/spec/data/html/guideline-400_files/Guideline.js +301 -0
- data/spec/data/html/guideline-400_files/OptimalOutcome.png +0 -0
- data/spec/data/html/guideline-400_files/WebResource(1).axd +561 -0
- data/spec/data/html/guideline-400_files/WebResource.axd +548 -0
- data/spec/data/html/guideline-400_files/styles.css +444 -0
- data/spec/data/html/guideline-400_files/styles2.css +115 -0
- data/spec/data/html/guideline-400_files/tab.css +50 -0
- data/spec/data/html/guideline-400_files/tabpane.js +297 -0
- data/spec/data/html/guideline.html +1809 -0
- data/spec/data/html/guideline_files/BindChildren.js +799 -0
- data/spec/data/html/guideline_files/Guideline.js +300 -0
- data/spec/data/html/guideline_files/LeftMenu.html +0 -0
- data/spec/data/html/guideline_files/MainFrame.html +18 -0
- data/spec/data/html/guideline_files/ScriptResource.axd +3725 -0
- data/spec/data/html/guideline_files/Stylesheet.css +1545 -0
- data/spec/data/html/guideline_files/WebResource(1).axd +0 -0
- data/spec/data/html/guideline_files/WebResource(2).axd +566 -0
- data/spec/data/html/guideline_files/WebResource(3).axd +219 -0
- data/spec/data/html/guideline_files/WebResource.axd +696 -0
- data/spec/data/html/guideline_files/framebar.html +0 -0
- data/spec/data/html/guideline_files/guideline.html +0 -0
- data/spec/data/html/guideline_files/home.png +0 -0
- data/spec/data/html/guideline_files/jquery-ui.css +578 -0
- data/spec/data/html/guideline_files/jquery.js +7 -0
- data/spec/data/html/guideline_files/slidebar.gif +29 -0
- data/spec/data/html/guideline_files/tab.css +49 -0
- data/spec/data/html/guideline_files/tabpane.js +297 -0
- data/spec/data/html/guidelines-400.html +368 -0
- data/spec/data/html/guidelines-400_files/CVlogo.jpg +0 -0
- data/spec/data/html/guidelines-400_files/EditListSearchHelper.js +141 -0
- data/spec/data/html/guidelines-400_files/OptimalOutcome.png +0 -0
- data/spec/data/html/guidelines-400_files/WebResource(1).axd +561 -0
- data/spec/data/html/guidelines-400_files/WebResource.axd +548 -0
- data/spec/data/html/guidelines-400_files/menu.css +29 -0
- data/spec/data/html/guidelines-400_files/menu.js +48 -0
- data/spec/data/html/guidelines-400_files/shadow.gif +0 -0
- data/spec/data/html/guidelines-400_files/styles.css +444 -0
- data/spec/data/html/guidelines-400_files/styles2.css +115 -0
- data/spec/data/html/guidelines.html +217 -0
- data/spec/data/html/guidelines_files/EditListSearchHelper.js +123 -0
- data/spec/data/html/guidelines_files/ScriptResource.axd +3725 -0
- data/spec/data/html/guidelines_files/Stylesheet.css +1545 -0
- data/spec/data/html/guidelines_files/jquery-ui.css +578 -0
- data/spec/data/html/login.aspx.html +293 -0
- data/spec/data/html/login.aspx_files/ScriptResource.axd +3332 -0
- data/spec/data/html/login.aspx_files/Stylesheet.css +1545 -0
- data/spec/data/html/login.aspx_files/jquery-ui.css +578 -0
- data/spec/data/html/login.aspx_files/jquery.js +7 -0
- data/spec/data/html/login400.aspx.html +191 -0
- data/spec/data/html/login400.aspx_files/WebResource(1).axd +561 -0
- data/spec/data/html/login400.aspx_files/WebResource.axd +548 -0
- data/spec/data/html/login400.aspx_files/styles.css +444 -0
- data/spec/data/html/version_all_guidelines-400.html +702 -0
- data/spec/data/html/version_all_guidelines-400_files/CVlogo.jpg +0 -0
- data/spec/data/html/version_all_guidelines-400_files/Calendar.js +521 -0
- data/spec/data/html/version_all_guidelines-400_files/OptimalOutcome.png +0 -0
- data/spec/data/html/version_all_guidelines-400_files/TwoSelects.js +300 -0
- data/spec/data/html/version_all_guidelines-400_files/menu.css +29 -0
- data/spec/data/html/version_all_guidelines-400_files/menu.js +48 -0
- data/spec/data/html/version_all_guidelines-400_files/shadow.gif +0 -0
- data/spec/data/html/version_all_guidelines-400_files/styles(1).css +134 -0
- data/spec/data/html/version_all_guidelines-400_files/styles.css +444 -0
- data/spec/data/html/version_all_guidelines-400_files/styles2.css +115 -0
- data/spec/data/html/version_all_guidelines.html +560 -0
- data/spec/data/html/version_all_guidelines_files/Calendar.js +521 -0
- data/spec/data/html/version_all_guidelines_files/ScriptResource.axd +3725 -0
- data/spec/data/html/version_all_guidelines_files/Stylesheet.css +1545 -0
- data/spec/data/html/version_all_guidelines_files/TwoSelects.js +304 -0
- data/spec/data/html/version_all_guidelines_files/jquery-ui.css +578 -0
- data/spec/lib/admin_module/command/config_spec.rb +27 -0
- data/spec/lib/admin_module/command/gdl_spec.rb +31 -0
- data/spec/lib/admin_module/configuration_spec.rb +47 -0
- data/spec/lib/admin_module/guideline_spec.rb +26 -0
- data/spec/lib/admin_module/page_factory_spec.rb +72 -0
- data/spec/lib/admin_module/pages/guideline_page_400_spec.rb +51 -0
- data/spec/lib/admin_module/pages/guideline_page_spec.rb +50 -0
- data/spec/lib/admin_module/pages/guidelines_page_400_spec.rb +92 -0
- data/spec/lib/admin_module/pages/guidelines_page_spec.rb +91 -0
- data/spec/lib/admin_module/pages/guidelines_version_all_page_400_spec.rb +102 -0
- data/spec/lib/admin_module/pages/guidelines_version_all_page_spec.rb +105 -0
- data/spec/lib/admin_module/pages/login_page_400_spec.rb +42 -0
- data/spec/lib/admin_module/pages/login_page_spec.rb +33 -0
- data/spec/support/html_spec.rb +26 -0
- data/spec/support/mocks.rb +23 -0
- metadata +191 -5
Binary file
|
@@ -0,0 +1,521 @@
|
|
1
|
+
function Calendar (cname, id, year,month,day,required)
|
2
|
+
{
|
3
|
+
// Used to notify the calendar that it is attached to a single html field.
|
4
|
+
this.fallback_single = 0;
|
5
|
+
|
6
|
+
// Used to notify the claendar that it is attached to 3 html fields.
|
7
|
+
this.fallback_multi = 1;
|
8
|
+
|
9
|
+
// Used to notify the calendar that it is attached to both field sets.
|
10
|
+
this.fallback_both = 2;
|
11
|
+
|
12
|
+
// Read-only calendar
|
13
|
+
this.viewOnly = false;
|
14
|
+
|
15
|
+
// Allows the user to select weekends
|
16
|
+
this.allowWeekends = true;
|
17
|
+
|
18
|
+
// Allows the user to select weekdays
|
19
|
+
this.allowWeekdays = true;
|
20
|
+
|
21
|
+
// The minimum date that the user can select (inclusive)
|
22
|
+
this.minDate = "--";
|
23
|
+
|
24
|
+
// The maximum date that the user can select (exclusive)
|
25
|
+
this.maxDate = "--";
|
26
|
+
|
27
|
+
// Allow the user to scroll dates
|
28
|
+
this.scrolling = true;
|
29
|
+
|
30
|
+
// The id of this calendar
|
31
|
+
this.name = cname;
|
32
|
+
|
33
|
+
// The first day of the week in the calendar (0-Sunday, 6-Saturday)
|
34
|
+
this.firstDayOfWeek = 0;
|
35
|
+
|
36
|
+
// Fallback method
|
37
|
+
this.fallback = this.fallback_both;
|
38
|
+
|
39
|
+
//property to check the mandatory selection
|
40
|
+
this.isRequired = required;
|
41
|
+
|
42
|
+
// Sets the date and strips out time information
|
43
|
+
this.calendarDate = new Date(year,month,day);
|
44
|
+
|
45
|
+
//# Start Issue of 0010261
|
46
|
+
var offset = parseInt(this.calendarDate.getTimezoneOffset());
|
47
|
+
if (offset < 0)
|
48
|
+
{
|
49
|
+
offset = offset.toString().substring(1, offset.length);
|
50
|
+
var dateReminder = offset % 60
|
51
|
+
if (dateReminder > 0)
|
52
|
+
{
|
53
|
+
offset = parseInt(offset) + parseInt(dateReminder);
|
54
|
+
}
|
55
|
+
this.calendarDate.setUTCMinutes(offset);
|
56
|
+
}
|
57
|
+
else if(offset > 0)
|
58
|
+
{
|
59
|
+
offset = "-" + offset.toString();
|
60
|
+
this.calendarDate.setUTCMinutes(offset);
|
61
|
+
}
|
62
|
+
//#End Issue of 0010261
|
63
|
+
|
64
|
+
this.calendarDate.setUTCHours(0);
|
65
|
+
this.calendarDate.setUTCMinutes(0);
|
66
|
+
this.calendarDate.setUTCSeconds(0);
|
67
|
+
this.calendarDate.setUTCMilliseconds(0);
|
68
|
+
|
69
|
+
// The field id that the calendar is attached to.
|
70
|
+
// For single input, this is used "as is". for the
|
71
|
+
// Multi-input, it is given a suffix for _day, _month
|
72
|
+
// and _year inputs.
|
73
|
+
this.attachedId = id;
|
74
|
+
|
75
|
+
// The left and right month control icons
|
76
|
+
this.controlLeft = "«";
|
77
|
+
this.controlRight = "»";
|
78
|
+
|
79
|
+
// The left and right month control icons (when disabled)
|
80
|
+
this.controlLeftDisabled = "";
|
81
|
+
this.controlRightDisabled = "";
|
82
|
+
|
83
|
+
// The css classes for the calendar and header
|
84
|
+
this.calendarStyle = "cal_calendar";
|
85
|
+
this.headerStyle = "cal_header";
|
86
|
+
this.headerwithEvent="cal_headerEvent";
|
87
|
+
this.headerCellStyle = "cal_cell";
|
88
|
+
this.headerCellStyleLabel = "cal_labelcell";
|
89
|
+
|
90
|
+
// The css classes for the rows
|
91
|
+
this.weekStyle = "cal_week";
|
92
|
+
this.evenWeekStyle = "cal_evenweek";
|
93
|
+
this.oddWeekStyle = "cal_oddweek";
|
94
|
+
|
95
|
+
// The css classes for the day elements
|
96
|
+
this.dayStyle = "cal_day";
|
97
|
+
this.disabledDayStyle = "cal_disabled";
|
98
|
+
this.commonDayStyle = "cal_common";
|
99
|
+
this.holidayDayStyle = "cal_holiday";
|
100
|
+
this.eventDayStyle = "cal_event";
|
101
|
+
this.todayDayStyle = "cal_today";
|
102
|
+
|
103
|
+
// specifies the labels for this calendar
|
104
|
+
this.dayLabels = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
|
105
|
+
this.monthLabels = new Array(
|
106
|
+
"January", "February", "March", "April"
|
107
|
+
, "May", "June", "July", "August"
|
108
|
+
, "September", "October", "November", "December");
|
109
|
+
|
110
|
+
// Specifies the dates of any event. The events are to be defined as arrays,
|
111
|
+
// with element 0 being the date and element 1 being an id.
|
112
|
+
this.eventDates = new Array();
|
113
|
+
|
114
|
+
// Attach event handlers to any fallback fields.
|
115
|
+
if (this.viewOnly == false)
|
116
|
+
{
|
117
|
+
if (this.isRequired==true)
|
118
|
+
{
|
119
|
+
setFieldValue(this.attachedId, this.calendarDate);
|
120
|
+
if ((this.fallback = this.fallback_both) || (this.fallback = this.fallback_single))
|
121
|
+
{
|
122
|
+
eval("document.getElementById(\"" + this.attachedId + "\").onchange = function () {updateFromSingle("+this.name+", this);}");
|
123
|
+
}
|
124
|
+
}
|
125
|
+
else
|
126
|
+
{
|
127
|
+
setValue(this.attachedId);
|
128
|
+
}
|
129
|
+
selectEvent = new Function();
|
130
|
+
}
|
131
|
+
|
132
|
+
|
133
|
+
}
|
134
|
+
|
135
|
+
function updateFromSingle (sender, helper) {
|
136
|
+
newDate = new Date (helper.value);
|
137
|
+
newDate.setUTCDate(newDate.getUTCDate()+1);
|
138
|
+
sender.calendarDate = newDate;
|
139
|
+
|
140
|
+
renderCalendar (sender);
|
141
|
+
setFieldValue(sender.attachedId, sender.calendarDate);
|
142
|
+
}
|
143
|
+
|
144
|
+
function updateFromMultiDay (sender, helper) {
|
145
|
+
|
146
|
+
if (isNaN(helper.value))
|
147
|
+
{
|
148
|
+
helper.value = sender.calendarDate.getUTCDate();
|
149
|
+
return false;
|
150
|
+
}
|
151
|
+
|
152
|
+
sender.calendarDate.setUTCDate(helper.value);
|
153
|
+
renderCalendar (sender);
|
154
|
+
setFieldValue(sender.attachedId, sender.calendarDate);
|
155
|
+
}
|
156
|
+
|
157
|
+
function updateFromMultiMonth (sender, helper) {
|
158
|
+
|
159
|
+
if (isNaN(helper.value)) {
|
160
|
+
helper.value = sender.calendarDate.getUTCMonths() -1;
|
161
|
+
return false;
|
162
|
+
}
|
163
|
+
|
164
|
+
sender.calendarDate.setUTCMonth(helper.value-1);
|
165
|
+
renderCalendar (sender);
|
166
|
+
setFieldValue(sender.attachedId, sender.calendarDate);
|
167
|
+
}
|
168
|
+
|
169
|
+
function updateFromMultiYear (sender, helper) {
|
170
|
+
|
171
|
+
if (isNaN(helper.value)) {
|
172
|
+
helper.value = sender.calendarDate.getUTCFullYear();
|
173
|
+
return false;
|
174
|
+
}
|
175
|
+
|
176
|
+
sender.calendarDate.setUTCFullYear(helper.value);
|
177
|
+
renderCalendar (sender);
|
178
|
+
setFieldValue(sender.attachedId, sender.calendarDate);
|
179
|
+
}
|
180
|
+
|
181
|
+
function getFirstCalendarDate (calendar)
|
182
|
+
{
|
183
|
+
return new Date
|
184
|
+
(
|
185
|
+
calendar.calendarDate.getUTCFullYear()
|
186
|
+
, calendar.calendarDate.getUTCMonth()
|
187
|
+
, 1
|
188
|
+
);
|
189
|
+
}
|
190
|
+
|
191
|
+
function renderCalendar (calendar)
|
192
|
+
{
|
193
|
+
|
194
|
+
calHtml1 = ("<table id=\"cal_" + calendar.attachedId + "\" class=\"" + calendar.calendarStyle +"\">");
|
195
|
+
calHtml1 += ((calendar.scrolling)?buildHeader(calendar):buildStaticHeader(calendar));
|
196
|
+
calHtml1 += buildCalendarTable (calendar);
|
197
|
+
calHtml1 += ("</table>");
|
198
|
+
|
199
|
+
document.getElementById(calendar.name + "_divCalendardisplay").innerHTML = calHtml1;
|
200
|
+
}
|
201
|
+
|
202
|
+
function scrollMonthBack (calendar)
|
203
|
+
{
|
204
|
+
calendar.calendarDate.setUTCMonth(calendar.calendarDate.getUTCMonth() - 1);
|
205
|
+
setFieldValue(calendar.attachedId, calendar.calendarDate);
|
206
|
+
renderCalendar (calendar);
|
207
|
+
}
|
208
|
+
|
209
|
+
function selectDate (calendar, day)
|
210
|
+
{
|
211
|
+
if (!calendar.viewOnly)
|
212
|
+
{
|
213
|
+
calendar.calendarDate.setUTCDate(day);
|
214
|
+
setFieldValue(calendar.attachedId, calendar.calendarDate);
|
215
|
+
calendar.isRequired=true;
|
216
|
+
renderCalendar (calendar);
|
217
|
+
}
|
218
|
+
}
|
219
|
+
|
220
|
+
function scrollMonthForward (calendar)
|
221
|
+
{
|
222
|
+
calendar.calendarDate.setDate(1);//Added 02/09/2005, Issue #1329
|
223
|
+
calendar.calendarDate.setUTCMonth(calendar.calendarDate.getUTCMonth()+1);
|
224
|
+
setFieldValue(calendar.attachedId, calendar.calendarDate);
|
225
|
+
renderCalendar (calendar);
|
226
|
+
}
|
227
|
+
|
228
|
+
function setValue(fieldId)
|
229
|
+
{
|
230
|
+
document.getElementById(fieldId).value = '';
|
231
|
+
document.getElementById(fieldId.substr(0,fieldId.indexOf("_")) +"_hdnSelectedDate").value = document. getElementById(fieldId).value;
|
232
|
+
}
|
233
|
+
|
234
|
+
function setFieldValue(fieldId, date)
|
235
|
+
{
|
236
|
+
document.getElementById(fieldId).value = (date.getUTCMonth()+1) + "/" + date.getUTCDate()+ "/" + date.getUTCFullYear();
|
237
|
+
document.getElementById(fieldId.substr(0,fieldId.indexOf("_")) +"_hdnSelectedDate").value = document.getElementById(fieldId).value;
|
238
|
+
}
|
239
|
+
|
240
|
+
function buildHeader (calendar)
|
241
|
+
{
|
242
|
+
enableLeft = true;
|
243
|
+
enableRight = true;
|
244
|
+
|
245
|
+
if (calendar.minDate != "--")
|
246
|
+
{
|
247
|
+
if (calendar.calendarDate.getUTCFullYear() <= calendar.minDate.getUTCFullYear())
|
248
|
+
{
|
249
|
+
if (calendar.calendarDate.getUTCMonth() <= calendar.minDate.getUTCMonth())
|
250
|
+
{
|
251
|
+
enableLeft = false;
|
252
|
+
}
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
if (calendar.maxDate != "--")
|
257
|
+
{
|
258
|
+
if (calendar.calendarDate.getUTCFullYear() >= calendar.maxDate.getUTCFullYear())
|
259
|
+
{
|
260
|
+
if (calendar.calendarDate.getUTCMonth() >= calendar.maxDate.getUTCMonth())
|
261
|
+
{
|
262
|
+
enableRight = false;
|
263
|
+
}
|
264
|
+
}
|
265
|
+
}
|
266
|
+
|
267
|
+
calHtml2 = "";
|
268
|
+
|
269
|
+
calHtml2 += (
|
270
|
+
"<tr class=\""
|
271
|
+
+ calendar.headerStyle
|
272
|
+
+ "\">");
|
273
|
+
calHtml2 += (
|
274
|
+
"<td class=\""
|
275
|
+
+ calendar.headerwithEvent
|
276
|
+
+ ((enableLeft)?("\" onclick=\"scrollMonthBack(" + calendar.name + ")"):"")
|
277
|
+
+ "\">"
|
278
|
+
+ ((enableLeft)?calendar.controlLeft:calendar.controlLeftDisabled)
|
279
|
+
+ "</td>");
|
280
|
+
calHtml2 += (
|
281
|
+
"<td colspan=\"5\" class=\""
|
282
|
+
+ calendar.headerCellStyleLabel
|
283
|
+
+ "\">"
|
284
|
+
+ calendar.monthLabels[calendar.calendarDate.getUTCMonth()]
|
285
|
+
+ ", " + calendar.calendarDate.getUTCFullYear()
|
286
|
+
+ "</td>");
|
287
|
+
calHtml2 += (
|
288
|
+
"<td class=\""
|
289
|
+
+ calendar.headerwithEvent
|
290
|
+
+ ((enableRight)?("\" onclick=\"scrollMonthForward(" + calendar.name + ")"):"")
|
291
|
+
+ "\">"
|
292
|
+
+ ((enableRight)?calendar.controlRight:calendar.controlRightDisabled)
|
293
|
+
+ "</td>");
|
294
|
+
|
295
|
+
calHtml2 += ("</tr>");
|
296
|
+
|
297
|
+
calHtml2 += (
|
298
|
+
"<tr class=\""
|
299
|
+
+ calendar.headerStyle
|
300
|
+
+ "\">")
|
301
|
+
|
302
|
+
for (i = 0; i < 7; i++) {
|
303
|
+
showDay = i + calendar.firstDayOfWeek;
|
304
|
+
if (showDay > 6) showDay = showDay - 7;
|
305
|
+
calHtml2 += (
|
306
|
+
"<td class=\""
|
307
|
+
+ calendar.headerCellStyle
|
308
|
+
+ "\">"
|
309
|
+
+ calendar.dayLabels[showDay]
|
310
|
+
+ "</td>");
|
311
|
+
|
312
|
+
}
|
313
|
+
|
314
|
+
calHtml2 += ("</tr>");
|
315
|
+
return calHtml2;
|
316
|
+
}
|
317
|
+
|
318
|
+
function buildStaticHeader (calendar)
|
319
|
+
{
|
320
|
+
calHtml2 = "";
|
321
|
+
|
322
|
+
calHtml2 += (
|
323
|
+
"<tr class=\""
|
324
|
+
+ calendar.headerStyle
|
325
|
+
+ "\">");
|
326
|
+
calHtml2 += (
|
327
|
+
"<td colspan=\"7\" class=\""
|
328
|
+
+ calendar.headerCellStyleLabel
|
329
|
+
+ "\">"
|
330
|
+
+ calendar.monthLabels[calendar.calendarDate.getUTCMonth()]
|
331
|
+
+ ", " + calendar.calendarDate.getUTCFullYear()
|
332
|
+
+ "</td>");
|
333
|
+
calHtml2 += ("</tr>");
|
334
|
+
|
335
|
+
calHtml2 += (
|
336
|
+
"<tr class=\""
|
337
|
+
+ calendar.headerStyle
|
338
|
+
+ "\">")
|
339
|
+
|
340
|
+
for (i = 0; i < 7; i++) {
|
341
|
+
showDay = i + calendar.firstDayOfWeek;
|
342
|
+
if (showDay > 6) showDay = showDay - 7;
|
343
|
+
calHtml2 += (
|
344
|
+
"<td class=\""
|
345
|
+
+ calendar.headerCellStyle
|
346
|
+
+ "\">"
|
347
|
+
+ calendar.dayLabels[showDay]
|
348
|
+
+ "</td>");
|
349
|
+
}
|
350
|
+
|
351
|
+
calHtml2 += ("</tr>");
|
352
|
+
return calHtml2
|
353
|
+
}
|
354
|
+
|
355
|
+
|
356
|
+
function RenderDayDisabled (calendar, currentDate)
|
357
|
+
{
|
358
|
+
calHtml += ('<td class="day">');
|
359
|
+
calHtml += ("<span class=\"" + calendar.disabledDayStyle + "\">");
|
360
|
+
calHtml += (currentDate.getUTCDate());
|
361
|
+
calHtml += ("</span>");
|
362
|
+
calHtml += ("</td>");
|
363
|
+
}
|
364
|
+
|
365
|
+
function RenderDayEnabled (calendar, currentDate, dayStyle,id)
|
366
|
+
{
|
367
|
+
currentDayStyle = dayStyle;
|
368
|
+
calHtml += ("<td class='day'>");
|
369
|
+
calHtml += ("<span class='" + dayStyle + "'onclick='selectDate(" + calendar.name + "," + currentDate.getUTCDate()+ ")';>"); //have cursor
|
370
|
+
calHtml += (currentDate.getUTCDate());
|
371
|
+
calHtml += ('</span>');
|
372
|
+
calHtml += ('</td>');
|
373
|
+
}
|
374
|
+
|
375
|
+
function RenderDayEvent (calendar, currentDate, dayStyle, eventId)
|
376
|
+
{
|
377
|
+
currentDayStyle = dayStyle;
|
378
|
+
calHtml += ('<td class="day">');
|
379
|
+
calHtml += ("<span class=\"" + dayStyle + "\" onclick=\"selectDate(" + calendar.name + ", " + currentDate.getUTCDate() + "," + id +"); " + calendar.name + ".selectEvent('" + eventId + "')\">");
|
380
|
+
calHtml += (currentDate.getUTCDate());
|
381
|
+
calHtml += ("</span>");
|
382
|
+
calHtml += ("</td>");
|
383
|
+
}
|
384
|
+
|
385
|
+
function buildCalendarTable (calendar)
|
386
|
+
{
|
387
|
+
currentDate = getFirstCalendarDate(calendar);
|
388
|
+
odd = 0;
|
389
|
+
while (currentDate.getUTCDay() != calendar.firstDayOfWeek)
|
390
|
+
{
|
391
|
+
currentDate.setUTCDate(currentDate.getUTCDate() - 1);
|
392
|
+
}
|
393
|
+
calHtml = "";
|
394
|
+
do
|
395
|
+
{
|
396
|
+
odd += 1;
|
397
|
+
calHtml += (
|
398
|
+
"<tr class=\"" + (((odd%2)==0) ? calendar.evenWeekStyle : calendar.oddWeekStyle) + "\">")
|
399
|
+
|
400
|
+
for (i = 0;i < 7;i++)
|
401
|
+
{
|
402
|
+
currentDayStyle = calendar.dayStyle;
|
403
|
+
currentEventStyle = calendar.commonDayStyle;
|
404
|
+
currentDateString = currentDate.getUTCFullYear() + "/" + (currentDate.getUTCMonth()+1) + "/" + currentDate.getUTCDate();
|
405
|
+
|
406
|
+
if (currentDate < calendar.minDate)
|
407
|
+
{
|
408
|
+
RenderDayDisabled (calendar, currentDate);
|
409
|
+
}
|
410
|
+
else if (currentDate > calendar.maxDate)
|
411
|
+
{
|
412
|
+
RenderDayDisabled (calendar, currentDate);
|
413
|
+
}
|
414
|
+
else if (currentDate.getUTCMonth() != calendar.calendarDate.getUTCMonth())
|
415
|
+
{
|
416
|
+
RenderDayDisabled (calendar, currentDate);
|
417
|
+
}
|
418
|
+
else if (currentDate.getUTCDate() == calendar.calendarDate.getUTCDate())
|
419
|
+
{
|
420
|
+
if ((currentDate.getUTCDay() == 0) || (currentDate.getUTCDay() == 6))
|
421
|
+
{
|
422
|
+
if (calendar.allowWeekends == true)
|
423
|
+
{
|
424
|
+
RenderDayEnabled (calendar, currentDate, calendar.todayDayStyle);
|
425
|
+
}
|
426
|
+
else
|
427
|
+
{
|
428
|
+
RenderDayDisabled (calendar, currentDate);
|
429
|
+
month = calendar.calendarDate.getUTCMonth();
|
430
|
+
calendar.calendarDate.setUTCDate(calendar.calendarDate.getUTCDate()+1);
|
431
|
+
if (month != calendar.calendarDate.getUTCMonth())
|
432
|
+
{
|
433
|
+
renderCalendar(calendar);
|
434
|
+
}
|
435
|
+
setFieldValue(calendar.attachedId, calendar.calendarDate);
|
436
|
+
}
|
437
|
+
} else
|
438
|
+
{
|
439
|
+
if (calendar.allowWeekdays == true)
|
440
|
+
{
|
441
|
+
if(calendar.isRequired)
|
442
|
+
RenderDayEnabled (calendar, currentDate, calendar.todayDayStyle);
|
443
|
+
else
|
444
|
+
{
|
445
|
+
RenderDayEnabled (calendar, currentDate, calendar.dayStyle);
|
446
|
+
currentDayStyle = calendar.todayDayStyle;
|
447
|
+
}
|
448
|
+
}
|
449
|
+
else
|
450
|
+
{
|
451
|
+
RenderDayDisabled (calendar, currentDate);
|
452
|
+
month = calendar.calendarDate.getUTCMonth();
|
453
|
+
calendar.calendarDate.setUTCDate(calendar.calendarDate.getUTCDate()+1);
|
454
|
+
if (month != calendar.calendarDate.getUTCMonth())
|
455
|
+
{
|
456
|
+
renderCalendar(calendar);
|
457
|
+
}
|
458
|
+
setFieldValue(calendar.attachedId, calendar.calendarDate);
|
459
|
+
}
|
460
|
+
}
|
461
|
+
}
|
462
|
+
else if ((currentDate.getUTCDay() == 0) || (currentDate.getUTCDay() == 6))
|
463
|
+
{
|
464
|
+
if (calendar.allowWeekends == true)
|
465
|
+
{
|
466
|
+
|
467
|
+
style = calendar.holidayDayStyle
|
468
|
+
|
469
|
+
for (j=0; j < calendar.eventDates.length; j++)
|
470
|
+
{
|
471
|
+
if (calendar.eventDates[j][0] == currentDateString)
|
472
|
+
{
|
473
|
+
style = calendar.eventDayStyle;
|
474
|
+
RenderDayEvent (calendar, currentDate, style, calendar.eventDates[j][0]);
|
475
|
+
}
|
476
|
+
}
|
477
|
+
|
478
|
+
if (style == calendar.holidayDayStyle)
|
479
|
+
{
|
480
|
+
RenderDayEnabled (calendar, currentDate, style);
|
481
|
+
}
|
482
|
+
}
|
483
|
+
else
|
484
|
+
{
|
485
|
+
RenderDayDisabled (calendar, currentDate);
|
486
|
+
}
|
487
|
+
} else {
|
488
|
+
if (calendar.allowWeekdays == true)
|
489
|
+
{
|
490
|
+
style = calendar.commonDayStyle
|
491
|
+
|
492
|
+
for (j=0; j < calendar.eventDates.length; j++)
|
493
|
+
{
|
494
|
+
if (calendar.eventDates[j][0] == currentDateString)
|
495
|
+
{
|
496
|
+
style = calendar.eventDayStyle;
|
497
|
+
RenderDayEvent (calendar, currentDate, style, calendar.eventDates[j][0]);
|
498
|
+
}
|
499
|
+
}
|
500
|
+
|
501
|
+
if (style == calendar.commonDayStyle)
|
502
|
+
{
|
503
|
+
RenderDayEnabled (calendar, currentDate, style);
|
504
|
+
}
|
505
|
+
}
|
506
|
+
else
|
507
|
+
{
|
508
|
+
RenderDayDisabled (calendar, currentDate);
|
509
|
+
}
|
510
|
+
}
|
511
|
+
|
512
|
+
currentDate.setUTCDate(currentDate.getUTCDate() + 1);
|
513
|
+
}
|
514
|
+
|
515
|
+
calHtml += ("</tr>");
|
516
|
+
|
517
|
+
|
518
|
+
} while (currentDate.getUTCMonth() == calendar.calendarDate.getUTCMonth());
|
519
|
+
|
520
|
+
return calHtml;
|
521
|
+
}
|