From f123729ed492f70de3db35c042874e5750bbea72 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Sat, 16 Nov 2024 23:27:12 +0100 Subject: properly implement move and remove added add_folder method to jwebmail api --- src/jwebmail/static/src/dh-move-submit.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/jwebmail/static/src/dh-move-submit.js (limited to 'src/jwebmail/static') diff --git a/src/jwebmail/static/src/dh-move-submit.js b/src/jwebmail/static/src/dh-move-submit.js new file mode 100644 index 0000000..cf16f9c --- /dev/null +++ b/src/jwebmail/static/src/dh-move-submit.js @@ -0,0 +1,19 @@ +function add_mail_ids(form_id) { + const chkbox = document.getElementsByClassName("jwm-mail-checkbox"); + const move_form = document.getElementById(form_id); + + for (const m of chkbox) { + if (m.checked) { + let inp = document.createElement("input"); + inp.setAttribute("type", "hidden"); + inp.setAttribute("name", "mail"); + inp.setAttribute("value", m.name); + move_form.append(inp); + } + } +} + +document.addEventListener("DOMContentLoaded", function() { + document.getElementById("move").addEventListener("click", () => add_mail_ids("move-mail")); + document.getElementById("remove").addEventListener("click", () => add_mail_ids("remove-mail")); +}); -- cgit v1.2.3