root/releases/bedework-3.4.1.1/deployment/webadmin/webapp/resources/resources/bedeworkEventForm.js

Revision 1932 (checked in by johnsa, 3 years ago)

small fix for the admin client calendar access control UI

  • Property svn:eol-style set to native
Line 
1 // Bedework event form functions
2
3 /* **********************************************************************
4     Copyright 2007 Rensselaer Polytechnic Institute. All worldwide rights reserved.
5
6     Redistribution and use of this distribution in source and binary forms,
7     with or without modification, are permitted provided that:
8        The above copyright notice and this permission notice appear in all
9         copies and supporting documentation;
10
11         The name, identifiers, and trademarks of Rensselaer Polytechnic
12         Institute are not used in advertising or publicity without the
13         express prior written permission of Rensselaer Polytechnic Institute;
14
15     DISCLAIMER: The software is distributed" AS IS" without any express or
16     implied warranty, including but not limited to, any implied warranties
17     of merchantability or fitness for a particular purpose or any warrant)'
18     of non-infringement of any current or pending patent rights. The authors
19     of the software make no representations about the suitability of this
20     software for any particular purpose. The entire risk as to the quality
21     and performance of the software is with the user. Should the software
22     prove defective, the user assumes the cost of all necessary servicing,
23     repair or correction. In particular, neither Rensselaer Polytechnic
24     Institute, nor the authors of the software are liable for any indirect,
25     special, consequential, or incidental damages related to the software,
26     to the maximum extent the law permits. */
27
28 dojo.require("dojo.event.*");
29 dojo.require("dojo.widget.*");
30 dojo.require("dojo.widget.DropdownDatePicker");
31 dojo.require("dojo.widget.DropdownTimePicker");
32
33 // ========================================================================
34 // ========================================================================
35 //   Language and customization
36 //   These should come from values in the header or included as a separate cutomization
37 //   file.
38
39 var rdateDeleteStr = "remove";
40
41 // ========================================================================
42 // rdate functions
43 // ========================================================================
44
45 /* An rdate
46  * date: String: internal date
47  * time: String
48  * tzid: timezone id or null
49  */
50 function BwREXdate(date, time, allDay, floating, utc, tzid) {
51   this.date = date;
52   this.time = time;
53   this.allDay = allDay;
54   this.floating = floating;
55   this.utc = utc;
56   this.tzid = tzid;
57
58   this.toString = function() {
59   }
60
61   /* varName: NOT GOOD - name of object
62    * reqPar: request par for hidden field
63    * row: current table row
64    * rdi: index of rdate fro delete
65    */
66   this.toFormRow = function(varName, row, rdi) {
67     row.insertCell(0).appendChild(document.createTextNode(this.date));
68     row.insertCell(1).appendChild(document.createTextNode(this.time));
69     row.insertCell(2).appendChild(document.createTextNode(this.tzid));
70     row.insertCell(3).innerHTML = "<a href=\"javascript:" + varName + ".deleteDate('" +
71                                    rdi + "')\">" + rdateDeleteStr + "</a>";
72   }
73
74   this.format = function() {
75     var res = this.date + "\t" + this.time + "\t";
76
77     if (this.tzid != null) {
78       res += this.tzid;
79     }
80
81     return res;
82   }
83
84   this.equals = function(that) {
85     return this.compareTo(that) == 0;
86   }
87
88   this.compareTo = function(that) {
89     var res = compareTo(that.date, this.date);
90     if (res != 0) {
91       return res;
92     }
93
94     res = compareTo(that.time, this.time);
95     if (res != 0) {
96       return res;
97     }
98
99     return compareTo(that.tzid, this.tzid);
100   }
101 }
102
103 function compareTo(thys, that) {
104   if (that < thys) {
105     return -1;
106   }
107
108   if (that > thys) {
109     return 1;
110   }
111
112   return 0;
113 }
114
115 function sortCompare(thys, that) {
116   return thys.compareTo(that);
117 }
118
119 var bwRdates = new BwREXdates("bwRdates", "bwRdatesField",
120                               "bwCurrentRdates", "bwCurrentRdatesNone",
121                               "visible", "invisible", 2);
122 var bwExdates = new BwREXdates("bwExdates", "bwExdatesField",
123                                "bwCurrentExdates", "bwCurrentExdatesNone",
124                                "visible", "invisible", 2);
125
126 /** Manipulate table of exception or recurrence dates.
127  *
128  * @param varName: NOT GOOD - name of object
129  * @param reqParId: id of hidden field we update
130  * @param tableId:   id of table we are manipulating
131  * @param noDatesId: some info to display when we have nothing
132  * @param visibleClass: class to set to make something visible
133  * @param invisibleClass: class to set to make something invisible
134  * @param numHeaderRows: Number of header rows in the table.
135  */
136 function BwREXdates(varName, reqParId, tableId, noDatesId,
137                     visibleClass, invisibleClass, numHeaderRows) {
138   var dates = new Array();
139
140   this.varName = varName;
141   this.reqParId = reqParId;
142   this.tableId = tableId;
143   this.noDatesId = noDatesId;
144   this.visibleClass = visibleClass;
145   this.invisibleClass = invisibleClass;
146   this.numHeaderRows = numHeaderRows;
147
148   /* val: String: internal date
149    * dateOnly: boolean
150    * tzid: String or null
151    */
152   this.addRdate = function(date, time, allDay, floating, utc, tzid) {
153     var newRdate = new BwREXdate(date, time, allDay, floating, utc, tzid);
154
155     if (!this.contains(newRdate)) {
156       dates.push(newRdate);
157     }
158   }
159
160   this.contains = function(rdate) {
161     for (var j = 0; j < dates.length; j++) {
162       var curRdate = dates[j];
163       if (curRdate.equals(rdate)) {
164         return true;
165       }
166     }
167
168     return false;
169   }
170
171   // Update the list -
172   this.update = function(date, time, allDay, floating, utc, tzid) {
173     this.addRdate(date, time, allDay, floating, utc, tzid);
174
175     // redraw the display
176     this.display();
177   }
178
179   this.deleteDate = function(index) {
180     dates.splice(index, 1);
181
182     // redraw the display
183     this.display();
184   }
185
186   // update the rdates table displayed on screen
187   this.display = function() {
188     try {
189       // get the table body
190       var rdTableBody = document.getElementById(tableId).tBodies[0];
191
192       // remove existing rows
193       for (i = rdTableBody.rows.length - 1; i >= numHeaderRows; i--) {
194         rdTableBody.deleteRow(i);
195       }
196
197       dates.sort(sortCompare);
198
199       // recreate the table rows
200       for (var j = 0; j < dates.length; j++) {
201         var curDate = dates[j];
202         var tr = rdTableBody.insertRow(j + numHeaderRows);
203
204         curDate.toFormRow(varName, tr, j);
205       }
206
207       if (dates.length == 0) {
208         changeClass(tableId, invisibleClass);
209         changeClass(noDatesId, visibleClass);
210       } else {
211         changeClass(tableId, visibleClass);
212         changeClass(noDatesId, invisibleClass);
213       }
214
215       /* Update the hidden field */
216
217       var formAcl = document.getElementById(reqParId);
218       formAcl.value = this.format();
219
220     } catch (e) {
221       alert(e);
222     }
223   }
224
225   this.format = function() {
226     var res = "";
227
228     for (var j = 0; j < dates.length; j++) {
229       var curDate = dates[j];
230
231       res += "DATE\t" + curDate.format();
232     }
233
234     return res;
235   }
236 }
237 // ========================================================================
238 // Submitted event comments
239 // ========================================================================
240
241 /* A comment accompanying a submitted event.
242  * These values come from sumbitted x-properties
243  * locationAddress: value of property X-BEDEWORK-LOCATION
244  * locationSubaddress: value of location's parameter X-BEDEWORK-SUBADDRESS
245  * locationUrl: value of location's parameter X-BEDEWORK-PARAM-URL
246  * contactName: value of x-property X-BEDEWORK-CONTACT
247  * contactPhone: value of contact's parameter X-BEDEWORK-PARAM-PHONE
248  * contactUrl: value of contact's parameter X-BEDEWORK-PARAM-URL
249  * contactEmail: value of contact's parameter X-BEDEWORK-PARAM-EMAIL
250  * category: value of x-property X-BEDEWORK-CATEGORIES
251  * notes: value of the x-property X-BEDEWORK-SUBMIT-COMMENT
252  */
253 function bwSubmitComment(locationAddress,locationSubaddress,locationUrl,contactName,contactPhone,contactUrl,contactEmail,category,notes) {
254   this.locationAddress = locationAddress;
255   this.locationSubaddress = locationSubaddress;
256   this.locationUrl = locationUrl;
257   this.contactName = contactName;
258   this.contactPhone = contactPhone;
259   this.contactUrl = contactUrl;
260   this.contactEmail = contactEmail;
261   this.category = category;
262   this.notes = notes;
263
264   this.render = function() {
265     var output = "";
266     if (this.locationAddress != "" || this.locationSubaddress != "" || this.locationUrl != "") {
267       output += '<table>';
268       output += '<tr><th colspan="2">Suggested Location:</th></tr>';
269       output += '<tr><td>Address:</td><td>' + this.locationAddress + '</td>';
270       output += '<tr><td>Subaddress:</td><td>' + this.locationSubaddress + '</td>';
271       output += '<tr><td>URL:</td><td>' + this.locationUrl + '</td>';
272       output += '</table>';
273     }
274     if (this.contactName != "" || this.contactPhone != "" || this.contactEmail != "" || this.contactUrl != "") {
275       output += '<table>';
276       output += '<tr><th colspan="2">Suggested Contact:</th></tr>';
277       output += '<tr><td>Name:</td><td>' + this.contactName + '</td></tr>';
278       output += '<tr><td>Phone:</td><td>' + this.contactPhone + '</td></tr>';
279       output += '<tr><td>URL:</td><td>' + this.contactUrl + '</td></tr>';
280       output += '<tr><td>Email:</td><td>' + this.contactEmail + '</td></tr>';
281       output += '</table>';
282     }
283     if (this.category != "") {
284       output += '<table>';
285       output += '<tr><th colspan="2">Suggested Category:</th></tr>';
286       output += '<tr><td>Category:</td><td>' + this.category + '</td></tr>';
287       output += '</table>';
288     }
289     output += '<p>';
290     if (this.notes != "") {
291       output += '<strong>Notes:</strong><br/>';
292       output += this.notes;
293     }
294     output += '</p>';
295
296     return output;
297   }
298
299   this.display = function(displayId) {
300     var showComment = document.getElementById(displayId);
301     showComment.innerHTML = this.render();
302   }
303
304   // launch comment in a pop-up window
305   this.launch = function() {
306     var commentWindow = window.open("", "commentWindow", "width=800,height=400,scrollbars=yes,resizable=yes,alwaysRaised=yes,menubar=no,toolbar=no");
307     commentWindow.document.open();
308     commentWindow.document.writeln("<html><head><title>Submitted Event Comments</title>");
309     commentWindow.document.writeln('<style type="text/css">');
310     commentWindow.document.writeln('body{background-color: #ffe; color: black; padding: 1em; font-size: 0.9em; font-family: Arial,sans-serif;}');
311     commentWindow.document.writeln('table{float: left; margin: 1em 1em 0 0; padding: 0.5em; border: 1px solid #ccc; font-size: 0.9em;}');
312     commentWindow.document.writeln('th{text-align: left;}');
313     commentWindow.document.writeln('td{padding-left: 2em;}');
314     commentWindow.document.writeln('p{clear:both; padding-top: 1em;}');
315     commentWindow.document.writeln('</style></head>');
316     commentWindow.document.writeln("<body><h3>Comments from Submitter</h3>");
317     commentWindow.document.writeln(this.render());
318     commentWindow.document.writeln("</body></html>");
319     commentWindow.document.close();
320     commentWindow.focus();
321   }
322 }
323
324 // ========================================================================
325 // ========================================================================
326
327 function setEventFields(formObj,portalFriendly,submitter) {
328   if (!portalFriendly) {
329     setDates(formObj);
330   }
331   setRecurrence(formObj);
332   setBedeworkXProperties(formObj,submitter);
333
334   //setAccessHow(formObj,1);
335   //setAccessAcl(formObj);
336 }
337 function setDates(formObj) {
338   var startDate = new Date();
339   startDate = dojo.widget.byId("bwEventWidgetStartDate").getDate();
340   formObj["eventStartDate.year"].value = startDate.getFullYear();
341   formObj["eventStartDate.month"].value = startDate.getMonth() + 1;
342   formObj["eventStartDate.day"].value = startDate.getDate();
343
344   var endDate = new Date();
345   endDate = dojo.widget.byId("bwEventWidgetEndDate").getDate();
346   formObj["eventEndDate.year"].value = endDate.getFullYear();
347   formObj["eventEndDate.month"].value = endDate.getMonth() + 1;
348   formObj["eventEndDate.day"].value = endDate.getDate();
349 }
350 function setBedeworkXProperties(formObj,submitter) {
351   // set up specific Bedework X-Properties on event form submission
352   // Depends on bedeworkXProperties.js
353   // Set application local x-properties here.
354
355   // X-BEDEWORK-IMAGE and its parameters:
356   if (formObj["xBwImageHolder"] && formObj["xBwImageHolder"].value != '') {
357     bwXProps.update(bwXPropertyImage,
358                   [[bwXParamDescription,''],
359                    [bwXParamWidth,''],
360                    [bwXParamHeight,'']],
361                    formObj["xBwImageHolder"].value,true);
362   }
363   // X-BEDEWORK-SUBMITTEDBY
364   bwXProps.update(bwXPropertySubmittedBy,[],submitter,true);
365
366   // commit all xproperties back to the form
367   bwXProps.generate(formObj);
368 }
369 function swapAllDayEvent(obj) {
370   allDayStartDateField = document.getElementById("allDayStartDateField");
371   allDayEndDateField = document.getElementById("allDayEndDateField");
372   durDays = document.getElementById("durationDays");
373   if (obj.checked) {
374     // show or hide time fields and set the days duration
375     changeClass('startTimeFields','invisible');
376     changeClass('endTimeFields','invisible');
377     changeClass('durationHrMin','invisible');
378     allDayStartDateField.value = "true";
379     allDayEndDateField.value = "true";
380     durDays.value = 1;
381   } else {
382     changeClass('startTimeFields','timeFields');
383     changeClass('endTimeFields','timeFields');
384     changeClass('durationHrMin','shown');
385     allDayStartDateField.value = "false";
386     allDayEndDateField.value = "false";
387     durDays.value = 0;
388   }
389 }
390 function swapFloatingTime(obj) {
391   startTimezone = document.getElementById("startTzid");
392   endTimezone = document.getElementById("endTzid");
393   startFloating = document.getElementById("startFloating");
394   endFloating = document.getElementById("endFloating");
395   if (obj.checked) {
396     document.getElementById("storeUTCFlag").checked = false;
397     startTimezone.disabled = true;
398     endTimezone.disabled = true;
399     startFloating.value = "true";
400     endFloating.value = "true";
401   } else {
402     startTimezone.disabled = false;
403     endTimezone.disabled = false;
404     startFloating.value = "false";
405     endFloating.value = "false";
406   }
407 }
408 function swapStoreUTC(obj) {
409   startTimezone = document.getElementById("startTzid");
410   endTimezone = document.getElementById("endTzid");
411   startStoreUTC = document.getElementById("startStoreUTC");
412   endStoreUTC = document.getElementById("endStoreUTC");
413   if (obj.checked) {
414     document.getElementById("floatingFlag").checked = false;
415     startTimezone.disabled = false;
416     endTimezone.disabled = false;
417     startStoreUTC.value = "true";
418     endStoreUTC.value = "true";
419   } else {
420     startStoreUTC.value = "false";
421     endStoreUTC.value = "false";
422   }
423 }
424 function swapRdateAllDay(obj) {
425   if (obj.checked) {
426     changeClass('rdateTimeFields','invisible');
427   } else {
428     changeClass('rdateTimeFields','timeFields');
429   }
430 }
431 function swapRdateFloatingTime(obj) {
432   rdateTimezone = document.getElementById("rdateTzid");
433   rdateFloating = document.getElementById("rdateFloating");
434   if (obj.checked) {
435     document.getElementById("rdateStoreUTC").checked = false;
436     rdateTimezone.disabled = true;
437   } else {
438     rdateTimezone.disabled = false;
439     rdateFloating.value = "false";
440   }
441 }
442 function swapRdateStoreUTC(obj) {
443   rdateTimezone = document.getElementById("rdateTzid");
444   rdateStoreUTC = document.getElementById("rdateStoreUTC");
445   if (obj.checked) {
446     document.getElementById("rdateFloating").checked = false;
447     rdateTimezone.disabled = false;
448     rdateStoreUTC.value = "true";
449   } else {
450     rdateStoreUTC.value = "false";
451   }
452 }
453 function swapDurationType(type) {
454   // get the components we need to manipulate
455   daysDurationElement = document.getElementById("durationDays");
456   hoursDurationElement = document.getElementById("durationHours");
457   minutesDurationElement = document.getElementById("durationMinutes");
458   weeksDurationElement = document.getElementById("durationWeeks");
459   if (type == 'week') {
460     weeksDurationElement.disabled = false;
461     daysDurationElement.disabled = true;
462     hoursDurationElement.disabled = true;
463     minutesDurationElement.disabled = true;
464   } else {
465     daysDurationElement.disabled = false;
466     hoursDurationElement.disabled = false;
467     minutesDurationElement.disabled = false;
468     // we are using day, hour, minute -- zero out the weeks.
469     weeksDurationElement.value = "0";
470     weeksDurationElement.disabled = true;
471   }
472 }
473 function swapRecurrence(obj) {
474   if (obj.value == 'true') {
475     changeClass('recurrenceFields','visible');
476     if (document.getElementById('rrulesSwitch')) {
477       changeClass('rrulesSwitch','visible');
478     }
479   } else {
480     changeClass('recurrenceFields','invisible');
481     if (document.getElementById('rrulesSwitch')) {
482       changeClass('rrulesSwitch','invisible');
483     }
484   }
485 }
486 function swapRrules(obj) {
487   if (obj.checked) {
488     changeClass('rrulesTable','visible');
489     changeClass('rrulesUiSwitch','visible');
490     if (document.getElementById('recurrenceInfo')) {
491       changeClass('recurrenceInfo','invisible');
492     }
493   } else {
494     changeClass('rrulesTable','invisible');
495     changeClass('rrulesUiSwitch','invisible');
496     if (document.getElementById('recurrenceInfo')) {
497       changeClass('recurrenceInfo','visible');
498     }
499   }
500 }
501 function showRrules(freq) {
502   // reveal and hide rrules fields
503   changeClass('recurrenceUntilRules','visible');
504
505   if (freq == 'NONE') {
506     changeClass('noneRecurrenceRules','visible');
507     changeClass('recurrenceUntilRules','invisible');
508   } else {
509     changeClass('noneRecurrenceRules','invisible');
510   }
511   if (freq == 'HOURLY') {
512     changeClass('hourlyRecurrenceRules','visible');
513   } else {
514     changeClass('hourlyRecurrenceRules','invisible');
515   }
516   if (freq == 'DAILY') {
517     changeClass('dailyRecurrenceRules','visible');
518   } else {
519     changeClass('dailyRecurrenceRules','invisible');
520   }
521   if (freq == 'WEEKLY') {
522     changeClass('weeklyRecurrenceRules','visible');
523   } else {
524     changeClass('weeklyRecurrenceRules','invisible');
525   }
526   if (freq == 'MONTHLY') {
527     changeClass('monthlyRecurrenceRules','visible');
528   } else {
529     changeClass('monthlyRecurrenceRules','invisible');
530   }
531   if (freq == 'YEARLY') {
532     changeClass('yearlyRecurrenceRules','visible');
533   } else {
534     changeClass('yearlyRecurrenceRules','invisible');
535   }
536 }
537 function recurSelectWeekends(id) {
538   chkBoxCollection = document.getElementById(id).getElementsByTagName('input');
539   if (chkBoxCollection) {
540     if (typeof chkBoxCollection.length != 'undefined') {
541       for (i = 0; i < chkBoxCollection.length; i++) {
542         if (chkBoxCollection[i].value == 'SU' || chkBoxCollection[i].value == 'SA') {
543            chkBoxCollection[i].checked = true;
544         } else {
545           chkBoxCollection[i].checked = false;
546         }
547       }
548     }
549   }
550 }
551 function recurSelectWeekdays(id) {
552   chkBoxCollection = document.getElementById(id).getElementsByTagName('input');
553   if (chkBoxCollection) {
554     if (typeof chkBoxCollection.length != 'undefined') {
555       for (i = 0; i < chkBoxCollection.length; i++) {
556         if (chkBoxCollection[i].value == 'SU' || chkBoxCollection[i].value == 'SA') {
557            chkBoxCollection[i].checked = false;
558         } else {
559           chkBoxCollection[i].checked = true;
560         }
561       }
562     }
563   }
564 }
565 function selectRecurCountUntil(id) {
566   document.getElementById(id).checked = true;
567 }
568 // Assemble the recurrence rules if recurrence is specified.
569 // Request params to set ('freq' is always set):
570 // interval, count, until (count OR until, not both)
571 // possibly: byday, bymonthday, bymonth, byyearday
572 function setRecurrence(formObj) {
573   var freq = getSelectedRadioButtonVal(formObj.freq);
574   if (freq != 'NONE') {
575     // build up recurrence rules
576     switch (freq) {
577       case "DAILY":
578         var bymonth = new Array();
579         // get the bymonth values
580         bymonth = collectRecurChkBoxVals(bymonth,document.getElementById('dayMonthCheckBoxList').getElementsByTagName('input'),false);
581         // set the form values
582         formObj.bymonth.value = bymonth.join(',');
583         formObj.interval.value = formObj.dailyInterval.value;
584         break;
585       case "WEEKLY":
586         var byday = new Array();
587         byday = collectRecurChkBoxVals(byday, document.getElementById('weekRecurFields').getElementsByTagName('input'),false);
588         formObj.byday.value = byday.join(',');
589         if (formObj.weekWkst.selectedIndex != -1) {
590           formObj.wkst.value = formObj.weekWkst[formObj.weekWkst.selectedIndex].value;
591         }
592         formObj.interval.value = formObj.weeklyInterval.value;
593         break;
594       case "MONTHLY":
595         var i = 1;
596         var monthByDayId = 'monthRecurFields' + i;
597         var byday = new Array();
598         var bymonthday = new Array();
599         var byyearday = new Array();
600         // get the byday values
601         while (document.getElementById(monthByDayId)) {
602           var monthFields = document.getElementById(monthByDayId);
603           var dayPosSelect = monthFields.getElementsByTagName('select');
604           var dayPos = dayPosSelect[0][dayPosSelect[0].selectedIndex].value;
605           if (dayPos) {
606             byday = collectRecurChkBoxVals(byday,monthFields.getElementsByTagName('input'),dayPos);
607           }
608           monthByDayId = monthByDayId.substring(0,monthByDayId.length-1) + ++i;
609         }
610         // get the bymonthday values
611         bymonthday = collectRecurChkBoxVals(bymonthday,document.getElementById('monthDaysCheckBoxList').getElementsByTagName('input'),false);
612         // set the form values
613         formObj.byday.value = byday.join(',');
614         formObj.bymonthday.value = bymonthday.join(',');
615         formObj.interval.value = formObj.monthlyInterval.value;
616         break;
617       case "YEARLY":
618         var i = 1;
619         var yearByDayId = 'yearRecurFields' + i;
620         var byday = new Array();
621         var bymonthday = new Array();
622         var bymonth = new Array();
623         var byweekno = new Array();
624         var byyearday = new Array();
625         // get the byday values
626         while (document.getElementById(yearByDayId)) {
627           var yearFields = document.getElementById(yearByDayId);
628           var dayPosSelect = yearFields.getElementsByTagName('select');
629           var dayPos = dayPosSelect[0][dayPosSelect[0].selectedIndex].value;
630           if (dayPos) {
631             byday = collectRecurChkBoxVals(byday,yearFields.getElementsByTagName('input'),dayPos);
632           }
633           yearByDayId = yearByDayId.substring(0,yearByDayId.length-1) + ++i;
634         }
635         // get the bymonth values
636         bymonth = collectRecurChkBoxVals(bymonth,document.getElementById('yearMonthCheckBoxList').getElementsByTagName('input'),false);
637         // get the bymonthday values
638         bymonthday = collectRecurChkBoxVals(bymonthday,document.getElementById('yearMonthDaysCheckBoxList').getElementsByTagName('input'),false);
639         // get the byweekno values
640         byweekno = collectRecurChkBoxVals(byweekno,document.getElementById('yearWeeksCheckBoxList').getElementsByTagName('input'),false);
641         // get the byyearday values
642         byyearday = collectRecurChkBoxVals(byyearday,document.getElementById('yearDaysCheckBoxList').getElementsByTagName('input'),false);
643
644         // set the form values
645         formObj.byday.value = byday.join(',');
646         formObj.bymonth.value = bymonth.join(',');
647         formObj.bymonthday.value = bymonthday.join(',');
648         formObj.byweekno.value = byweekno.join(',');
649         formObj.byyearday.value = byyearday.join(',');
650         if (formObj.yearWkst.selectedIndex != -1) {
651           formObj.wkst.value = formObj.yearWkst[formObj.yearWkst.selectedIndex].value;
652         }
653         formObj.interval.value = formObj.yearlyInterval.value;
654         break;
655     }
656     // build up count or until values
657     var recur = getSelectedRadioButtonVal(formObj.recurCountUntil);
658     switch (recur) {
659       case "forever":
660         // do nothing
661         break;
662       case "count":
663         formObj.count.value = formObj.countHolder.value;
664         break;
665       case "until":
666         // the following will not be adequate for recurrences smaller than a day;
667         // we will need to set the time properly at that point.
668         formObj.until.value = dojo.widget.byId("bwEventWidgetUntilDate").getValue() + "T000000";
669         break;
670     }
671   }
672
673   if (debug) {
674     alert("frequency: " + freq + "\ninterval: " + formObj.interval.value + "\ncount: " + formObj.count.value + "\nuntil: " + formObj.until.value + "\nbyday: " + formObj.byday.value + "\nbymonthday: " + formObj.bymonthday.value + "\nbymonth: " + formObj.bymonth.value + "\nbyyearday: " + formObj.byyearday.value + "\nwkst: " + formObj.wkst.value);
675     var formFields = '';
676     for (i = 0; i < formObj.length; i++) {
677       formFields += formObj[i].name + ": " + formObj[i].value + "\n";
678     }
679     alert(formFields);
680   }
681   return true;
682 }
683
684 function setRdateDateTime(formObj) {
685   var rdateTime = dojo.byId("bwEventWidgeRdateTime");
686   alert (rdateTime.getValue());
687   if (rdateTime.getValue() != "") {
688     /*var rdateTimeObj = rdateTime.getTime();
689     var timeString = rdateTimeObj.
690     formOjb.datetime.value += "T" +*/
691   }
692 }
693
694 function untilClickHandler(evt) {
695    selectRecurCountUntil('recurUntil');
696 }
697
698 function resetPublishBox(calSelectId) {
699   // User has closed the publish box without publishing.
700   // Reset the calendar select box to default value and hide the publishBox.
701   var calSelect = document.getElementById(calSelectId);
702   calSelect.selectedIndex = 0;
703   changeClass('publishBox','invisible');
704 }
705
706
707 function init() {
708   var untilHolder = dojo.byId("untilHolder");
709   dojo.event.connect(untilHolder, "onclick", untilClickHandler);
710 }
711
712 dojo.addOnLoad(init);
713
714
Note: See TracBrowser for help on using the browser.