From 0201298cd8f767389789f7c35897985d4475836a Mon Sep 17 00:00:00 2001 From: Thomas B. <thomas@roundcube.net> Date: Mon, 16 Sep 2013 13:47:24 -0400 Subject: [PATCH] Merge pull request #118 from Dennis1993/patch-12 --- program/steps/mail/compose.inc | 3 +++ program/js/editor.js | 3 +++ program/steps/settings/func.inc | 29 +++++++++++++++++------------ program/steps/mail/sendmail.inc | 6 ++++-- program/steps/settings/save_prefs.inc | 1 + config/defaults.inc.php | 4 ++++ 6 files changed, 32 insertions(+), 14 deletions(-) diff --git a/config/defaults.inc.php b/config/defaults.inc.php index 95e024c..97c8f3b 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -984,5 +984,9 @@ // Georgia, Helvetica, Impact, Tahoma, Terminal, Times New Roman, Trebuchet MS, Verdana $config['default_font'] = 'Verdana'; +// Default font size for composed HTML message. +// Supported sizes: 8pt, 10pt, 12pt, 14pt, 18pt, 24pt, 36pt +$config['default_font_size'] = '10pt'; + // Enables display of email address with name instead of a name (and address in title) $config['message_show_email'] = false; diff --git a/program/js/editor.js b/program/js/editor.js index e403d1f..e1ef368 100644 --- a/program/js/editor.js +++ b/program/js/editor.js @@ -80,6 +80,9 @@ if (rcmail.env.default_font) $(tinyMCE.get(rcmail.env.composebody).getBody()).css('font-family', rcmail.env.default_font); + if (rcmail.env.default_font_size) + $(tinyMCE.get(rcmail.env.composebody).getBody()).css('font-size', rcmail.env.default_font_size); + if (elem && elem.type == 'select-one') { rcmail.change_identity(elem); // Focus previously focused element diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 39dca3b..30c9f79 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -148,6 +148,9 @@ $OUTPUT->set_env('default_font', $font); } +// default font size for HTML editor +$OUTPUT->set_env('default_font_size', $RCMAIL->config->get('default_font_size')); + // get reference message and set compose mode if ($msg_uid = $COMPOSE['param']['draft_uid']) { $compose_mode = RCUBE_COMPOSE_DRAFT; diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 779fb87..8fe1496 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -473,8 +473,10 @@ $message_body = get_input_value('_message', RCUBE_INPUT_POST, TRUE, $message_charset); if ($isHtml) { - $font = rcube_fontdefs($RCMAIL->config->get('default_font')); - $bstyle = $font && is_string($font) ? " style='font-family: $font'" : ''; + $font = rcube_fontdefs($RCMAIL->config->get('default_font')); + $font = $font && is_string($font) ? ' '.$font : NULL; + $font_size = $RCMAIL->config->get('default_font_size'); + $bstyle = " style='font: ".$font_size.$font.";'"; // append doctype and html/body wrappers $message_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">' . diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index ecd35e9..b492c96 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -844,23 +844,28 @@ continue 2; } - $field_id = 'rcmfd_default_font'; - $fonts = rcube_fontdefs(); - $selected = $config['default_font']; + // Default font size + $field_id = 'rcmfd_default_font_size'; + $select_default_font_size = new html_select(array('name' => '_default_font_size', 'id' => $field_id)); - $select = '<select name="_default_font" id="'.$field_id.'">'; - $select .= '<option value=""' . (!$selected ? ' selected="selected"' : '') . '>---</option>'; - foreach ($fonts as $fname => $font) { - $select .= '<option value="'.$fname.'"' - . ($fname == $selected ? ' selected="selected"' : '') - . ' style=\'font-family: ' . $font . '\'>' - . Q($fname) . '</option>'; + $fontsizes = array('8pt', '10pt', '12pt', '14pt', '18pt', '24pt', '36pt'); + foreach ($fontsizes as $size) { + $select_default_font_size->add($size, $size); } - $select .= '</select>'; + + // Default font + $field_id = 'rcmfd_default_font'; + $select_default_font = new html_select(array('name' => '_default_font', 'id' => $field_id)); + + $fonts = rcube_fontdefs(); + foreach ($fonts as $fname => $font) { + $select_default_font->add($fname, $fname); + } $blocks['main']['options']['default_font'] = array( 'title' => html::label($field_id, Q(rcube_label('defaultfont'))), - 'content' => $select + 'content' => $select_default_font_size->show($RCMAIL->config->get('default_font_size', 1)). + $select_default_font->show($RCMAIL->config->get('default_font', 1)) ); } break; diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 3e8b1d1..717c7ad 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -89,6 +89,7 @@ 'reply_mode' => isset($_POST['_reply_mode']) ? intval($_POST['_reply_mode']) : 0, 'strip_existing_sig' => isset($_POST['_strip_existing_sig']), 'default_font' => get_input_value('_default_font', RCUBE_INPUT_POST), + 'default_font_size' => get_input_value('_default_font_size', RCUBE_INPUT_POST), 'forward_attachment' => !empty($_POST['_forward_attachment']), ); -- Gitblit v1.9.1