From 22a47cced6cb80bf2e6aca7a07520b618573dfd3 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 10 Jun 2019 13:44:17 +0200 Subject: [PATCH] Changes in `display_next` setting (#6795) - Move it to Preferences > User Interface > Main Options - Make it apply to Contacts interface too - Make it apply only if deleting/moving a previewed message/contact --- CHANGELOG | 4 +++ config/defaults.inc.php | 2 +- program/js/app.js | 46 ++++++++++++++++----------- program/js/list.js | 4 +-- program/localization/en_US/labels.inc | 2 +- program/steps/addressbook/func.inc | 5 +-- program/steps/settings/func.inc | 30 ++++++++--------- program/steps/settings/save_prefs.inc | 2 +- 8 files changed, 54 insertions(+), 41 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 84172e8e7..57e6c1197 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,10 @@ CHANGELOG Roundcube Webmail - Support $HasAttachment/$HasNoAttachment keywords (#6201) - Support PECL memcached extension as a session and cache storage driver (experimental) - installto.sh: Add possibility to run the update even on the up-to-date installation (#6533) +- Changes in `display_next` setting (#6795): + - Move it to Preferences > User Interface > Main Options + - Make it apply to Contacts interface too + - Make it apply only if deleting/moving a previewed message/contact - Redis: Support connection to unix socket - Elastic: Add Prev/Next buttons on message page toolbar (#6648) - Elastic: Close search options on Enter key press in quick-search input (#6660) diff --git a/config/defaults.inc.php b/config/defaults.inc.php index 7ae6b117b..24689b4c7 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -1159,7 +1159,7 @@ $config['refresh_interval'] = 60; // If true all folders will be checked for recent messages $config['check_all_folders'] = false; -// If true, after message delete/move, the next message will be displayed +// If true, after message/contact delete/move, the next message/contact will be displayed $config['display_next'] = true; // Default messages listing mode. One of 'threads' or 'list'. diff --git a/program/js/app.js b/program/js/app.js index 9405c4d62..8b48dcd20 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3203,13 +3203,14 @@ function rcube_webmail() // show wait message if (this.env.action == 'show') lock = this.set_busy(true, 'movingmessage'); - else - this.show_contentframe(false); // Hide message command buttons until a message is selected this.enable_command(this.env.message_commands, false); this.with_selected_messages('move', post_data, lock); + + if (this.env.action != 'show') + this.show_contentframe(false); }; // delete selected messages from the current mailbox @@ -3252,8 +3253,8 @@ function rcube_webmail() if (!post_data._uid) return; - this.show_contentframe(false); this.with_selected_messages('delete', post_data); + this.show_contentframe(false); }; // Send a specific move/delete request with UIDs of all selected messages @@ -3265,7 +3266,8 @@ function rcube_webmail() // update the list (remove rows, clear selection) if (this.message_list) { var n, len, id, root, roots = [], - selection = post_data._uid; + selection = post_data._uid, + display_next = this.env.display_next && this.preview_id; if (selection === '*') selection = this.message_list.get_selection(); @@ -3283,11 +3285,13 @@ function rcube_webmail() } } if (remove) - this.message_list.remove_row(id, (this.env.display_next && n == selection.length-1)); + this.message_list.remove_row(id, display_next && n == selection.length-1); } + // make sure there are no selected rows - if (!this.env.display_next && remove) + if (!display_next && remove) this.message_list.clear_selection(); + // update thread tree icons for (n=0, len=roots.length; naction && !$OUTPUT->ajax_call) { } } - $search_mods = $RCMAIL->config->get('addressbook_search_mods', $SEARCH_MODS_DEFAULT); - $OUTPUT->set_env('search_mods', $search_mods); + $OUTPUT->set_env('display_next', (bool) $RCMAIL->config->get('display_next')); + $OUTPUT->set_env('search_mods', $RCMAIL->config->get('addressbook_search_mods', $SEARCH_MODS_DEFAULT)); $OUTPUT->set_env('address_sources', $js_list); $OUTPUT->set_env('writable_source', $writeable); $OUTPUT->set_env('contact_move_enabled', $writeable > 1); $OUTPUT->set_env('contact_copy_enabled', $writeable > 1 || ($writeable == 1 && count($js_list) > 1)); $OUTPUT->set_pagetitle($RCMAIL->gettext('contacts')); + $_SESSION['addressbooks_count'] = $count; $_SESSION['addressbooks_count_writeable'] = $writeable; diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 144d60c51..efff0d35c 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -281,6 +281,21 @@ function rcmail_user_prefs($current = null) ); } + // "display after delete" checkbox + if (!isset($no_override['display_next'])) { + if (!$current) { + continue 2; + } + + $field_id = 'rcmfd_displaynext'; + $input = new html_checkbox(array('name' => '_display_next', 'id' => $field_id, 'value' => 1)); + + $blocks['main']['options']['display_next'] = array( + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('displaynext'))), + 'content' => $input->show($config['display_next']?1:0), + ); + } + if (!isset($no_override['refresh_interval'])) { if (!$current) { continue 2; @@ -604,21 +619,6 @@ function rcmail_user_prefs($current = null) 'content' => $input->show($config['inline_images']?1:0), ); } - - // "display after delete" checkbox - if (!isset($no_override['display_next'])) { - if (!$current) { - continue 2; - } - - $field_id = 'rcmfd_displaynext'; - $input = new html_checkbox(array('name' => '_display_next', 'id' => $field_id, 'value' => 1)); - - $blocks['main']['options']['display_next'] = array( - 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('displaynext'))), - 'content' => $input->show($config['display_next']?1:0), - ); - } break; // Mail composition diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 1fbe9d7ff..ddfcf82d4 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -31,6 +31,7 @@ case 'general': 'date_format' => rcmail_prefs_input('date_format', '/^[a-zA-Z_.\/ -]+$/'), 'time_format' => rcmail_prefs_input('time_format', '/^[a-zA-Z0-9: ]+$/'), 'prettydate' => isset($_POST['_pretty_date']), + 'display_next' => isset($_POST['_display_next']), 'refresh_interval' => intval($_POST['_refresh_interval']) * 60, 'standard_windows' => isset($_POST['_standard_windows']), 'skin' => rcmail_prefs_input('skin', '/^[a-zA-Z0-9_.-]+$/'), @@ -63,7 +64,6 @@ case 'mailview': 'prefer_html' => isset($_POST['_prefer_html']), 'inline_images' => isset($_POST['_inline_images']), 'show_images' => intval($_POST['_show_images']), - 'display_next' => isset($_POST['_display_next']), 'default_charset' => rcmail_prefs_input('default_charset', '/^[a-zA-Z0-9-]+$/'), );