]> code.citadel.org Git - citadel.git/blobdiff - webcit/messages.c
A single address book popup now supports multiple
[citadel.git] / webcit / messages.c
index cfcf8ff94d3f2af60e6ccf9dc034fd03a48f24a8..fc380bf554d510e181f743748b99a6a5f14e4ef1 100644 (file)
@@ -649,6 +649,7 @@ struct attach_link {
 void read_message(long msgnum, int printable_view, char *section) {
        char buf[SIZ];
        char mime_partnum[256];
+       char mime_name[256];
        char mime_filename[256];
        char mime_content_type[256];
        char mime_charset[256];
@@ -721,7 +722,7 @@ void read_message(long msgnum, int printable_view, char *section) {
                if (!strcmp(buf, "000")) {
                        wprintf("<i>");
                        wprintf(_("unexpected end of message"));
-                       wprintf("</i><br /><br />\n");
+                       wprintf(" (1)</i><br /><br />\n");
                        wprintf("</span>\n");
                        return;
                }
@@ -800,12 +801,19 @@ void read_message(long msgnum, int printable_view, char *section) {
                }
 
                if (!strncasecmp(buf, "part=", 5)) {
+                       extract_token(mime_name, &buf[5], 0, '|', sizeof mime_filename);
                        extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename);
                        extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum);
                        extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition);
                        extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type);
                        mime_length = extract_int(&buf[5], 5);
 
+                       striplt(mime_name);
+                       striplt(mime_filename);
+                       if ( (strlen(mime_filename) == 0) && (strlen(mime_name) > 0) ) {
+                               strcpy(mime_filename, mime_name);
+                       }
+
                        if (!strcasecmp(mime_content_type, "message/rfc822")) {
                                if (strlen(mime_submessages) > 0) {
                                        strcat(mime_submessages, "|");
@@ -1013,7 +1021,7 @@ void read_message(long msgnum, int printable_view, char *section) {
                if (!strcmp(buf, "000")) {
                        wprintf("<i>");
                        wprintf(_("unexpected end of message"));
-                       wprintf("</i><br /><br />\n");
+                       wprintf(" (2)</i><br /><br />\n");
                        goto ENDBODY;
                }
                if (!strncasecmp(buf, "X-Citadel-MSG4-Partnum:", 23)) {
@@ -1330,7 +1338,7 @@ void pullquote_message(long msgnum, int forward_attachments, int include_headers
 
        while (serv_getln(buf, sizeof buf), strcasecmp(buf, "text")) {
                if (!strcmp(buf, "000")) {
-                       wprintf(_("unexpected end of message"));
+                       wprintf("%s (3)", _("unexpected end of message"));
                        return;
                }
                if (include_headers) {
@@ -1433,7 +1441,7 @@ void pullquote_message(long msgnum, int forward_attachments, int include_headers
        strcpy(mime_content_type, "text/plain");
        while (serv_getln(buf, sizeof buf), (strlen(buf) > 0)) {
                if (!strcmp(buf, "000")) {
-                       wprintf(_("unexpected end of message"));
+                       wprintf("%s (4)", _("unexpected end of message"));
                        goto ENDBODY;
                }
                if (!strncasecmp(buf, "Content-type: ", 14)) {
@@ -3007,18 +3015,20 @@ void display_enter(void)
                escputs(bstr("recp"));
                wprintf("\" size=50 maxlength=1000 />");
                wprintf("<div class=\"auto_complete\" id=\"recp_name_choices\"></div>");
+               wprintf("</td><td rowspan=3>");
 
                /** Pop open an address book -- begin **/
-
                wprintf(
-                       "<a href=\"javascript:PopOpenAddressBook();\" title=\"FIXME\">"
-                       "<img border=0 width=16 height=16 src=\"static/viewcontacts_16x.gif\">"
-                       "</a>"
+                       "<a href=\"javascript:PopOpenAddressBook('recp_id|%s|cc_id|%s|bcc_id|%s');\" "
+                       "title=\"%s\">"
+                       "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
+                       "&nbsp;%s</a>",
+                       _("To:"), _("CC:"), _("BCC:"),
+                       _("Contacts"), _("Contacts")
                );
-
                /** Pop open an address book -- end **/
 
-               wprintf("</td><td></td></tr>\n");
+               wprintf("</td></tr>\n");
 
                wprintf("<tr><td>");
                wprintf("<font size=-1>");
@@ -3029,7 +3039,7 @@ void display_enter(void)
                escputs(bstr("cc"));
                wprintf("\" size=50 maxlength=1000 />");
                wprintf("<div class=\"auto_complete\" id=\"cc_name_choices\"></div>");
-               wprintf("</td><td></td></tr>\n");
+               wprintf("</td></tr>\n");
 
                wprintf("<tr><td>");
                wprintf("<font size=-1>");
@@ -3040,7 +3050,7 @@ void display_enter(void)
                escputs(bstr("bcc"));
                wprintf("\" size=50 maxlength=1000 />");
                wprintf("<div class=\"auto_complete\" id=\"bcc_name_choices\"></div>");
-               wprintf("</td><td></td></tr>\n");
+               wprintf("</td></tr>\n");
 
                /** Initialize the autocomplete ajax helpers (found in wclib.js) */
                wprintf("<script type=\"text/javascript\">      \n"
@@ -3051,7 +3061,12 @@ void display_enter(void)
 
        wprintf("<tr><td>");
        wprintf("<font size=-1>");
-       wprintf(_("Subject (optional):"));
+       if (recipient_required) {
+               wprintf(_("Subject:"));
+       }
+       else {
+               wprintf(_("Subject (optional):"));
+       }
        wprintf("</font>");
        wprintf("</td><td>"
                "<input type=\"text\" name=\"subject\" value=\"");
@@ -3195,30 +3210,13 @@ void display_enter(void)
        }
 
        wprintf("</form>\n");
-
        wprintf("</td></tr></table></div>\n");
 
-       /* Close the main div, now open a new one, hidden initially, for address book popups.
-        * Remember: the popup div will be closed by wDumpContent, which will think it's merely
-        * closing the main div.  FIXME put this in its own function so we can use it from the
-        * calendar too.
-        */
-       wprintf("</div><div id=\"address_book_popup\" style=\"display:none;\">");
-       svprintf("BOXTITLE", WCS_STRING,  _("Contacts") );
-       do_template("beginbox");
-       wprintf("<div id=\"address_book_inner_div\"></div>");
-       wprintf("<div align=center><p class=\"close_popup\" "
-               "onclick=\"javascript:Effect.Fade('address_book_popup', { duration: 0.5 });\" "
-               ">");
-               wprintf(_("Close window"));
-               wprintf("</p></div>");
-       do_template("endbox");
-
-DONE:  wDumpContent(1);
+DONE:  address_book_popup();
+       wDumpContent(1);
 }
 
 
-
 /**
  * \brief delete a message
  */