]> code.citadel.org Git - citadel.git/blobdiff - webcit/messages.c
Address book popup is now rendered using an ajax refresh
[citadel.git] / webcit / messages.c
index 70e2c1fd69e48807b15e90a44385e1cde0ccbc68..4a4b116e8ccee55557056c37309a3681007346c4 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];
@@ -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, "|");
@@ -3008,7 +3016,7 @@ void display_enter(void)
                wprintf("\" size=50 maxlength=1000 />");
                wprintf("<div class=\"auto_complete\" id=\"recp_name_choices\"></div>");
 
-               /** Pop open an address book -- begin **
+               /** Pop open an address book -- begin **/
 
                wprintf(
                        "<a href=\"javascript:PopOpenAddressBook();\" title=\"%s\">"
@@ -3016,7 +3024,7 @@ void display_enter(void)
                        "</a>", _("Contacts")
                );
 
-               ** Pop open an address book -- end **/
+               /** Pop open an address book -- end **/
 
                wprintf("</td><td></td></tr>\n");
 
@@ -3195,30 +3203,24 @@ 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
+       wprintf("</div>\n");    /* End of 'content' div */
+
+       /* Open a new div, hidden initially, for address book popups.
+        * 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_popup\" style=\"display:none;\">");
+       wprintf("<div id=\"address_book_popup_container_div\">");
+       wprintf("<div id=\"address_book_popup_middle_div\"></div>");
        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");
-
+       wprintf("</div>");
+       /* The 'address_book_popup' div will be closed by wDumpContent() */
 DONE:  wDumpContent(1);
 }
 
 
-
 /**
  * \brief delete a message
  */