'members' => array(
'stationery_link', 'mailto_handler', 'compose_cc', 'compose_bcc',
'compose_spellcheck', 'compose_confirm', 'set_priority',
- 'compose_popup', 'compose_html', 'mail_domain', 'compose_cursor',
+ 'compose_popup', 'compose_html', 'compose_html_font_family',
+ 'compose_html_font_size', 'mail_domain', 'compose_cursor',
'sending_charset', 'encryptselect', 'save_attachments',
'disposition_request_read'
)
'desc' => _("Compose messages with an HTML editor by default?")
);
+// For the HTML editor, this is the default font family.
+// This needs to be in CSS-parseable format.
+$_prefs['compose_html_font_family'] = array(
+ 'value' => 'Arial',
+ 'advanced' => true,
+ 'locked' => true,
+ 'type' => 'string',
+ 'desc' => _("The default font family to use in the HTML editor.")
+);
+
+// For the HTML editor, this is the default font size.
+$_prefs['compose_html_font_size'] = array(
+ 'value' => 14,
+ 'advanced' => true,
+ 'locked' => true,
+ 'type' => 'number',
+ 'desc' => _("The default font size to use in the HTML editor (in pixels).")
+);
+
// default outgoing mail domain and address completion
$_prefs['mail_domain'] = array(
'value' => '',
v5.0-git
--------
+[mms] Add preference to define default font family/size for the HTML compose
+ editor.
[mms] Honor nav_expanded preference (DIMP).
[mms] Allow admin to define list of safe e-mail addresses that will not
experience HTML image blocking (Request #9129).
$htmlBody->setCharset($charset);
$htmlBody->setDisposition('inline');
$htmlBody->setDescription(Horde_String::convertCharset(_("HTML Version"), $nls_charset, $charset));
+
+ /* Add default font CSS information here. The data comes to us
+ * with no HTML body tag - so simply wrap the data in a body
+ * tag with the CSS information. */
+ $styles = array();
+ if ($font_family = $GLOBALS['prefs']->getValue('compose_html_font_family')) {
+ $styles[] = 'font-family:' . $font_family;
+ }
+ if ($font_size = intval($GLOBALS['prefs']->getValue('compose_html_font_size'))) {
+ $styles[] = 'font-size:' . $font_size . 'px';
+ }
+
+ if (!empty($styles)) {
+ $body_html = '<body style="' . implode(';', $styles) . '">' .
+ $body_html .
+ '</body>';
+ }
+
$htmlBody->setContents($GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($body_html, 'cleanhtml', array('charset' => $charset)));
$textBody->setDescription(Horde_String::convertCharset(_("Plaintext Version"), $nls_charset, $charset));
$ui->suppress[] = 'disposition_request_read';
}
+ if (!$prefs->getValue('compose_html')) {
+ $ui->suppress[] = 'compose_html_font_family';
+ $ui->suppress[] = 'compose_html_font_size';
+ }
+
/* Sort encodings. */
if (!$prefs->isLocked('sending_charset')) {
asort($registry->nlsconfig['encodings']);
{
$GLOBALS['injector']->getInstance('Horde_Editor')->getEditor('Ckeditor', array('basic' => $basic));
+ $font_family = $GLOBALS['prefs']->getValue('compose_html_font_family');
+ if (!$font_family) {
+ $font_family = 'Arial';
+ }
+
+ $font_size = intval($GLOBALS['prefs']->getValue('compose_html_font_size'));
+ $font_size = $font_size
+ /* Font size should be between 8 and 24 pixels. Or else recipients
+ * will hate us. Default to 14px. */
+ ? min(24, max(8, $font_size)) . 'px'
+ : '14px';
+
$config = array(
/* To more closely match "normal" textarea behavior, send <BR> on
* enter instead of <P>. */
/* Default display font. This is NOT the font used to send
* the message, however. */
- 'contentsCss: "body { font-family: Arial; font-size: 12px; }"',
- 'font_defaultLabel: "Arial"',
- 'fontSize_defaultLabel: "12px"'
+ 'contentsCss: "body { font-family: ' . $font_family . '; font-size: ' . $font_size . '; }"',
+ 'font_defaultLabel: "' . $font_family . '"',
+ 'fontSize_defaultLabel: "' . $font_size . '"'
);
$buttons = $GLOBALS['prefs']->getValue('ckeditor_buttons');