Drag-and-drop move messages is now complete.
authorArt Cancro <ajc@citadel.org>
Wed, 30 Nov 2005 04:54:02 +0000 (04:54 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 30 Nov 2005 04:54:02 +0000 (04:54 +0000)
webcit/ChangeLog
webcit/static/wclib.js

index 2fab0ee41e205afc8ad1ffae84b698257cf55dae..c225cc25b3bcbbf7b970dedc4dfc1cca77becaa1 100644 (file)
@@ -1,9 +1,11 @@
 $Id$
 
+Tue Nov 29 23:53:33 EST 2005 ajc
+* Drag-and-drop move messages is now complete.
+
 Tue Nov 29 23:20:23 EST 2005 ajc
 * Completed the JavaScript-detection of room names in the iconbar as drop
-  targets.  For now it simply displays an alert box.  Doing the actual
-  message move will only require some simple glue code...
+  targets.
 
 Mon Nov 28 23:04:13 EST 2005 ajc
 * Made the iconbar room list somewhat usable (collapse/expand).  It is not yet
index 6bfc7e65c18f705d4b960202b48fafb866d8d873..2bf28597c5422a02c662d03305333b97f1484b5a 100644 (file)
@@ -162,6 +162,31 @@ function CtdlDeleteSelectedMessages(evt) {
        $('preview_pane').innerHTML = '';
 }
 
+
+// Move selected messages.
+function CtdlMoveSelectedMessages(evt, target_roomname) {
+       
+       if (CtdlNumMsgsSelected < 1) {
+               // Nothing to delete, so exit silently.
+               return false;
+       }
+       for (i=0; i<CtdlNumMsgsSelected; ++i) {
+               new Ajax.Request(
+                       'ajax_servcmd', {
+                               method:'post',
+                               parameters:'g_cmd=MOVE ' + CtdlMsgsSelected[i] + '|' + target_roomname + '|0',
+                               onComplete:CtdlClearDeletedMsg(CtdlMsgsSelected[i])
+                       }
+               );
+       }
+       CtdlNumMsgsSelected = 0;
+
+       // Clear the preview pane too.
+       $('preview_pane').innerHTML = '';
+}
+
+
+
 // This gets called when the user touches the keyboard after selecting messages...
 function CtdlMsgListKeyPress(evt) {
        if(document.all) {                              // aIEeee
@@ -360,9 +385,9 @@ function CtdlMoveMsgMouseUp(evt) {
                /* alert('Offsets are: ' + l + ' ' + t + ' ' + r + ' ' + b + '.'); */
        
                if ( (x >= l) && (x <= r) && (y >= t) && (y <= b) ) {
-                       // Yes, we dropped it on a hotspot.  Just delete for now... FIXME
-                       // CtdlDeleteSelectedMessages(evt);
-                       alert('you dropped on ' + drop_targets_roomnames[i]);
+                       // Yes, we dropped it on a hotspot.
+                       CtdlMoveSelectedMessages(evt, drop_targets_roomnames[i]);
+                       return true;
                }
        }