4 +-----------------------------------------------------------------------+
5 | program/steps/mail/list.inc |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2005, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Send message list to client (as remote response) |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
18 $Id: list.inc 575 2007-05-18 12:35:28Z thomasb $
23 // is there a sort type for this request?
24 if ($sort = get_input_value('_sort', RCUBE_INPUT_GET))
26 // yes, so set the sort vars
27 list($sort_col, $sort_order) = explode('_', $sort);
29 // set session vars for sort (so next page and task switch know how to sort)
30 $_SESSION['sort_col'] = $sort_col;
31 $_SESSION['sort_order'] = $sort_order;
35 // use session settings if set, defaults if not
36 $sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col'];
37 $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
40 $mbox_name = $IMAP->get_mailbox_name();
42 // fetch message headers
43 if ($count = $IMAP->messagecount($mbox_name, 'ALL', !empty($_REQUEST['_refresh'])))
44 $a_headers = $IMAP->list_headers($mbox_name, NULL, $sort_col, $sort_order);
46 $unseen = $IMAP->messagecount($mbox_name, 'UNSEEN', !empty($_REQUEST['_refresh']));
48 // update message count display
49 $pages = ceil($count/$IMAP->page_size);
50 $OUTPUT->set_env('messagecount', $count);
51 $OUTPUT->set_env('pagecount', $pages);
52 $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count));
55 $OUTPUT->command('set_unread_count', $mbox_name, $unseen);
59 if (isset($a_headers) && count($a_headers))
60 rcmail_js_message_list($a_headers);