From 43fa235da354c8b53aa69ba745c1d398a758fcaf Mon Sep 17 00:00:00 2001 From: svncommit <devs@roundcube.net> Date: Wed, 26 Oct 2005 05:42:19 -0400 Subject: [PATCH] --- program/steps/mail/list.inc | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-) diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc index 1e9ce92..5dd652d 100644 --- a/program/steps/mail/list.inc +++ b/program/steps/mail/list.inc @@ -25,6 +25,37 @@ $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 @@ // 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); } -- Gitblit v1.9.1