diff options
Diffstat (limited to 'program/steps/settings')
-rw-r--r-- | program/steps/settings/edit_identity.inc | 34 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 9 | ||||
-rw-r--r-- | program/steps/settings/save_identity.inc | 15 | ||||
-rw-r--r-- | program/steps/settings/save_prefs.inc | 3 |
4 files changed, 55 insertions, 6 deletions
diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc index 316eec785..af9cb26cc 100644 --- a/program/steps/settings/edit_identity.inc +++ b/program/steps/settings/edit_identity.inc @@ -42,7 +42,17 @@ else function rcube_identity_form($attrib) { - global $IDENTITY_RECORD, $JS_OBJECT_NAME; + global $IDENTITY_RECORD, $JS_OBJECT_NAME, $OUTPUT; + + $OUTPUT->include_script('tiny_mce/tiny_mce_src.js'); + $OUTPUT->add_script("tinyMCE.init({ mode : 'specific_textareas'," . + "apply_source_formatting : true," . + "theme : 'advanced'," . + "theme_advanced_toolbar_location : 'top'," . + "theme_advanced_toolbar_align : 'left'," . + "theme_advanced_buttons1 : 'bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,separator,outdent,indent,charmap,hr'," . + "theme_advanced_buttons2 : 'link,unlink,forecolor,fontselect,fontsizeselect'," . + "theme_advanced_buttons3 : '' });"); if (!$IDENTITY_RECORD && $GLOBALS['_action']!='add-identity') return rcube_label('notfound'); @@ -62,7 +72,8 @@ function rcube_identity_form($attrib) 'organization' => array('type' => 'text'), 'reply-to' => array('type' => 'text', 'label' => 'replyto'), 'bcc' => array('type' => 'text'), - 'signature' => array('type' => 'textarea'), + 'signature' => array('type' => 'textarea', 'size' => "40", 'rows' => "6"), + 'html_signature'=>array('type' => 'checkbox', 'label' => 'htmlsignature', 'onclick' => 'return rcmail.toggle_editor(this, \'_signature\');'), 'standard' => array('type' => 'checkbox', 'label' => 'setdefault')); @@ -87,6 +98,25 @@ function rcube_identity_form($attrib) foreach ($a_show_cols as $col => $colprop) { $attrib['id'] = 'rcmfd_'.$col; + + if (strlen($colprop['onclick'])) + $attrib['onclick'] = $colprop['onclick']; + else + unset($attrib['onclick']); + + if ($col == 'signature') + { + $attrib['size'] = $colprop['size']; + $attrib['rows'] = $colprop['rows']; + $attrib['mce_editable'] = $IDENTITY_RECORD['html_signature'] ? "true" : "false"; + } + else + { + unset($attrib['size']); + unset($attrib['rows']); + unset($attrib['mce_editable']); + } + $label = strlen($colprop['label']) ? $colprop['label'] : $col; $value = rcmail_get_edit_field($col, $IDENTITY_RECORD[$col], $attrib, $colprop['type']); diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index f08b75af8..fd985726d 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -147,6 +147,14 @@ function rcmail_user_prefs_form($attrib) rep_specialchars_output(rcube_label('prettydate')), $input_prettydate->show($CONFIG['prettydate']?1:0)); + // Show checkbox for HTML Editor + $field_id = 'rcmfd_htmleditor'; + $input_htmleditor = new checkbox(array('name' => '_htmleditor', 'id' => $field_id, 'value' => 1)); + $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", + $field_id, + rep_specialchars_output(rcube_label('htmleditor')), + $input_htmleditor->show($CONFIG['htmleditor']?1:0)); + if (!empty($CONFIG['drafts_mbox'])) { $field_id = 'rcmfd_autosave'; @@ -168,7 +176,6 @@ function rcmail_user_prefs_form($attrib) - function rcmail_identities_list($attrib) { global $DB, $CONFIG, $OUTPUT, $JS_OBJECT_NAME; diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc index ffbcfe3d9..60a6855f0 100644 --- a/program/steps/settings/save_identity.inc +++ b/program/steps/settings/save_identity.inc @@ -19,9 +19,9 @@ */ -$a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'standard', 'signature'); +$a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'standard', 'signature', 'html_signature'); $a_html_cols = array('signature'); - +$a_boolean_cols = array('standard', 'html_signature'); // check input if (empty($_POST['_name']) || empty($_POST['_email'])) @@ -48,6 +48,17 @@ if ($_POST['_iid']) $DB->quote(get_input_value($fname, RCUBE_INPUT_POST, in_array($col, $a_html_cols)))); } + // set "off" values for checkboxes that were not checked, and therefore + // not included in the POST body. + foreach ($a_boolean_cols as $col) + { + $fname = '_' . $col; + if (!isset($_POST[$fname])) + { + $a_write_sql[] = sprintf("%s=0", $DB->quoteIdentifier($col)); + } + } + if (sizeof($a_write_sql)) { $DB->query("UPDATE ".get_table_name('identities')." diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 73fb231f2..a438de002 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -28,6 +28,7 @@ $a_user_prefs['timezone'] = isset($_POST['_timezone']) ? floatval($_POST['_timez $a_user_prefs['dst_active'] = isset($_POST['_dst_active']) ? TRUE : FALSE; $a_user_prefs['pagesize'] = is_numeric($_POST['_pagesize']) ? (int)$_POST['_pagesize'] : $CONFIG['pagesize']; $a_user_prefs['prefer_html'] = isset($_POST['_prefer_html']) ? TRUE : FALSE; +$a_user_prefs['htmleditor'] = isset($_POST['_htmleditor']) ? TRUE : FALSE; $a_user_prefs['draft_autosave'] = isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0; // MM: Date format toggle (Pretty / Standard) @@ -49,4 +50,4 @@ $_action = 'preferences'; // overwrite action variable $OUTPUT->add_script(sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $_action)); -?>
\ No newline at end of file +?> |