From b82dbb899e3978e31371ae541c2f4c5087637ced Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 19 Sep 2005 02:56:21 +0000 Subject: [PATCH] * Two-pane mail reading now uses Ajax instead of a hidden iframe, and it's very crisp and responsive. * "Print message" function now opens up a new window for the print preview. I just couldn't figure out a way to keep the b0rken IE from printing the screen instead of the message. --- webcit/ChangeLog | 8 ++++ webcit/messages.c | 98 ++++++++++++++++++++--------------------------- webcit/webcit.c | 2 + webcit/webcit.h | 1 + 4 files changed, 52 insertions(+), 57 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index f6febbc08..d2eedda3c 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,11 @@ $Log$ +Revision 625.17 2005/09/19 02:56:21 ajc +* Two-pane mail reading now uses Ajax instead of a hidden iframe, and it's + very crisp and responsive. +* "Print message" function now opens up a new window for the print + preview. I just couldn't figure out a way to keep the b0rken IE from + printing the screen instead of the message. + Revision 625.16 2005/09/19 02:07:17 ajc * Renamed 'ScriptaculousEffect' back to 'Effect' because there is no longer any namespace conflict. @@ -3030,3 +3037,4 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix + diff --git a/webcit/messages.c b/webcit/messages.c index 47d515f3a..79cb312bb 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -469,7 +469,7 @@ void display_vcard(char *vcard_source, char alpha, int full, char *storename) { /* * I wanna SEE that message! */ -void read_message(long msgnum, int suppress_buttons) { +void read_message(long msgnum, int printable_view) { char buf[SIZ]; char mime_partnum[256]; char mime_filename[256]; @@ -523,9 +523,11 @@ void read_message(long msgnum, int suppress_buttons) { } /* begin everythingamundo table */ - wprintf("
\n"); - wprintf("
\n"); + if (!printable_view) { + wprintf("
\n"); + wprintf("
\n"); + } /* begin message header table */ wprintf("\n"); /* start msg buttons */ - if (!suppress_buttons) { + if (!printable_view) { wprintf(""); } @@ -899,8 +901,10 @@ ENDBODY: wprintf("
\n"); /* Reply */ @@ -747,8 +749,8 @@ void read_message(long msgnum, int suppress_buttons) { ); } - wprintf("" - "[%s]", msgnum, _("Print")); + wprintf("" + "[%s]", msgnum, msgnum, _("Print")); wprintf("
\n"); /* end everythingamundo table */ - wprintf("
\n"); - wprintf("

\n"); + if (!printable_view) { + wprintf("
\n"); + wprintf("

\n"); + } #ifdef HAVE_ICONV if (ic != (iconv_t)(-1) ) { @@ -917,63 +921,42 @@ ENDBODY: */ void embed_message(void) { long msgnum = 0L; - char *sourceiframe; - char *targetdiv; - char *print_it; msgnum = atol(bstr("msgnum")); - sourceiframe = bstr("sourceiframe"); - targetdiv = bstr("targetdiv"); - print_it = bstr("print_it"); + begin_ajax_response(); + read_message(msgnum, 0); + end_ajax_response(); +} - output_headers(1, 0, 0, 0, 1, 0); - begin_burst(); - wprintf(""); +/* + * Printable view of a message + */ +void print_message(void) { + long msgnum = 0L; - /* If we're loading into a hidden iframe, chances are the caller told us - * about a target div somewhere that we need to copy into when we're done. - */ - if (strlen(targetdiv) > 0) wprintf( -" \n" -" \n", - targetdiv, - sourceiframe - ); + msgnum = atol(bstr("msgnum")); + output_headers(0, 0, 0, 0, 0, 0); + + wprintf("Content-type: text/html\r\n" + "Server: %s\r\n" + "Connection: close\r\n", + SERVER); + begin_burst(); - if (!strcasecmp(print_it, "yes")) wprintf( -" \n" -" \n", - sourceiframe, - sourceiframe + wprintf("\r\n\r\n\n" + "Printable view\n" + "\n" ); + + read_message(msgnum, 1); - wprintf(""); - wprintf(" 0) { - wprintf(" onLoad='loaded_now_copy_it();'"); - } - if (!strcasecmp(print_it, "yes")) { - wprintf(" onLoad='loaded_now_print_it();'"); - } - wprintf(">\n"); - read_message(msgnum, (!strcasecmp(print_it, "yes") ? 1 : 0) ); - wprintf("\n"); + wprintf("\n\n\n"); wDumpContent(0); } - /* * Read message in simple, JavaScript-embeddable form for 'forward' * or 'reply quoted' operations. @@ -1282,10 +1265,7 @@ void display_summarized(int num) { wprintf(""); if (WC->summ[num].is_new) wprintf(""); - wprintf("", - WC->summ[num].msgnum); escputs(WC->summ[num].subj); - wprintf(""); if (WC->summ[num].is_new) wprintf(""); wprintf(""); if (WC->summ[num].is_new) wprintf(""); @@ -1969,9 +1949,13 @@ void readloop(char *oper) /* If a tabular view, set up the line */ if (is_summary) { bg = 1 - bg; - wprintf("", + wprintf("summ[a].msgnum); + + wprintf(">"); } /* Display the message */ diff --git a/webcit/webcit.c b/webcit/webcit.c index 82422c2c5..9c510fab5 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -1187,6 +1187,8 @@ void session_loop(struct httprequest *req) readloop("headers"); } else if (!strcasecmp(action, "msg")) { embed_message(); + } else if (!strcasecmp(action, "printmsg")) { + print_message(); } else if (!strcasecmp(action, "display_enter")) { display_enter(); } else if (!strcasecmp(action, "post")) { diff --git a/webcit/webcit.h b/webcit/webcit.h index 6506edffe..9dfa8ab53 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -387,6 +387,7 @@ void serv_read(char *buf, int bytes); int haschar(char *, char); void readloop(char *oper); void embed_message(void); +void print_message(void); void text_to_server(char *ptr, int convert_to_html); void display_enter(void); void post_message(void); -- 2.39.2