view_mail.js: better display of attachment links; attachments are now working
authorArt Cancro <ajc@citadel.org>
Tue, 19 Sep 2023 20:02:38 +0000 (16:02 -0400)
committerArt Cancro <ajc@citadel.org>
Tue, 19 Sep 2023 20:02:38 +0000 (16:02 -0400)
Displaying each one as a link definitely makes it stand out from the message text.
Display the size of each attachment --   _(bytes) is already in the webcit-classic translations
Downloads are working, but the wrong file name is derived

webcit-ng/server/webcit.h
webcit-ng/static/js/view_mail.js

index d06e3800c7117205be8c9868f96ac6c2be4f2c16..1304100dd24d0440ef6ab791499151b9e3250e4d 100644 (file)
@@ -23,6 +23,7 @@
 #include <sys/un.h>
 #include <sys/poll.h>
 #include <time.h>
+#include <sys/time.h>
 #include <string.h>
 #include <pwd.h>
 #include <errno.h>
index a647ed0a3d9d02f5f1ade9b2709ad5341eae37ce..0c7052cb7617da8d1fe7cbd2930b5b002169233c 100644 (file)
@@ -216,7 +216,12 @@ function mail_render_one(msgnum, msg, target_div, include_controls) {
                                                outmsg += "<ul>";
                                        }
                                        display_attachments += 1;
-                                       outmsg += "<li><i class=\"fa fa-paperclip\"></i>&nbsp;" + msg.part[r].partnum + ": " + msg.part[r].filename + "</li>";
+                                       outmsg += "<li>"
+                                               + "<a href=\"/ctdl/r/" + escapeHTMLURI(current_room) + "/" + msgnum + "/" + msg.part[r].partnum + "\">"
+                                               + "<i class=\"fa fa-paperclip\"></i>&nbsp;" + msg.part[r].partnum + ": " + msg.part[r].filename
+                                               + " (" + msg.part[r].len + " " + _("bytes") + ")"
+                                               + "</a>"
+                                               + "</li>";
                                }
                        }
                        if (display_attachments > 0) {