From 399a2d68b6529f19898b6d6ef3c05add128aadfa Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Thu, 03 Sep 2015 03:28:17 -0400 Subject: [PATCH] Make optional adding of standard signature separator - sig_separator (#1487768) --- CHANGELOG | 1 + program/steps/mail/compose.inc | 10 ++++++---- program/steps/settings/func.inc | 14 ++++++++++++++ program/localization/en_US/labels.inc | 1 + program/steps/settings/save_prefs.inc | 1 + config/defaults.inc.php | 3 +++ 6 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index a8a52ca..cee177f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Make optional adding of standard signature separator - sig_separator (#1487768) - Optimize folder_size() on Cyrus IMAP by using special folder annotation (#1490514) - Make optional hidding of folders with name starting with a dot - imap_skip_hidden_folders (#1490468) - Add option to enable HTML editor always, except when replying to plain text messages (#1489365) diff --git a/config/defaults.inc.php b/config/defaults.inc.php index 3bb8cf9..a3b7b53 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -1116,6 +1116,9 @@ // the signature below the quoted text (sig_below = true). $config['sig_below'] = false; +// Enables adding of standard separator to the signature +$config['sig_separator'] = true; + // Use MIME encoding (quoted-printable) for 8bit characters in message body $config['force_7bit'] = false; diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc index e3f6fc8..90d2c30 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -511,6 +511,7 @@ $labels['replyandforwardonly'] = 'replies and forwards only'; $labels['insertsignature'] = 'Insert signature'; $labels['sigbelow'] = 'Place signature below the quoted message'; +$labels['sigseparator'] = 'Force standard separator in signatures'; $labels['previewpanemarkread'] = 'Mark previewed messages as read'; $labels['afternseconds'] = 'after $n seconds'; $labels['reqmdn'] = 'Always request a return receipt'; diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 807d0ef..488b82e 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -484,7 +484,9 @@ $top_posting = intval($RCMAIL->config->get('reply_mode')) > 0 && !$RCMAIL->config->get('sig_below') && ($COMPOSE['mode'] == RCUBE_COMPOSE_REPLY || $COMPOSE['mode'] == RCUBE_COMPOSE_FORWARD); - $separator = $top_posting ? '---' : '-- '; + + $separator = $top_posting ? '---' : '-- '; + $add_separator = (bool) $RCMAIL->config->get('sig_separator'); $field_attrib['onchange'] = rcmail_output::JS_OBJECT_NAME.".change_identity(this)"; $select_from = new html_select($field_attrib); @@ -500,15 +502,15 @@ if ($sql_arr['html_signature']) { $text = $RCMAIL->html2text($html, array('links' => false)); - $text = trim($text); + $text = trim($text, "\r\n"); } else { $t2h = new rcube_text2html($text, false); $html = $t2h->get_html(); } - if (!preg_match('/^--[ -]\r?\n/m', $text)) { - $text = $separator . "\n" . $text; + if ($add_separator && !preg_match('/^--[ -]\r?\n/m', $text)) { + $text = $separator . "\n" . ltrim($text, "\r\n"); $html = $separator . "<br>" . $html; } diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 22c02ee..061ba12 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -874,6 +874,20 @@ ); } + if (!isset($no_override['sig_separator'])) { + if (!$current) { + continue 2; + } + + $field_id = 'rcmfd_sig_separator'; + $input = new html_checkbox(array('name' => '_sig_separator', 'id' => $field_id, 'value' => 1)); + + $blocks['sig']['options']['sig_separator'] = array( + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('sigseparator'))), + 'content' => $input->show($RCMAIL->config->get('sig_separator') ? 1 : 0), + ); + } + if (!isset($no_override['forward_attachment'])) { if (!$current) { continue 2; diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 91104cb..355954c 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -87,6 +87,7 @@ 'reply_mode' => isset($_POST['_reply_mode']) ? intval($_POST['_reply_mode']) : 0, 'sig_below' => isset($_POST['_sig_below']) ? true : false, 'strip_existing_sig' => isset($_POST['_strip_existing_sig']), + 'sig_separator' => isset($_POST['_sig_separator']) ? true : false, 'default_font' => rcube_utils::get_input_value('_default_font', rcube_utils::INPUT_POST), 'default_font_size' => rcube_utils::get_input_value('_default_font_size', rcube_utils::INPUT_POST), 'reply_all_mode' => intval($_POST['_reply_all_mode']), -- Gitblit v1.9.1