Files
FHC-Core/public/js/helpers/EmailHelpers.js
T
Johann Hoffmann d0adf2dfc3 improved assistenz subqueries for zweitbetreuer infos by using common table expression instead of 8 subqueries; adapted splitMailsHelper function to take in body parameter to set default email text by parameter; dateStyles adapted so "in 12 days" also applies to termine without uploads; titleEdit modal in student & studentDetail component; send email to relevant assistenzen & projektarbeit betreuer about change from old to new title; 2nd flat table in AbgabetoolAssistenz that provides a list of all projektarbeittermine so it can be filtered & multiselected; multi delete & multi edit on these selected termine; tried to introduce a media query for zoomed in desktop users that shrinks fontsize and tabulator rows/cells; standard assistenz table column definitions have sensible minWidths & most columns are default invisible; fancy multiselect headerfilter on qualitygate 1/2 status column; actually figured out a vue watcher race codnition triggering loadProjektarbeiten twice unnecessarily; added a reload Button in case one observes a faulty reactivity somewhere in the table; fancy multiselect headerfilter on termin status column for flat table; Preselect current Semester & autoapply Filter for it; WIP refine new table & hunt for bugz; WIP working on the exact custom select handler Handling with filtered datasets; fixed root element style on legacy php view for abgabetool in old cis; WIP define more accurate allowed to delete & allowed to Edit conditions for abgabetermine -> currently benotet quality gates can be edited/deleted!!!!!
2026-05-06 13:46:26 +02:00

56 lines
1.6 KiB
JavaScript

export async function splitMailsHelper(mails, event, subject, body, alertPluginRef, phrasenPluginRef) {
let splititem = ",";
let maillist = mails.join(splititem);
let mailto = "";
const encodedBody = body && typeof body === 'string' ? encodeURIComponent(body) : null;
const subjectlength = subject && typeof subject === 'string' ? subject.length + 9 : 0;
const bodylength = encodedBody ? encodedBody.length + 6 : 0;
const overhead = subjectlength + bodylength;
debugger
if (overhead > 2024)
{
await alertPluginRef.alertWarning({message: phrasenPluginRef.t('ui', 'bodyZuLang')});
return;
}
if (maillist.length > 2024)
{
if (await alertPluginRef.confirm({message: phrasenPluginRef.t('ui', 'zuvieleEMails') }) === false)
return;
}
let firstrun = true;
let useBcc = event?.ctrlKey || event?.metaKey;
while (maillist.length > 0)
{
if (maillist.length + overhead > 2024)
{
let splitposition = maillist.lastIndexOf(splititem, 1900 - overhead);
mailto = maillist.substring(0, splitposition);
maillist = maillist.substring(splitposition + 1);
}
else
{
mailto = maillist;
maillist = "";
}
let mailLink = useBcc ? `mailto:?bcc=${mailto}` : `mailto:${mailto}`;
if (subject && typeof subject === 'string') mailLink += `?subject=${subject}`;
if (encodedBody) mailLink += `&body=${encodedBody}`;
if (firstrun)
{
window.location.href = mailLink;
firstrun = false;
}
else
{
if (await alertPluginRef.confirm({message: phrasenPluginRef.t('stv', 'weitereEMail')}) === true)
{
window.location.href = mailLink;
}
}
}
}