source: github/program/steps/mail/list.inc @ c97c575

HEADcourier-fixdev-browser-capabilitiespdorelease-0.8
Last change on this file since c97c575 was c97c575, checked in by thomascube <thomas@…>, 14 months ago

Force page reload if list columns changed in IE8 (#1487822)

  • Property mode set to 100644
File size: 4.8 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, The Roundcube Dev Team                       |
9 |                                                                       |
10 | Licensed under the GNU General Public License version 3 or            |
11 | any later version with exceptions for skins & plugins.                |
12 | See the README file for a full license statement.                     |
13 |                                                                       |
14 | PURPOSE:                                                              |
15 |   Send message list to client (as remote response)                    |
16 |                                                                       |
17 +-----------------------------------------------------------------------+
18 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
19 +-----------------------------------------------------------------------+
20
21 $Id$
22
23*/
24
25if (!$OUTPUT->ajax_call) {
26  return;
27}
28
29// is there a sort type for this request?
30if ($sort = get_input_value('_sort', RCUBE_INPUT_GET))
31{
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  $save_arr = array();
37  $_SESSION['sort_col'] = $save_arr['message_sort_col'] = $sort_col;
38  $_SESSION['sort_order'] = $save_arr['message_sort_order'] = $sort_order;
39}
40else
41{
42  // use session settings if set, defaults if not
43  $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : $CONFIG['message_sort_col'];
44  $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
45}
46
47// is there a set of columns for this request?
48if ($cols = get_input_value('_cols', RCUBE_INPUT_GET))
49{
50  $save_arr = array();
51  $save_arr['list_cols'] = explode(',', $cols);
52}
53
54if ($save_arr) {
55  $RCMAIL->user->save_prefs($save_arr);
56
57  // force page reload if list columns changed in IE8 (#1487822)
58  if ($save_arr['list_cols'] && $OUTPUT->browser->ie && $OUTPUT->browser->ver == 8) {
59    $OUTPUT->redirect(array('_mbox' => $RCMAIL->storage->get_folder()), 0);
60  }
61}
62
63$mbox_name = $RCMAIL->storage->get_folder();
64$threading = (bool) $RCMAIL->storage->get_threading();
65
66// Synchronize mailbox cache, handle flag changes
67$RCMAIL->storage->folder_sync($mbox_name);
68
69// initialize searching result if search_filter is used
70if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL')
71{
72  $search_request = md5($mbox_name.$_SESSION['search_filter']);
73  $RCMAIL->storage->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $sort_col);
74  $_SESSION['search'] = $RCMAIL->storage->get_search_set();
75  $_SESSION['search_request'] = $search_request;
76  $OUTPUT->set_env('search_request', $search_request);
77}
78
79// fetch message headers
80if ($count = $RCMAIL->storage->count($mbox_name, $threading ? 'THREADS' : 'ALL', !empty($_REQUEST['_refresh'])))
81  $a_headers = $RCMAIL->storage->list_messages($mbox_name, NULL, $sort_col, $sort_order);
82
83// update search set (possible change of threading mode)
84if (!empty($_REQUEST['_search']) && isset($_SESSION['search'])
85    && $_SESSION['search_request'] == $_REQUEST['_search']
86) {
87  $_SESSION['search'] = $RCMAIL->storage->get_search_set();
88}
89// remove old search data
90else if (empty($_REQUEST['_search']) && isset($_SESSION['search'])) {
91  $RCMAIL->session->remove('search');
92}
93
94
95// empty result? we'll skip UNSEEN counting in rcmail_send_unread_count()
96if (empty($search_request) && empty($a_headers)) {
97    $unseen = 0;
98}
99
100// update mailboxlist
101rcmail_send_unread_count($mbox_name, !empty($_REQUEST['_refresh']), $unseen);
102
103// update message count display
104$pages = ceil($count/$RCMAIL->storage->get_pagesize());
105$OUTPUT->set_env('messagecount', $count);
106$OUTPUT->set_env('pagecount', $pages);
107$OUTPUT->set_env('threading', $threading);
108$OUTPUT->set_env('current_page', $count ? $RCMAIL->storage->get_page() : 1);
109$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count), $mbox_name);
110$OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text());
111
112// add message rows
113rcmail_js_message_list($a_headers, FALSE, $cols);
114if (isset($a_headers) && count($a_headers))
115{
116  if ($search_request)
117    $OUTPUT->show_message('searchsuccessful', 'confirmation', array('nr' => $count));
118}
119else {
120  // handle IMAP errors (e.g. #1486905)
121  if ($err_code = $RCMAIL->storage->get_error_code()) {
122    rcmail_display_server_error();
123  }
124  else if ($search_request)
125    $OUTPUT->show_message('searchnomatch', 'notice');
126  else
127    $OUTPUT->show_message('nomessagesfound', 'notice');
128}
129
130// send response
131$OUTPUT->send();
Note: See TracBrowser for help on using the repository browser.