From: Art Cancro Date: Wed, 11 Oct 2023 03:18:07 +0000 (-0400) Subject: broken: attachments window cannot be a child of the editor body X-Git-Tag: v997~121 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=44166de3fa70105519c629b4f486163bcd927e93 broken: attachments window cannot be a child of the editor body It causes the attachments window to be saved as part of the message text. Oof. --- diff --git a/webcit-ng/server/messages.c b/webcit-ng/server/messages.c index 415241368..ee5f34249 100644 --- a/webcit-ng/server/messages.c +++ b/webcit-ng/server/messages.c @@ -185,6 +185,12 @@ void dav_put_message(struct http_transaction *h, struct ctdlsession *c, char *eu char *mailbcc = get_url_param(h, "mailbcc"); // Bcc: if (!mailbcc) mailbcc = ""; + // If there are attachments, we have to merge them into the message text. + char *att = get_url_param(h, "att"); + if (!att) { + syslog(LOG_DEBUG, "attachments: <%s>", att); // FIXME write this + } + // Mode 4 will give us metadata back after upload ctdl_printf(c, "ENT0 1|%s||4|%s||1|%s|%s|||%s|", mailto, subj, mailcc, mailbcc, wefw); ctdl_readline(c, buf, sizeof buf); diff --git a/webcit-ng/static/js/upload.js b/webcit-ng/static/js/upload.js index 96e02b972..228e97ace 100644 --- a/webcit-ng/static/js/upload.js +++ b/webcit-ng/static/js/upload.js @@ -89,10 +89,10 @@ function upload_file(file) { + ` ` + item["uploadfilename"] + " (" + item["contenttype"] + ", " + item["contentlength"] + " " + _("bytes") + ")"; document.getElementById("ctdl-upload_list").appendChild(new_upl); - }); - // append it to the global list of uploads - uploads.push(j_response); + // append it to the global list of uploads + uploads.push(item); + }); document.getElementById("num_attachments").innerHTML = uploads.length; } else if (xhr.readyState == 4 && xhr.status != 200) { diff --git a/webcit-ng/static/js/view_mail.js b/webcit-ng/static/js/view_mail.js index 8e31a18cf..3071496e8 100644 --- a/webcit-ng/static/js/view_mail.js +++ b/webcit-ng/static/js/view_mail.js @@ -525,7 +525,7 @@ function mail_compose(is_quoted, references, quoted_msgnum, m_to, m_cc, m_subjec document.getElementById("ctdl-compose-cc-field").style.display = "block"; } - activate_uploads("ctdl-editor-body"); + activate_uploads("ctdl-compose-mail"); } // Called when the user clicks the button to make the hidden "CC" and "BCC" lines appear. @@ -561,6 +561,15 @@ function mail_send_message() { + "&mailcc=" + msm_field("ctdl-compose-cc-field", ",") // Cc: (if present) + "&mailbcc=" + msm_field("ctdl-compose-bcc-field", ",") // Bcc: (if present) ; + if (uploads.length > 0) { + url += "&att="; + for (let i=0; i