Limit length of Commands sent to citserver; do multible json requests if neccessary
[citadel.git] / webcit / static / wclib.js
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);