diff options
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/mail/check_recent.inc | 10 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 1 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 35 | ||||
-rw-r--r-- | program/steps/settings/save_prefs.inc | 28 |
4 files changed, 41 insertions, 33 deletions
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc index 1a1b08c60..90d17c15b 100644 --- a/program/steps/mail/check_recent.inc +++ b/program/steps/mail/check_recent.inc @@ -19,8 +19,14 @@ +-----------------------------------------------------------------------+ */ +// If there's no folder or messages list, there's nothing to update +// This can happen on 'refresh' request +if (empty($_REQUEST['_folderlist']) && empty($_REQUEST['_list'])) { + return; +} + $current = $RCMAIL->storage->get_folder(); -$check_all = !empty($_GET['_refresh']) || (bool)$RCMAIL->config->get('check_all_folders'); +$check_all = $RCMAIL->action != 'refresh' || (bool)$RCMAIL->config->get('check_all_folders'); // list of folders to check if ($check_all) { @@ -102,6 +108,4 @@ foreach ($a_mailboxes as $mbox_name) { } } -$RCMAIL->plugins->exec_hook('keep_alive', array()); - $OUTPUT->send(); diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 961a604a2..df83b03a8 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -1846,6 +1846,7 @@ $OUTPUT->add_handlers(array( // register action aliases $RCMAIL->register_action_map(array( + 'refresh' => 'check_recent.inc', 'preview' => 'show.inc', 'print' => 'show.inc', 'moveto' => 'move_del.inc', diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 8bef2ff51..876e02761 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['refresh_interval'])) { + $field_id = 'rcmfd_refresh_interval'; + $select_refresh_interval = new html_select(array('name' => '_refresh_interval', 'id' => $field_id)); + + $select_refresh_interval->add(rcube_label('never'), 0); + foreach (array(1, 3, 5, 10, 15, 30, 60) as $min) { + if (!$config['min_refresh_interval'] || $config['min_refresh_interval'] <= $min * 60) { + $label = rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))); + $select_refresh_interval->add($label, $min); + } + } + + $blocks['main']['options']['refresh_interval'] = array( + 'title' => html::label($field_id, Q(rcube_label('refreshinterval'))), + 'content' => $select_refresh_interval->show($config['refresh_interval']/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..5daab0d24 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'], + 'refresh_interval' => isset($_POST['_refresh_interval']) ? intval($_POST['_refresh_interval'])*60 : $CONFIG['refresh_interval'], + '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['refresh_interval']) && !empty($CONFIG['min_refresh_interval'])) { + if ($a_user_prefs['refresh_interval'] > $CONFIG['min_refresh_interval']) { + $a_user_prefs['refresh_interval'] = $CONFIG['min_refresh_interval']; + } } + 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 |