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 /* FIXME is there a way to not update this div when it is not showing? */
167 new Ajax.PeriodicalUpdater('online_users', 'do_template?template=who_iconbar', {method: 'get', frequency: 30});
169 function changeIconBarEvent(event) {
170 changeIconBar(event.target);
172 function changeIconBar(target) {
173 var switchTo = target.ctdlSwitchIconBarTo;
174 WCLog("Changing to: " + switchTo);
175 ctdlLocalPrefs.setPref("iconbar_view", target.ctdlSwitchIconBarTo);
176 if (switchTo == "rooms") {
177 switch_to_room_list();
178 setTextContent(target, _switchToMenu);
179 target.ctdlSwitchIconBarTo = "menu";
181 switch_to_menu_buttons();
182 setTextContent(target, _switchToRoomList);
183 target.ctdlSwitchIconBarTo = "rooms";
186 function switch_to_room_list() {
187 var roomlist = document.getElementById("roomlist");
188 var summary = document.getElementById("iconbar_menu");
189 if (!rooms || !floors || !roomlist) {
190 FillRooms(IconBarRoomList);
192 roomlist.className = roomlist.className.replace("hidden","");
193 summary.className += " hidden";
196 function switch_to_menu_buttons() {
197 if (roomlist != null) {
198 roomlist.className += "hidden";
200 var iconbar = document.getElementById("iconbar_menu");
201 iconbar.className = iconbar.className.replace("hidden","");
202 var roomlist = document.getElementById("roomlist");
203 roomlist.className += " hidden";
206 function GenericTreeRoomList(roomlist) {
207 var currentExpanded = ctdlLocalPrefs.readPref("rooms_expanded");
208 var curRoomName = "";
209 if (document.getElementById("rmname")) {
210 curRoomName = getTextContent(document.getElementById("rmname"));
212 currentDropTargets = new Array();
213 var iconbar = document.getElementById("iconbar");
214 var ul = document.createElement("ul");
215 roomlist.appendChild(ul);
216 // Add mailbox, because they are special
217 var mailboxLI = document.createElement("li");
218 ul.appendChild(mailboxLI);
219 var mailboxSPAN = document.createElement("span");
220 var _mailbox = getTextContent(document.getElementById("mbox_template"));
221 mailboxSPAN.appendChild(document.createTextNode(_mailbox));
222 $(mailboxSPAN).observe('click', expandFloorEvent);
223 mailboxLI.appendChild(mailboxSPAN);
224 mailboxLI.className = "floor";
225 var mailboxUL = document.createElement("ul");
226 mailboxLI.appendChild(mailboxUL);
227 var mailboxRooms = GetMailboxRooms();
228 for(var i=0; i<mailboxRooms.length; i++) {
229 var room = mailboxRooms[i];
230 currentDropTargets.push(addRoomToList(mailboxUL, room, curRoomName));
232 if (currentExpanded != null && currentExpanded == _mailbox ) {
233 expandFloor(mailboxSPAN);
235 for(var a=0; a<floors.length; a++) {
236 var floor = floors[a];
237 var floornum = floor[0];
243 var floorLI = document.createElement("li");
244 ul.appendChild(floorLI);
245 var floorSPAN = document.createElement("span");
246 floorSPAN.appendChild(document.createTextNode(name));
247 $(floorSPAN).observe('click', expandFloorEvent);
248 floorLI.appendChild(floorSPAN);
249 floorLI.className = "floor";
250 var floorUL = document.createElement("ul");
251 floorLI.appendChild(floorUL);
252 var roomsForFloor = GetRoomsByFloorNum(floornum);
253 for(var b=0; b<roomsForFloor.length; b++) {
254 var room = roomsForFloor[b];
255 currentDropTargets.push(addRoomToList(floorUL, room, curRoomName));
257 if (currentExpanded != null && currentExpanded == name) {
258 expandFloor(floorSPAN);
263 function IconBarRoomList() {
264 roomlist = document.getElementById("roomlist");
265 GenericTreeRoomList(roomlist);
267 function KNRoomsRoomList() {
268 roomlist = document.getElementById("roomlist_knrooms");
269 GenericTreeRoomList(roomlist);
272 function addRoomToList(floorUL,room, roomToEmphasize) {
273 var roomName = room[RN_ROOM_NAME];
274 var flag = room[RN_ROOM_FLAG];
275 var curView = room[RN_CUR_VIEW];
276 var view = room[RN_DEF_VIEW];
277 var raflags = room[RN_RAFLAGS];
278 var isMailBox = ((flag & QR_MAILBOX) == QR_MAILBOX);
279 var hasNewMsgs = ((raflags & UA_HASNEWMSGS) == UA_HASNEWMSGS);
280 var roomLI = document.createElement("li");
281 var roomA = document.createElement("a");
282 roomA.setAttribute("href","dotgoto?room="+roomName);
283 roomA.appendChild(document.createTextNode(roomName));
284 roomLI.appendChild(roomA);
285 floorUL.appendChild(roomLI);
286 var className = "room ";
287 if (view == VIEW_MAILBOX) {
288 className += "room-private"
289 } else if (view == VIEW_ADDRESSBOOK) {
290 className += "room-addr";
291 } else if (view == VIEW_CALENDAR || view == VIEW_CALBRIEF) {
292 className += "room-cal";
293 } else if (view == VIEW_TASKS) {
294 className += "room-tasks";
295 } else if (view == VIEW_NOTES) {
296 className += "room-notes";
298 className += "room-chat";
301 className += " room-newmsgs";
303 if (roomName == roomToEmphasize) {
304 className += " room-emphasized";
306 roomLI.setAttribute("class", className);
307 roomA.dropTarget = true;
308 roomA.dropHandler = roomListDropHandler;
312 function roomListDropHandler(target, dropped) {
313 if (dropped.getAttribute("citadel:msgid")) {
314 var room = getTextContent(target);
316 for(msgId in currentlyMarkedRows) { //defined in summaryview.js
319 var mvCommand = encodeURI("g_cmd=MOVE " + msgIds + "|"+room+"|0");
320 new Ajax.Request('ajax_servcmd', {
322 parameters: mvCommand,
323 onComplete: deleteAllMarkedRows()});
326 function expandFloorEvent(event) {
327 expandFloor(event.target);
329 function expandFloor(target) {
330 if (target.nodeName.toLowerCase() != "span") {
331 return; // ignore clicks on child UL
333 ctdlLocalPrefs.setPref("rooms_expanded", target.firstChild.nodeValue);
334 var parentUL = target.parentNode;
335 if (currentlyExpandedFloor != null) {
336 currentlyExpandedFloor.className = currentlyExpandedFloor.className.replace("floor-expanded","");
338 parentUL.className = parentUL.className + " floor-expanded";
339 currentlyExpandedFloor = parentUL;
342 // These functions handle moving sticky notes around the screen by dragging them
344 var uid_of_note_being_dragged = 0;
345 var saved_cursor_style = 'default';
346 var note_was_dragged = 0;
348 function NotesDragMouseUp(evt) {
349 document.onmouseup = null;
350 document.onmousemove = null;
351 if (document.layers) {
352 document.releaseEvents(Event.MOUSEUP | Event.MOUSEMOVE);
355 d = $('note-' + uid_of_note_being_dragged);
356 d.style.cursor = saved_cursor_style;
358 // If any motion actually occurred, submit an ajax http call to record it to the server
359 if (note_was_dragged > 0) {
360 p = 'note_uid=' + uid_of_note_being_dragged
361 + '&left=' + d.style.left
362 + '&top=' + d.style.top
363 + '&r=' + CtdlRandomString();
373 uid_of_note_being_dragged = '';
377 function NotesDragMouseMove(evt) {
378 x = (ns6 ? evt.clientX : event.clientX);
379 x_increment = x - saved_x;
380 y = (ns6 ? evt.clientY : event.clientY);
381 y_increment = y - saved_y;
384 d = $('note-' + uid_of_note_being_dragged);
386 divTop = parseInt(d.style.top);
387 divLeft = parseInt(d.style.left);
389 d.style.top = (divTop + y_increment) + 'px';
390 d.style.left = (divLeft + x_increment) + 'px';
394 note_was_dragged = 1;
399 function NotesDragMouseDown(evt, uid) {
400 saved_x = (ns6 ? evt.clientX : event.clientX);
401 saved_y = (ns6 ? evt.clientY : event.clientY);
402 document.onmouseup = NotesDragMouseUp;
403 document.onmousemove = NotesDragMouseMove;
404 if (document.layers) {
405 document.captureEvents(Event.MOUSEUP | Event.MOUSEMOVE);
407 uid_of_note_being_dragged = uid;
408 d = $('note-' + uid_of_note_being_dragged);
409 saved_cursor_style = d.style.cursor;
410 d.style.cursor = 'move';
411 return false; // disable the default action
415 // Called when the user clicks on the palette icon of a sticky note to change its color.
416 // It toggles the color selector visible or invisible.
418 function NotesClickPalette(evt, uid) {
419 uid_of_note_being_colored = uid;
420 d = $('palette-' + uid_of_note_being_colored);
422 if (d.style.display) {
423 if (d.style.display == 'none') {
424 d.style.display = 'block';
427 d.style.display = 'none';
431 d.style.display = 'block';
438 // Called when the user clicks on one of the colors in an open color selector.
439 // Sets the desired color and then closes the color selector.
441 function NotesClickColor(evt, uid, red, green, blue, notecolor, titlecolor) {
442 uid_of_note_being_colored = uid;
443 palette_button = $('palette-' + uid_of_note_being_colored);
444 note_div = $('note-' + uid_of_note_being_colored);
445 titlebar_div = $('titlebar-' + uid_of_note_being_colored);
447 // alert('FIXME red=' + red + ' green=' + green + ' blue=' + blue);
449 note_div.style.backgroundColor = notecolor;
450 titlebar_div.style.backgroundColor = titlecolor;
451 palette_button.style.display = 'none';
453 // submit an ajax http call to record it to the server
454 p = 'note_uid=' + uid_of_note_being_colored
458 + '&r=' + CtdlRandomString();
471 // These functions handle resizing sticky notes by dragging the resize handle
473 var uid_of_note_being_resized = 0;
474 var saved_cursor_style = 'default';
475 var note_was_resized = 0;
477 function NotesResizeMouseUp(evt) {
478 document.onmouseup = null;
479 document.onmousemove = null;
480 if (document.layers) {
481 document.releaseEvents(Event.MOUSEUP | Event.MOUSEMOVE);
484 d = $('note-' + uid_of_note_being_resized);
485 d.style.cursor = saved_cursor_style;
487 // If any motion actually occurred, submit an ajax http call to record it to the server
488 if (note_was_resized > 0) {
489 p = 'note_uid=' + uid_of_note_being_resized
490 + '&width=' + d.style.width
491 + '&height=' + d.style.height
492 + '&r=' + CtdlRandomString();
502 uid_of_note_being_resized = '';
503 return false; // disable the default action
506 function NotesResizeMouseMove(evt) {
507 x = (ns6 ? evt.clientX : event.clientX);
508 x_increment = x - saved_x;
509 y = (ns6 ? evt.clientY : event.clientY);
510 y_increment = y - saved_y;
513 d = $('note-' + uid_of_note_being_resized);
515 divTop = parseInt(d.style.height);
516 divLeft = parseInt(d.style.width);
518 newHeight = divTop + y_increment;
519 if (newHeight < 50) newHeight = 50;
521 newWidth = divLeft + x_increment;
522 if (newWidth < 50) newWidth = 50;
524 d.style.height = newHeight + 'px';
525 d.style.width = newWidth + 'px';
529 note_was_resized = 1;
530 return false; // disable the default action
534 function NotesResizeMouseDown(evt, uid) {
535 saved_x = (ns6 ? evt.clientX : event.clientX);
536 saved_y = (ns6 ? evt.clientY : event.clientY);
537 document.onmouseup = NotesResizeMouseUp;
538 document.onmousemove = NotesResizeMouseMove;
539 if (document.layers) {
540 document.captureEvents(Event.MOUSEUP | Event.MOUSEMOVE);
542 uid_of_note_being_resized = uid;
543 d = $('note-' + uid_of_note_being_resized);
544 saved_cursor_style = d.style.cursor;
545 d.style.cursor = 'move';
546 return false; // disable the default action
550 function DeleteStickyNote(evt, uid, confirmation_prompt) {
551 uid_of_note_being_deleted = uid;
552 d = $('note-' + uid_of_note_being_deleted);
554 if (confirm(confirmation_prompt)) {
557 // submit an ajax http call to delete it on the server
558 p = 'note_uid=' + uid_of_note_being_deleted
560 + '&r=' + CtdlRandomString();
571 function ctdl_ts_getInnerText(el) {
572 if (typeof el == "string") return el;
573 if (typeof el == "undefined") { return el };
574 if (el.innerText) return el.innerText; //Not needed but it is faster
577 var cs = el.childNodes;
579 for (var i = 0; i < l; i++) {
580 switch (cs[i].nodeType) {
581 case 1: //ELEMENT_NODE
582 str += ts_getInnerText(cs[i]);
585 str += cs[i].nodeValue;
593 // Place a gradient loadscreen on an element, e.g to use before Ajax.updater
594 function CtdlLoadScreen(elementid) {
595 var elem = document.getElementById(elementid);
596 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>";
601 // Pop open the address book (target_input is the INPUT field to populate)
603 function PopOpenAddressBook(target_input) {
604 $('address_book_popup').style.display = 'block';
605 p = 'target_input=' + target_input + '&r=' + CtdlRandomString();
607 'address_book_popup_middle_div',
608 'display_address_book_middle_div',
617 function PopulateAddressBookInnerDiv(which_addr_book, target_input) {
618 $('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>";
619 p = 'which_addr_book=' + which_addr_book
620 + '&target_input=' + target_input
621 + '&r=' + CtdlRandomString();
623 'address_book_inner_div',
624 'display_address_book_inner_div',
632 // What happens when a contact is selected from the address book popup
633 // (populate the specified target)
635 function AddContactsToTarget(target, whichaddr) {
636 while (whichaddr.selectedIndex != -1) {
637 if (target.value.length > 0) {
638 target.value = target.value + ', ';
640 target.value = target.value + whichaddr.value;
641 whichaddr.options[whichaddr.selectedIndex].selected = false;
645 // Respond to a meeting invitation
646 function RespondToInvitation(question_divname, title_divname, msgnum, cal_partnum, sc) {
647 p = 'msgnum=' + msgnum + '&cal_partnum=' + cal_partnum + '&sc=' + sc ;
648 new Ajax.Updater(title_divname, 'respond_to_request', { method: 'post', parameters: p } );
649 Effect.Fade(question_divname, { duration: 0.5 });
652 // Handle a received RSVP
653 function HandleRSVP(question_divname, title_divname, msgnum, cal_partnum, sc) {
654 p = 'msgnum=' + msgnum + '&cal_partnum=' + cal_partnum + '&sc=' + sc ;
655 new Ajax.Updater(title_divname, 'handle_rsvp', { method: 'post', parameters: p } );
656 Effect.Fade(question_divname, { duration: 0.5 });
658 /* var fakeMouse = document.createEvent("MouseEvents");
659 fakeMouse.initMouseEvent("click", true, true, window,
660 0,0,0,0,0, false, false, false, false, 0, null); */
661 // TODO: Collapse into one function
662 function toggleTaskDtStart(event) {
663 var checkBox = $('nodtstart');
664 var checkBoxTime = $('dtstart_time_assoc');
665 var dtstart = document.getElementById("dtstart");
666 var dtstart_date = document.getElementById("dtstart_date");
667 var dtstart_time = document.getElementById("dtstart_time");
668 if (checkBox.checked) {
669 dtstart_date.style.visibility = "hidden";
670 dtstart_time.style.visibility = "hidden";
672 if (checkBoxTime.checked) {
673 dtstart_time.style.visibility = "visible";
675 dtstart_time.style.visibility = "hidden";
677 dtstart_date.style.visibility = "visible";
678 if (dtstart.value.length == 0)
679 dtstart.dpck._initCurrentDate();
682 function toggleTaskDue(event) {
683 var checkBox = $('nodue');
684 var checkBoxTime = $('due_time_assoc');
685 var due = document.getElementById("due");
686 var due_date = document.getElementById("due_date");
687 var due_time = document.getElementById("due_time");
688 if (checkBox.checked) {
689 due_date.style.visibility = "hidden";
690 due_time.style.visibility = "hidden";
692 if (checkBoxTime.checked) {
693 due_time.style.visibility = "visible";
695 due_time.style.visibility = "hidden";
697 due_date.style.visibility = "visible";
698 if (due.value.length == 0)
699 due.dpck._initCurrentDate();
702 function ToggleTaskDateOrNoDateActivate(event) {
703 var dtstart = document.getElementById("nodtstart");
704 if (dtstart != null) {
705 toggleTaskDtStart(null);
707 $('nodtstart').observe('click', toggleTaskDtStart);
708 $('dtstart_time_assoc').observe('click', toggleTaskDtStart);
709 $('nodue').observe('click', toggleTaskDue);
710 $('due_time_assoc').observe('click', toggleTaskDue);
713 function TaskViewGatherCategoriesFromTable() {
714 var table = $('taskview');
717 function attachDatePicker(relative) {
718 var dpck = new DatePicker({
720 language: 'en', //wclang.substr(0,2),
721 disableFutureDate: false,
722 dateFormat: [ ["yyyy", "mm", "dd"], "-"],
725 document.getElementById(relative).dpck = dpck; // attach a ref to it
727 function eventEditAllDay() {
728 var allDayCheck = document.getElementById("alldayevent");
729 var dtend_time = document.getElementById("dtend_time");
730 var dtstart_time = document.getElementById("dtstart_time");
731 if(allDayCheck.checked) {
732 dtstart_time.style.visibility = "hidden";
733 dtend_time.style.visibility = "hidden";
735 dtstart_time.style.visibility = "visible";
736 dtend_time.style.visibility = "visible";
740 // Functions which handle show/hide of various elements in the recurrence editor
742 function RecurrenceShowHide() {
744 if ($('is_recur').checked) {
745 $('rrule_div').style.display = 'block';
748 $('rrule_div').style.display = 'none';
751 if ($('freq_selector').selectedIndex == 4) {
752 $('weekday_selector').style.display = 'block';
755 $('weekday_selector').style.display = 'none';
758 if ($('freq_selector').selectedIndex == 5) {
759 $('monthday_selector').style.display = 'block';
762 $('monthday_selector').style.display = 'none';
765 if ($('rrend_count').checked) {
766 $('rrcount').disabled = false;
769 $('rrcount').disabled = true;
772 if ($('rrend_until').checked) {
773 $('rruntil').disabled = false;
776 $('rruntil').disabled = true;
779 if ($('rrmonthtype_mday').checked) {
780 $('rrmday').disabled = false;
783 $('rrmday').disabled = true;
786 if ($('rrmonthtype_wday').checked) {
787 $('rrmweek').disabled = false;
788 $('rrmweekday').disabled = false;
791 $('rrmweek').disabled = true;
792 $('rrmweekday').disabled = true;
795 if ($('freq_selector').selectedIndex == 6) {
796 $('yearday_selector').style.display = 'block';
799 $('yearday_selector').style.display = 'none';
802 $('ymday').innerHTML = 'XXXX-' + $('dtstart').value.substr(5);
803 $('rrmday').innerHTML = $('dtstart').value.substr(8);
805 if ($('rryeartype_ywday').checked) {
806 $('rrymweek').disabled = false;
807 $('rrymweekday').disabled = false;
808 $('rrymonth').disabled = false;
811 $('rrymweek').disabled = true;
812 $('rrymweekday').disabled = true;
813 $('rrymonth').disabled = true;
819 // Enable or disable the 'check attendee availability' button depending on whether
820 // the attendees list is empty
821 function EnableOrDisableCheckButton()
823 if ($('attendees_box').value.length == 0) {
824 $('check_button').disabled = true;
827 $('check_button').disabled = false;
834 function launchChat(event) {
835 window.open('chat', 'ctdl_chat_window', 'toolbar=no,location=no,directories=no,copyhistory=no,status=no,scrollbars=yes,resizable=yes');
838 function WCLog(msg) {
839 if (!!window.console && !!console.log) {
841 } else if (!!window.opera && !!opera.postError) {
842 opera.postError(msg);
844 wc_log += msg + "\r\n";
848 function RefreshSMTPqueueDisplay() {
849 new Ajax.Updater('smtpqueue_inner_div',
850 'display_smtpqueue_inner_div', { method: 'get',
851 parameters: Math.random() } );
854 function DeleteSMTPqueueMsg(msgnum1, msgnum2) {
855 var p = encodeURI('g_cmd=DELE ' + msgnum1 + ',' + msgnum2);
860 onComplete: RefreshSMTPqueueDisplay()
866 function ConfirmLogoff() {
869 'do_template?template=confirmlogoff',
872 onSuccess: function(cl_success) {
880 function switch_to_lang(new_lang) {
881 p = 'push?url=' + encodeURI(window.location);
882 new Ajax.Request(p, { method: 'get' } );
883 window.location = 'switch_language?lang=' + new_lang ;