From eb149220ceabf0b5aa11ebebbd3df200bb9c2425 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 10 Nov 2005 22:38:41 +0000 Subject: [PATCH] * 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. --- webcit/ChangeLog | 4 ++++ webcit/iconbar.c | 3 +++ webcit/static/wclib.js | 21 ++++++++++++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 59ac15b5b..8b6a7680c 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -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. diff --git a/webcit/iconbar.c b/webcit/iconbar.c index b67711ed9..70bdea271 100644 --- a/webcit/iconbar.c +++ b/webcit/iconbar.c @@ -306,6 +306,9 @@ void do_iconbar(void) { ); wprintf("\n"); + + wprintf("
Drag to trash here...
"); + wprintf("\n"); } diff --git a/webcit/static/wclib.js b/webcit/static/wclib.js index 3b9574006..69c0183df 100644 --- a/webcit/static/wclib.js +++ b/webcit/static/wclib.js @@ -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; } -- 2.39.2