mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 06:54:04 +00:00
Merge branch 'feature-777242/StudVW_alternative_Contacting_ma0080' into studvw_lvvw_2026_08_rc_77973_76688
This commit is contained in:
@@ -111,7 +111,8 @@ function generateJSDataStorageObject($indexPage, $calledPath, $calledMethod)
|
||||
'theme' => [
|
||||
'name'=>$ci->config->item('theme_name'),
|
||||
'modes'=>$ci->config->item('theme_modes'),
|
||||
]
|
||||
],
|
||||
'domain' => DOMAIN
|
||||
);
|
||||
|
||||
$toPrint = "\n";
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -54,7 +54,8 @@ export default {
|
||||
cisRoot: String,
|
||||
avatarUrl: String,
|
||||
logoutUrl: String,
|
||||
activeAddons: String // semicolon separated list of active addons
|
||||
activeAddons: String, // semicolon separated list of active addons
|
||||
authUid: String
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
@@ -88,6 +89,7 @@ export default {
|
||||
hasZGVMasterPermission: this.permissions['student/editMakkZgv'],
|
||||
hasZGVDoctorPermission: this.permissions['student/editDokZgv'],
|
||||
hasBismeldenPermission: this.permissions['student/editBismelden'],
|
||||
authUid: this.authUid
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import { splitMailsHelper } from "../../../../helpers/EmailHelpers.js"
|
||||
import { splitMailsHelper } from "../../../../helpers/EmailHelpers.js";
|
||||
import { splitMailLinks } from "../../../../helpers/EmailHelpers.js";
|
||||
import FormInput from "../../../Form/Input.js";
|
||||
import FormForm from "../../../Form/Form.js";
|
||||
|
||||
export default {
|
||||
name: "Kontaktieren",
|
||||
components: {
|
||||
FormInput,
|
||||
FormForm
|
||||
},
|
||||
computed: {
|
||||
internMails() {
|
||||
if (this.modelValue.mail_intern)
|
||||
@@ -21,38 +29,150 @@ export default {
|
||||
props: {
|
||||
modelValue: Object
|
||||
},
|
||||
|
||||
inject: {
|
||||
authUid: {
|
||||
from: 'authUid',
|
||||
required: true
|
||||
},
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
mailLinks: [],
|
||||
mailLinksClicked: [],
|
||||
showMailDialog: false,
|
||||
showDivKomp: false,
|
||||
showDivKompLocalStorageId: 'studvw-contact-showDivKomp'
|
||||
}
|
||||
},
|
||||
activated() {
|
||||
const showDivCompLocalStorage = window.localStorage.getItem(this.showDivKompLocalStorageId);
|
||||
this.showDivKomp = (showDivCompLocalStorage === 'true') ? true : false;
|
||||
},
|
||||
methods: {
|
||||
internMail(event) {
|
||||
if (this.internMails.length)
|
||||
{
|
||||
splitMailsHelper(this.internMails, event, null, null, this.$fhcAlert, this.$p)
|
||||
splitMailsHelper(this.internMails, event, null, null, this.$fhcAlert, this.$p, this.authUid)
|
||||
}
|
||||
},
|
||||
privateMail(event) {
|
||||
if (this.privateMails.length)
|
||||
{
|
||||
splitMailsHelper(this.privateMails, event, null,null, this.$fhcAlert, this.$p)
|
||||
splitMailsHelper(this.privateMails, event, null, null, this.$fhcAlert, this.$p, this.authUid)
|
||||
}
|
||||
},
|
||||
createMailLinks(event, mailGroup){
|
||||
let recipients = mailGroup == 'private' ? this.privateMails : this.internMails;
|
||||
this.mailLinks = splitMailLinks(
|
||||
recipients,
|
||||
"",
|
||||
event.ctrlKey || event.metaKey,
|
||||
this.authUid
|
||||
);
|
||||
this.mailLinksClicked = [];
|
||||
|
||||
this.showMailDialog = true;
|
||||
},
|
||||
handleMailLink(link, index){
|
||||
this.mailLinksClicked.push(index);
|
||||
window.open(link, '_blank', 'noopener');
|
||||
},
|
||||
reset(){
|
||||
this.showMailDialog = false;
|
||||
},
|
||||
onSwitchChange(){
|
||||
window.localStorage.setItem(this.showDivKompLocalStorageId, this.showDivKomp);
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div>
|
||||
<div id="elementID"></div>
|
||||
<div class="row">
|
||||
<div class="col-lg-2">
|
||||
<button class="btn btn-primary mb-2" @click="internMail($event)" :title="$p.t('stv', 'bccEMail')">
|
||||
<i class="fa-solid fa-mail"></i> {{$p.t('stv', 'internEMail')}}
|
||||
</button>
|
||||
<div class="core-kontaktieren">
|
||||
<div id="elementID"></div>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-start pb-3">
|
||||
<a
|
||||
v-if="showMailDialog"
|
||||
class="btn btn-outline-secondary m-2"
|
||||
@click.prevent="reset"
|
||||
>
|
||||
<span class="fa-solid fa-delete-left" :title="this.$p.t('ui','zurueck')" ></span>
|
||||
|
||||
<span>{{ $p.t('ui','zurueck') }}</span>
|
||||
</a>
|
||||
<div v-else> </div>
|
||||
|
||||
<form-input
|
||||
container-class="form-switch mb-0"
|
||||
type="checkbox"
|
||||
:label="$p.t('ui/kompatibilityMode_WebmailClient')"
|
||||
v-model="showDivKomp"
|
||||
@change="onSwitchChange"
|
||||
>
|
||||
</form-input>
|
||||
</div>
|
||||
|
||||
<div v-if="!showDivKomp">
|
||||
<div class="row">
|
||||
<div class="col-lg-2">
|
||||
<button class="btn btn-primary mb-2" @click="internMail($event)" :title="$p.t('stv', 'bccEMail')">
|
||||
<i class="fa-solid fa-mail"></i> {{$p.t('stv', 'internEMail')}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-2">
|
||||
<button class="btn btn-primary mb-2" @click="privateMail($event)" :title="$p.t('stv', 'bccEMail')">
|
||||
<i class="fa-solid fa-mail"></i> {{$p.t('stv', 'privateEMail')}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-2">
|
||||
<button class="btn btn-primary mb-2" @click="privateMail($event)" :title="$p.t('stv', 'bccEMail')">
|
||||
<i class="fa-solid fa-mail"></i> {{$p.t('stv', 'privateEMail')}}
|
||||
</button>
|
||||
|
||||
<div v-if="showDivKomp">
|
||||
|
||||
<div v-if="!showMailDialog" class="row">
|
||||
<div class="col-lg-2">
|
||||
<button class="btn btn-secondary mb-2" @click="createMailLinks($event, 'intern')" :title="$p.t('stv', 'bccEMail')">
|
||||
<i class="fa-solid fa-mail"></i> {{$p.t('stv', 'internEMail')}} ({{$p.t('ui', 'webmailclient')}})
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!showMailDialog" class="row">
|
||||
<div class="col-lg-2">
|
||||
<button class="btn btn-secondary mb-2" @click="createMailLinks($event, 'private')" :title="$p.t('stv', 'bccEMail')">
|
||||
<i class="fa-solid fa-mail"></i> {{$p.t('stv', 'privateEMail')}} ({{$p.t('ui', 'webmailclient')}})
|
||||
</button>
|
||||
</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(link, index)"
|
||||
>
|
||||
Email {{ index + 1 }}
|
||||
</a>
|
||||
<span v-show="mailLinksClicked.includes(index)"> <i class="fa-solid fa-check text-success"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<a
|
||||
:href="mailLinks[0]"
|
||||
@click.prevent="handleMailLink(mailLinks[0], index)"
|
||||
class="btn btn-primary m-2"
|
||||
>
|
||||
{{$p.t('ui', 'openInMailClient')}}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>`
|
||||
};
|
||||
</div>
|
||||
`
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export async function splitMailsHelper(mails, event, subject, body, alertPluginRef, phrasenPluginRef) {
|
||||
export async function splitMailsHelper(mails, event, subject, body, alertPluginRef, phrasenPluginRef, uidCC) {
|
||||
await phrasenPluginRef.loadCategory('ui');
|
||||
|
||||
let splititem = ",";
|
||||
let maillist = mails.join(splititem);
|
||||
let useBcc = event?.ctrlKey || event?.metaKey;
|
||||
@@ -46,7 +47,10 @@ export async function splitMailsHelper(mails, event, subject, body, alertPluginR
|
||||
}
|
||||
|
||||
// construct the clean mailLink
|
||||
let mailLink = useBcc ? `mailto:?bcc=${mailto}` : `mailto:${mailto}`;
|
||||
let mailadressUid = (uidCC && typeof uidCC === 'string')
|
||||
? uidCC + '@' + FHC_JS_DATA_STORAGE_OBJECT.domain
|
||||
: 'noreply@' + FHC_JS_DATA_STORAGE_OBJECT.domain;
|
||||
let mailLink = useBcc ? `mailto:${mailadressUid}?cc=${mailadressUid}&bcc=${mailto}` : `mailto:${mailto}`;
|
||||
if (queryString) {
|
||||
// If using BCC, the string already has a '?', so append with '&'. Otherwise, start with '?'
|
||||
mailLink += useBcc ? `&${queryString}` : `?${queryString}`;
|
||||
@@ -63,4 +67,79 @@ export async function splitMailsHelper(mails, event, subject, body, alertPluginR
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
@@ -49804,7 +49804,7 @@ array(
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'stv',
|
||||
'category' => 'ui',
|
||||
'phrase' => 'weitereEMail',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
@@ -62123,6 +62123,66 @@ I have been informed that I am under no obligation to consent to the transmissio
|
||||
)
|
||||
),
|
||||
// tabulator presets section phrases 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'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ui',
|
||||
'phrase' => 'kompatibilityMode_WebmailClient',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Kompatibilitätsmodus für Webmail',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Open in Compatibility mode (Webmail)',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'ui',
|
||||
'phrase' => 'webmailclient',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Webmail',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'webmail',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user