diff options
-rw-r--r-- | config/main.inc.php.dist | 7 | ||||
-rw-r--r-- | program/localization/en_US/labels.inc | 2 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 35 | ||||
-rw-r--r-- | program/steps/settings/save_prefs.inc | 28 |
4 files changed, 37 insertions, 35 deletions
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist index dafee72f1..64312b6a9 100644 --- a/config/main.inc.php.dist +++ b/config/main.inc.php.dist @@ -241,7 +241,6 @@ $rcmail_config['skin_include_php'] = false; $rcmail_config['display_version'] = false; // Session lifetime in minutes -// must be greater than 'keep_alive'/60 $rcmail_config['session_lifetime'] = 10; // Session domain: .example.org @@ -500,7 +499,6 @@ $rcmail_config['recipients_separator'] = ','; $rcmail_config['max_pagesize'] = 200; // Minimal value of user's 'keep_alive' setting (in seconds) -// Must be less than 'session_lifetime' $rcmail_config['min_keep_alive'] = 60; // Enables files upload indicator. Requires APC installed and enabled apc.rfc1867 option. @@ -780,8 +778,9 @@ $rcmail_config['read_when_deleted'] = true; // Use 'Purge' to remove messages marked as deleted $rcmail_config['flag_for_deletion'] = false; -// Default interval for keep-alive/check-recent requests (in seconds) -// Must be greater than or equal to 'min_keep_alive' and less than 'session_lifetime' +// Default interval for auto-refresh requests (in seconds) +// These are requests for system state updates e.g. checking for new messages, etc. +// Setting it to 0 disables the feature. $rcmail_config['keep_alive'] = 60; // If true all folders will be checked for recent messages diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc index 2b1397f02..1999bad13 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -414,7 +414,7 @@ $labels['always'] = 'always'; $labels['showinlineimages'] = 'Display attached images below the message'; $labels['autosavedraft'] = 'Automatically save draft'; $labels['everynminutes'] = 'every $n minute(s)'; -$labels['keepalive'] = 'Check for new messages on'; +$labels['refreshinterval'] = 'Refresh (check for new messages, etc.)'; $labels['never'] = 'never'; $labels['immediately'] = 'immediately'; $labels['messagesdisplaying'] = 'Displaying Messages'; diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 8bef2ff51..27e1e1346 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -237,6 +237,24 @@ function rcmail_user_prefs($current=null) ); } + if (!isset($no_override['keep_alive'])) { + $field_id = 'rcmfd_keep_alive'; + $select_keep_alive = new html_select(array('name' => '_keep_alive', 'id' => $field_id)); + + $select_keep_alive->add(rcube_label('never'), 0); + foreach (array(1, 3, 5, 10, 15, 30, 60) as $min) { + if (!$config['min_keep_alive'] || $config['min_keep_alive'] <= $min * 60) { + $label = rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))); + $select_keep_alive->add($label, $min); + } + } + + $blocks['main']['options']['keep_alive'] = array( + 'title' => html::label($field_id, Q(rcube_label('refreshinterval'))), + 'content' => $select_keep_alive->show($config['keep_alive']/60), + ); + } + // show drop-down for available skins if (!isset($no_override['skin'])) { $skins = rcmail_get_skins(); @@ -370,23 +388,6 @@ function rcmail_user_prefs($current=null) 'content' => $input_pagesize->show($size ? $size : 50), ); } - - if (!isset($no_override['keep_alive'])) { - $field_id = 'rcmfd_keep_alive'; - $select_keep_alive = new html_select(array('name' => '_keep_alive', 'id' => $field_id)); - - foreach(array(1, 3, 5, 10, 15, 30, 60) as $min) - if((!$config['min_keep_alive'] || $config['min_keep_alive'] <= $min * 60) - && (!$config['session_lifetime'] || $config['session_lifetime'] > $min)) { - $select_keep_alive->add(rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))), $min); - } - - $blocks['new_message']['options']['keep_alive'] = array( - 'title' => html::label($field_id, Q(rcube_label('keepalive'))), - 'content' => $select_keep_alive->show($config['keep_alive']/60), - ); - } - if (!isset($no_override['check_all_folders'])) { $field_id = 'rcmfd_check_all_folders'; $input_check_all = new html_checkbox(array('name' => '_check_all_folders', 'id' => $field_id, 'value' => 1)); diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index db7b134c4..2f22be7c4 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -33,7 +33,8 @@ switch ($CURR_SECTION) 'date_format' => isset($_POST['_date_format']) ? get_input_value('_date_format', RCUBE_INPUT_POST) : $CONFIG['date_format'], 'time_format' => isset($_POST['_time_format']) ? get_input_value('_time_format', RCUBE_INPUT_POST) : ($CONFIG['time_format'] ? $CONFIG['time_format'] : 'H:i'), 'prettydate' => isset($_POST['_pretty_date']) ? TRUE : FALSE, - 'skin' => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['skin'], + 'keep_alive' => isset($_POST['_keep_alive']) ? intval($_POST['_keep_alive'])*60 : $CONFIG['keep_alive'], + 'skin' => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['skin'], ); // compose derived date/time format strings @@ -50,7 +51,6 @@ switch ($CURR_SECTION) 'preview_pane_mark_read' => isset($_POST['_preview_pane_mark_read']) ? intval($_POST['_preview_pane_mark_read']) : $CONFIG['preview_pane_mark_read'], 'autoexpand_threads' => isset($_POST['_autoexpand_threads']) ? intval($_POST['_autoexpand_threads']) : 0, 'mdn_requests' => isset($_POST['_mdn_requests']) ? intval($_POST['_mdn_requests']) : 0, - 'keep_alive' => isset($_POST['_keep_alive']) ? intval($_POST['_keep_alive'])*60 : $CONFIG['keep_alive'], 'check_all_folders' => isset($_POST['_check_all_folders']) ? TRUE : FALSE, 'mail_pagesize' => is_numeric($_POST['_mail_pagesize']) ? max(2, intval($_POST['_mail_pagesize'])) : $CONFIG['mail_pagesize'], ); @@ -157,16 +157,16 @@ switch ($CURR_SECTION) $a_user_prefs['timezone'] = (string) $a_user_prefs['timezone']; - break; - case 'mailbox': - - // force keep_alive - if (isset($a_user_prefs['keep_alive'])) { - $a_user_prefs['keep_alive'] = max(60, $CONFIG['min_keep_alive'], $a_user_prefs['keep_alive']); - if (!empty($CONFIG['session_lifetime'])) - $a_user_prefs['keep_alive'] = min($CONFIG['session_lifetime']*60, $a_user_prefs['keep_alive']); + if (isset($a_user_prefs['keep_alive']) && !empty($CONFIG['min_keep_alive'])) { + if ($a_user_prefs['keep_alive'] > $CONFIG['min_keep_alive']) { + $a_user_prefs['keep_alive'] = $CONFIG['min_keep_alive']; + } } + break; + + case 'mailbox': + // force min size if ($a_user_prefs['mail_pagesize'] < 1) $a_user_prefs['mail_pagesize'] = 10; @@ -174,7 +174,8 @@ switch ($CURR_SECTION) if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['mail_pagesize'] > $CONFIG['max_pagesize'])) $a_user_prefs['mail_pagesize'] = (int) $CONFIG['max_pagesize']; - break; + break; + case 'addressbook': // force min size @@ -184,7 +185,8 @@ switch ($CURR_SECTION) if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['addressbook_pagesize'] > $CONFIG['max_pagesize'])) $a_user_prefs['addressbook_pagesize'] = (int) $CONFIG['max_pagesize']; - break; + break; + case 'folders': // special handling for 'default_folders' @@ -199,7 +201,7 @@ switch ($CURR_SECTION) } } - break; + break; } // Save preferences |