Add config/preference option to disable saving messages in localStorage (#1489979)
| | |
| | | // 0 - never, 1 - always, 2 - on reply to HTML message, 3 - on forward or reply to HTML message |
| | | $config['htmleditor'] = 0; |
| | | |
| | | // save copies of compose messages in the browser's local storage |
| | | // for recovery in case of browser crashes and session timeout. |
| | | $config['compose_save_localstorage'] = true; |
| | | |
| | | // show pretty dates as standard |
| | | $config['prettydate'] = true; |
| | | |
| | |
| | | } |
| | | |
| | | // check for locally stored compose data |
| | | if (this.env.save_localstorage) |
| | | this.compose_restore_dialog(0, html_mode) |
| | | |
| | | if (input_to.val() == '') |
| | |
| | | } |
| | | |
| | | // save compose form content to local storage every 5 seconds |
| | | if (!this.local_save_timer && window.localStorage) { |
| | | if (!this.local_save_timer && window.localStorage && this.env.save_localstorage) { |
| | | // track typing activity and only save on changes |
| | | this.compose_type_activity = this.compose_type_activity_last = 0; |
| | | $(document).bind('keypress', function(e){ ref.compose_type_activity++; }); |
| | |
| | | // store the contents of the compose form to localstorage |
| | | this.save_compose_form_local = function() |
| | | { |
| | | // feature is disabled |
| | | if (!this.env.save_localstorage) |
| | | return; |
| | | |
| | | var formdata = { session:this.env.session_id, changed:new Date().getTime() }, |
| | | ed, empty = true; |
| | | |
| | |
| | | $labels['miscfolding'] = 'RFC 2047/2231 (MS Outlook)'; |
| | | $labels['2047folding'] = 'Full RFC 2047 (other)'; |
| | | $labels['force7bit'] = 'Use MIME encoding for 8-bit characters'; |
| | | $labels['savelocalstorage'] = "Save in the browser's local storage (temporarily)"; |
| | | $labels['advancedoptions'] = 'Advanced options'; |
| | | $labels['toggleadvancedoptions'] = 'Toggle advanced options'; |
| | | $labels['focusonnewmessage'] = 'Focus browser window on new message'; |
| | |
| | | $OUTPUT->set_env('mailbox', $RCMAIL->storage->get_folder()); |
| | | $OUTPUT->set_env('top_posting', intval($RCMAIL->config->get('reply_mode')) > 0); |
| | | $OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ','))); |
| | | $OUTPUT->set_env('save_localstorage', (bool)$RCMAIL->config->get('compose_save_localstorage')); |
| | | |
| | | $drafts_mbox = $RCMAIL->config->get('drafts_mbox'); |
| | | $config_show_sig = $RCMAIL->config->get('show_sig', 1); |
| | |
| | | ); |
| | | } |
| | | |
| | | if (!isset($no_override['compose_save_localstorage'])) { |
| | | if (!$current) { |
| | | continue 2; |
| | | } |
| | | |
| | | $field_id = 'rcmfd_compose_save_localstorage'; |
| | | $input = new html_checkbox(array('name' => '_compose_save_localstorage', 'id' => $field_id, 'value' => 1)); |
| | | |
| | | $blocks['advanced']['options']['compose_save_localstorage'] = array( |
| | | 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('savelocalstorage'))), |
| | | 'content' => $input->show($config['compose_save_localstorage']?1:0), |
| | | ); |
| | | } |
| | | |
| | | break; |
| | | |
| | | // Addressbook config |
| | |
| | | 'default_font_size' => rcube_utils::get_input_value('_default_font_size', rcube_utils::INPUT_POST), |
| | | 'reply_all_mode' => intval($_POST['_reply_all_mode']), |
| | | 'forward_attachment' => !empty($_POST['_forward_attachment']), |
| | | 'compose_save_localstorage' => intval($_POST['_compose_save_localstorage']), |
| | | ); |
| | | |
| | | break; |