Compare commits

...

1 Commits

Author SHA1 Message Date
ma0068 c86d6f4bf3 - enable opening in new tab with prevent.default
- rendering of maillinks
- useBCC without CC
2026-07-07 14:31:23 +02:00
5 changed files with 181 additions and 13 deletions
@@ -62,6 +62,7 @@ $configArray = [
logout-url="<?= site_url('Cis/Auth/logout'); ?>"
:permissions="<?= htmlspecialchars(json_encode($permissions)); ?>"
:config="<?= htmlspecialchars(json_encode($configArray)); ?>"
auth-uid="<?= getAuthUID()?>"
>
</router-view>
</div>
@@ -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
}
},
@@ -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: `
<div>
<div id="elementID"></div>
<div class="row">
<div class="core-kontaktieren>
<div id="elementID"></div>
<div v-if="!showMailDialog" class="row">
<div class="col-lg-2">
<button class="btn btn-primary mb-2" @click="internMail($event)" :title="$p.t('stv', 'bccEMail')">
<button class="btn btn-primary mb-2" @click="createMailLinks($event, 'intern')" :title="$p.t('stv', 'bccEMail')">
<i class="fa-solid fa-mail"></i> {{$p.t('stv', 'internEMail')}}
</button>
</div>
</div>
<div class="row">
<div v-if="!showMailDialog" class="row">
<div class="col-lg-2">
<button class="btn btn-primary mb-2" @click="privateMail($event)" :title="$p.t('stv', 'bccEMail')">
<button class="btn btn-primary mb-2" @click="createMailLinks($event, 'private')" :title="$p.t('stv', 'bccEMail')">
<i class="fa-solid fa-mail"></i> {{$p.t('stv', 'privateEMail')}}
</button>
</div>
</div>
</div>`
<div v-if="showMailDialog" class="mt-3">
<div v-if="mailLinks.length > 1" class="mt-2">
<p>{{$p.t('stv', 'zuvieleEMails')}}</p>
<div
v-for="(link,index) in mailLinks"
:key="index"
class="mb-2">
<a
:href="link"
@click.prevent="handleMailLink"
>
Email {{ index + 1 }}
</a>
</div>
<a
class="btn btn-outline-secondary m-2"
@click.prevent="reset"
>
<span class="fa-solid fa-rotate-right" :title="this.$p.t('ui','zurueck')" ></span>
</a>
</div>
<div v-else>
<a
:href="mailLinks[0]"
@click.prevent="handleMailLink"
class="btn btn-primary m-2"
>
{{$p.t('ui', 'openInMailClient')}}
</a>
<a
class="btn btn-outline-secondary m-2"
@click.prevent="reset"
>
<span class="fa-solid fa-rotate-right" :title="this.$p.t('ui','zurueck')" ></span>
</a>
</div>
</div>
`
};
+76 -2
View File
@@ -40,6 +40,80 @@ export async function splitMailsHelper(mails, event, subject, alertPluginRef, ph
window.location.href = mailLink;
}
}
}
}
}
/**
* 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;
}
+20
View File
@@ -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'
)
)
),
);