* Completed the implementation of a simple drop target for messages. Right
authorArt Cancro <ajc@citadel.org>
Thu, 10 Nov 2005 22:38:41 +0000 (22:38 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 10 Nov 2005 22:38:41 +0000 (22:38 +0000)
  now it just drops to trash.  Need to do a folder list drop now.

webcit/ChangeLog
webcit/iconbar.c
webcit/static/wclib.js

index 59ac15b5bfd1058f2599b93180a15f864ac83759..8b6a7680c215f8ef27886b8c236424f7f6baebc4 100644 (file)
@@ -1,5 +1,9 @@
 $Id$
 
+Thu Nov 10 17:37:32 EST 2005 ajc
+* Completed the implementation of a simple drop target for messages.  Right
+  now it just drops to trash.  Need to do a folder list drop now.
+
 Wed Nov  9 23:07:44 EST 2005 ajc
 * Removed arbitrary upper bound in message select array, after realizing that
   JavaScript arrays don't need to have their size declared.
index b67711ed90c9056ad609d018c395a417872b5279..70bdea271669a38896bd0b5095357a114e363b57 100644 (file)
@@ -306,6 +306,9 @@ void do_iconbar(void) {
        );
 
        wprintf("</ul>\n");
+
+       wprintf("<div id=\"dropstuff\">Drag to trash here...</div>");
+
        wprintf("</div>\n");
 }
 
index 3b9574006c791744a2fb6e1f9cc3fefccab01dac..69c0183df81a09bf8cbaab638baa9afb9523edb1 100644 (file)
@@ -231,7 +231,7 @@ function CtdlResizeMsgListMouseDown(evt) {
        if (document.layers) {
                document.captureEvents(Event.MOUSEUP | Event.MOUSEMOVE);
        }
-       return true;
+       return false;           // disable the default action
 }
 
 
@@ -309,6 +309,25 @@ function CtdlMoveMsgMouseUp(evt) {
                document.body.removeChild(mm_div);      
                mm_div = null;
        }
+
+       // Did we release the mouse button while hovering over a drop target?
+       // NOTE: this only works cross-browser because the iconbar div is always
+       //      positioned at 0,0.  Browsers differ in whether the 'offset'
+       //      functions return pos relative to the document or parent.
+
+       x = (ns6 ? evt.clientX : event.clientX);
+       y = (ns6 ? evt.clientY : event.clientY);
+
+       l = parseInt($('dropstuff').offsetLeft);
+       t = parseInt($('dropstuff').offsetTop);
+       r = parseInt($('dropstuff').offsetLeft) + parseInt($('dropstuff').offsetWidth);
+       b = parseInt($('dropstuff').offsetTop) + parseInt($('dropstuff').offsetHeight);
+
+       if ( (x >= l) && (x <= r) && (y >= t) && (y <= b) ) {
+               // Yes, we dropped it on a hotspot.  Just delete for now... FIXME
+               CtdlDeleteSelectedMessages(evt);
+       }
+
        return true;
 }