From: Wilfried Goesgens Date: Tue, 6 Sep 2011 23:00:12 +0000 (+0000) Subject: Limit length of Commands sent to citserver; do multible json requests if neccessary X-Git-Tag: v8.11~480 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=b84408f4c69030535a3db080783ad5b612731fa7;hp=607880cfaee7b35a635328e443417c0d01b74922 Limit length of Commands sent to citserver; do multible json requests if neccessary - roomListDropHandler() when cut'n'paste moving split after the move vector reaches 800 chars - deleteAllSelectedMessages() when moving to trash / purging split into chunks to limit the command lengths --- diff --git a/webcit/static/summaryview.js b/webcit/static/summaryview.js index 280fe7885..0dffd2416 100644 --- a/webcit/static/summaryview.js +++ b/webcit/static/summaryview.js @@ -413,6 +413,23 @@ function deleteAllSelectedMessages() { var msgIds = ""; for(msgId in currentlyMarkedRows) { msgIds += ","+msgId; + + if (msgIds.length > 800) { + if (!room_is_trash) { + mvCommand = encodeURI("g_cmd=MOVE " + msgIds + "|_TRASH_|0"); + } + else { + mvCommand = encodeURI("g_cmd=DELE " + msgIds); + } + new Ajax.Request("ajax_servcmd", { + parameters: mvCommand, + method: 'post', + onSuccess: function(transport) { + WCLog(transport.responseText); + } + }); + msgIds = ""; + } } if (!room_is_trash) { diff --git a/webcit/static/wclib.js b/webcit/static/wclib.js index 1d6935c4e..31a0d7b4a 100644 --- a/webcit/static/wclib.js +++ b/webcit/static/wclib.js @@ -302,17 +302,26 @@ function addRoomToList(floorUL,room, roomToEmphasize) { function roomListDropHandler(target, dropped) { if (dropped.getAttribute("citadel:msgid")) { - var room = getTextContent(target); - var msgIds = ""; - for(msgId in currentlyMarkedRows) { //defined in summaryview.js - msgIds += ","+msgId; - } - var mvCommand = encodeURI("g_cmd=MOVE " + msgIds + "|"+room+"|0"); - new Ajax.Request('ajax_servcmd', { - method: 'post', + var room = getTextContent(target); + var msgIds = ""; + for(msgId in currentlyMarkedRows) { //defined in summaryview.js + msgIds += ","+msgId; + if (msgIds.length > 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);