Limit length of Commands sent to citserver; do multible json requests if neccessary
authorWilfried Goesgens <dothebart@citadel.org>
Tue, 6 Sep 2011 23:00:12 +0000 (23:00 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Tue, 6 Sep 2011 23:00:12 +0000 (23:00 +0000)
  - roomListDropHandler() when cut'n'paste moving split after the move vector reaches 800 chars
  - deleteAllSelectedMessages() when <del> moving to trash / purging split into chunks to limit the command lengths

webcit/static/summaryview.js
webcit/static/wclib.js

index 280fe788551363d9a7153b1d8667a526be1b4f35..0dffd2416482ea75d493a79596532b6ff56aa010 100644 (file)
@@ -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) {
index 1d6935c4eeae7f53ac0f195888a672c70a605795..31a0d7b4ad674d8236c7f39917d8ac8458eb3196 100644 (file)
@@ -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);