From f3b659935f3386c077746cd7a84770532ed0ec50 Mon Sep 17 00:00:00 2001 From: thomascube Date: Sun, 23 Oct 2005 14:39:09 +0000 Subject: Added patches for default language and sorting function --- program/steps/mail/list.inc | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'program/steps/mail/list.inc') diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc index 1e9ce926b..5dd652d44 100644 --- a/program/steps/mail/list.inc +++ b/program/steps/mail/list.inc @@ -25,6 +25,37 @@ $OUTPUT_TYPE = 'js'; $unseen = $IMAP->messagecount($mbox, 'UNSEEN', !empty($_GET['_refresh']) ? TRUE : FALSE); $count = $IMAP->messagecount(); +// is there a sort type for this request? +if ($sort = isset($_GET['_sort']) ? $_GET['_sort'] : false) + { + // yes, so set the sort vars + list($sort_col, $sort_order) = explode('_', $sort); + + // iloha mail sort func doesn't know about a 'Sender' col + $sort_col = $sort_col == 'Sender' ? 'From' : $sort_col; + + // set session vars for sort (so next page and task switch know how to sort) + $_SESSION['sort_col'] = $sort_col; + $_SESSION['sort_order'] = $sort_order; + } +else + { + // if switching folder, use default sorting + if ($_GET['_refresh'] == '1') + { + $sort_col = 'date'; + $sort_order = 'desc'; + unset($_SESSION['sort_col'], $_SESSION['sort_order']); + } + else + { + // use session settings if set, defaults if not + $sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : 'date'; + $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : 'desc'; + } + } + + // update message count display $pages = ceil($count/$IMAP->page_size); $commands = sprintf("this.set_env('messagecount', %d);\n", $count); @@ -39,7 +70,7 @@ $commands .= sprintf("this.set_unread_count('%s', %d);\n", addslashes($mbox), $u // add message rows if ($count) { - $a_headers = $IMAP->list_headers($mbox); + $a_headers = $IMAP->list_headers($mbox, null, $sort_col, $sort_order); $commands .= rcmail_js_message_list($a_headers); } -- cgit v1.2.3