$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
}
-
-
/*
* Display the menubar. Set as_single_page to
* display HTML headers and footers -- otherwise it's assumed
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);
- }
}
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' ;
+}
+
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();
+}
+
+
+
+
/*
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")) {
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);