Mercurial > hg > rc2
comparison program/steps/mail/pagenav.inc @ 0:4681f974d28b
vanilla 1.3.3 distro, I hope
author | Charlie Root |
---|---|
date | Thu, 04 Jan 2018 15:52:31 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4681f974d28b |
---|---|
1 <?php | |
2 | |
3 /** | |
4 +-----------------------------------------------------------------------+ | |
5 | program/steps/mail/pagenav.inc | | |
6 | | | |
7 | This file is part of the Roundcube Webmail client | | |
8 | Copyright (C) 2005-2016, 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 | Updates message page navigation controls | | |
16 | | | |
17 +-----------------------------------------------------------------------+ | |
18 | Author: Aleksander Machniak <alec@alec.pl> | | |
19 +-----------------------------------------------------------------------+ | |
20 */ | |
21 | |
22 $uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GET); | |
23 $index = $RCMAIL->storage->index(null, rcmail_sort_column(), rcmail_sort_order()); | |
24 $cnt = $index->count_messages(); | |
25 | |
26 if ($cnt && ($pos = $index->exists($uid, true)) !== false) { | |
27 $prev = $pos ? $index->get_element($pos-1) : 0; | |
28 $first = $pos ? $index->get_element('FIRST') : 0; | |
29 $next = $pos < $cnt-1 ? $index->get_element($pos+1) : 0; | |
30 $last = $pos < $cnt-1 ? $index->get_element('LAST') : 0; | |
31 } | |
32 else { | |
33 // error, this will at least disable page navigation | |
34 $OUTPUT->command('set_rowcount', ''); | |
35 $OUTPUT->send(); | |
36 } | |
37 | |
38 // Set UIDs and activate navigation buttons | |
39 if ($prev) { | |
40 $OUTPUT->set_env('prev_uid', $prev); | |
41 $OUTPUT->command('enable_command', 'previousmessage', 'firstmessage', true); | |
42 } | |
43 | |
44 if ($next) { | |
45 $OUTPUT->set_env('next_uid', $next); | |
46 $OUTPUT->command('enable_command', 'nextmessage', 'lastmessage', true); | |
47 } | |
48 | |
49 if ($first) { | |
50 $OUTPUT->set_env('first_uid', $first); | |
51 } | |
52 | |
53 if ($last) { | |
54 $OUTPUT->set_env('last_uid', $last); | |
55 } | |
56 | |
57 // Don't need a real messages count value | |
58 $OUTPUT->set_env('messagecount', 1); | |
59 | |
60 // Set rowcount text | |
61 $OUTPUT->command('set_rowcount', $RCMAIL->gettext(array( | |
62 'name' => 'messagenrof', | |
63 'vars' => array('nr' => $pos+1, 'count' => $cnt) | |
64 ))); | |
65 | |
66 $OUTPUT->send(); |