summaryrefslogtreecommitdiff
path: root/program/steps/mail/list.inc
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2005-10-23 14:39:09 +0000
committerthomascube <thomas@roundcube.net>2005-10-23 14:39:09 +0000
commitf3b659935f3386c077746cd7a84770532ed0ec50 (patch)
treef396f50225366a1e3661580786cfde368454b10c /program/steps/mail/list.inc
parentf619dedc5aa2020eeffa01e05feacedb043ccb66 (diff)
Added patches for default language and sorting function
Diffstat (limited to 'program/steps/mail/list.inc')
-rw-r--r--program/steps/mail/list.inc33
1 files changed, 32 insertions, 1 deletions
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);
}