summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/main.inc.php.dist8
-rw-r--r--program/localization/de_CH/labels.inc4
-rw-r--r--program/localization/de_DE/labels.inc4
-rw-r--r--program/localization/en_US/labels.inc4
-rw-r--r--program/steps/mail/compose.inc3
-rw-r--r--program/steps/settings/func.inc24
-rw-r--r--program/steps/settings/save_prefs.inc3
7 files changed, 42 insertions, 8 deletions
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index e536917c4..c0471999d 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -195,6 +195,9 @@ $rcmail_config['mail_header_delimiter'] = NULL;
* 'fuzzy_search' => 0);
*/
+// list of configuration option names that need to be available in Javascript.
+$rcmail_config['javascript_config'] = array('read_when_deleted', 'flag_for_deletion');
+
// try to load host-specific configuration
$rcmail_config['include_host_config'] = FALSE;
@@ -222,9 +225,8 @@ $rcmail_config['message_sort_col'] = 'date';
// default sort order
$rcmail_config['message_sort_order'] = 'DESC';
-// list of configuration option names that need to be available in Javascript.
-$rcmail_config['javascript_config'] = array('read_when_deleted', 'flag_for_deletion');
-
+// save compose message every 300 seconds (5min)
+$rcmail_config['draft_autosave'] = 300;
// end of config file
?>
diff --git a/program/localization/de_CH/labels.inc b/program/localization/de_CH/labels.inc
index d4a467d99..85070942a 100644
--- a/program/localization/de_CH/labels.inc
+++ b/program/localization/de_CH/labels.inc
@@ -200,6 +200,10 @@ $labels['pagesize'] = 'Einträge pro Seite';
$labels['signature'] = 'Signatur';
$labels['dstactive'] = 'Sommerzeit';
+$labels['autosavedraft'] = 'Entwurf autom. speichern';
+$labels['everynminutes'] = 'alle $n Minuten';
+$labels['never'] = 'nie';
+
$labels['folder'] = 'Ordner';
$labels['folders'] = 'Ordner';
$labels['foldername'] = 'Ordnername';
diff --git a/program/localization/de_DE/labels.inc b/program/localization/de_DE/labels.inc
index f1cef48d5..ce19c98f1 100644
--- a/program/localization/de_DE/labels.inc
+++ b/program/localization/de_DE/labels.inc
@@ -201,6 +201,10 @@ $labels['pagesize'] = 'Einträge pro Seite';
$labels['signature'] = 'Signatur';
$labels['dstactive'] = 'Sommerzeit';
+$labels['autosavedraft'] = 'Entwurf autom. speichern';
+$labels['everynminutes'] = 'alle $n Minuten';
+$labels['never'] = 'nie';
+
$labels['folder'] = 'Ordner';
$labels['folders'] = 'Ordner';
$labels['foldername'] = 'Ordnername';
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 5945392d3..810ae78a2 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -202,6 +202,10 @@ $labels['pagesize'] = 'Rows per page';
$labels['signature'] = 'Signature';
$labels['dstactive'] = 'Daylight savings';
+$labels['autosavedraft'] = 'Automatically save draft';
+$labels['everynminutes'] = 'every $n minutes';
+$labels['never'] = 'never';
+
$labels['folder'] = 'Folder';
$labels['folders'] = 'Folders';
$labels['foldername'] = 'Folder name';
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 2f650d6e4..14adb1266 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -55,6 +55,9 @@ $_SESSION['compose'] = array('id' => uniqid(rand()));
// add some labels to client
rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'sendingmessage', 'messagesaved');
+// add config parameter to client script
+$OUTPUT->add_script(sprintf("%s.set_env('draft_autosave', %d);", $JS_OBJECT_NAME, !empty($CONFIG['drafts_mbox']) ? $CONFIG['draft_autosave'] : 0));
+
// get reference message and set compose mode
if ($msg_uid = get_input_value('_reply_uid', RCUBE_INPUT_GET))
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index a22ac9ae6..f08b75af8 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -46,10 +46,13 @@ function rcmail_user_prefs_form($attrib)
// return the complete edit form as table
$out = "$form_start<table" . $attrib_str . ">\n\n";
- $a_show_cols = array('language' => array('type' => 'text'),
- 'pagesize' => array('type' => 'text'),
- 'timezone' => array('type' => 'text'),
- 'prettydate' => array('type' => 'text'));
+ $a_show_cols = array(
+ 'language' => array('type' => 'text'),
+ 'pagesize' => array('type' => 'text'),
+ 'timezone' => array('type' => 'text'),
+ 'prettydate' => array('type' => 'text'),
+ 'draft_autosave' => array('type' => 'text')
+ );
// show language selection
$a_lang = rcube_list_languages();
@@ -144,6 +147,19 @@ function rcmail_user_prefs_form($attrib)
rep_specialchars_output(rcube_label('prettydate')),
$input_prettydate->show($CONFIG['prettydate']?1:0));
+ if (!empty($CONFIG['drafts_mbox']))
+ {
+ $field_id = 'rcmfd_autosave';
+ $select_autosave = new select(array('name' => '_draft_autosave', 'id' => $field_id));
+ $select_autosave->add(rcube_label('never'), 0);
+ foreach (array(3, 5, 10) as $i => $min)
+ $select_autosave->add(rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))), $min*60);
+
+ $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n",
+ $field_id,
+ rep_specialchars_output(rcube_label('autosavedraft')),
+ $select_autosave->show($CONFIG['draft_autosave']));
+ }
$out .= "\n</table>$form_end";
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index 98912daae..73fb231f2 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -28,13 +28,14 @@ $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['draft_autosave'] = isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0;
// MM: Date format toggle (Pretty / Standard)
$a_user_prefs['prettydate'] = isset($_POST['_pretty_date']) ? TRUE : FALSE;
if (isset($_POST['_language']))
{
- $sess_user_lang = $_SESSION['user_lang'] = $_POST['_language'];
+ $sess_user_lang = $_SESSION['user_lang'] = get_input_value('_language', RCUBE_INPUT_POST);
rcmail_set_locale($sess_user_lang);
}