* Multi select using ctrl now handles the condition of a message already being
authorArt Cancro <ajc@citadel.org>
Sat, 5 Nov 2005 04:52:53 +0000 (04:52 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 5 Nov 2005 04:52:53 +0000 (04:52 +0000)
  selected and the user doing ctrl-click to deselect it.

webcit/ChangeLog
webcit/static/wclib.js

index 3af6843e323efbb3e20eaa09c15b0c0a4b968495..613890bd75115fd5567a2243fc51934f53ee7515 100644 (file)
@@ -1,7 +1,11 @@
 $Id$
 
+Fri Nov  4 23:47:23 EST 2005 ajc
+* Multi select using ctrl now handles the condition of a message already being
+  selected and the user doing ctrl-click to deselect it.
+
 Fri Nov  4 17:04:49 EST 2005 ajc
- * Multi select (using the ctrl key) is now working.
+* Multi select (using the ctrl key) is now working.
 
 Thu Nov  3 23:44:55 EST 2005 ajc
 * Removed all of the absolute URL's.
index 14ff2985868952a3b81caa8066355f34d133dc6c..764801f994462635aac8bef417b2de520bc5e2f1 100644 (file)
@@ -73,10 +73,27 @@ function CtdlSingleClickMsg(evt, msgnum) {
                }
        }
 
-       $('m'+msgnum).style.backgroundColor='#69aaff';
-       $('m'+msgnum).style.color='#fff';
-       CtdlNumMsgsSelected = CtdlNumMsgsSelected + 1;
-       CtdlMsgsSelected[CtdlNumMsgsSelected-1] = msgnum;
+       // For multi select ... is the message being clicked already selected?
+       already_selected = 0;
+       if ( (evt.ctrlKey) && (CtdlNumMsgsSelected > 0) ) {
+               for (i=0; i<CtdlNumMsgsSelected; ++i) {
+                       if (CtdlMsgsSelected[i] == msgnum) {
+                               already_selected = 1;
+                       }
+               }
+       }
+
+       // Now select (or de-select) the message
+       if ( (evt.ctrlKey) && (already_selected == 1) ) {
+               $('m'+msgnum).style.backgroundColor = '#fff';
+               $('m'+msgnum).style.color = '#000';
+       }
+       else {
+               $('m'+msgnum).style.backgroundColor='#69aaff';
+               $('m'+msgnum).style.color='#fff';
+               CtdlNumMsgsSelected = CtdlNumMsgsSelected + 1;
+               CtdlMsgsSelected[CtdlNumMsgsSelected-1] = msgnum;
+       }
 
        // Update the preview pane
        new Ajax.Updater('preview_pane', '/msg/'+msgnum, { method: 'get' } );