source: subversion/trunk/roundcubemail/program/steps/mail/list.inc @ 2109

Last change on this file since 2109 was 2109, checked in by alec, 5 years ago

#1485587: show proper message when using status filter

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1<?php
2
3/*
4 +-----------------------------------------------------------------------+
5 | program/steps/mail/list.inc                                           |
6 |                                                                       |
7 | This file is part of the RoundCube Webmail client                     |
8 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
9 | Licensed under the GNU GPL                                            |
10 |                                                                       |
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// is there a sort type for this request?
23if ($sort = get_input_value('_sort', RCUBE_INPUT_GET))
24{
25  // yes, so set the sort vars
26  list($sort_col, $sort_order) = explode('_', $sort);
27
28  // set session vars for sort (so next page and task switch know how to sort)
29  $save_arr = array();
30  $_SESSION['sort_col'] = $save_arr['message_sort_col'] = $sort_col;
31  $_SESSION['sort_order'] = $save_arr['message_sort_order'] = $sort_order;
32 
33  $RCMAIL->user->save_prefs($save_arr);
34}
35else
36{
37  // use session settings if set, defaults if not
38  $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : $CONFIG['message_sort_col'];
39  $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
40}
41
42$mbox_name = $IMAP->get_mailbox_name();
43
44// initialize searching result if search_filter is used
45if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL')
46{
47  $search_request = md5($mbox_name.$_SESSION['search_filter']);
48
49  $IMAP->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $sort_col);
50  $_SESSION['search'][$search_request] = $IMAP->get_search_set();
51  $OUTPUT->set_env('search_request', $search_request);
52}
53                             
54
55// fetch message headers
56if ($IMAP->messagecount($mbox_name, 'ALL', !empty($_REQUEST['_refresh'])))
57  $a_headers = $IMAP->list_headers($mbox_name, NULL, $sort_col, $sort_order);
58
59$count = $IMAP->messagecount($mbox_name);
60$unseen = $IMAP->messagecount($mbox_name, 'UNSEEN', !empty($_REQUEST['_refresh']));
61
62// update message count display
63$pages = ceil($count/$IMAP->page_size);
64$OUTPUT->set_env('messagecount', $count);
65$OUTPUT->set_env('pagecount', $pages);
66$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count));
67$OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text());
68
69// add message rows
70if (isset($a_headers) && count($a_headers))
71{
72  rcmail_js_message_list($a_headers);
73  if ($search_request)
74    $OUTPUT->show_message('searchsuccessful', 'confirmation', array('nr' => $count));
75}
76else if ($search_request)
77  $OUTPUT->show_message('searchnomatch', 'notice');
78else
79  $OUTPUT->show_message('nomessagesfound', 'notice');
80 
81// update mailboxlist
82$OUTPUT->command('set_unread_count', $mbox_name, $unseen, ($mbox_name == 'INBOX'));
83
84// send response
85$OUTPUT->send();
86
87?>
Note: See TracBrowser for help on using the repository browser.