]> code.citadel.org Git - citadel.git/blobdiff - webcit-ng/static/js/view_mail.js
view_mail.js: show/hide attachments screen, added title bar style and close button
[citadel.git] / webcit-ng / static / js / view_mail.js
index 2847109b33976e733c0a26a050d537ac13616503..4bcb2886c216cfd01393d3e277a9a3777047d537 100644 (file)
@@ -13,6 +13,7 @@ var newmail_notify = {
         NO  : 0,                                                               // do not perform new mail notifications
         YES : 1                                                                        // yes, perform new mail notifications
 };
+var num_attachments = 0;                                                       // number of attachments in current composed msg
 
 
 // This is the async back end for mail_delete_selected()
@@ -513,7 +514,7 @@ function mail_compose(is_quoted, references, quoted_msgnum, m_to, m_cc, m_subjec
                + "<div class=\"ctdl-compose-toolbar\">"
                + "<span class=\"ctdl-msg-button\" onclick=\"mail_send_message()\"><i class=\"fa fa-paper-plane\" style=\"color:green\"></i> " + _("Send message") + "</span>"
                + "<span class=\"ctdl-msg-button\">" + _("Save to Drafts") + "</span>"
-               + "<span class=\"ctdl-msg-button\">" + _("Attachments:") + " 0" + "</span>"
+               + "<span class=\"ctdl-msg-button\" onClick=\"show_or_hide_attachments()\"><i class=\"fa fa-paperclip\" style=\"color:grey\"></i> " + _("Attachments:") + " <span id=\"ctdl_num_attachments\">" + num_attachments + "</span></span>"
                + "<span class=\"ctdl-msg-button\">" + _("Contacts") + "</span>"
                + "<span class=\"ctdl-msg-button\" onClick=\"gotoroom(current_room)\"><i class=\"fa fa-trash\" style=\"color:red\"></i> " + _("Cancel") + "</span>"
                + "</div>"
@@ -525,6 +526,37 @@ function mail_compose(is_quoted, references, quoted_msgnum, m_to, m_cc, m_subjec
                document.getElementById("ctdl-compose-cc-label").style.display = "block";
                document.getElementById("ctdl-compose-cc-field").style.display = "block";
        }
+
+       // Now the compose screen is set up properly; set up the attachments modal in case the user wants it
+
+       document.getElementById("ctdl_big_modal").innerHTML = ""
+               + "<div id=\"ctdl_attachments_outer\">"
+               + "<div id=\"ctdl_attachments_title\" class=\"ctdl-compose-attachments-title\">"
+               + "<div><h1><i class=\"fa fa-paperclip\" style=\"color:grey\"></i> " + _("Attachments:") + "</h1></div>"
+               + "<div><h1><i class=\"fas fa-window-close\" style=\"color:red\" onClick=\"show_or_hide_attachments()\"></i></h1></div>"
+               + "</div>"
+               + "<br>"
+               + "this is the attachments modal.  there are many like it, but this one is mine."
+               + "</div>"
+       ;
+
+}
+
+
+// Show or hide the attachments window in the composer
+function show_or_hide_attachments() {
+
+       if (document.getElementById("ctdl_big_modal").style.display == "block") {
+               document.getElementById("ctdl_big_modal").style.display = "none";
+       }
+       else {
+               document.getElementById("ctdl_big_modal").style.display = "block";
+               document.getElementById("ctdl_attachments_outer").style.width =
+                       Math.trunc((document.getElementById("ctdl-editor-body").getBoundingClientRect().width) * 0.90).toString() + "px";
+               document.getElementById("ctdl_attachments_outer").style.height =
+                       Math.trunc((document.getElementById("ctdl-editor-body").getBoundingClientRect().height) * 0.90).toString() + "px";
+       }
+
 }