X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Fstatic%2Fwclib.js;h=e8c0c4ee72c2aa1cd2df3f9e8132c02c284d9552;hp=6fddde5c814f11e7b156b6c941c0f0875e4a40f9;hb=fc08ae6465b6da1d9008ce4b20b3cc2c2a5781af;hpb=c8e4059cae8c4464db08a0fb8cbbb41e6e6cb5f7 diff --git a/webcit/static/wclib.js b/webcit/static/wclib.js index 6fddde5c8..e8c0c4ee7 100644 --- a/webcit/static/wclib.js +++ b/webcit/static/wclib.js @@ -1,8 +1,21 @@ /* - * Copyright 2005 - 2010 The Citadel Team - * Licensed under the GPL V3 - * * JavaScript function library for WebCit. + * + * Copyright (c) 2005-2011 by the citadel.org team + * + * This program is open source software. You can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -11,10 +24,6 @@ var room_is_trash = 0; var currentlyExpandedFloor = null; var roomlist = null; - -var _switchToRoomList = "switch to room list"; -var _switchToMenu = "switch to menu"; - var currentDropTarget = null; var supportsAddEventListener = (!!document.addEventListener); @@ -47,6 +56,19 @@ function strcmp ( str1, str2 ) { return ( ( str1 == str2 ) ? 0 : ( ( str1 > str2 ) ? 1 : -1 ) ); } + + +function ToggleVisibility ($Which) +{ + if (document.getElementById) + { + if (document.getElementById($Which).style.display == "none") + document.getElementById($Which).style.display = "inline"; + else + document.getElementById($Which).style.display = "none"; + } +} + function emptyElement(element) { childNodes = element.childNodes; for(var i=0; i 800) { + var mvCommand = encodeURI("g_cmd=MOVE " + msgIds + "|"+room+"|0"); + new Ajax.Request("ajax_servcmd", { + parameters: mvCommand, + method: 'post', + }); + msgIds = ""; + } + + } + var mvCommand = encodeURI("g_cmd=MOVE " + msgIds + "|"+room+"|0"); + new Ajax.Request('ajax_servcmd', { + method: 'post', parameters: mvCommand, onComplete: deleteAllMarkedRows()}); - } + } } function expandFloorEvent(event) { expandFloor(event.target); @@ -867,18 +867,70 @@ function ConfirmLogoff() { new Ajax.Updater( 'md-content', 'do_template?template=confirmlogoff', - { - method: 'get', + { + method: 'get', + evalScripts: true, onSuccess: function(cl_success) { toggleModal(1); } - } - ); + } + ); } function switch_to_lang(new_lang) { - p = 'push?url=' + encodeURI(window.location); - new Ajax.Request(p, { method: 'get' } ); + p = 'push?url=' + encodeURI(window.location); + new Ajax.Request(p, { method: 'get' } ); window.location = 'switch_language?lang=' + new_lang ; } + + +function toggle_roomlist() +{ + /* WARNING: VILE, SLEAZY HACK. We determine the state of the box based on the image loaded. */ + if ( $('expand_roomlist').src.substring($('expand_roomlist').src.length - 12) == "collapse.gif" ) { + $('roomlist').style.display = 'none'; + $('expand_roomlist').src = 'static/webcit_icons/expand.gif'; + wstate=0; + } + + else { + $('roomlist').style.display = 'block'; + $('expand_roomlist').src = 'static/webcit_icons/collapse.gif'; + $('roomlist').innerHTML = ''; + FillRooms(IconBarRoomList); + wstate=1; + } + + // tell the server what I did + p = 'toggle_roomlist_expanded_state?wstate=' + wstate + '?rand=' + Math.random() ; + new Ajax.Request(p, { method: 'get' } ); + + return false; /* this prevents the click from registering as a roomlist button press */ +} + + +function toggle_wholist() +{ + /* WARNING: VILE, SLEAZY HACK. We determine the state of the box based on the image loaded. */ + if ( $('expand_wholist').src.substring($('expand_wholist').src.length - 12) == "collapse.gif" ) { + $('online_users').style.display = 'none'; + $('expand_wholist').src = 'static/webcit_icons/expand.gif'; + wstate=0; + } + + else { + $('online_users').style.display = 'block'; + $('expand_wholist').src = 'static/webcit_icons/collapse.gif'; + activate_iconbar_wholist_populat0r(); + wstate=1; + } + + // tell the server what I did + p = 'toggle_wholist_expanded_state?wstate=' + wstate + '?rand=' + Math.random() ; + new Ajax.Request(p, { method: 'get' } ); + + return false; /* this prevents the click from registering as a wholist button press */ +} + +