diff options
author | thomascube <thomas@roundcube.net> | 2012-02-02 22:18:10 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2012-02-02 22:18:10 +0000 |
commit | 43875379d5fcfc4e4d29e2edcbbed614a2050f7d (patch) | |
tree | 2679484edd2b05012c56eb01d6bfc8ff67916328 /program/steps | |
parent | fd6f6e27c4c727c1485674147e997eb9ce6118d6 (diff) |
Allow users to choose cols for contacts list sorting
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/addressbook/list.inc | 5 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 28 | ||||
-rw-r--r-- | program/steps/settings/save_prefs.inc | 1 |
3 files changed, 25 insertions, 9 deletions
diff --git a/program/steps/addressbook/list.inc b/program/steps/addressbook/list.inc index 46651853c..de7149bce 100644 --- a/program/steps/addressbook/list.inc +++ b/program/steps/addressbook/list.inc @@ -5,7 +5,7 @@ | program/steps/addressbook/list.inc | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2007, The Roundcube Dev Team | + | Copyright (C) 2005-2012, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -34,6 +34,7 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search $page = isset($_SESSION['page']) ? $_SESSION['page'] : 1; $_SESSION['page'] = $page; + $sort_col = $this->config->get('addressbook_sort_col', 'name'); // Get records from all sources foreach ($search as $s => $set) { @@ -49,7 +50,7 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search while ($row = $result->next()) { $row['sourceid'] = $s; - $key = $row['name'] . ':' . $row['sourceid']; + $key = $row[$sort_col] . ':' . $row['sourceid']; $records[$key] = $row; } unset($result); diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 18a466020..48230f5bb 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -5,7 +5,7 @@ | program/steps/settings/func.inc | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2007, The Roundcube Dev Team | + | Copyright (C) 2005-2012, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -651,13 +651,17 @@ function rcmail_user_prefs($current=null) ); } - if (!isset($no_override['autocomplete_single'])) { - $field_id = 'rcmfd_autocomplete_single'; - $checkbox = new html_checkbox(array('name' => '_autocomplete_single', 'id' => $field_id, 'value' => 1)); + // show addressbook sort column + if (!isset($no_override['addressbook_sort_col'])) { + $field_id = 'rcmfd_addressbook_sort_col'; + $select_sort = new html_select(array('name' => '_addressbook_sort_col', 'id' => $field_id)); + $select_sort->add(rcube_label('name'), 'name'); + $select_sort->add(rcube_label('firstname'), 'firstname'); + $select_sort->add(rcube_label('surname'), 'surname'); - $blocks['main']['options']['autocomplete_single'] = array( - 'title' => html::label($field_id, Q(rcube_label('autocompletesingle'))), - 'content' => $checkbox->show($config['autocomplete_single']?1:0), + $blocks['main']['options']['sort_col'] = array( + 'title' => html::label($field_id, Q(rcube_label('listsorting'))), + 'content' => $select_sort->show($config['addressbook_sort_col']), ); } @@ -674,6 +678,16 @@ function rcmail_user_prefs($current=null) ); } + if (!isset($no_override['autocomplete_single'])) { + $field_id = 'rcmfd_autocomplete_single'; + $checkbox = new html_checkbox(array('name' => '_autocomplete_single', 'id' => $field_id, 'value' => 1)); + + $blocks['main']['options']['autocomplete_single'] = array( + 'title' => html::label($field_id, Q(rcube_label('autocompletesingle'))), + 'content' => $checkbox->show($config['autocomplete_single']?1:0), + ); + } + break; // Special IMAP folders diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 88a05486a..87d06ef3e 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -97,6 +97,7 @@ switch ($CURR_SECTION) $a_user_prefs = array( 'default_addressbook' => get_input_value('_default_addressbook', RCUBE_INPUT_POST, true), 'autocomplete_single' => isset($_POST['_autocomplete_single']) ? TRUE : FALSE, + 'addressbook_sort_col' => get_input_value('_addressbook_sort_col', RCUBE_INPUT_POST), 'addressbook_pagesize' => is_numeric($_POST['_addressbook_pagesize']) ? max(2, intval($_POST['_addressbook_pagesize'])) : $CONFIG['addressbook_pagesize'], ); |