From 1fb46bb74c29bdaf2f87ff271767bb04b339fe35 Mon Sep 17 00:00:00 2001 From: ralf Date: Wed, 11 May 2022 18:05:54 +0200 Subject: [PATCH] display attachments also as a block (fieldset) replacing the ruler, if one is configured --- api/src/Etemplate/Widget/HtmlArea.php | 2 +- mail/inc/class.mail_compose.inc.php | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/api/src/Etemplate/Widget/HtmlArea.php b/api/src/Etemplate/Widget/HtmlArea.php index b6ed91c0cb..f4a05133a5 100644 --- a/api/src/Etemplate/Widget/HtmlArea.php +++ b/api/src/Etemplate/Widget/HtmlArea.php @@ -203,7 +203,7 @@ class HtmlArea extends Etemplate\Widget * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ */ - body { + body, p, div { font-family: $font_family; font-size: $font_size; line-height: 1.4; diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index d8f6ce15de..c792e50877 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -1165,7 +1165,7 @@ class mail_compose if ($content['mimeType'] === 'html') { $start = "
\n"; - $before = $disableRuler ? '' : '
'; + $before = $disableRuler ? '' : '
'; $inbetween = ''; } else @@ -2382,13 +2382,9 @@ class mail_compose */ static function wrapBlockWithPreferredFont($content, $legend, $class=null) { - $options = '';/*' style="border: 2px solid silver; border-left: none; border-right: none;'. - 'font-family: '.($GLOBALS['egw_info']['user']['preferences']['common']['rtf_font'] ?? 'arial, helvetica, sans-serif'). - '; font-size: '.($GLOBALS['egw_info']['user']['preferences']['common']['rtf_size'] ?? '10').'pt"';*/ - if (!empty($class)) $options = ' class="'.htmlspecialchars($class).'"'; - return Api\Html::fieldset($content, $legend, $options); + return Api\Html::fieldset($content, $legend, $options ?? ''); } /** @@ -2532,9 +2528,17 @@ class mail_compose case 'html': $body = "\n".$_formData['body']; + if (!empty($attachment_links)) { - if (strpos($body, '') !== false) + // if we have a ruler, replace it with the attachment block + static $ruler = '
]*>#', $attachment_links, $body); + } + // else place it before the signature + elseif (strpos($body, '') !== false) { $body = str_replace('', $attachment_links.'', $body); } @@ -2543,6 +2547,8 @@ class mail_compose $body .= $attachment_links; } } + $body = str_replace($ruler, 'setBody($this->convertHTMLToText($body, true, true). @@ -2714,7 +2720,7 @@ class mail_compose } elseif ($html) { - return '

'.lang('Download attachments').":

\n\n"; + return self::wrapBlockWithPreferredFont("\n", lang('Download attachments'), 'attachmentLinks'); } return lang('Download attachments').":\n- ".implode("\n- ", $links)."\n"; }