From c86d6f4bf3ce2c53f88347391d35f44c52586946 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 7 Jul 2026 14:31:23 +0200 Subject: [PATCH] - enable opening in new tab with prevent.default - rendering of maillinks - useBCC without CC --- application/views/Studentenverwaltung.php | 1 + .../js/components/Stv/Studentenverwaltung.js | 4 +- .../Details/Kontaktieren.js | 91 +++++++++++++++++-- public/js/helpers/EmailHelpers.js | 78 +++++++++++++++- system/phrasesupdate.php | 20 ++++ 5 files changed, 181 insertions(+), 13 deletions(-) diff --git a/application/views/Studentenverwaltung.php b/application/views/Studentenverwaltung.php index 8dd2dd93d..c1a55c6bf 100644 --- a/application/views/Studentenverwaltung.php +++ b/application/views/Studentenverwaltung.php @@ -62,6 +62,7 @@ $configArray = [ logout-url="" :permissions="" :config="" + auth-uid="" > diff --git a/public/js/components/Stv/Studentenverwaltung.js b/public/js/components/Stv/Studentenverwaltung.js index 66ff7f891..acb1b84f2 100644 --- a/public/js/components/Stv/Studentenverwaltung.js +++ b/public/js/components/Stv/Studentenverwaltung.js @@ -57,7 +57,8 @@ export default { url_mode: String, url_prestudent_id: String, url_tab: String, - url_studiengang: String + url_studiengang: String, + authUid: String }, provide() { return { @@ -91,6 +92,7 @@ export default { hasZGVMasterPermission: this.permissions['student/editMakkZgv'], hasZGVDoctorPermission: this.permissions['student/editDokZgv'], hasBismeldenPermission: this.permissions['student/editBismelden'], + authUid: this.authUid } }, diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Kontaktieren.js b/public/js/components/Stv/Studentenverwaltung/Details/Kontaktieren.js index d075b5a82..3d2b8ed80 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Kontaktieren.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Kontaktieren.js @@ -1,4 +1,5 @@ -import { splitMailsHelper } from "../../../../helpers/EmailHelpers.js" +import { splitMailLinks } from "../../../../helpers/EmailHelpers.js"; + export default { name: "Kontaktieren", computed: { @@ -21,7 +22,18 @@ export default { props: { modelValue: Object }, - + inject: { + authUid: { + from: 'authUid', + required: true + }, + }, + data(){ + return { + mailLinks: [], + showMailDialog: false + } + }, methods: { internMail(event) { if (this.internMails.length) @@ -34,25 +46,84 @@ export default { { splitMailsHelper(this.privateMails, event, null, this.$fhcAlert, this.$p) } + }, + createMailLinks(event, mailGroup){ + let recipients = mailGroup == 'private' ? this.privateMails : this.internMails; + this.mailLinks = splitMailLinks( + recipients, + "", + event.ctrlKey || event.metaKey, + this.authUid + ); + + this.showMailDialog = true; + }, + handleMailLink(event){ + window.open(event.target.href, '_blank', 'noopener'); + }, + reset(){ + this.showMailDialog = false; } }, template: ` -
-
-
+
+ +
-
- -
+ +
-
-
` + +
+
+

{{$p.t('stv', 'zuvieleEMails')}}

+ + + + + +
+
+ + {{$p.t('ui', 'openInMailClient')}} + + + + + +
+
+ ` }; \ No newline at end of file diff --git a/public/js/helpers/EmailHelpers.js b/public/js/helpers/EmailHelpers.js index 87daa828a..47aff573d 100644 --- a/public/js/helpers/EmailHelpers.js +++ b/public/js/helpers/EmailHelpers.js @@ -40,6 +40,80 @@ export async function splitMailsHelper(mails, event, subject, alertPluginRef, ph window.location.href = mailLink; } } - } -} \ No newline at end of file +} + + +/** + * just splits the list of mails + * + * @param mails emailadresses + * @param subject subject + * @param useBcc useBcc + * @returns array of links for splitted mails + */ +export function splitMailLinks(mails, subject = "", useBcc = false, uidCC= "", maxLength = 2024) { + if (!Array.isArray(mails) || mails.length === 0) { + return []; + } + + const separator = ","; + const encodedSubject = subject ? encodeURIComponent(subject) : ""; + + // reserve space for the subject parameter + const subjectLength = encodedSubject + ? `?subject=${encodedSubject}`.length + : 0; + + const limit = maxLength - subjectLength; + + const links = []; + let currentRecipients = []; + + for (const mail of mails) { + if (!mail) continue; + + const testRecipients = [...currentRecipients, mail]; + const recipientString = testRecipients.join(separator); + + if (recipientString.length > limit && currentRecipients.length > 0) { + + links.push(createMailto( + currentRecipients.join(separator), + encodedSubject, + useBcc, + uidCC + )); + + currentRecipients = [mail]; + } + else { + currentRecipients.push(mail); + } + } + + if (currentRecipients.length > 0) { + links.push(createMailto( + currentRecipients.join(separator), + encodedSubject, + useBcc, + uidCC + )); + } + + return links; +} + +function createMailto(recipients, encodedSubject, useBcc, uidCC) { + let mailadressUid = uidCC + '@technikum-wien.at'; + + let link = useBcc + ? `mailto:${encodeURIComponent(mailadressUid)}?cc=${encodeURIComponent(mailadressUid)}&bcc=${encodeURIComponent(recipients)}` + : `mailto:${encodeURIComponent(recipients)}`; + + if (encodedSubject) { + link += `${useBcc ? "&" : "?"}subject=${encodedSubject}`; + } + + return link; +} diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 92a05156b..be53ff438 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -58197,6 +58197,26 @@ I have been informed that I am under no obligation to consent to the transmissio ) ), // ### Phrases Dashboard Admin END + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'openInMailClient', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'In Mailanwendung öffnen', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Open in Mailclient', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), );