commit | author | age
|
4e17e6
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/mail/list.inc | |
|
6 |
| | |
|
7 |
| This file is part of the RoundCube Webmail client | |
|
8 |
| Copyright (C) 2005, RoundCube Dev. - Switzerland | |
30233b
|
9 |
| Licensed under the GNU GPL | |
4e17e6
|
10 |
| | |
T |
11 |
| PURPOSE: | |
|
12 |
| Send message list to client (as remote response) | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id$ |
|
19 |
|
|
20 |
*/ |
|
21 |
|
|
22 |
$REMOTE_REQUEST = TRUE; |
cd900d
|
23 |
$OUTPUT_TYPE = 'js'; |
4e17e6
|
24 |
|
cd900d
|
25 |
$unseen = $IMAP->messagecount($mbox, 'UNSEEN', !empty($_GET['_refresh']) ? TRUE : FALSE); |
4e17e6
|
26 |
$count = $IMAP->messagecount(); |
583672
|
27 |
$sort = isset($_GET['_sort']) ? $_GET['_sort'] : false; |
4e17e6
|
28 |
|
f3b659
|
29 |
// is there a sort type for this request? |
583672
|
30 |
if ($sort) |
f3b659
|
31 |
{ |
T |
32 |
// yes, so set the sort vars |
|
33 |
list($sort_col, $sort_order) = explode('_', $sort); |
|
34 |
|
|
35 |
// set session vars for sort (so next page and task switch know how to sort) |
|
36 |
$_SESSION['sort_col'] = $sort_col; |
|
37 |
$_SESSION['sort_order'] = $sort_order; |
|
38 |
} |
|
39 |
else |
b076a4
|
40 |
{ |
T |
41 |
// use session settings if set, defaults if not |
|
42 |
$sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col']; |
|
43 |
$sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order']; |
f3b659
|
44 |
} |
T |
45 |
|
|
46 |
|
4e17e6
|
47 |
// update message count display |
T |
48 |
$pages = ceil($count/$IMAP->page_size); |
|
49 |
$commands = sprintf("this.set_env('messagecount', %d);\n", $count); |
|
50 |
$commands .= sprintf("this.set_env('pagecount', %d);\n", $pages); |
|
51 |
$commands .= sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text()); |
|
52 |
|
|
53 |
// update mailboxlist |
|
54 |
$mbox = $IMAP->get_mailbox_name(); |
cd900d
|
55 |
$commands .= sprintf("this.set_unread_count('%s', %d);\n", addslashes($mbox), $unseen); |
4e17e6
|
56 |
|
T |
57 |
|
|
58 |
// add message rows |
|
59 |
if ($count) |
|
60 |
{ |
f3b659
|
61 |
$a_headers = $IMAP->list_headers($mbox, null, $sort_col, $sort_order); |
4e17e6
|
62 |
$commands .= rcmail_js_message_list($a_headers); |
T |
63 |
} |
|
64 |
|
|
65 |
|
|
66 |
// send response |
|
67 |
rcube_remote_response($commands); |
|
68 |
|
|
69 |
exit; |
|
70 |
?> |