summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-10-24 11:36:48 +0200
committerAleksander Machniak <alec@alec.pl>2012-10-24 11:36:48 +0200
commitf0affa6cc29ac05c1b73f47efe2c8751e3ca4c87 (patch)
tree6101e7f1d969f9c1e3d44501be5b983a2c5a9220
parent1e7aa75d18e34b0733d49a3af689be0f3d73b83c (diff)
- Fix handling dont_override with message_sort_col and message_sort_order settings (#1488760)
-rw-r--r--CHANGELOG1
-rw-r--r--program/js/app.js19
-rw-r--r--program/steps/mail/func.inc16
-rw-r--r--program/steps/mail/list.inc36
4 files changed, 43 insertions, 29 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 6705a92ea..d9707f8cd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix handling dont_override with message_sort_col and message_sort_order settings (#1488760)
- Fix HTML part detection in messages with attachments (#1488769)
- Fix bug where wrong words were highlighted on spell-before-send check
- Fix handling of URLs with asterisk characters (#1488759)
diff --git a/program/js/app.js b/program/js/app.js
index 06eb9295c..8296400ba 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -594,12 +594,11 @@ function rcube_webmail()
break;
case 'sort':
- var sort_order, sort_col = props;
+ var sort_order = this.env.sort_order,
+ sort_col = !this.env.disabled_sort_col ? props : this.env.sort_col;
- if (this.env.sort_col==sort_col)
- sort_order = this.env.sort_order=='ASC' ? 'DESC' : 'ASC';
- else
- sort_order = 'ASC';
+ if (!this.env.disabled_sort_order)
+ sort_order = this.env.sort_col == sort_col && sort_order == 'ASC' ? 'DESC' : 'ASC';
// set table header and update env
this.set_list_sorting(sort_col, sort_order);
@@ -5733,13 +5732,11 @@ function rcube_webmail()
col = this.env.coltypes[n];
if ((cell = thead.rows[0].cells[n]) && (col == 'from' || col == 'to' || col == 'fromto')) {
cell.id = 'rcm'+col;
+ $('span,a', cell).text(this.get_label(col == 'fromto' ? smart_col : col));
// if we have links for sorting, it's a bit more complicated...
- if (cell.firstChild && cell.firstChild.tagName.toLowerCase()=='a') {
- cell = cell.firstChild;
- cell.onclick = function(){ return rcmail.command('sort', this.__col, this); };
- cell.__col = col;
- }
- cell.innerHTML = this.get_label(col == 'fromto' ? smart_col : col);
+ $('a', cell).click(function(){
+ return rcmail.command('sort', this.id.replace(/^rcm/, ''), this);
+ });
}
}
}
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 39bccac16..4302bf9af 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -381,6 +381,8 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null
*/
function rcmail_message_list_head($attrib, $a_show_cols)
{
+ global $RCMAIL;
+
$skin_path = $_SESSION['skin_path'];
$image_tag = html::img(array('src' => "%s%s", 'alt' => "%s"));
@@ -388,8 +390,18 @@ function rcmail_message_list_head($attrib, $a_show_cols)
$sort_col = $_SESSION['sort_col'];
$sort_order = $_SESSION['sort_order'];
+ $dont_override = (array)$RCMAIL->config->get('dont_override');
+ $disabled_sort = in_array('message_sort_col', $dont_override);
+ $disabled_order = in_array('message_sort_order', $dont_override);
+
+ $RCMAIL->output->set_env('disabled_sort_col', $disabled_sort);
+ $RCMAIL->output->set_env('disabled_sort_order', $disabled_order);
+
// define sortable columns
- $a_sort_cols = array('subject', 'date', 'from', 'to', 'fromto', 'size', 'cc');
+ if ($disabled_sort)
+ $a_sort_cols = $sort_col && !$disabled_order ? array($sort_col) : array();
+ else
+ $a_sort_cols = array('subject', 'date', 'from', 'to', 'fromto', 'size', 'cc');
if (!empty($attrib['optionsmenuicon'])) {
$onclick = 'return ' . JS_OBJECT_NAME . ".command('menu-open', 'messagelistmenu')";
@@ -439,7 +451,7 @@ function rcmail_message_list_head($attrib, $a_show_cols)
else if ($col_name[0] != '<')
$col_name = '<span class="' . $col .'">' . $col_name . '</span>';
- $sort_class = $col == $sort_col ? " sorted$sort_order" : '';
+ $sort_class = $col == $sort_col && !$disabled_order ? " sorted$sort_order" : '';
$class_name = $col.$sort_class;
// put it all together
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc
index b5d579d7d..b433f81fc 100644
--- a/program/steps/mail/list.inc
+++ b/program/steps/mail/list.inc
@@ -23,27 +23,33 @@ if (!$OUTPUT->ajax_call) {
return;
}
+$save_arr = array();
+$dont_override = (array) $RCMAIL->config->get('dont_override');
+
// is there a sort type for this request?
-if ($sort = get_input_value('_sort', RCUBE_INPUT_GET))
-{
+if ($sort = get_input_value('_sort', RCUBE_INPUT_GET)) {
// yes, so set the sort vars
list($sort_col, $sort_order) = explode('_', $sort);
// set session vars for sort (so next page and task switch know how to sort)
- $save_arr = array();
- $_SESSION['sort_col'] = $save_arr['message_sort_col'] = $sort_col;
- $_SESSION['sort_order'] = $save_arr['message_sort_order'] = $sort_order;
+ if (!in_array('message_sort_col', $dont_override)) {
+ $_SESSION['sort_col'] = $save_arr['message_sort_col'] = $sort_col;
+ }
+ if (!in_array('message_sort_order', $dont_override)) {
+ $_SESSION['sort_order'] = $save_arr['message_sort_order'] = $sort_order;
+ }
}
// is there a set of columns for this request?
-if ($cols = get_input_value('_cols', RCUBE_INPUT_GET))
-{
- $save_arr = array();
- $save_arr['list_cols'] = explode(',', $cols);
+if ($cols = get_input_value('_cols', RCUBE_INPUT_GET)) {
+ if (!in_array('list_cols', $dont_override)) {
+ $save_arr['list_cols'] = explode(',', $cols);
+ }
}
-if ($save_arr)
+if (!empty($save_arr)) {
$RCMAIL->user->save_prefs($save_arr);
+}
$mbox_name = $RCMAIL->storage->get_folder();
$threading = (bool) $RCMAIL->storage->get_threading();
@@ -52,8 +58,7 @@ $threading = (bool) $RCMAIL->storage->get_threading();
$RCMAIL->storage->folder_sync($mbox_name);
// initialize searching result if search_filter is used
-if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL')
-{
+if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') {
$search_request = md5($mbox_name.$_SESSION['search_filter']);
$RCMAIL->storage->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, rcmail_sort_column());
$_SESSION['search'] = $RCMAIL->storage->get_search_set();
@@ -76,7 +81,6 @@ else if (empty($_REQUEST['_search']) && isset($_SESSION['search'])) {
$RCMAIL->session->remove('search');
}
-
// empty result? we'll skip UNSEEN counting in rcmail_send_unread_count()
if (empty($search_request) && empty($a_headers)) {
$unseen = 0;
@@ -96,10 +100,10 @@ $OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text());
// add message rows
rcmail_js_message_list($a_headers, FALSE, $cols);
-if (isset($a_headers) && count($a_headers))
-{
- if ($search_request)
+if (isset($a_headers) && count($a_headers)) {
+ if ($search_request) {
$OUTPUT->show_message('searchsuccessful', 'confirmation', array('nr' => $count));
+ }
}
else {
// handle IMAP errors (e.g. #1486905)