From b84408f4c69030535a3db080783ad5b612731fa7 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 6 Sep 2011 23:00:12 +0000 Subject: [PATCH] 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 --- webcit/static/summaryview.js | 17 +++++++++++++++++ webcit/static/wclib.js | 27 ++++++++++++++++++--------- 2 files changed, 35 insertions(+), 9 deletions(-) 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); -- 2.30.2