* Removed the 'mark message as seen' C code (in the mailbox view) because it
authorArt Cancro <ajc@citadel.org>
Thu, 3 Nov 2005 16:13:46 +0000 (16:13 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 3 Nov 2005 16:13:46 +0000 (16:13 +0000)
  was no longer getting called.  Implemented this in JavaScript using an ajax
  call plus a new WebCit function to perform generic server commands using
  ajax.  Also reinstated the removal of bold font weight for messages
  transitioning from unseen to seen (again, in JavaScript).

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

index 6147783b347be925e468000a1abc53767ecf1283..fa527c947c3e3be0d78b29801af19809d25739f0 100644 (file)
@@ -1,5 +1,12 @@
 $Id$
 
+Thu Nov  3 11:11:37 EST 2005 ajc
+* Removed the 'mark message as seen' C code (in the mailbox view) because it
+  was no longer getting called.  Implemented this in JavaScript using an ajax
+  call plus a new WebCit function to perform generic server commands using
+  ajax.  Also reinstated the removal of bold font weight for messages
+  transitioning from unseen to seen (again, in JavaScript).
+
 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
index fcde57aedf55a78359239c3435d42662d176005e..2332cc0459091529b5a32ce522edc1d395bb8f61 100644 (file)
@@ -363,8 +363,6 @@ void do_generic(void)
 }
 
 
-
-
 /*
  * Display the menubar.  Set as_single_page to
  * display HTML headers and footers -- otherwise it's assumed
index acb74a13236d8e92f3b8f3b0a4e5e8795b89a6f8..82fb3dd4818a87846e084aeab8f22cd1ef73c9d0 100644 (file)
@@ -2227,15 +2227,6 @@ DONE:
                WC->num_summ = 0;
                free(WC->summ);
        }
-
-       /* If we got here via a mailbox view and are reading a single
-        * message, mark it as "seen." We do this after rendering the web page
-        * so it doesn't keep the user waiting.
-        */
-       if ( (maxmsgs == 1) && (WC->wc_view == VIEW_MAILBOX) ) {
-               serv_printf("SEEN %ld|1", startmsg);
-               serv_getln(buf, sizeof buf);
-       }
 }
 
 
index 7ea98ae00c48a5f1dd97618c8e0e362fe2ee68bf..b4202cfb841e10a5bb4e31e67a434e9ab3c12b10 100644 (file)
@@ -73,5 +73,20 @@ function CtdlSingleClickMsg(msgnum) {
        CtdlNumMsgsSelected = CtdlNumMsgsSelected + 1;
        CtdlMsgsSelected[CtdlNumMsgsSelected-1] = msgnum;
 
+       // Update the preview pane
        new Ajax.Updater('preview_pane', '/msg/'+msgnum, { method: 'get' } );
+
+       // Mark the message as read
+       new Ajax.Request(
+               '/ajax_servcmd', {
+                       method: 'post',
+                       parameters: 'g_cmd=SEEN '+msgnum+'|1',
+                       onComplete: CtdlRemoveTheUnseenBold(msgnum)
+               }
+       );
 }
+
+function CtdlRemoveTheUnseenBold(msgnum) {
+       $('m'+msgnum).style.fontWeight='normal' ;
+}
+
index ffb40a9c72d20091a239f854eaafc9604b5a1a36..3ec962f938b3f208b3c9dc4358ba228c1606d601 100644 (file)
@@ -824,6 +824,51 @@ void end_ajax_response(void) {
         wDumpContent(0);
 }
 
+void ajax_servcmd(void)
+{
+       char buf[1024];
+       char gcontent[1024];
+       char *junk;
+       size_t len;
+
+       begin_ajax_response();
+
+       serv_printf("%s", bstr("g_cmd"));
+       serv_getln(buf, sizeof buf);
+
+       if (buf[0] == '8') {
+               serv_printf("\n\n000");
+       }
+       if ((buf[0] == '1') || (buf[0] == '8')) {
+               while (serv_getln(gcontent, sizeof gcontent), strcmp(gcontent, "000")) {
+                       /* maybe do something with it? */
+               }
+               wprintf("000");
+       }
+       if (buf[0] == '4') {
+               text_to_server(bstr("g_input"), 0);
+               serv_puts("000");
+       }
+       if (buf[0] == '6') {
+               len = atol(&buf[4]);
+               junk = malloc(len);
+               serv_read(junk, len);
+               free(junk);
+       }
+       if (buf[0] == '7') {
+               len = atol(&buf[4]);
+               junk = malloc(len);
+               memset(junk, 0, len);
+               serv_write(junk, len);
+               free(junk);
+       }
+
+       end_ajax_response();
+}
+
+
+
+
 
 
 /*
@@ -1359,6 +1404,8 @@ void session_loop(struct httprequest *req)
                display_generic();
        } else if (!strcasecmp(action, "do_generic")) {
                do_generic();
+       } else if (!strcasecmp(action, "ajax_servcmd")) {
+               ajax_servcmd();
        } else if (!strcasecmp(action, "display_menubar")) {
                display_menubar(1);
        } else if (!strcasecmp(action, "mimepart")) {
index 6e9852c8f56e620c26faabf5850ba7c594e175ca..efdcf285d0b2c9f67f606f329fa4aa501dd9b809 100644 (file)
@@ -465,6 +465,7 @@ void display_siteconfig(void);
 void siteconfig(void);
 void display_generic(void);
 void do_generic(void);
+void ajax_servcmd(void);
 void display_menubar(int);
 void smart_goto(char *);
 void worker_entry(void);