2 * Copyright 2005 - 2010 The Citadel Team
3 * Licensed under the GPL V3
5 * JavaScript function library for WebCit.
10 var room_is_trash = 0;
12 var currentlyExpandedFloor = null;
15 var _switchToRoomList = "switch to room list";
16 var _switchToMenu = "switch to menu";
18 var currentDropTarget = null;
20 var supportsAddEventListener = (!!document.addEventListener);
21 var today = new Date();
24 if (document.all) {browserType = "ie"}
25 if (window.navigator.userAgent.toLowerCase().match("gecko")) {
28 var ns6=document.getElementById&&!document.all;
29 Event.observe(window, 'load', ToggleTaskDateOrNoDateActivate);
30 Event.observe(window, 'load', taskViewActivate);
31 //document.observe("dom:loaded", setupPrefEngine);
32 document.observe("dom:loaded", setupIconBar);
33 function CtdlRandomString() {
34 return((Math.random()+'').substr(3));
36 function strcmp ( str1, str2 ) {
37 // http://kevin.vanzonneveld.net
38 // + original by: Waldo Malqui Silva
39 // + input by: Steve Hilder
40 // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
41 // + revised by: gorthaur
42 // * example 1: strcmp( 'waldo', 'owald' );
44 // * example 2: strcmp( 'owald', 'waldo' );
47 return ( ( str1 == str2 ) ? 0 : ( ( str1 > str2 ) ? 1 : -1 ) );
50 function emptyElement(element) {
51 childNodes = element.childNodes;
52 for(var i=0; i<childNodes.length; i++) {
54 element.removeChild(childNodes[i]);
56 WCLog(e+"|"+e.description);
60 /** Implements superior internet explorer 'extract all child text from element' feature'. Falls back on buggy, patent violating standardized method */
61 function getTextContent(element) {
62 if (element.textContent == undefined) {
63 return element.innerText;
65 return element.textContent;
67 /** Same reasons as above */
68 function setTextContent(element, textContent) {
69 if(element.textContent == undefined) {
70 element.innerText = textContent;
72 element.textContent = textContent;
76 // We love string tokenizers.
77 function extract_token(source_string, token_num, delimiter) {
79 var extracted_string = source_string;
82 for (i=0; i<token_num; ++i) {
83 var j = extracted_string.indexOf(delimiter);
85 extracted_string = extracted_string.substr(j+1);
90 j = extracted_string.indexOf(delimiter);
92 extracted_string = extracted_string.substr(0, j);
95 return extracted_string;
98 function CtdlSpawnContextMenu(event, source) {
99 // remove any existing menus
100 disintergrateContextMenus(null);
101 var x = event.clientX-10; // cut a few pixels out so our mouseout works right
102 var y = event.clientY-10;
103 var contextDIV = document.createElement("div");
104 contextDIV.setAttribute("id", "ctdlContextMenu");
105 document.body.appendChild(contextDIV);
106 var sourceChildren = source.childNodes;
107 for(var j=0; j<sourceChildren.length; j++) {
108 contextDIV.appendChild(sourceChildren[j].cloneNode(true));
110 var leftRule = "left: "+x+"px;";
111 contextDIV.setAttribute("style", leftRule);
112 contextDIV.setAttribute("actual", leftRule);
113 contextDIV.style.top = y+"px";
114 contextDIV.style.display = "block";
115 $(contextDIV).observe('mouseout',disintergrateContextMenus);
117 function disintergrateContextMenus(event) {
118 var contextMenu = document.getElementById("ctdlContextMenu");
120 contextMenu.parentNode.removeChild(contextMenu);
122 Event.stopObserving(document,'click',disintergrateContextMenus);
124 // This code handles the popups for important-messages.
125 function hide_imsg_popup() {
126 if (browserType == "gecko") {
127 document.poppedLayer = eval('document.getElementById(\'important_message\')');
129 else if (browserType == "ie") {
130 document.poppedLayer = eval('document.all[\'important_message\']');
133 document.poppedLayer = eval('document.layers[\'`important_message\']');
136 document.poppedLayer.style.visibility = "hidden";
140 // This function activates the ajax-powered recipient autocompleters on the message entry screen.
141 function activate_entmsg_autocompleters() {
142 new Ajax.Autocompleter('cc_id', 'cc_name_choices', 'cc_autocomplete', {} );
143 new Ajax.Autocompleter('bcc_id', 'bcc_name_choices', 'bcc_autocomplete', {} );
144 new Ajax.Autocompleter('recp_id', 'recp_name_choices', 'recp_autocomplete', {} );
147 function setupIconBar() {
148 if (!document.getElementById("switch")) {
151 _switchToRoomList = getTextContent(document.getElementById("rmlist_template"));
152 _switchToMenu = getTextContent(document.getElementById("mnlist_template"));
153 var switchSpan = document.getElementById("switch").firstChild;
154 if (switchSpan != null) {
155 setTextContent(switchSpan, _switchToRoomList);
156 $(switchSpan).observe('click', changeIconBarEvent);
157 var currentView = ctdlLocalPrefs.readPref("iconbar_view");
158 if (currentView != null) {
159 switchSpan.ctdlSwitchIconBarTo = currentView;
160 changeIconBar(switchSpan);
162 switchSpan.ctdlSwitchIconBarTo = "rooms";
165 var online_users = document.getElementById("online_users");
166 if (online_users.offsetParent != null && online_users.offsetTop > 0) {
167 new Ajax.PeriodicalUpdater('online_users', 'do_template?template=who_iconbar', {method: 'get', frequency: 30});
170 function changeIconBarEvent(event) {
171 changeIconBar(event.target);
173 function changeIconBar(target) {
174 var switchTo = target.ctdlSwitchIconBarTo;
175 WCLog("Changing to: " + switchTo);
176 ctdlLocalPrefs.setPref("iconbar_view", target.ctdlSwitchIconBarTo);
177 if (switchTo == "rooms") {
178 switch_to_room_list();
179 setTextContent(target, _switchToMenu);
180 target.ctdlSwitchIconBarTo = "menu";
182 switch_to_menu_buttons();
183 setTextContent(target, _switchToRoomList);
184 target.ctdlSwitchIconBarTo = "rooms";
187 function switch_to_room_list() {
188 var roomlist = document.getElementById("roomlist");
189 var summary = document.getElementById("iconbar_menu");
190 if (!rooms || !floors || !roomlist) {
191 FillRooms(IconBarRoomList);
193 roomlist.className = roomlist.className.replace("hidden","");
194 summary.className += " hidden";
197 function switch_to_menu_buttons() {
198 if (roomlist != null) {
199 roomlist.className += "hidden";
201 var iconbar = document.getElementById("iconbar_menu");
202 iconbar.className = iconbar.className.replace("hidden","");
203 var roomlist = document.getElementById("roomlist");
204 roomlist.className += " hidden";
207 function GenericTreeRoomList(roomlist) {
208 var currentExpanded = ctdlLocalPrefs.readPref("rooms_expanded");
209 var curRoomName = "";
210 if (document.getElementById("rmname")) {
211 curRoomName = getTextContent(document.getElementById("rmname"));
213 currentDropTargets = new Array();
214 var iconbar = document.getElementById("iconbar");
215 var ul = document.createElement("ul");
216 roomlist.appendChild(ul);
217 // Add mailbox, because they are special
218 var mailboxLI = document.createElement("li");
219 ul.appendChild(mailboxLI);
220 var mailboxSPAN = document.createElement("span");
221 var _mailbox = getTextContent(document.getElementById("mbox_template"));
222 mailboxSPAN.appendChild(document.createTextNode(_mailbox));
223 $(mailboxSPAN).observe('click', expandFloorEvent);
224 mailboxLI.appendChild(mailboxSPAN);
225 mailboxLI.className = "floor";
226 var mailboxUL = document.createElement("ul");
227 mailboxLI.appendChild(mailboxUL);
228 var mailboxRooms = GetMailboxRooms();
229 for(var i=0; i<mailboxRooms.length; i++) {
230 var room = mailboxRooms[i];
231 currentDropTargets.push(addRoomToList(mailboxUL, room, curRoomName));
233 if (currentExpanded != null && currentExpanded == _mailbox ) {
234 expandFloor(mailboxSPAN);
236 for(var a=0; a<floors.length; a++) {
237 var floor = floors[a];
238 var floornum = floor[0];
244 var floorLI = document.createElement("li");
245 ul.appendChild(floorLI);
246 var floorSPAN = document.createElement("span");
247 floorSPAN.appendChild(document.createTextNode(name));
248 $(floorSPAN).observe('click', expandFloorEvent);
249 floorLI.appendChild(floorSPAN);
250 floorLI.className = "floor";
251 var floorUL = document.createElement("ul");
252 floorLI.appendChild(floorUL);
253 var roomsForFloor = GetRoomsByFloorNum(floornum);
254 for(var b=0; b<roomsForFloor.length; b++) {
255 var room = roomsForFloor[b];
256 currentDropTargets.push(addRoomToList(floorUL, room, curRoomName));
258 if (currentExpanded != null && currentExpanded == name) {
259 expandFloor(floorSPAN);
264 function IconBarRoomList() {
265 roomlist = document.getElementById("roomlist");
266 GenericTreeRoomList(roomlist);
268 function KNRoomsRoomList() {
269 roomlist = document.getElementById("roomlist_knrooms");
270 GenericTreeRoomList(roomlist);
273 function addRoomToList(floorUL,room, roomToEmphasize) {
274 var roomName = room[RN_ROOM_NAME];
275 var flag = room[RN_ROOM_FLAG];
276 var curView = room[RN_CUR_VIEW];
277 var view = room[RN_DEF_VIEW];
278 var raflags = room[RN_RAFLAGS];
279 var isMailBox = ((flag & QR_MAILBOX) == QR_MAILBOX);
280 var hasNewMsgs = ((raflags & UA_HASNEWMSGS) == UA_HASNEWMSGS);
281 var roomLI = document.createElement("li");
282 var roomA = document.createElement("a");
283 roomA.setAttribute("href","dotgoto?room="+roomName);
284 roomA.appendChild(document.createTextNode(roomName));
285 roomLI.appendChild(roomA);
286 floorUL.appendChild(roomLI);
287 var className = "room ";
288 if (view == VIEW_MAILBOX) {
289 className += "room-private"
290 } else if (view == VIEW_ADDRESSBOOK) {
291 className += "room-addr";
292 } else if (view == VIEW_CALENDAR || view == VIEW_CALBRIEF) {
293 className += "room-cal";
294 } else if (view == VIEW_TASKS) {
295 className += "room-tasks";
296 } else if (view == VIEW_NOTES) {
297 className += "room-notes";
299 className += "room-chat";
302 className += " room-newmsgs";
304 if (roomName == roomToEmphasize) {
305 className += " room-emphasized";
307 roomLI.setAttribute("class", className);
308 roomA.dropTarget = true;
309 roomA.dropHandler = roomListDropHandler;
313 function roomListDropHandler(target, dropped) {
314 if (dropped.getAttribute("citadel:msgid")) {
315 var room = getTextContent(target);
317 for(msgId in currentlyMarkedRows) { //defined in summaryview.js
320 var mvCommand = "g_cmd=MOVE " + msgIds + "|"+room+"|0";
321 new Ajax.Request('ajax_servcmd', {
323 parameters: mvCommand,
324 onComplete: deleteAllMarkedRows()});
327 function expandFloorEvent(event) {
328 expandFloor(event.target);
330 function expandFloor(target) {
331 if (target.nodeName.toLowerCase() != "span") {
332 return; // ignore clicks on child UL
334 ctdlLocalPrefs.setPref("rooms_expanded", target.firstChild.nodeValue);
335 var parentUL = target.parentNode;
336 if (currentlyExpandedFloor != null) {
337 currentlyExpandedFloor.className = currentlyExpandedFloor.className.replace("floor-expanded","");
339 parentUL.className = parentUL.className + " floor-expanded";
340 currentlyExpandedFloor = parentUL;
343 // These functions handle moving sticky notes around the screen by dragging them
345 var uid_of_note_being_dragged = 0;
346 var saved_cursor_style = 'default';
347 var note_was_dragged = 0;
349 function NotesDragMouseUp(evt) {
350 document.onmouseup = null;
351 document.onmousemove = null;
352 if (document.layers) {
353 document.releaseEvents(Event.MOUSEUP | Event.MOUSEMOVE);
356 d = $('note-' + uid_of_note_being_dragged);
357 d.style.cursor = saved_cursor_style;
359 // If any motion actually occurred, submit an ajax http call to record it to the server
360 if (note_was_dragged > 0) {
361 p = 'note_uid=' + uid_of_note_being_dragged
362 + '&left=' + d.style.left
363 + '&top=' + d.style.top
364 + '&r=' + CtdlRandomString();
374 uid_of_note_being_dragged = '';
378 function NotesDragMouseMove(evt) {
379 x = (ns6 ? evt.clientX : event.clientX);
380 x_increment = x - saved_x;
381 y = (ns6 ? evt.clientY : event.clientY);
382 y_increment = y - saved_y;
385 d = $('note-' + uid_of_note_being_dragged);
387 divTop = parseInt(d.style.top);
388 divLeft = parseInt(d.style.left);
390 d.style.top = (divTop + y_increment) + 'px';
391 d.style.left = (divLeft + x_increment) + 'px';
395 note_was_dragged = 1;
400 function NotesDragMouseDown(evt, uid) {
401 saved_x = (ns6 ? evt.clientX : event.clientX);
402 saved_y = (ns6 ? evt.clientY : event.clientY);
403 document.onmouseup = NotesDragMouseUp;
404 document.onmousemove = NotesDragMouseMove;
405 if (document.layers) {
406 document.captureEvents(Event.MOUSEUP | Event.MOUSEMOVE);
408 uid_of_note_being_dragged = uid;
409 d = $('note-' + uid_of_note_being_dragged);
410 saved_cursor_style = d.style.cursor;
411 d.style.cursor = 'move';
412 return false; // disable the default action
416 // Called when the user clicks on the palette icon of a sticky note to change its color.
417 // It toggles the color selector visible or invisible.
419 function NotesClickPalette(evt, uid) {
420 uid_of_note_being_colored = uid;
421 d = $('palette-' + uid_of_note_being_colored);
423 if (d.style.display) {
424 if (d.style.display == 'none') {
425 d.style.display = 'block';
428 d.style.display = 'none';
432 d.style.display = 'block';
439 // Called when the user clicks on one of the colors in an open color selector.
440 // Sets the desired color and then closes the color selector.
442 function NotesClickColor(evt, uid, red, green, blue, notecolor, titlecolor) {
443 uid_of_note_being_colored = uid;
444 palette_button = $('palette-' + uid_of_note_being_colored);
445 note_div = $('note-' + uid_of_note_being_colored);
446 titlebar_div = $('titlebar-' + uid_of_note_being_colored);
448 // alert('FIXME red=' + red + ' green=' + green + ' blue=' + blue);
450 note_div.style.backgroundColor = notecolor;
451 titlebar_div.style.backgroundColor = titlecolor;
452 palette_button.style.display = 'none';
454 // submit an ajax http call to record it to the server
455 p = 'note_uid=' + uid_of_note_being_colored
459 + '&r=' + CtdlRandomString();
472 // These functions handle resizing sticky notes by dragging the resize handle
474 var uid_of_note_being_resized = 0;
475 var saved_cursor_style = 'default';
476 var note_was_resized = 0;
478 function NotesResizeMouseUp(evt) {
479 document.onmouseup = null;
480 document.onmousemove = null;
481 if (document.layers) {
482 document.releaseEvents(Event.MOUSEUP | Event.MOUSEMOVE);
485 d = $('note-' + uid_of_note_being_resized);
486 d.style.cursor = saved_cursor_style;
488 // If any motion actually occurred, submit an ajax http call to record it to the server
489 if (note_was_resized > 0) {
490 p = 'note_uid=' + uid_of_note_being_resized
491 + '&width=' + d.style.width
492 + '&height=' + d.style.height
493 + '&r=' + CtdlRandomString();
503 uid_of_note_being_resized = '';
504 return false; // disable the default action
507 function NotesResizeMouseMove(evt) {
508 x = (ns6 ? evt.clientX : event.clientX);
509 x_increment = x - saved_x;
510 y = (ns6 ? evt.clientY : event.clientY);
511 y_increment = y - saved_y;
514 d = $('note-' + uid_of_note_being_resized);
516 divTop = parseInt(d.style.height);
517 divLeft = parseInt(d.style.width);
519 newHeight = divTop + y_increment;
520 if (newHeight < 50) newHeight = 50;
522 newWidth = divLeft + x_increment;
523 if (newWidth < 50) newWidth = 50;
525 d.style.height = newHeight + 'px';
526 d.style.width = newWidth + 'px';
530 note_was_resized = 1;
531 return false; // disable the default action
535 function NotesResizeMouseDown(evt, uid) {
536 saved_x = (ns6 ? evt.clientX : event.clientX);
537 saved_y = (ns6 ? evt.clientY : event.clientY);
538 document.onmouseup = NotesResizeMouseUp;
539 document.onmousemove = NotesResizeMouseMove;
540 if (document.layers) {
541 document.captureEvents(Event.MOUSEUP | Event.MOUSEMOVE);
543 uid_of_note_being_resized = uid;
544 d = $('note-' + uid_of_note_being_resized);
545 saved_cursor_style = d.style.cursor;
546 d.style.cursor = 'move';
547 return false; // disable the default action
551 function DeleteStickyNote(evt, uid, confirmation_prompt) {
552 uid_of_note_being_deleted = uid;
553 d = $('note-' + uid_of_note_being_deleted);
555 if (confirm(confirmation_prompt)) {
558 // submit an ajax http call to delete it on the server
559 p = 'note_uid=' + uid_of_note_being_deleted
561 + '&r=' + CtdlRandomString();
572 function ctdl_ts_getInnerText(el) {
573 if (typeof el == "string") return el;
574 if (typeof el == "undefined") { return el };
575 if (el.innerText) return el.innerText; //Not needed but it is faster
578 var cs = el.childNodes;
580 for (var i = 0; i < l; i++) {
581 switch (cs[i].nodeType) {
582 case 1: //ELEMENT_NODE
583 str += ts_getInnerText(cs[i]);
586 str += cs[i].nodeValue;
594 // Place a gradient loadscreen on an element, e.g to use before Ajax.updater
595 function CtdlLoadScreen(elementid) {
596 var elem = document.getElementById(elementid);
597 elem.innerHTML = "<div align=center><br><table border=0 cellpadding=10 bgcolor=\"#ffffff\"><tr><td><img src=\"static/throbber.gif\" /><font color=\"#AAAAAA\"> Loading....</font></td></tr></table><br /></div>";
602 // Pop open the address book (target_input is the INPUT field to populate)
604 function PopOpenAddressBook(target_input) {
605 $('address_book_popup').style.display = 'block';
606 p = 'target_input=' + target_input + '&r=' + CtdlRandomString();
608 'address_book_popup_middle_div',
609 'display_address_book_middle_div',
618 function PopulateAddressBookInnerDiv(which_addr_book, target_input) {
619 $('address_book_inner_div').innerHTML = "<div align=center><br><table border=0 cellpadding=10 bgcolor=\"#ffffff\"><tr><td><img src=\"static/throbber.gif\" /><font color=\"#AAAAAA\"> Loading....</font></td></tr></table><br /></div>";
620 p = 'which_addr_book=' + which_addr_book
621 + '&target_input=' + target_input
622 + '&r=' + CtdlRandomString();
624 'address_book_inner_div',
625 'display_address_book_inner_div',
633 // What happens when a contact is selected from the address book popup
634 // (populate the specified target)
636 function AddContactsToTarget(target, whichaddr) {
637 while (whichaddr.selectedIndex != -1) {
638 if (target.value.length > 0) {
639 target.value = target.value + ', ';
641 target.value = target.value + whichaddr.value;
642 whichaddr.options[whichaddr.selectedIndex].selected = false;
646 // Respond to a meeting invitation
647 function RespondToInvitation(question_divname, title_divname, msgnum, cal_partnum, sc) {
648 p = 'msgnum=' + msgnum + '&cal_partnum=' + cal_partnum + '&sc=' + sc ;
649 new Ajax.Updater(title_divname, 'respond_to_request', { method: 'post', parameters: p } );
650 Effect.Fade(question_divname, { duration: 0.5 });
653 // Handle a received RSVP
654 function HandleRSVP(question_divname, title_divname, msgnum, cal_partnum, sc) {
655 p = 'msgnum=' + msgnum + '&cal_partnum=' + cal_partnum + '&sc=' + sc ;
656 new Ajax.Updater(title_divname, 'handle_rsvp', { method: 'post', parameters: p } );
657 Effect.Fade(question_divname, { duration: 0.5 });
659 /* var fakeMouse = document.createEvent("MouseEvents");
660 fakeMouse.initMouseEvent("click", true, true, window,
661 0,0,0,0,0, false, false, false, false, 0, null); */
662 // TODO: Collapse into one function
663 function toggleTaskDtStart(event) {
664 var checkBox = $('nodtstart');
665 var checkBoxTime = $('dtstart_time_assoc');
666 var dtstart = document.getElementById("dtstart");
667 var dtstart_date = document.getElementById("dtstart_date");
668 var dtstart_time = document.getElementById("dtstart_time");
669 if (checkBox.checked) {
670 dtstart_date.style.visibility = "hidden";
671 dtstart_time.style.visibility = "hidden";
673 if (checkBoxTime.checked) {
674 dtstart_time.style.visibility = "visible";
676 dtstart_time.style.visibility = "hidden";
678 dtstart_date.style.visibility = "visible";
679 if (dtstart.value.length == 0)
680 dtstart.dpck._initCurrentDate();
683 function toggleTaskDue(event) {
684 var checkBox = $('nodue');
685 var checkBoxTime = $('due_time_assoc');
686 var due = document.getElementById("due");
687 var due_date = document.getElementById("due_date");
688 var due_time = document.getElementById("due_time");
689 if (checkBox.checked) {
690 due_date.style.visibility = "hidden";
691 due_time.style.visibility = "hidden";
693 if (checkBoxTime.checked) {
694 due_time.style.visibility = "visible";
696 due_time.style.visibility = "hidden";
698 due_date.style.visibility = "visible";
699 if (due.value.length == 0)
700 due.dpck._initCurrentDate();
703 function ToggleTaskDateOrNoDateActivate(event) {
704 var dtstart = document.getElementById("nodtstart");
705 if (dtstart != null) {
706 toggleTaskDtStart(null);
708 $('nodtstart').observe('click', toggleTaskDtStart);
709 $('dtstart_time_assoc').observe('click', toggleTaskDtStart);
710 $('nodue').observe('click', toggleTaskDue);
711 $('due_time_assoc').observe('click', toggleTaskDue);
714 function TaskViewGatherCategoriesFromTable() {
715 var table = $('taskview');
718 function attachDatePicker(relative) {
719 var dpck = new DatePicker({
721 language: 'en', //wclang.substr(0,2),
722 disableFutureDate: false,
723 dateFormat: [ ["yyyy", "mm", "dd"], "-"],
726 document.getElementById(relative).dpck = dpck; // attach a ref to it
728 function eventEditAllDay() {
729 var allDayCheck = document.getElementById("alldayevent");
730 var dtend_time = document.getElementById("dtend_time");
731 var dtstart_time = document.getElementById("dtstart_time");
732 if(allDayCheck.checked) {
733 dtstart_time.style.visibility = "hidden";
734 dtend_time.style.visibility = "hidden";
736 dtstart_time.style.visibility = "visible";
737 dtend_time.style.visibility = "visible";
741 // Functions which handle show/hide of various elements in the recurrence editor
743 function RecurrenceShowHide() {
745 if ($('is_recur').checked) {
746 $('rrule_div').style.display = 'block';
749 $('rrule_div').style.display = 'none';
752 if ($('freq_selector').selectedIndex == 4) {
753 $('weekday_selector').style.display = 'block';
756 $('weekday_selector').style.display = 'none';
759 if ($('freq_selector').selectedIndex == 5) {
760 $('monthday_selector').style.display = 'block';
763 $('monthday_selector').style.display = 'none';
766 if ($('rrend_count').checked) {
767 $('rrcount').disabled = false;
770 $('rrcount').disabled = true;
773 if ($('rrend_until').checked) {
774 $('rruntil').disabled = false;
777 $('rruntil').disabled = true;
780 if ($('rrmonthtype_mday').checked) {
781 $('rrmday').disabled = false;
784 $('rrmday').disabled = true;
787 if ($('rrmonthtype_wday').checked) {
788 $('rrmweek').disabled = false;
789 $('rrmweekday').disabled = false;
792 $('rrmweek').disabled = true;
793 $('rrmweekday').disabled = true;
796 if ($('freq_selector').selectedIndex == 6) {
797 $('yearday_selector').style.display = 'block';
800 $('yearday_selector').style.display = 'none';
803 $('ymday').innerHTML = 'XXXX-' + $('dtstart').value.substr(5);
804 $('rrmday').innerHTML = $('dtstart').value.substr(8);
806 if ($('rryeartype_ywday').checked) {
807 $('rrymweek').disabled = false;
808 $('rrymweekday').disabled = false;
809 $('rrymonth').disabled = false;
812 $('rrymweek').disabled = true;
813 $('rrymweekday').disabled = true;
814 $('rrymonth').disabled = true;
820 // Enable or disable the 'check attendee availability' button depending on whether
821 // the attendees list is empty
822 function EnableOrDisableCheckButton()
824 if ($('attendees_box').value.length == 0) {
825 $('check_button').disabled = true;
828 $('check_button').disabled = false;
835 function launchChat(event) {
836 window.open('chat', 'ctdl_chat_window', 'toolbar=no,location=no,directories=no,copyhistory=no,status=no,scrollbars=yes,resizable=yes');
839 function WCLog(msg) {
840 if (!!window.console && !!console.log) {
842 } else if (!!window.opera && !!opera.postError) {
843 opera.postError(msg);
845 wc_log += msg + "\r\n";
849 function RefreshSMTPqueueDisplay() {
850 new Ajax.Updater('smtpqueue_inner_div',
851 'display_smtpqueue_inner_div', { method: 'get',
852 parameters: Math.random() } );
855 function DeleteSMTPqueueMsg(msgnum1, msgnum2) {
859 parameters: 'g_cmd=DELE ' + msgnum1 + ',' + msgnum2,
860 onComplete: RefreshSMTPqueueDisplay()
866 function ConfirmLogoff() {
869 'do_template?template=confirmlogoff',
872 onSuccess: function(cl_success) {