summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-09-17 09:14:13 +0000
committeralecpl <alec@alec.pl>2010-09-17 09:14:13 +0000
commit614c642a4ba8b050ecb26d25d349077f6192aa8d (patch)
tree1b2203c73785f19d9161d2d6328901ec25f9c173 /program/steps/mail
parentb8d96f6e609f3bb8a72fa724bc273175c8e7dbb1 (diff)
- Fix list_cols is not updated after column dragging (#1486999)
- Improved save-pref action and moved to separate file in utils task directory - Improved http_post/http_request to support first argument in form 'task/action'
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/func.inc35
-rw-r--r--program/steps/mail/list.inc4
2 files changed, 27 insertions, 12 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index eb785ca68..91fd05e8c 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -171,7 +171,9 @@ function rcmail_message_list($attrib)
&& (($f = array_search('from', $a_show_cols)) !== false) && array_search('to', $a_show_cols) === false)
$a_show_cols[$f] = 'to';
- // make sure 'threads' column is present
+ // make sure 'threads' and 'subject' columns are present
+ if (!in_array('subject', $a_show_cols))
+ array_unshift($a_show_cols, 'subject');
if (!in_array('threads', $a_show_cols))
array_unshift($a_show_cols, 'threads');
@@ -223,28 +225,41 @@ function rcmail_message_list($attrib)
/**
* return javascript commands to add rows to the message list
- * or to replace the whole list (IE only)
*/
-function rcmail_js_message_list($a_headers, $insert_top=FALSE, $head_replace=FALSE)
+function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null)
{
global $CONFIG, $IMAP, $RCMAIL, $OUTPUT;
- if (!empty($_SESSION['list_attrib']['columns']))
- $a_show_cols = $_SESSION['list_attrib']['columns'];
- else
- $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject');
+ if (empty($a_show_cols)) {
+ if (!empty($_SESSION['list_attrib']['columns']))
+ $a_show_cols = $_SESSION['list_attrib']['columns'];
+ else
+ $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject');
+ }
+ else {
+ if (!is_array($a_show_cols))
+ $a_show_cols = preg_split('/[\s,;]+/', strip_quotes($a_show_cols));
+ $head_replace = true;
+ }
$mbox = $IMAP->get_mailbox_name();
$delim = $IMAP->get_hierarchy_delimiter();
+ // make sure 'threads' and 'subject' columns are present
+ if (!in_array('subject', $a_show_cols))
+ array_unshift($a_show_cols, 'subject');
+ if (!in_array('threads', $a_show_cols))
+ array_unshift($a_show_cols, 'threads');
+
+ $_SESSION['list_attrib']['columns'] = $a_show_cols;
+
// show 'to' instead of 'from' in sent/draft messages
if ((strpos($mbox.$delim, $CONFIG['sent_mbox'].$delim)===0 || strpos($mbox.$delim, $CONFIG['drafts_mbox'].$delim)===0)
&& (($f = array_search('from', $a_show_cols)) !== false) && array_search('to', $a_show_cols) === false)
$a_show_cols[$f] = 'to';
- // make sure 'threads' column is present
- if (!in_array('threads', $a_show_cols))
- array_unshift($a_show_cols, 'threads');
+ // Make sure there are no duplicated columns (#1486999)
+ $a_show_cols = array_unique($a_show_cols);
// Plugins may set header's list_cols/list_flags and other rcube_mail_header variables
// and list columns
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc
index 69d03b3bf..9f59243d2 100644
--- a/program/steps/mail/list.inc
+++ b/program/steps/mail/list.inc
@@ -48,7 +48,7 @@ if ($cols = get_input_value('_cols', RCUBE_INPUT_GET))
$save_arr['list_cols'] = explode(',', $cols);
}
-if ($save_arr)
+if ($save_arr)
$RCMAIL->user->save_prefs($save_arr);
$mbox_name = $IMAP->get_mailbox_name();
@@ -88,7 +88,7 @@ $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count));
$OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text());
// add message rows
-rcmail_js_message_list($a_headers, FALSE, (bool) $cols);
+rcmail_js_message_list($a_headers, FALSE, $cols);
if (isset($a_headers) && count($a_headers))
{
if ($search_request)