summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/include/main.inc24
-rw-r--r--program/js/app.js5
-rw-r--r--program/js/editor.js3
-rw-r--r--program/localization/en_US/labels.inc1
-rw-r--r--program/localization/pl_PL/labels.inc1
-rw-r--r--program/steps/mail/compose.inc6
-rw-r--r--program/steps/mail/sendmail.inc19
-rw-r--r--program/steps/settings/func.inc20
-rw-r--r--program/steps/settings/save_prefs.inc1
9 files changed, 73 insertions, 7 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index f6c29d043..8aa38c8d1 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -2408,3 +2408,27 @@ function rcube_autocomplete_init()
$RCMAIL->output->set_env('autocomplete_min_length', $RCMAIL->config->get('autocomplete_min_length'));
$RCMAIL->output->add_label('autocompletechars', 'autocompletemore');
}
+
+function rcube_fontdefs($font = null)
+{
+ $fonts = array(
+ 'Andale Mono' => '"Andale Mono",Times,monospace',
+ 'Arial' => 'Arial,Helvetica,sans-serif',
+ 'Arial Black' => '"Arial Black","Avant Garde",sans-serif',
+ 'Book Antiqua' => '"Book Antiqua",Palatino,serif',
+ 'Courier New' => '"Courier New",Courier,monospace',
+ 'Georgia' => 'Georgia,Palatino,serif',
+ 'Helvetica' => 'Helvetica,Arial,sans-serif',
+ 'Impact' => 'Impact,Chicago,sans-serif',
+ 'Tahoma' => 'Tahoma,Arial,Helvetica,sans-serif',
+ 'Terminal' => 'Terminal,Monaco,monospace',
+ 'Times New Roman' => '"Times New Roman",Times,serif',
+ 'Trebuchet MS' => '"Trebuchet MS",Geneva,sans-serif',
+ 'Verdana' => 'Verdana,Geneva,sans-serif',
+ );
+
+ if ($font)
+ return $fonts[$font];
+
+ return $fonts;
+}
diff --git a/program/js/app.js b/program/js/app.js
index d2b44344e..b6c7d1dfd 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3048,6 +3048,11 @@ function rcube_webmail()
this.display_spellcheck_controls(false);
this.plain2html($('#'+props.id).val(), props.id);
tinyMCE.execCommand('mceAddControl', false, props.id);
+
+ if (this.env.default_font)
+ window.setTimeout(function() {
+ $(tinyMCE.get(props.id).getBody()).css('font-family', rcmail.env.default_font);
+ }, 500);
}
else {
var thisMCE = tinyMCE.get(props.id), existingHtml;
diff --git a/program/js/editor.js b/program/js/editor.js
index 9ad50cea5..5e08671f1 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -66,6 +66,9 @@ function rcmail_editor_callback()
var elem = rcube_find_object('_from'),
fe = rcmail.env.compose_focus_elem;
+ if (rcmail.env.default_font)
+ $(tinyMCE.get(rcmail.env.composebody).getBody()).css('font-family', rcmail.env.default_font);
+
if (elem && elem.type == 'select-one') {
rcmail.change_identity(elem);
// Focus previously focused element
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 51f5530da..f192209ed 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -407,6 +407,7 @@ $labels['advancedoptions'] = 'Advanced options';
$labels['focusonnewmessage'] = 'Focus browser window on new message';
$labels['checkallfolders'] = 'Check all folders for new messages';
$labels['displaynext'] = 'After message delete/move display the next message';
+$labels['defaultfont'] = 'Default font of HTML message';
$labels['mainoptions'] = 'Main Options';
$labels['section'] = 'Section';
$labels['maintenance'] = 'Maintenance';
diff --git a/program/localization/pl_PL/labels.inc b/program/localization/pl_PL/labels.inc
index 420c84d23..85a671816 100644
--- a/program/localization/pl_PL/labels.inc
+++ b/program/localization/pl_PL/labels.inc
@@ -440,5 +440,6 @@ $labels['source'] = 'Źródła';
$labels['license'] = 'Licencja';
$labels['about'] = 'O programie';
$labels['support'] = 'Wsparcie techniczne';
+$labels['defaultfont'] = 'Czcionka wiadomości HTML';
?>
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 71729602a..03619f1a2 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -142,6 +142,12 @@ $OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_s
// use jquery UI for showing prompt() dialogs
$RCMAIL->plugins->load_plugin('jqueryui');
+// default font for HTML editor
+$font = rcube_fontdefs($RCMAIL->config->get('default_font', 'Verdana'));
+if ($font && !is_array($font)) {
+ $OUTPUT->set_env('default_font', $font);
+}
+
// get reference message and set compose mode
if ($msg_uid = $COMPOSE['param']['draft_uid']) {
$RCMAIL->imap->set_mailbox($CONFIG['drafts_mbox']);
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 0da1ee342..6e124f98f 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -397,6 +397,15 @@ $isHtml = (bool) get_input_value('_is_html', RCUBE_INPUT_POST);
// fetch message body
$message_body = get_input_value('_message', RCUBE_INPUT_POST, TRUE, $message_charset);
+if ($isHtml) {
+ $font = rcube_fontdefs($RCMAIL->config->get('default_font', 'Verdana'));
+ $bstyle = $font && is_string($font) ? " style='font-family: $font'" : '';
+
+ // append doctype and html/body wrappers
+ $message_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">' .
+ "\r\n<html><body$bstyle>\r\n" . $message_body;
+}
+
if (!$savedraft) {
if ($isHtml) {
// remove signature's div ID
@@ -406,10 +415,6 @@ if (!$savedraft) {
$bstyle = 'padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%';
$message_body = preg_replace('/<blockquote>/',
'<blockquote type="cite" style="'.$bstyle.'">', $message_body);
-
- // append doctype and html/body wrappers
- $message_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">' .
- "\r\n<html><body>\r\n" . $message_body;
}
// Check spelling before send
@@ -443,8 +448,10 @@ if (!$savedraft) {
if ($footer)
$message_body .= "\r\n" . $footer;
- if ($isHtml)
- $message_body .= "\r\n</body></html>\r\n";
+}
+
+if ($isHtml) {
+ $message_body .= "\r\n</body></html>\r\n";
}
// set line length for body wrapping
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 28da87628..b778afa13 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -481,7 +481,6 @@ function rcmail_user_prefs($current=null)
'sig' => array('name' => Q(rcube_label('signatureoptions'))),
);
- // Show checkbox for HTML Editor
if (!isset($no_override['htmleditor'])) {
$field_id = 'rcmfd_htmleditor';
$select_htmleditor = new html_select(array('name' => '_htmleditor', 'id' => $field_id));
@@ -634,6 +633,25 @@ function rcmail_user_prefs($current=null)
);
}
+ if (!isset($no_override['default_font'])) {
+ $field_id = 'rcmfd_default_font';
+ $fonts = rcube_fontdefs();
+ $default_font = $config['default_font'] ? $config['default_font'] : 'Verdana';
+
+ $select = '<select name="_default_font" id="'.$field_id.'">';
+ foreach ($fonts as $fname => $font)
+ $select .= '<option value="'.$fname.'"'
+ . ($fname == $default_font ? ' selected="selected"' : '')
+ . ' style=\'font-family: ' . $font . '\'>'
+ . Q($fname) . '</option>';
+ $select .= '</select>';
+
+ $blocks['main']['options']['default_font'] = array(
+ 'title' => html::label($field_id, Q(rcube_label('defaultfont'))),
+ 'content' => $select
+ );
+ }
+
break;
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index f5f3e36d3..a6388c579 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -86,6 +86,7 @@ switch ($CURR_SECTION)
'top_posting' => !empty($_POST['_top_posting']),
'strip_existing_sig' => isset($_POST['_strip_existing_sig']),
'sig_above' => !empty($_POST['_sig_above']) && !empty($_POST['_top_posting']),
+ 'default_font' => get_input_value('_default_font', RCUBE_INPUT_POST),
);
break;