2 * JavaScript function library for WebCit.
4 * Copyright (c) 2005-2011 by the citadel.org team
6 * This program is open source software. You can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 var room_is_trash = 0;
25 var currentlyExpandedFloor = null;
27 var currentDropTarget = null;
29 var supportsAddEventListener = (!!document.addEventListener);
30 var today = new Date();
33 if (document.all) {browserType = "ie"}
34 if (window.navigator.userAgent.toLowerCase().match("gecko")) {
37 var ns6=document.getElementById&&!document.all;
38 Event.observe(window, 'load', ToggleTaskDateOrNoDateActivate);
39 Event.observe(window, 'load', taskViewActivate);
40 //document.observe("dom:loaded", setupPrefEngine);
41 document.observe("dom:loaded", setupIconBar);
42 function CtdlRandomString() {
43 return((Math.random()+'').substr(3));
45 function strcmp ( str1, str2 ) {
46 // http://kevin.vanzonneveld.net
47 // + original by: Waldo Malqui Silva
48 // + input by: Steve Hilder
49 // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
50 // + revised by: gorthaur
51 // * example 1: strcmp( 'waldo', 'owald' );
53 // * example 2: strcmp( 'owald', 'waldo' );
56 return ( ( str1 == str2 ) ? 0 : ( ( str1 > str2 ) ? 1 : -1 ) );
61 function ToggleVisibility ($Which)
63 if (document.getElementById)
65 if (document.getElementById($Which).style.display == "none")
66 document.getElementById($Which).style.display = "inline";
68 document.getElementById($Which).style.display = "none";
72 function emptyElement(element) {
73 childNodes = element.childNodes;
74 for(var i=0; i<childNodes.length; i++) {
76 element.removeChild(childNodes[i]);
78 WCLog(e+"|"+e.description);
82 /** Implements superior internet explorer 'extract all child text from element' feature'. Falls back on buggy, patent violating standardized method */
83 function getTextContent(element) {
84 if (element.textContent == undefined) {
85 return element.innerText;
87 return element.textContent;
89 /** Same reasons as above */
90 function setTextContent(element, textContent) {
91 if(element.textContent == undefined) {
92 element.innerText = textContent;
94 element.textContent = textContent;
98 // We love string tokenizers.
99 function extract_token(source_string, token_num, delimiter) {
101 var extracted_string = source_string;
104 for (i=0; i<token_num; ++i) {
105 var j = extracted_string.indexOf(delimiter);
107 extracted_string = extracted_string.substr(j+1);
112 j = extracted_string.indexOf(delimiter);
114 extracted_string = extracted_string.substr(0, j);
117 return extracted_string;
120 function CtdlSpawnContextMenu(event, source) {
121 // remove any existing menus
122 disintergrateContextMenus(null);
123 var x = event.clientX-10; // cut a few pixels out so our mouseout works right
124 var y = event.clientY-10;
125 var contextDIV = document.createElement("div");
126 contextDIV.setAttribute("id", "ctdlContextMenu");
127 document.body.appendChild(contextDIV);
128 var sourceChildren = source.childNodes;
129 for(var j=0; j<sourceChildren.length; j++) {
130 contextDIV.appendChild(sourceChildren[j].cloneNode(true));
132 var leftRule = "left: "+x+"px;";
133 contextDIV.setAttribute("style", leftRule);
134 contextDIV.setAttribute("actual", leftRule);
135 contextDIV.style.top = y+"px";
136 contextDIV.style.display = "block";
137 $(contextDIV).observe('mouseout',disintergrateContextMenus);
139 function disintergrateContextMenus(event) {
140 var contextMenu = document.getElementById("ctdlContextMenu");
142 contextMenu.parentNode.removeChild(contextMenu);
144 Event.stopObserving(document,'click',disintergrateContextMenus);
146 // This code handles the popups for important-messages.
147 function hide_imsg_popup() {
148 if (browserType == "gecko") {
149 document.poppedLayer = eval('document.getElementById(\'important_message\')');
151 else if (browserType == "ie") {
152 document.poppedLayer = eval('document.all[\'important_message\']');
155 document.poppedLayer = eval('document.layers[\'`important_message\']');
158 document.poppedLayer.style.visibility = "hidden";
162 // This function activates the ajax-powered recipient autocompleters on the message entry screen.
163 function activate_entmsg_autocompleters() {
164 new Ajax.Autocompleter('cc_id', 'cc_name_choices', 'cc_autocomplete', {} );
165 new Ajax.Autocompleter('bcc_id', 'bcc_name_choices', 'bcc_autocomplete', {} );
166 new Ajax.Autocompleter('recp_id', 'recp_name_choices', 'recp_autocomplete', {} );
169 function activate_iconbar_wholist_populat0r()
171 new Ajax.PeriodicalUpdater('online_users', 'do_template?template=who_iconbar', {method: 'get', frequency: 30});
174 function setupIconBar() {
176 /* WARNING: VILE, SLEAZY HACK. We determine the state of the box based on the image loaded. */
177 if ( $('expand_roomlist').src.substring($('expand_roomlist').src.length - 12) == "collapse.gif" ) {
178 $('roomlist').style.display = 'block';
179 FillRooms(IconBarRoomList);
182 $('roomlist').style.display = 'none';
185 /* WARNING: VILE, SLEAZY HACK. We determine the state of the box based on the image loaded. */
186 if ( $('expand_wholist').src.substring($('expand_wholist').src.length - 12) == "collapse.gif" ) {
187 $('online_users').style.display = 'block';
188 activate_iconbar_wholist_populat0r();
191 $('online_users').style.display = 'none';
196 function GenericTreeRoomList(roomlist) {
197 var currentExpanded = ctdlLocalPrefs.readPref("rooms_expanded");
198 var curRoomName = "";
199 if (document.getElementById("rmname")) {
200 curRoomName = getTextContent(document.getElementById("rmname"));
202 currentDropTargets = new Array();
203 var iconbar = document.getElementById("iconbar");
204 var ul = document.createElement("ul");
205 roomlist.appendChild(ul);
206 // Add mailbox, because they are special
207 var mailboxLI = document.createElement("li");
208 ul.appendChild(mailboxLI);
209 var mailboxSPAN = document.createElement("span");
210 var _mailbox = getTextContent(document.getElementById("mbox_template"));
211 mailboxSPAN.appendChild(document.createTextNode(_mailbox));
212 $(mailboxSPAN).observe('click', expandFloorEvent);
213 mailboxLI.appendChild(mailboxSPAN);
214 mailboxLI.className = "floor";
215 var mailboxUL = document.createElement("ul");
216 mailboxLI.appendChild(mailboxUL);
217 var mailboxRooms = GetMailboxRooms();
218 for(var i=0; i<mailboxRooms.length; i++) {
219 var room = mailboxRooms[i];
220 currentDropTargets.push(addRoomToList(mailboxUL, room, curRoomName));
222 if (currentExpanded != null && currentExpanded == _mailbox ) {
223 expandFloor(mailboxSPAN);
225 for(var a=0; a<floors.length; a++) {
226 var floor = floors[a];
227 var floornum = floor[0];
233 var floorLI = document.createElement("li");
234 ul.appendChild(floorLI);
235 var floorSPAN = document.createElement("span");
236 floorSPAN.appendChild(document.createTextNode(name));
237 $(floorSPAN).observe('click', expandFloorEvent);
238 floorLI.appendChild(floorSPAN);
239 floorLI.className = "floor";
240 var floorUL = document.createElement("ul");
241 floorLI.appendChild(floorUL);
242 var roomsForFloor = GetRoomsByFloorNum(floornum);
243 for(var b=0; b<roomsForFloor.length; b++) {
244 var room = roomsForFloor[b];
245 currentDropTargets.push(addRoomToList(floorUL, room, curRoomName));
247 if (currentExpanded != null && currentExpanded == name) {
248 expandFloor(floorSPAN);
253 function IconBarRoomList() {
254 roomlist = document.getElementById("roomlist");
255 GenericTreeRoomList(roomlist);
257 function KNRoomsRoomList() {
258 roomlist = document.getElementById("roomlist_knrooms");
259 GenericTreeRoomList(roomlist);
262 function addRoomToList(floorUL,room, roomToEmphasize) {
263 var roomName = room[RN_ROOM_NAME];
264 var flag = room[RN_ROOM_FLAG];
265 var curView = room[RN_CUR_VIEW];
266 var view = room[RN_DEF_VIEW];
267 var raflags = room[RN_RAFLAGS];
268 var isMailBox = ((flag & QR_MAILBOX) == QR_MAILBOX);
269 var hasNewMsgs = ((raflags & UA_HASNEWMSGS) == UA_HASNEWMSGS);
270 var roomLI = document.createElement("li");
271 var roomA = document.createElement("a");
272 roomA.setAttribute("href","dotgoto?room="+roomName);
273 roomA.appendChild(document.createTextNode(roomName));
274 roomLI.appendChild(roomA);
275 floorUL.appendChild(roomLI);
276 var className = "room ";
277 if (view == VIEW_MAILBOX) {
278 className += "room-private"
279 } else if (view == VIEW_ADDRESSBOOK) {
280 className += "room-addr";
281 } else if (view == VIEW_CALENDAR || view == VIEW_CALBRIEF) {
282 className += "room-cal";
283 } else if (view == VIEW_TASKS) {
284 className += "room-tasks";
285 } else if (view == VIEW_NOTES) {
286 className += "room-notes";
288 className += "room-chat";
291 className += " room-newmsgs";
293 if (roomName == roomToEmphasize) {
294 className += " room-emphasized";
296 roomLI.setAttribute("class", className);
297 roomA.dropTarget = true;
298 roomA.dropHandler = roomListDropHandler;
302 function roomListDropHandler(target, dropped) {
303 if (dropped.getAttribute("citadel:msgid")) {
304 var room = getTextContent(target);
306 for(msgId in currentlyMarkedRows) { //defined in summaryview.js
309 var mvCommand = encodeURI("g_cmd=MOVE " + msgIds + "|"+room+"|0");
310 new Ajax.Request('ajax_servcmd', {
312 parameters: mvCommand,
313 onComplete: deleteAllMarkedRows()});
316 function expandFloorEvent(event) {
317 expandFloor(event.target);
319 function expandFloor(target) {
320 if (target.nodeName.toLowerCase() != "span") {
321 return; // ignore clicks on child UL
323 ctdlLocalPrefs.setPref("rooms_expanded", target.firstChild.nodeValue);
324 var parentUL = target.parentNode;
325 if (currentlyExpandedFloor != null) {
326 currentlyExpandedFloor.className = currentlyExpandedFloor.className.replace("floor-expanded","");
328 parentUL.className = parentUL.className + " floor-expanded";
329 currentlyExpandedFloor = parentUL;
332 // These functions handle moving sticky notes around the screen by dragging them
334 var uid_of_note_being_dragged = 0;
335 var saved_cursor_style = 'default';
336 var note_was_dragged = 0;
338 function NotesDragMouseUp(evt) {
339 document.onmouseup = null;
340 document.onmousemove = null;
341 if (document.layers) {
342 document.releaseEvents(Event.MOUSEUP | Event.MOUSEMOVE);
345 d = $('note-' + uid_of_note_being_dragged);
346 d.style.cursor = saved_cursor_style;
348 // If any motion actually occurred, submit an ajax http call to record it to the server
349 if (note_was_dragged > 0) {
350 p = 'note_uid=' + uid_of_note_being_dragged
351 + '&left=' + d.style.left
352 + '&top=' + d.style.top
353 + '&r=' + CtdlRandomString();
363 uid_of_note_being_dragged = '';
367 function NotesDragMouseMove(evt) {
368 x = (ns6 ? evt.clientX : event.clientX);
369 x_increment = x - saved_x;
370 y = (ns6 ? evt.clientY : event.clientY);
371 y_increment = y - saved_y;
374 d = $('note-' + uid_of_note_being_dragged);
376 divTop = parseInt(d.style.top);
377 divLeft = parseInt(d.style.left);
379 d.style.top = (divTop + y_increment) + 'px';
380 d.style.left = (divLeft + x_increment) + 'px';
384 note_was_dragged = 1;
389 function NotesDragMouseDown(evt, uid) {
390 saved_x = (ns6 ? evt.clientX : event.clientX);
391 saved_y = (ns6 ? evt.clientY : event.clientY);
392 document.onmouseup = NotesDragMouseUp;
393 document.onmousemove = NotesDragMouseMove;
394 if (document.layers) {
395 document.captureEvents(Event.MOUSEUP | Event.MOUSEMOVE);
397 uid_of_note_being_dragged = uid;
398 d = $('note-' + uid_of_note_being_dragged);
399 saved_cursor_style = d.style.cursor;
400 d.style.cursor = 'move';
401 return false; // disable the default action
405 // Called when the user clicks on the palette icon of a sticky note to change its color.
406 // It toggles the color selector visible or invisible.
408 function NotesClickPalette(evt, uid) {
409 uid_of_note_being_colored = uid;
410 d = $('palette-' + uid_of_note_being_colored);
412 if (d.style.display) {
413 if (d.style.display == 'none') {
414 d.style.display = 'block';
417 d.style.display = 'none';
421 d.style.display = 'block';
428 // Called when the user clicks on one of the colors in an open color selector.
429 // Sets the desired color and then closes the color selector.
431 function NotesClickColor(evt, uid, red, green, blue, notecolor, titlecolor) {
432 uid_of_note_being_colored = uid;
433 palette_button = $('palette-' + uid_of_note_being_colored);
434 note_div = $('note-' + uid_of_note_being_colored);
435 titlebar_div = $('titlebar-' + uid_of_note_being_colored);
437 // alert('FIXME red=' + red + ' green=' + green + ' blue=' + blue);
439 note_div.style.backgroundColor = notecolor;
440 titlebar_div.style.backgroundColor = titlecolor;
441 palette_button.style.display = 'none';
443 // submit an ajax http call to record it to the server
444 p = 'note_uid=' + uid_of_note_being_colored
448 + '&r=' + CtdlRandomString();
461 // These functions handle resizing sticky notes by dragging the resize handle
463 var uid_of_note_being_resized = 0;
464 var saved_cursor_style = 'default';
465 var note_was_resized = 0;
467 function NotesResizeMouseUp(evt) {
468 document.onmouseup = null;
469 document.onmousemove = null;
470 if (document.layers) {
471 document.releaseEvents(Event.MOUSEUP | Event.MOUSEMOVE);
474 d = $('note-' + uid_of_note_being_resized);
475 d.style.cursor = saved_cursor_style;
477 // If any motion actually occurred, submit an ajax http call to record it to the server
478 if (note_was_resized > 0) {
479 p = 'note_uid=' + uid_of_note_being_resized
480 + '&width=' + d.style.width
481 + '&height=' + d.style.height
482 + '&r=' + CtdlRandomString();
492 uid_of_note_being_resized = '';
493 return false; // disable the default action
496 function NotesResizeMouseMove(evt) {
497 x = (ns6 ? evt.clientX : event.clientX);
498 x_increment = x - saved_x;
499 y = (ns6 ? evt.clientY : event.clientY);
500 y_increment = y - saved_y;
503 d = $('note-' + uid_of_note_being_resized);
505 divTop = parseInt(d.style.height);
506 divLeft = parseInt(d.style.width);
508 newHeight = divTop + y_increment;
509 if (newHeight < 50) newHeight = 50;
511 newWidth = divLeft + x_increment;
512 if (newWidth < 50) newWidth = 50;
514 d.style.height = newHeight + 'px';
515 d.style.width = newWidth + 'px';
519 note_was_resized = 1;
520 return false; // disable the default action
524 function NotesResizeMouseDown(evt, uid) {
525 saved_x = (ns6 ? evt.clientX : event.clientX);
526 saved_y = (ns6 ? evt.clientY : event.clientY);
527 document.onmouseup = NotesResizeMouseUp;
528 document.onmousemove = NotesResizeMouseMove;
529 if (document.layers) {
530 document.captureEvents(Event.MOUSEUP | Event.MOUSEMOVE);
532 uid_of_note_being_resized = uid;
533 d = $('note-' + uid_of_note_being_resized);
534 saved_cursor_style = d.style.cursor;
535 d.style.cursor = 'move';
536 return false; // disable the default action
540 function DeleteStickyNote(evt, uid, confirmation_prompt) {
541 uid_of_note_being_deleted = uid;
542 d = $('note-' + uid_of_note_being_deleted);
544 if (confirm(confirmation_prompt)) {
547 // submit an ajax http call to delete it on the server
548 p = 'note_uid=' + uid_of_note_being_deleted
550 + '&r=' + CtdlRandomString();
561 function ctdl_ts_getInnerText(el) {
562 if (typeof el == "string") return el;
563 if (typeof el == "undefined") { return el };
564 if (el.innerText) return el.innerText; //Not needed but it is faster
567 var cs = el.childNodes;
569 for (var i = 0; i < l; i++) {
570 switch (cs[i].nodeType) {
571 case 1: //ELEMENT_NODE
572 str += ts_getInnerText(cs[i]);
575 str += cs[i].nodeValue;
583 // Place a gradient loadscreen on an element, e.g to use before Ajax.updater
584 function CtdlLoadScreen(elementid) {
585 var elem = document.getElementById(elementid);
586 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>";
591 // Pop open the address book (target_input is the INPUT field to populate)
593 function PopOpenAddressBook(target_input) {
594 $('address_book_popup').style.display = 'block';
595 p = 'target_input=' + target_input + '&r=' + CtdlRandomString();
597 'address_book_popup_middle_div',
598 'display_address_book_middle_div',
607 function PopulateAddressBookInnerDiv(which_addr_book, target_input) {
608 $('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>";
609 p = 'which_addr_book=' + which_addr_book
610 + '&target_input=' + target_input
611 + '&r=' + CtdlRandomString();
613 'address_book_inner_div',
614 'display_address_book_inner_div',
622 // What happens when a contact is selected from the address book popup
623 // (populate the specified target)
625 function AddContactsToTarget(target, whichaddr) {
626 while (whichaddr.selectedIndex != -1) {
627 if (target.value.length > 0) {
628 target.value = target.value + ', ';
630 target.value = target.value + whichaddr.value;
631 whichaddr.options[whichaddr.selectedIndex].selected = false;
635 // Respond to a meeting invitation
636 function RespondToInvitation(question_divname, title_divname, msgnum, cal_partnum, sc) {
637 p = 'msgnum=' + msgnum + '&cal_partnum=' + cal_partnum + '&sc=' + sc ;
638 new Ajax.Updater(title_divname, 'respond_to_request', { method: 'post', parameters: p } );
639 Effect.Fade(question_divname, { duration: 0.5 });
642 // Handle a received RSVP
643 function HandleRSVP(question_divname, title_divname, msgnum, cal_partnum, sc) {
644 p = 'msgnum=' + msgnum + '&cal_partnum=' + cal_partnum + '&sc=' + sc ;
645 new Ajax.Updater(title_divname, 'handle_rsvp', { method: 'post', parameters: p } );
646 Effect.Fade(question_divname, { duration: 0.5 });
648 /* var fakeMouse = document.createEvent("MouseEvents");
649 fakeMouse.initMouseEvent("click", true, true, window,
650 0,0,0,0,0, false, false, false, false, 0, null); */
651 // TODO: Collapse into one function
652 function toggleTaskDtStart(event) {
653 var checkBox = $('nodtstart');
654 var checkBoxTime = $('dtstart_time_assoc');
655 var dtstart = document.getElementById("dtstart");
656 var dtstart_date = document.getElementById("dtstart_date");
657 var dtstart_time = document.getElementById("dtstart_time");
658 if (checkBox.checked) {
659 dtstart_date.style.visibility = "hidden";
660 dtstart_time.style.visibility = "hidden";
662 if (checkBoxTime.checked) {
663 dtstart_time.style.visibility = "visible";
665 dtstart_time.style.visibility = "hidden";
667 dtstart_date.style.visibility = "visible";
668 if (dtstart.value.length == 0)
669 dtstart.dpck._initCurrentDate();
672 function toggleTaskDue(event) {
673 var checkBox = $('nodue');
674 var checkBoxTime = $('due_time_assoc');
675 var due = document.getElementById("due");
676 var due_date = document.getElementById("due_date");
677 var due_time = document.getElementById("due_time");
678 if (checkBox.checked) {
679 due_date.style.visibility = "hidden";
680 due_time.style.visibility = "hidden";
682 if (checkBoxTime.checked) {
683 due_time.style.visibility = "visible";
685 due_time.style.visibility = "hidden";
687 due_date.style.visibility = "visible";
688 if (due.value.length == 0)
689 due.dpck._initCurrentDate();
692 function ToggleTaskDateOrNoDateActivate(event) {
693 var dtstart = document.getElementById("nodtstart");
694 if (dtstart != null) {
695 toggleTaskDtStart(null);
697 $('nodtstart').observe('click', toggleTaskDtStart);
698 $('dtstart_time_assoc').observe('click', toggleTaskDtStart);
699 $('nodue').observe('click', toggleTaskDue);
700 $('due_time_assoc').observe('click', toggleTaskDue);
703 function TaskViewGatherCategoriesFromTable() {
704 var table = $('taskview');
707 function attachDatePicker(relative) {
708 var dpck = new DatePicker({
710 language: 'en', //wclang.substr(0,2),
711 disableFutureDate: false,
712 dateFormat: [ ["yyyy", "mm", "dd"], "-"],
715 document.getElementById(relative).dpck = dpck; // attach a ref to it
717 function eventEditAllDay() {
718 var allDayCheck = document.getElementById("alldayevent");
719 var dtend_time = document.getElementById("dtend_time");
720 var dtstart_time = document.getElementById("dtstart_time");
721 if(allDayCheck.checked) {
722 dtstart_time.style.visibility = "hidden";
723 dtend_time.style.visibility = "hidden";
725 dtstart_time.style.visibility = "visible";
726 dtend_time.style.visibility = "visible";
730 // Functions which handle show/hide of various elements in the recurrence editor
732 function RecurrenceShowHide() {
734 if ($('is_recur').checked) {
735 $('rrule_div').style.display = 'block';
738 $('rrule_div').style.display = 'none';
741 if ($('freq_selector').selectedIndex == 4) {
742 $('weekday_selector').style.display = 'block';
745 $('weekday_selector').style.display = 'none';
748 if ($('freq_selector').selectedIndex == 5) {
749 $('monthday_selector').style.display = 'block';
752 $('monthday_selector').style.display = 'none';
755 if ($('rrend_count').checked) {
756 $('rrcount').disabled = false;
759 $('rrcount').disabled = true;
762 if ($('rrend_until').checked) {
763 $('rruntil').disabled = false;
766 $('rruntil').disabled = true;
769 if ($('rrmonthtype_mday').checked) {
770 $('rrmday').disabled = false;
773 $('rrmday').disabled = true;
776 if ($('rrmonthtype_wday').checked) {
777 $('rrmweek').disabled = false;
778 $('rrmweekday').disabled = false;
781 $('rrmweek').disabled = true;
782 $('rrmweekday').disabled = true;
785 if ($('freq_selector').selectedIndex == 6) {
786 $('yearday_selector').style.display = 'block';
789 $('yearday_selector').style.display = 'none';
792 $('ymday').innerHTML = 'XXXX-' + $('dtstart').value.substr(5);
793 $('rrmday').innerHTML = $('dtstart').value.substr(8);
795 if ($('rryeartype_ywday').checked) {
796 $('rrymweek').disabled = false;
797 $('rrymweekday').disabled = false;
798 $('rrymonth').disabled = false;
801 $('rrymweek').disabled = true;
802 $('rrymweekday').disabled = true;
803 $('rrymonth').disabled = true;
809 // Enable or disable the 'check attendee availability' button depending on whether
810 // the attendees list is empty
811 function EnableOrDisableCheckButton()
813 if ($('attendees_box').value.length == 0) {
814 $('check_button').disabled = true;
817 $('check_button').disabled = false;
824 function launchChat(event) {
825 window.open('chat', 'ctdl_chat_window', 'toolbar=no,location=no,directories=no,copyhistory=no,status=no,scrollbars=yes,resizable=yes');
828 function WCLog(msg) {
829 if (!!window.console && !!console.log) {
831 } else if (!!window.opera && !!opera.postError) {
832 opera.postError(msg);
834 wc_log += msg + "\r\n";
838 function RefreshSMTPqueueDisplay() {
839 new Ajax.Updater('smtpqueue_inner_div',
840 'display_smtpqueue_inner_div', { method: 'get',
841 parameters: Math.random() } );
844 function DeleteSMTPqueueMsg(msgnum1, msgnum2) {
845 var p = encodeURI('g_cmd=DELE ' + msgnum1 + ',' + msgnum2);
850 onComplete: RefreshSMTPqueueDisplay()
856 function ConfirmLogoff() {
859 'do_template?template=confirmlogoff',
862 onSuccess: function(cl_success) {
870 function switch_to_lang(new_lang) {
871 p = 'push?url=' + encodeURI(window.location);
872 new Ajax.Request(p, { method: 'get' } );
873 window.location = 'switch_language?lang=' + new_lang ;
877 function toggle_roomlist()
879 /* WARNING: VILE, SLEAZY HACK. We determine the state of the box based on the image loaded. */
880 if ( $('expand_roomlist').src.substring($('expand_roomlist').src.length - 12) == "collapse.gif" ) {
881 $('roomlist').style.display = 'none';
882 $('expand_roomlist').src = 'static/expand.gif';
887 $('roomlist').style.display = 'block';
888 $('expand_roomlist').src = 'static/collapse.gif';
889 FillRooms(IconBarRoomList);
893 // tell the server what I did
894 p = 'toggle_roomlist_expanded_state?wstate=' + wstate + '?rand=' + Math.random() ;
895 new Ajax.Request(p, { method: 'get' } );
897 return false; /* this prevents the click from registering as a roomlist button press */
901 function toggle_wholist()
903 /* WARNING: VILE, SLEAZY HACK. We determine the state of the box based on the image loaded. */
904 if ( $('expand_wholist').src.substring($('expand_wholist').src.length - 12) == "collapse.gif" ) {
905 $('online_users').style.display = 'none';
906 $('expand_wholist').src = 'static/expand.gif';
911 $('online_users').style.display = 'block';
912 $('expand_wholist').src = 'static/collapse.gif';
913 activate_iconbar_wholist_populat0r();
917 // tell the server what I did
918 p = 'toggle_wholist_expanded_state?wstate=' + wstate + '?rand=' + Math.random() ;
919 new Ajax.Request(p, { method: 'get' } );
921 return false; /* this prevents the click from registering as a wholist button press */