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 $('roomlist').innerHTML = '';
180 FillRooms(IconBarRoomList);
183 $('roomlist').style.display = 'none';
186 /* WARNING: VILE, SLEAZY HACK. We determine the state of the box based on the image loaded. */
187 if ( $('expand_wholist').src.substring($('expand_wholist').src.length - 12) == "collapse.gif" ) {
188 $('online_users').style.display = 'block';
189 activate_iconbar_wholist_populat0r();
192 $('online_users').style.display = 'none';
197 function GenericTreeRoomList(roomlist) {
198 var currentExpanded = ctdlLocalPrefs.readPref("rooms_expanded");
199 var curRoomName = "";
200 if (document.getElementById("rmname")) {
201 curRoomName = getTextContent(document.getElementById("rmname"));
203 currentDropTargets = new Array();
204 var iconbar = document.getElementById("iconbar");
205 var ul = document.createElement("ul");
206 roomlist.appendChild(ul);
207 // Add mailbox, because they are special
208 var mailboxLI = document.createElement("li");
209 ul.appendChild(mailboxLI);
210 var mailboxSPAN = document.createElement("span");
211 var _mailbox = getTextContent(document.getElementById("mbox_template"));
212 mailboxSPAN.appendChild(document.createTextNode(_mailbox));
213 $(mailboxSPAN).observe('click', expandFloorEvent);
214 mailboxLI.appendChild(mailboxSPAN);
215 mailboxLI.className = "floor";
216 var mailboxUL = document.createElement("ul");
217 mailboxLI.appendChild(mailboxUL);
218 var mailboxRooms = GetMailboxRooms();
219 for(var i=0; i<mailboxRooms.length; i++) {
220 var room = mailboxRooms[i];
221 currentDropTargets.push(addRoomToList(mailboxUL, room, curRoomName));
223 if (currentExpanded != null && currentExpanded == _mailbox ) {
224 expandFloor(mailboxSPAN);
226 for(var a=0; a<floors.length; a++) {
227 var floor = floors[a];
228 var floornum = floor[0];
234 var floorLI = document.createElement("li");
235 ul.appendChild(floorLI);
236 var floorSPAN = document.createElement("span");
237 floorSPAN.appendChild(document.createTextNode(name));
238 $(floorSPAN).observe('click', expandFloorEvent);
239 floorLI.appendChild(floorSPAN);
240 floorLI.className = "floor";
241 var floorUL = document.createElement("ul");
242 floorLI.appendChild(floorUL);
243 var roomsForFloor = GetRoomsByFloorNum(floornum);
244 for(var b=0; b<roomsForFloor.length; b++) {
245 var room = roomsForFloor[b];
246 currentDropTargets.push(addRoomToList(floorUL, room, curRoomName));
248 if (currentExpanded != null && currentExpanded == name) {
249 expandFloor(floorSPAN);
254 function IconBarRoomList() {
255 roomlist = document.getElementById("roomlist");
256 GenericTreeRoomList(roomlist);
258 function KNRoomsRoomList() {
259 roomlist = document.getElementById("roomlist_knrooms");
260 GenericTreeRoomList(roomlist);
263 function addRoomToList(floorUL,room, roomToEmphasize) {
264 var roomName = room[RN_ROOM_NAME];
265 var flag = room[RN_ROOM_FLAG];
266 var curView = room[RN_CUR_VIEW];
267 var view = room[RN_DEF_VIEW];
268 var raflags = room[RN_RAFLAGS];
269 var isMailBox = ((flag & QR_MAILBOX) == QR_MAILBOX);
270 var hasNewMsgs = ((raflags & UA_HASNEWMSGS) == UA_HASNEWMSGS);
271 var roomLI = document.createElement("li");
272 var roomA = document.createElement("a");
273 roomA.setAttribute("href","dotgoto?room="+roomName);
274 roomA.appendChild(document.createTextNode(roomName));
275 roomLI.appendChild(roomA);
276 floorUL.appendChild(roomLI);
277 var className = "room ";
278 if (view == VIEW_MAILBOX) {
279 className += "room-private"
280 } else if (view == VIEW_ADDRESSBOOK) {
281 className += "room-addr";
282 } else if (view == VIEW_CALENDAR || view == VIEW_CALBRIEF) {
283 className += "room-cal";
284 } else if (view == VIEW_TASKS) {
285 className += "room-tasks";
286 } else if (view == VIEW_NOTES) {
287 className += "room-notes";
289 className += "room-chat";
292 className += " room-newmsgs";
294 if (roomName == roomToEmphasize) {
295 className += " room-emphasized";
297 roomLI.setAttribute("class", className);
298 roomA.dropTarget = true;
299 roomA.dropHandler = roomListDropHandler;
303 function roomListDropHandler(target, dropped) {
304 if (dropped.getAttribute("citadel:msgid")) {
305 var room = getTextContent(target);
307 for(msgId in currentlyMarkedRows) { //defined in summaryview.js
310 var mvCommand = encodeURI("g_cmd=MOVE " + msgIds + "|"+room+"|0");
311 new Ajax.Request('ajax_servcmd', {
313 parameters: mvCommand,
314 onComplete: deleteAllMarkedRows()});
317 function expandFloorEvent(event) {
318 expandFloor(event.target);
320 function expandFloor(target) {
321 if (target.nodeName.toLowerCase() != "span") {
322 return; // ignore clicks on child UL
324 ctdlLocalPrefs.setPref("rooms_expanded", target.firstChild.nodeValue);
325 var parentUL = target.parentNode;
326 if (currentlyExpandedFloor != null) {
327 currentlyExpandedFloor.className = currentlyExpandedFloor.className.replace("floor-expanded","");
329 parentUL.className = parentUL.className + " floor-expanded";
330 currentlyExpandedFloor = parentUL;
333 // These functions handle moving sticky notes around the screen by dragging them
335 var uid_of_note_being_dragged = 0;
336 var saved_cursor_style = 'default';
337 var note_was_dragged = 0;
339 function NotesDragMouseUp(evt) {
340 document.onmouseup = null;
341 document.onmousemove = null;
342 if (document.layers) {
343 document.releaseEvents(Event.MOUSEUP | Event.MOUSEMOVE);
346 d = $('note-' + uid_of_note_being_dragged);
347 d.style.cursor = saved_cursor_style;
349 // If any motion actually occurred, submit an ajax http call to record it to the server
350 if (note_was_dragged > 0) {
351 p = 'note_uid=' + uid_of_note_being_dragged
352 + '&left=' + d.style.left
353 + '&top=' + d.style.top
354 + '&r=' + CtdlRandomString();
364 uid_of_note_being_dragged = '';
368 function NotesDragMouseMove(evt) {
369 x = (ns6 ? evt.clientX : event.clientX);
370 x_increment = x - saved_x;
371 y = (ns6 ? evt.clientY : event.clientY);
372 y_increment = y - saved_y;
375 d = $('note-' + uid_of_note_being_dragged);
377 divTop = parseInt(d.style.top);
378 divLeft = parseInt(d.style.left);
380 d.style.top = (divTop + y_increment) + 'px';
381 d.style.left = (divLeft + x_increment) + 'px';
385 note_was_dragged = 1;
390 function NotesDragMouseDown(evt, uid) {
391 saved_x = (ns6 ? evt.clientX : event.clientX);
392 saved_y = (ns6 ? evt.clientY : event.clientY);
393 document.onmouseup = NotesDragMouseUp;
394 document.onmousemove = NotesDragMouseMove;
395 if (document.layers) {
396 document.captureEvents(Event.MOUSEUP | Event.MOUSEMOVE);
398 uid_of_note_being_dragged = uid;
399 d = $('note-' + uid_of_note_being_dragged);
400 saved_cursor_style = d.style.cursor;
401 d.style.cursor = 'move';
402 return false; // disable the default action
406 // Called when the user clicks on the palette icon of a sticky note to change its color.
407 // It toggles the color selector visible or invisible.
409 function NotesClickPalette(evt, uid) {
410 uid_of_note_being_colored = uid;
411 d = $('palette-' + uid_of_note_being_colored);
413 if (d.style.display) {
414 if (d.style.display == 'none') {
415 d.style.display = 'block';
418 d.style.display = 'none';
422 d.style.display = 'block';
429 // Called when the user clicks on one of the colors in an open color selector.
430 // Sets the desired color and then closes the color selector.
432 function NotesClickColor(evt, uid, red, green, blue, notecolor, titlecolor) {
433 uid_of_note_being_colored = uid;
434 palette_button = $('palette-' + uid_of_note_being_colored);
435 note_div = $('note-' + uid_of_note_being_colored);
436 titlebar_div = $('titlebar-' + uid_of_note_being_colored);
438 // alert('FIXME red=' + red + ' green=' + green + ' blue=' + blue);
440 note_div.style.backgroundColor = notecolor;
441 titlebar_div.style.backgroundColor = titlecolor;
442 palette_button.style.display = 'none';
444 // submit an ajax http call to record it to the server
445 p = 'note_uid=' + uid_of_note_being_colored
449 + '&r=' + CtdlRandomString();
462 // These functions handle resizing sticky notes by dragging the resize handle
464 var uid_of_note_being_resized = 0;
465 var saved_cursor_style = 'default';
466 var note_was_resized = 0;
468 function NotesResizeMouseUp(evt) {
469 document.onmouseup = null;
470 document.onmousemove = null;
471 if (document.layers) {
472 document.releaseEvents(Event.MOUSEUP | Event.MOUSEMOVE);
475 d = $('note-' + uid_of_note_being_resized);
476 d.style.cursor = saved_cursor_style;
478 // If any motion actually occurred, submit an ajax http call to record it to the server
479 if (note_was_resized > 0) {
480 p = 'note_uid=' + uid_of_note_being_resized
481 + '&width=' + d.style.width
482 + '&height=' + d.style.height
483 + '&r=' + CtdlRandomString();
493 uid_of_note_being_resized = '';
494 return false; // disable the default action
497 function NotesResizeMouseMove(evt) {
498 x = (ns6 ? evt.clientX : event.clientX);
499 x_increment = x - saved_x;
500 y = (ns6 ? evt.clientY : event.clientY);
501 y_increment = y - saved_y;
504 d = $('note-' + uid_of_note_being_resized);
506 divTop = parseInt(d.style.height);
507 divLeft = parseInt(d.style.width);
509 newHeight = divTop + y_increment;
510 if (newHeight < 50) newHeight = 50;
512 newWidth = divLeft + x_increment;
513 if (newWidth < 50) newWidth = 50;
515 d.style.height = newHeight + 'px';
516 d.style.width = newWidth + 'px';
520 note_was_resized = 1;
521 return false; // disable the default action
525 function NotesResizeMouseDown(evt, uid) {
526 saved_x = (ns6 ? evt.clientX : event.clientX);
527 saved_y = (ns6 ? evt.clientY : event.clientY);
528 document.onmouseup = NotesResizeMouseUp;
529 document.onmousemove = NotesResizeMouseMove;
530 if (document.layers) {
531 document.captureEvents(Event.MOUSEUP | Event.MOUSEMOVE);
533 uid_of_note_being_resized = uid;
534 d = $('note-' + uid_of_note_being_resized);
535 saved_cursor_style = d.style.cursor;
536 d.style.cursor = 'move';
537 return false; // disable the default action
541 function DeleteStickyNote(evt, uid, confirmation_prompt) {
542 uid_of_note_being_deleted = uid;
543 d = $('note-' + uid_of_note_being_deleted);
545 if (confirm(confirmation_prompt)) {
548 // submit an ajax http call to delete it on the server
549 p = 'note_uid=' + uid_of_note_being_deleted
551 + '&r=' + CtdlRandomString();
562 function ctdl_ts_getInnerText(el) {
563 if (typeof el == "string") return el;
564 if (typeof el == "undefined") { return el };
565 if (el.innerText) return el.innerText; //Not needed but it is faster
568 var cs = el.childNodes;
570 for (var i = 0; i < l; i++) {
571 switch (cs[i].nodeType) {
572 case 1: //ELEMENT_NODE
573 str += ts_getInnerText(cs[i]);
576 str += cs[i].nodeValue;
584 // Place a gradient loadscreen on an element, e.g to use before Ajax.updater
585 function CtdlLoadScreen(elementid) {
586 var elem = document.getElementById(elementid);
587 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>";
592 // Pop open the address book (target_input is the INPUT field to populate)
594 function PopOpenAddressBook(target_input) {
595 $('address_book_popup').style.display = 'block';
596 p = 'target_input=' + target_input + '&r=' + CtdlRandomString();
598 'address_book_popup_middle_div',
599 'display_address_book_middle_div',
608 function PopulateAddressBookInnerDiv(which_addr_book, target_input) {
609 $('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>";
610 p = 'which_addr_book=' + which_addr_book
611 + '&target_input=' + target_input
612 + '&r=' + CtdlRandomString();
614 'address_book_inner_div',
615 'display_address_book_inner_div',
623 // What happens when a contact is selected from the address book popup
624 // (populate the specified target)
626 function AddContactsToTarget(target, whichaddr) {
627 while (whichaddr.selectedIndex != -1) {
628 if (target.value.length > 0) {
629 target.value = target.value + ', ';
631 target.value = target.value + whichaddr.value;
632 whichaddr.options[whichaddr.selectedIndex].selected = false;
636 // Respond to a meeting invitation
637 function RespondToInvitation(question_divname, title_divname, msgnum, cal_partnum, sc) {
638 p = 'msgnum=' + msgnum + '&cal_partnum=' + cal_partnum + '&sc=' + sc ;
639 new Ajax.Updater(title_divname, 'respond_to_request', { method: 'post', parameters: p } );
640 Effect.Fade(question_divname, { duration: 0.5 });
643 // Handle a received RSVP
644 function HandleRSVP(question_divname, title_divname, msgnum, cal_partnum, sc) {
645 p = 'msgnum=' + msgnum + '&cal_partnum=' + cal_partnum + '&sc=' + sc ;
646 new Ajax.Updater(title_divname, 'handle_rsvp', { method: 'post', parameters: p } );
647 Effect.Fade(question_divname, { duration: 0.5 });
649 /* var fakeMouse = document.createEvent("MouseEvents");
650 fakeMouse.initMouseEvent("click", true, true, window,
651 0,0,0,0,0, false, false, false, false, 0, null); */
652 // TODO: Collapse into one function
653 function toggleTaskDtStart(event) {
654 var checkBox = $('nodtstart');
655 var checkBoxTime = $('dtstart_time_assoc');
656 var dtstart = document.getElementById("dtstart");
657 var dtstart_date = document.getElementById("dtstart_date");
658 var dtstart_time = document.getElementById("dtstart_time");
659 if (checkBox.checked) {
660 dtstart_date.style.visibility = "hidden";
661 dtstart_time.style.visibility = "hidden";
663 if (checkBoxTime.checked) {
664 dtstart_time.style.visibility = "visible";
666 dtstart_time.style.visibility = "hidden";
668 dtstart_date.style.visibility = "visible";
669 if (dtstart.value.length == 0)
670 dtstart.dpck._initCurrentDate();
673 function toggleTaskDue(event) {
674 var checkBox = $('nodue');
675 var checkBoxTime = $('due_time_assoc');
676 var due = document.getElementById("due");
677 var due_date = document.getElementById("due_date");
678 var due_time = document.getElementById("due_time");
679 if (checkBox.checked) {
680 due_date.style.visibility = "hidden";
681 due_time.style.visibility = "hidden";
683 if (checkBoxTime.checked) {
684 due_time.style.visibility = "visible";
686 due_time.style.visibility = "hidden";
688 due_date.style.visibility = "visible";
689 if (due.value.length == 0)
690 due.dpck._initCurrentDate();
693 function ToggleTaskDateOrNoDateActivate(event) {
694 var dtstart = document.getElementById("nodtstart");
695 if (dtstart != null) {
696 toggleTaskDtStart(null);
698 $('nodtstart').observe('click', toggleTaskDtStart);
699 $('dtstart_time_assoc').observe('click', toggleTaskDtStart);
700 $('nodue').observe('click', toggleTaskDue);
701 $('due_time_assoc').observe('click', toggleTaskDue);
704 function TaskViewGatherCategoriesFromTable() {
705 var table = $('taskview');
708 function attachDatePicker(relative) {
709 var dpck = new DatePicker({
711 language: 'en', //wclang.substr(0,2),
712 disableFutureDate: false,
713 dateFormat: [ ["yyyy", "mm", "dd"], "-"],
716 document.getElementById(relative).dpck = dpck; // attach a ref to it
718 function eventEditAllDay() {
719 var allDayCheck = document.getElementById("alldayevent");
720 var dtend_time = document.getElementById("dtend_time");
721 var dtstart_time = document.getElementById("dtstart_time");
722 if(allDayCheck.checked) {
723 dtstart_time.style.visibility = "hidden";
724 dtend_time.style.visibility = "hidden";
726 dtstart_time.style.visibility = "visible";
727 dtend_time.style.visibility = "visible";
731 // Functions which handle show/hide of various elements in the recurrence editor
733 function RecurrenceShowHide() {
735 if ($('is_recur').checked) {
736 $('rrule_div').style.display = 'block';
739 $('rrule_div').style.display = 'none';
742 if ($('freq_selector').selectedIndex == 4) {
743 $('weekday_selector').style.display = 'block';
746 $('weekday_selector').style.display = 'none';
749 if ($('freq_selector').selectedIndex == 5) {
750 $('monthday_selector').style.display = 'block';
753 $('monthday_selector').style.display = 'none';
756 if ($('rrend_count').checked) {
757 $('rrcount').disabled = false;
760 $('rrcount').disabled = true;
763 if ($('rrend_until').checked) {
764 $('rruntil').disabled = false;
767 $('rruntil').disabled = true;
770 if ($('rrmonthtype_mday').checked) {
771 $('rrmday').disabled = false;
774 $('rrmday').disabled = true;
777 if ($('rrmonthtype_wday').checked) {
778 $('rrmweek').disabled = false;
779 $('rrmweekday').disabled = false;
782 $('rrmweek').disabled = true;
783 $('rrmweekday').disabled = true;
786 if ($('freq_selector').selectedIndex == 6) {
787 $('yearday_selector').style.display = 'block';
790 $('yearday_selector').style.display = 'none';
793 $('ymday').innerHTML = 'XXXX-' + $('dtstart').value.substr(5);
794 $('rrmday').innerHTML = $('dtstart').value.substr(8);
796 if ($('rryeartype_ywday').checked) {
797 $('rrymweek').disabled = false;
798 $('rrymweekday').disabled = false;
799 $('rrymonth').disabled = false;
802 $('rrymweek').disabled = true;
803 $('rrymweekday').disabled = true;
804 $('rrymonth').disabled = true;
810 // Enable or disable the 'check attendee availability' button depending on whether
811 // the attendees list is empty
812 function EnableOrDisableCheckButton()
814 if ($('attendees_box').value.length == 0) {
815 $('check_button').disabled = true;
818 $('check_button').disabled = false;
825 function launchChat(event) {
826 window.open('chat', 'ctdl_chat_window', 'toolbar=no,location=no,directories=no,copyhistory=no,status=no,scrollbars=yes,resizable=yes');
829 function WCLog(msg) {
830 if (!!window.console && !!console.log) {
832 } else if (!!window.opera && !!opera.postError) {
833 opera.postError(msg);
835 wc_log += msg + "\r\n";
839 function RefreshSMTPqueueDisplay() {
840 new Ajax.Updater('smtpqueue_inner_div',
841 'display_smtpqueue_inner_div', { method: 'get',
842 parameters: Math.random() } );
845 function DeleteSMTPqueueMsg(msgnum1, msgnum2) {
846 var p = encodeURI('g_cmd=DELE ' + msgnum1 + ',' + msgnum2);
851 onComplete: RefreshSMTPqueueDisplay()
857 function ConfirmLogoff() {
860 'do_template?template=confirmlogoff',
864 onSuccess: function(cl_success) {
872 function switch_to_lang(new_lang) {
873 p = 'push?url=' + encodeURI(window.location);
874 new Ajax.Request(p, { method: 'get' } );
875 window.location = 'switch_language?lang=' + new_lang ;
879 function toggle_roomlist()
881 /* WARNING: VILE, SLEAZY HACK. We determine the state of the box based on the image loaded. */
882 if ( $('expand_roomlist').src.substring($('expand_roomlist').src.length - 12) == "collapse.gif" ) {
883 $('roomlist').style.display = 'none';
884 $('expand_roomlist').src = 'static/webcit_icons/expand.gif';
889 $('roomlist').style.display = 'block';
890 $('expand_roomlist').src = 'static/webcit_icons/collapse.gif';
891 $('roomlist').innerHTML = '';
892 FillRooms(IconBarRoomList);
896 // tell the server what I did
897 p = 'toggle_roomlist_expanded_state?wstate=' + wstate + '?rand=' + Math.random() ;
898 new Ajax.Request(p, { method: 'get' } );
900 return false; /* this prevents the click from registering as a roomlist button press */
904 function toggle_wholist()
906 /* WARNING: VILE, SLEAZY HACK. We determine the state of the box based on the image loaded. */
907 if ( $('expand_wholist').src.substring($('expand_wholist').src.length - 12) == "collapse.gif" ) {
908 $('online_users').style.display = 'none';
909 $('expand_wholist').src = 'static/webcit_icons/expand.gif';
914 $('online_users').style.display = 'block';
915 $('expand_wholist').src = 'static/webcit_icons/collapse.gif';
916 activate_iconbar_wholist_populat0r();
920 // tell the server what I did
921 p = 'toggle_wholist_expanded_state?wstate=' + wstate + '?rand=' + Math.random() ;
922 new Ajax.Request(p, { method: 'get' } );
924 return false; /* this prevents the click from registering as a wholist button press */