* Mailbox view -- onClick is now implemented by a JavaScript function which
authorArt Cancro <ajc@citadel.org>
Thu, 3 Nov 2005 04:47:28 +0000 (04:47 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 3 Nov 2005 04:47:28 +0000 (04:47 +0000)
  is defined in wclib.js -- now, it not only handles the Ajax load of the
  message into the preview pane, but it also highlights the table row, and
  remembers the highlighting so it can be turned off when another row is
  selected.  This is if course a prelude to ajaxifying the table...

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

index b22144bbdba263b807cbe50fe9ff3c8f69b32ecf..6147783b347be925e468000a1abc53767ecf1283 100644 (file)
@@ -1,5 +1,12 @@
 $Id$
 
+Wed Nov  2 23:45:16 EST 2005 ajc
+* Mailbox view -- onClick is now implemented by a JavaScript function which
+  is defined in wclib.js -- now, it not only handles the Ajax load of the
+  message into the preview pane, but it also highlights the table row, and
+  remembers the highlighting so it can be turned off when another row is
+  selected.  This is if course a prelude to ajaxifying the table...
+
 Wed Nov  2 15:57:37 EST 2005 ajc
 * Switched the mailbox summary back to a table.  This is tabular data and it
   ought to be marked up as a table.  We went to fixed width floating div's in
index 4e262e3808ad9160b0849448704cd917938b1de7..acb74a13236d8e92f3b8f3b0a4e5e8795b89a6f8 100644 (file)
@@ -1331,14 +1331,11 @@ ENDBODY:
 }
 
 
-
-
-
 void display_summarized(int num) {
        char datebuf[64];
 
        wprintf("<tr id=\"m%ld\" style=\"width:100%%;font-weight:%s;background-color:#fff\" "
-               "onClick=\" new Ajax.Updater('preview_pane', '/msg/%d', { method: 'get' } ); \">",
+               "onClick=\"CtdlSingleClickMsg(%ld)\">",
                WC->summ[num].msgnum,
                (WC->summ[num].is_new ? "bold" : "normal"),
                WC->summ[num].msgnum
index d0c3ca4a6d428727f29fb5347490cfeea44c8d77..7ea98ae00c48a5f1dd97618c8e0e362fe2ee68bf 100644 (file)
@@ -46,3 +46,32 @@ function activate_entmsg_autocompleters() {
        new Ajax.Autocompleter('bcc_id', 'bcc_name_choices', '/bcc_autocomplete', {} );
        new Ajax.Autocompleter('recp_id', 'recp_name_choices', '/recp_autocomplete', {} );
 }
+
+
+// Static variables for mailbox view...
+//
+var CtdlNumMsgsSelected = 0;
+var CtdlMsgsSelected = new Array(100); // arbitrary
+
+// This gets called when you single click on a message in the mailbox view.
+// We know that the element id of the table row will be the letter 'm' plus the message number.
+//
+function CtdlSingleClickMsg(msgnum) {
+
+       // $('preview_pane').innerHTML = '<div align="center">Loading...</div>' ;
+
+       if (CtdlNumMsgsSelected > 0) {
+               for (i=0; i<CtdlNumMsgsSelected; ++i) {
+                       $('m'+CtdlMsgsSelected[i]).style.backgroundColor = '#fff';
+                       $('m'+CtdlMsgsSelected[i]).style.color = '#000';
+               }
+               CtdlNumMsgsSelected = 0;
+       }
+
+       $('m'+msgnum).style.backgroundColor='#69aaff';
+       $('m'+msgnum).style.color='#fff';
+       CtdlNumMsgsSelected = CtdlNumMsgsSelected + 1;
+       CtdlMsgsSelected[CtdlNumMsgsSelected-1] = msgnum;
+
+       new Ajax.Updater('preview_pane', '/msg/'+msgnum, { method: 'get' } );
+}