From ff7be4946a7ccd600c54d0c6c452a46838ccd64a Mon Sep 17 00:00:00 2001 From: Fabian Helfer Date: Fri, 9 Jan 2026 10:01:31 +0100 Subject: [PATCH 1/3] [Fix] #0046784 Mail: Placeholder Checkbox missing --- .../Mail/classes/class.ilMailFormGUI.php | 148 +++++++++--------- 1 file changed, 77 insertions(+), 71 deletions(-) diff --git a/components/ILIAS/Mail/classes/class.ilMailFormGUI.php b/components/ILIAS/Mail/classes/class.ilMailFormGUI.php index 0249ebad6802..87b870378bc3 100755 --- a/components/ILIAS/Mail/classes/class.ilMailFormGUI.php +++ b/components/ILIAS/Mail/classes/class.ilMailFormGUI.php @@ -35,6 +35,8 @@ use ILIAS\Data\Clock\ClockFactory; use ILIAS\Data\Factory as DataFactory; use ILIAS\Mail\Folder\MailScheduleData; +use ILIAS\UI\URLBuilder; +use ILIAS\Data\URI; /** * @ilCtrl_Calls ilMailFormGUI: ilMailAttachmentGUI, ilMailSearchGUI, ilMailSearchCoursesGUI, ilMailSearchGroupsGUI, ilMailingListsGUI, ilMailFormUploadHandlerGUI @@ -53,6 +55,8 @@ class ilMailFormGUI final public const string MAIL_FORM_TYPE_FORWARD = 'forward'; final public const string MAIL_FORM_TYPE_DRAFT = 'draft'; final public const string MAIL_FORM_TYPE_OUTBOX = 'outbox'; + final public const string MAIL_FORM_MODE_REGULAR_MAIL = 'regular_mail'; + final public const string MAIL_FORM_MODE_SERIAL_LETTER = 'serial_letter'; private readonly ilGlobalTemplateInterface $tpl; private readonly ilCtrlInterface $ctrl; @@ -275,7 +279,7 @@ public function saveMessageToOutbox(array $form_values, Form $form): void ilUtil::securePlainString($form_values['m_subject'] ?? $this->lng->txt('mail_no_subject')), $sanitized_message, $files, - $form_values['use_placeholders'], + ilSession::get('mail_mode') === self::MAIL_FORM_MODE_SERIAL_LETTER, $outbox_id ?? null ), $form_values['use_schedule']['m_schedule'] @@ -356,7 +360,7 @@ public function sendMessage(): void ilUtil::securePlainString($value['m_subject']), $value['m_message'], $files, - $value['use_placeholders'] + ilSession::get('mail_mode') === self::MAIL_FORM_MODE_SERIAL_LETTER, ) ) { $this->showSubmissionErrors($errors); @@ -456,7 +460,7 @@ public function saveDraft(): void $value['m_message'], $draft_id, $value['use_schedule']['m_schedule'] ?? null, - $value['use_placeholders'], + ilSession::get('mail_mode') === self::MAIL_FORM_MODE_SERIAL_LETTER, ilMailFormCall::getContextId(), ilMailFormCall::getContextParameters() ); @@ -746,6 +750,7 @@ public function showForm(?Form $form = null): void break; case self::MAIL_FORM_TYPE_NEW: + ilSession::clear('mail_mode'); ilSession::clear('draft'); ilSession::clear('outbox'); // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails. @@ -783,6 +788,7 @@ public function showForm(?Form $form = null): void break; case self::MAIL_FORM_TYPE_ROLE: + ilSession::set('mail_mode', self::MAIL_FORM_MODE_SERIAL_LETTER); $roles = []; if ($this->http->wrapper()->post()->has('roles')) { $roles = $this->http->wrapper()->post()->retrieve( @@ -933,7 +939,7 @@ protected function saveMailBeforeSearch(): void ilUtil::securePlainString($result['m_subject']->getValue()), ilUtil::securePlainString($result['m_message']->getValue()), $resource_collection_id, - (bool) $result['use_placeholders']->getValue(), + ilSession::get('mail_mode') === self::MAIL_FORM_MODE_SERIAL_LETTER, ilMailFormCall::getContextId(), ilMailFormCall::getContextParameters() ); @@ -1093,24 +1099,22 @@ protected function buildFormElements(?array $mail_data): array $this->lng->txt('message_content') )->withValue($mail_data['m_message'] ?? ''); - $use_placeholders = $ff->hidden()->withValue('0'); + $mode = ilSession::get('mail_mode') ?: self::MAIL_FORM_MODE_REGULAR_MAIL; $placeholders = []; - foreach ($context->getPlaceholders() as $key => $value) { - $placeholders[$value['placeholder']] = $value['label']; - } - if (count($placeholders) > 0) { - $m_message = $m_message - ->withMustacheVariables( - $placeholders, - $this->lng->txt('mail_nacc_use_placeholder') . '
' - . sprintf($this->lng->txt('placeholders_advise'), '
') - ) - ; - $use_placeholders = $use_placeholders->withValue('1'); + if ($mode === self::MAIL_FORM_MODE_SERIAL_LETTER) { + foreach ($context->getPlaceholders() as $key => $value) { + $placeholders[$value['placeholder']] = $value['label']; + } + if (count($placeholders) > 0) { + $m_message = $m_message + ->withMustacheVariables( + $placeholders, + $this->lng->txt('mail_nacc_use_placeholder') . '
' + . sprintf($this->lng->txt('placeholders_advise'), '
') + ) + ; + } } - $use_placeholders = $use_placeholders->withAdditionalTransformation( - $this->refinery->kindlyTo()->bool() - ); if ($signal !== null) { $m_subject = $m_subject->withAdditionalOnLoadCode( @@ -1200,7 +1204,6 @@ function (?array $v) { $elements['use_schedule'] = $use_schedule_input; - $elements['use_placeholders'] = $use_placeholders; $section = $ff->section( $elements, $this->lng->txt('compose') @@ -1218,16 +1221,7 @@ protected function addToolbarButtons(): void $action = $this->ctrl->getFormAction($this, 'searchUsers'); $btn = $bf->standard( $this->lng->txt('search_recipients'), - '' - )->withAdditionalOnLoadCode( - function ($id) use ($action) { - return "document.getElementById('{$id}').addEventListener('click', function (event) { - let mailform = document.querySelector('form.c-form'); - let btn = mailform.querySelector('button'); - btn.formAction = '{$action}'; - mailform.requestSubmit(btn); - });"; - } + $action, ); $this->toolbar->addComponent($btn); @@ -1235,32 +1229,14 @@ function ($id) use ($action) { $action = $this->ctrl->getFormAction($this, 'searchCoursesTo'); $btn = $bf->standard( $this->lng->txt('mail_my_courses'), - '' - )->withAdditionalOnLoadCode( - function ($id) use ($action) { - return "document.getElementById('{$id}').addEventListener('click', function (event) { - let mailform = document.querySelector('form.c-form'); - let btn = mailform.querySelector('button'); - btn.formAction = '{$action}'; - mailform.requestSubmit(btn); - });"; - } + $action, ); $this->toolbar->addComponent($btn); $action = $this->ctrl->getFormAction($this, 'searchGroupsTo'); $btn = $bf->standard( $this->lng->txt('mail_my_groups'), - '' - )->withAdditionalOnLoadCode( - function ($id) use ($action) { - return "document.getElementById('{$id}').addEventListener('click', function (event) { - let mailform = document.querySelector('form.c-form'); - let btn = mailform.querySelector('button'); - btn.formAction = '{$action}'; - mailform.requestSubmit(btn); - });"; - } + $action ); $this->toolbar->addComponent($btn); @@ -1268,16 +1244,7 @@ function ($id) use ($action) { $action = $this->ctrl->getFormAction($this, 'searchMailingListsTo'); $btn = $bf->standard( $this->lng->txt('mail_my_mailing_lists'), - '' - )->withAdditionalOnLoadCode( - function ($id) use ($action) { - return "document.getElementById('{$id}').addEventListener('click', function (event) { - let mailform = document.querySelector('form.c-form'); - let btn = mailform.querySelector('button'); - btn.formAction = '{$action}'; - mailform.requestSubmit(btn); - });"; - } + $action ); $this->toolbar->addComponent($btn); } @@ -1285,17 +1252,56 @@ function ($id) use ($action) { $action = $this->ctrl->getFormAction($this, 'editAttachments'); $btn = $bf->standard( $this->lng->txt('edit_attachments'), - '' - )->withAdditionalOnLoadCode( - function ($id) use ($action) { - return "document.getElementById('{$id}').addEventListener('click', function (event) { - let mailform = document.querySelector('form.c-form'); - let btn = mailform.querySelector('button'); - btn.formAction = '{$action}'; - mailform.requestSubmit(btn); - });"; - } + $action ); $this->toolbar->addComponent($btn); + + $current_mode = ilSession::get('mail_mode') ?: self::MAIL_FORM_MODE_REGULAR_MAIL; + $action = $this->ctrl->getFormAction($this, 'toggleMailMode'); + $url_builder = new UrlBuilder(new URI(ILIAS_HTTP_PATH . '/' . $action)); + [$url_builder, $mail_mode_parameter] = $url_builder->acquireParameter(['mail', 'form'], 'mail_mode'); + $btn = $this->ui_factory->viewControl()->mode( + [ + $this->lng->txt(self::MAIL_FORM_MODE_REGULAR_MAIL) => (string) $url_builder->withParameter($mail_mode_parameter, self::MAIL_FORM_MODE_REGULAR_MAIL)->buildURI(), + $this->lng->txt(self::MAIL_FORM_MODE_SERIAL_LETTER) => (string) $url_builder->withParameter($mail_mode_parameter, self::MAIL_FORM_MODE_SERIAL_LETTER)->buildURI(), + ], + 'Modes' + )->withActive($this->lng->txt($current_mode)); + $this->toolbar->addComponent($btn); + + $this->tpl->addOnLoadCode( + "document.getElementById('{$this->toolbar->getId()}').querySelectorAll('button').forEach(function(button) { + button.addEventListener('click', function(event) { + event.preventDefault(); + event.stopPropagation(); + event.stopImmediatePropagation(); + + let mailform = document.querySelector('form.c-form'); + let action = button.getAttribute('data-action'); + if (action && mailform) { + let submitBtn = mailform.querySelector('button[type=\"submit\"]'); + if (submitBtn) { + submitBtn.formAction = action; + mailform.requestSubmit(btn); + } else { + mailform.action = action; + mailform.submit(); + } + } + return false; + }, true); + });" + ); + } + + public function toggleMailMode(): void + { + $this->saveMailBeforeSearch(); + + $mode = $this->getQueryParam('mail_form_mail_mode', $this->refinery->kindlyTo()->string(), self::MAIL_FORM_MODE_REGULAR_MAIL); + if (in_array($mode, [self::MAIL_FORM_MODE_REGULAR_MAIL, self::MAIL_FORM_MODE_SERIAL_LETTER], true)) { + ilSession::set('mail_mode', $mode); + } + $this->searchResults(); } } From 3d081841bb7c70400093808bd96300150a630dae Mon Sep 17 00:00:00 2001 From: Fabian Helfer Date: Fri, 9 Jan 2026 10:09:50 +0100 Subject: [PATCH 2/3] [Fix] #0046784 Mail: Add language Variables --- lang/ilias_de.lang | 2 ++ lang/ilias_en.lang | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lang/ilias_de.lang b/lang/ilias_de.lang index e3171cd20843..07fed7a7747f 100644 --- a/lang/ilias_de.lang +++ b/lang/ilias_de.lang @@ -11772,6 +11772,7 @@ mail#:#only_inbox_trash_info#:#Falls aktiviert, werden ausschließlich Mails gel mail#:#orphaned_mail_body#:#Es existieren alte oder verwaiste Mails in den folgenden Ordnern. Beachten Sie, dass diese Mails in kürze automatisch gelöscht werden. mail#:#orphaned_mail_subject#:#Benachrichtigung über alte Mails mail#:#placeholders_advise#:#Persönliche Platzhalter werden nur für Personen im „An”-Feld ersetzt. Personen im „CC”-Feld und „BCC”-Feld erhalten die Mail mit nicht-ersetzten Platzhaltern. +mail#:#regular_mail#:#Reguläre Mail mail#:#search_content#:#Suchergebnis mail#:#search_recipients#:#Personen suchen mail#:#second_email_missing_info#:#Auswahl nicht möglich, da keine zweite E-Mail-Adresse eingetragen wurde @@ -11780,6 +11781,7 @@ mail#:#send_mail_admins#:#Administration mail#:#send_mail_members#:#Mitglied mail#:#send_mail_to#:#Mail an mail#:#send_mail_tutors#:#Kursbetreuung +mail#:#serial_letter#:#Serienbrief mail#:#show_mail_settings#:#Einstellungen anzeigen mail#:#show_mail_settings_info#:#Aktiviert die Anzeige der Mail-Einstellungen im Bereich 'Einstellungen' oder 'Mail'. Benutzer können die Mail-Einstellungen nur ändern, wenn die Konfiguration des Benutzer-Profils dies erlaubt. Wenn Benutzer nicht berechtigt sind, die Mail-Einstellung ihrer Profils zu ändern, dann gelten die globalen Einstellungen. Dies gilt auch dann, wenn Benutzer in der Vergangenheit die Berechtigung zum Ändern der Mail-Einstellungen hatten und persönliche Einstellungen vorgenommen haben. mail#:#system_notification_installation_changed_by#:#Geändert durch diff --git a/lang/ilias_en.lang b/lang/ilias_en.lang index 375d1ee00f6b..566626c2d726 100644 --- a/lang/ilias_en.lang +++ b/lang/ilias_en.lang @@ -11774,6 +11774,7 @@ mail#:#only_inbox_trash_info#:#Only delete e-mails that are located in the Inbox mail#:#orphaned_mail_body#:#Your mailbox contains the following old or orphaned mails. Please note that these mails will soon be automatically deleted. mail#:#orphaned_mail_subject#:#Notification of old mails mail#:#placeholders_advise#:#Personal placeholders are only replaced with user-specific information for recipients listed in the ‘To’ field.%s Personal placeholders for recipients listed in the CC and BCC fields are NOT replaced with user-specific information and instead show up as placeholders. +mail#:#regular_mail#:#Regular Mail mail#:#search_content#:#Search Result mail#:#search_recipients#:#Look up Users mail#:#second_email_missing_info#:#Selection not possible because no second e-mail address has been entered. @@ -11782,6 +11783,7 @@ mail#:#send_mail_admins#:#All Administrators mail#:#send_mail_members#:#All Members mail#:#send_mail_to#:#Mail to mail#:#send_mail_tutors#:#All Tutors +mail#:#serial_letter#:#Serial Letter mail#:#show_mail_settings#:#Show Mail Settings mail#:#show_mail_settings_info#:#Enable individual users to alter their mail settings, thereby overriding the global mail settings that would otherwise apply to them. ‘Mail Settings’ are accessible via their ‘Personal Settings’ or ‘Communication > Mail’. Note: In order for users to be allowed to change their individual mail settings and thereby override the global settings, this needs to be set in the 'Standard Fields' section of the global user account administration settings. If users do not have the permission to change these profile settings, the global default is applied even if users were able to and did change their personal mail settings in the past. mail#:#system_notification_installation_changed_by#:#Changed by From ae080d0a21de56efbcec9313c17dbf0a90c0d59e Mon Sep 17 00:00:00 2001 From: Fabian Helfer Date: Fri, 9 Jan 2026 15:04:01 +0100 Subject: [PATCH 3/3] [Fix] #0046784 Mail: remove ilSession to store mode --- .../Mail/classes/class.ilMailFormGUI.php | 107 ++++++++++++++---- lang/ilias_de.lang | 3 +- lang/ilias_en.lang | 1 + 3 files changed, 86 insertions(+), 25 deletions(-) diff --git a/components/ILIAS/Mail/classes/class.ilMailFormGUI.php b/components/ILIAS/Mail/classes/class.ilMailFormGUI.php index 87b870378bc3..1a7fd03e8273 100755 --- a/components/ILIAS/Mail/classes/class.ilMailFormGUI.php +++ b/components/ILIAS/Mail/classes/class.ilMailFormGUI.php @@ -279,7 +279,7 @@ public function saveMessageToOutbox(array $form_values, Form $form): void ilUtil::securePlainString($form_values['m_subject'] ?? $this->lng->txt('mail_no_subject')), $sanitized_message, $files, - ilSession::get('mail_mode') === self::MAIL_FORM_MODE_SERIAL_LETTER, + $form_values['use_placeholders'], $outbox_id ?? null ), $form_values['use_schedule']['m_schedule'] @@ -360,7 +360,7 @@ public function sendMessage(): void ilUtil::securePlainString($value['m_subject']), $value['m_message'], $files, - ilSession::get('mail_mode') === self::MAIL_FORM_MODE_SERIAL_LETTER, + $value['use_placeholders'], ) ) { $this->showSubmissionErrors($errors); @@ -460,7 +460,7 @@ public function saveDraft(): void $value['m_message'], $draft_id, $value['use_schedule']['m_schedule'] ?? null, - ilSession::get('mail_mode') === self::MAIL_FORM_MODE_SERIAL_LETTER, + $value['use_placeholders'], ilMailFormCall::getContextId(), ilMailFormCall::getContextParameters() ); @@ -750,7 +750,6 @@ public function showForm(?Form $form = null): void break; case self::MAIL_FORM_TYPE_NEW: - ilSession::clear('mail_mode'); ilSession::clear('draft'); ilSession::clear('outbox'); // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails. @@ -788,7 +787,6 @@ public function showForm(?Form $form = null): void break; case self::MAIL_FORM_TYPE_ROLE: - ilSession::set('mail_mode', self::MAIL_FORM_MODE_SERIAL_LETTER); $roles = []; if ($this->http->wrapper()->post()->has('roles')) { $roles = $this->http->wrapper()->post()->retrieve( @@ -856,10 +854,10 @@ public function showForm(?Form $form = null): void } $this->tpl->parseCurrentBlock(); - $this->addToolbarButtons(); if ($form === null) { $form = $this->buildForm($mail_data); } + $this->addToolbarButtons($form); $this->tpl->setVariable('FORM', $this->ui_renderer->render($form)); $this->tpl->addJavaScript('assets/js/ilMailComposeFunctions.js'); $this->tpl->printToStdout(); @@ -915,10 +913,14 @@ public function cancelMail(): void $this->showForm(); } - protected function saveMailBeforeSearch(): void + protected function saveMailBeforeSearch(?array $input_results = null): void { - $form = $this->buildForm()->withRequest($this->request); - $result = $form->getInputGroup()->getInputs()[0]->getInputs(); + if (!$input_results) { + $form = $this->buildForm()->withRequest($this->request); + $result = $form->getInputGroup()->getInputs()[0]->getInputs(); + } else { + $result = $input_results; + } $resource_collection_id = null; $attachments = $result['attachments']->getValue(); @@ -939,7 +941,7 @@ protected function saveMailBeforeSearch(): void ilUtil::securePlainString($result['m_subject']->getValue()), ilUtil::securePlainString($result['m_message']->getValue()), $resource_collection_id, - ilSession::get('mail_mode') === self::MAIL_FORM_MODE_SERIAL_LETTER, + (bool) $result['use_placeholders']->getValue(), ilMailFormCall::getContextId(), ilMailFormCall::getContextParameters() ); @@ -1099,7 +1101,9 @@ protected function buildFormElements(?array $mail_data): array $this->lng->txt('message_content') )->withValue($mail_data['m_message'] ?? ''); - $mode = ilSession::get('mail_mode') ?: self::MAIL_FORM_MODE_REGULAR_MAIL; + $use_placeholder_value = $mail_data['use_placeholders'] ?? $this->mail_form_type === self::MAIL_FORM_TYPE_ROLE; + $mode = $use_placeholder_value ? self::MAIL_FORM_MODE_SERIAL_LETTER : self::MAIL_FORM_MODE_REGULAR_MAIL; + $use_placeholders = $ff->hidden()->withValue($use_placeholder_value ? '1' : '0'); $placeholders = []; if ($mode === self::MAIL_FORM_MODE_SERIAL_LETTER) { foreach ($context->getPlaceholders() as $key => $value) { @@ -1115,6 +1119,10 @@ protected function buildFormElements(?array $mail_data): array ; } } + $use_placeholders = $use_placeholders->withAdditionalTransformation( + $this->refinery->kindlyTo()->bool() + ); + if ($signal !== null) { $m_subject = $m_subject->withAdditionalOnLoadCode( @@ -1204,6 +1212,7 @@ function (?array $v) { $elements['use_schedule'] = $use_schedule_input; + $elements['use_placeholders'] = $use_placeholders; $section = $ff->section( $elements, $this->lng->txt('compose') @@ -1214,14 +1223,23 @@ function (?array $v) { ]; } - protected function addToolbarButtons(): void + protected function addToolbarButtons(Form $form): void { $bf = $this->ui_factory->button(); $action = $this->ctrl->getFormAction($this, 'searchUsers'); $btn = $bf->standard( $this->lng->txt('search_recipients'), - $action, + '', + )->withAdditionalOnLoadCode( + function ($id) use ($action) { + return "document.getElementById('{$id}').addEventListener('click', function (event) { + let mailform = document.querySelector('form.c-form'); + let btn = mailform.querySelector('button'); + btn.formAction = '{$action}'; + mailform.requestSubmit(btn); + });"; + } ); $this->toolbar->addComponent($btn); @@ -1229,14 +1247,32 @@ protected function addToolbarButtons(): void $action = $this->ctrl->getFormAction($this, 'searchCoursesTo'); $btn = $bf->standard( $this->lng->txt('mail_my_courses'), - $action, + '' + )->withAdditionalOnLoadCode( + function ($id) use ($action) { + return "document.getElementById('{$id}').addEventListener('click', function (event) { + let mailform = document.querySelector('form.c-form'); + let btn = mailform.querySelector('button'); + btn.formAction = '{$action}'; + mailform.requestSubmit(btn); + });"; + } ); $this->toolbar->addComponent($btn); $action = $this->ctrl->getFormAction($this, 'searchGroupsTo'); $btn = $bf->standard( $this->lng->txt('mail_my_groups'), - $action + '' + )->withAdditionalOnLoadCode( + function ($id) use ($action) { + return "document.getElementById('{$id}').addEventListener('click', function (event) { + let mailform = document.querySelector('form.c-form'); + let btn = mailform.querySelector('button'); + btn.formAction = '{$action}'; + mailform.requestSubmit(btn); + });"; + } ); $this->toolbar->addComponent($btn); @@ -1244,7 +1280,16 @@ protected function addToolbarButtons(): void $action = $this->ctrl->getFormAction($this, 'searchMailingListsTo'); $btn = $bf->standard( $this->lng->txt('mail_my_mailing_lists'), - $action + '' + )->withAdditionalOnLoadCode( + function ($id) use ($action) { + return "document.getElementById('{$id}').addEventListener('click', function (event) { + let mailform = document.querySelector('form.c-form'); + let btn = mailform.querySelector('button'); + btn.formAction = '{$action}'; + mailform.requestSubmit(btn); + });"; + } ); $this->toolbar->addComponent($btn); } @@ -1252,11 +1297,21 @@ protected function addToolbarButtons(): void $action = $this->ctrl->getFormAction($this, 'editAttachments'); $btn = $bf->standard( $this->lng->txt('edit_attachments'), - $action + '' + )->withAdditionalOnLoadCode( + function ($id) use ($action) { + return "document.getElementById('{$id}').addEventListener('click', function (event) { + let mailform = document.querySelector('form.c-form'); + let btn = mailform.querySelector('button'); + btn.formAction = '{$action}'; + mailform.requestSubmit(btn); + });"; + } ); $this->toolbar->addComponent($btn); - $current_mode = ilSession::get('mail_mode') ?: self::MAIL_FORM_MODE_REGULAR_MAIL; + $result = $form->getInputGroup()->getInputs()[0]->getInputs(); + $use_placeholders = (bool) $result['use_placeholders']->getValue(); $action = $this->ctrl->getFormAction($this, 'toggleMailMode'); $url_builder = new UrlBuilder(new URI(ILIAS_HTTP_PATH . '/' . $action)); [$url_builder, $mail_mode_parameter] = $url_builder->acquireParameter(['mail', 'form'], 'mail_mode'); @@ -1265,12 +1320,13 @@ protected function addToolbarButtons(): void $this->lng->txt(self::MAIL_FORM_MODE_REGULAR_MAIL) => (string) $url_builder->withParameter($mail_mode_parameter, self::MAIL_FORM_MODE_REGULAR_MAIL)->buildURI(), $this->lng->txt(self::MAIL_FORM_MODE_SERIAL_LETTER) => (string) $url_builder->withParameter($mail_mode_parameter, self::MAIL_FORM_MODE_SERIAL_LETTER)->buildURI(), ], - 'Modes' - )->withActive($this->lng->txt($current_mode)); + 'mail_mode_switch_label' + )->withActive($this->lng->txt($use_placeholders ? self::MAIL_FORM_MODE_SERIAL_LETTER : self::MAIL_FORM_MODE_REGULAR_MAIL)); $this->toolbar->addComponent($btn); - $this->tpl->addOnLoadCode( - "document.getElementById('{$this->toolbar->getId()}').querySelectorAll('button').forEach(function(button) { + "document.getElementById('{$this->toolbar->getId()}') + .querySelector('div[aria-label=\"" . $this->lng->txt('mail_mode_switch_label') . "\"]') + .querySelectorAll('button[data-action]').forEach(function(button) { button.addEventListener('click', function(event) { event.preventDefault(); event.stopPropagation(); @@ -1296,12 +1352,15 @@ protected function addToolbarButtons(): void public function toggleMailMode(): void { - $this->saveMailBeforeSearch(); + $form = $this->buildForm()->withRequest($this->request); $mode = $this->getQueryParam('mail_form_mail_mode', $this->refinery->kindlyTo()->string(), self::MAIL_FORM_MODE_REGULAR_MAIL); if (in_array($mode, [self::MAIL_FORM_MODE_REGULAR_MAIL, self::MAIL_FORM_MODE_SERIAL_LETTER], true)) { - ilSession::set('mail_mode', $mode); + $result = $form->getInputGroup()->getInputs()[0]->getInputs(); + $result['use_placeholders'] = $result['use_placeholders']->withValue($mode === self::MAIL_FORM_MODE_SERIAL_LETTER ? '1' : '0'); } + $this->saveMailBeforeSearch($result ?? null); + $this->searchResults(); } } diff --git a/lang/ilias_de.lang b/lang/ilias_de.lang index 07fed7a7747f..45eebc7a43ae 100644 --- a/lang/ilias_de.lang +++ b/lang/ilias_de.lang @@ -11630,6 +11630,7 @@ mail#:#mail_member_notification#:#Teilnehmerbenachrichtigung mail#:#mail_members_of_mailing_list#:#Mitglieder der Verteilerliste „%s“ mail#:#mail_members_search_continue#:#Weiter mail#:#mail_message_send#:#Die Mail wurde versandt. +mail#:#mail_mode_switch_label#:#Zwischen persönlicher Mail und Serienmail umschalten mail#:#mail_move_error#:#Beim Versuch, Ihre E-Mail zu verschieben, ist ein Fehler aufgetreten. mail#:#mail_move_to#:#Verschieben nach: mail#:#mail_move_to_folder_btn_label#:#Mail verschieben @@ -11772,7 +11773,7 @@ mail#:#only_inbox_trash_info#:#Falls aktiviert, werden ausschließlich Mails gel mail#:#orphaned_mail_body#:#Es existieren alte oder verwaiste Mails in den folgenden Ordnern. Beachten Sie, dass diese Mails in kürze automatisch gelöscht werden. mail#:#orphaned_mail_subject#:#Benachrichtigung über alte Mails mail#:#placeholders_advise#:#Persönliche Platzhalter werden nur für Personen im „An”-Feld ersetzt. Personen im „CC”-Feld und „BCC”-Feld erhalten die Mail mit nicht-ersetzten Platzhaltern. -mail#:#regular_mail#:#Reguläre Mail +mail#:#regular_mail#:#Persönliche Mail mail#:#search_content#:#Suchergebnis mail#:#search_recipients#:#Personen suchen mail#:#second_email_missing_info#:#Auswahl nicht möglich, da keine zweite E-Mail-Adresse eingetragen wurde diff --git a/lang/ilias_en.lang b/lang/ilias_en.lang index 566626c2d726..c9be5eaaa82c 100644 --- a/lang/ilias_en.lang +++ b/lang/ilias_en.lang @@ -11632,6 +11632,7 @@ mail#:#mail_member_notification#:#Participant Notification mail#:#mail_members_of_mailing_list#:#Members of Mailing List "%s" mail#:#mail_members_search_continue#:#Continue mail#:#mail_message_send#:#Message sent. +mail#:#mail_mode_switch_label#:#Switch between personal mail and mail merge mode mail#:#mail_move_error#:#An error occurred while trying to move your mail. mail#:#mail_move_to#:#Move to: mail#:#mail_move_to_folder_btn_label#:#Move Mail