4 +-----------------------------------------------------------------------+
5 | program/steps/mail/move_del.inc |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Move the submitted messages to a specific mailbox or delete them |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
18 $Id: move_del.inc 573 2007-05-18 11:29:25Z thomasb $
23 if ($_action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox']))
25 $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST))));
26 $target = get_input_value('_target_mbox', RCUBE_INPUT_POST);
27 $moved = $IMAP->move_message($uids, $target, get_input_value('_mbox', RCUBE_INPUT_POST));
32 $OUTPUT->command('list_mailbox');
33 $OUTPUT->show_message('errormoving', 'error');
40 else if ($_action=='delete' && !empty($_POST['_uid']))
42 $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST))));
43 $del = $IMAP->delete_message($uids, get_input_value('_mbox', RCUBE_INPUT_POST));
48 $OUTPUT->command('list_mailbox');
49 $OUTPUT->show_message('errordeleting', 'error');
55 // unknown action or missing query param
59 // refresh saved seach set after moving some messages
60 if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set)
61 $_SESSION['search'][$search_request] = $IMAP->refresh_search();
64 // update message count display
65 $msg_count = $IMAP->messagecount();
66 $pages = ceil($msg_count / $IMAP->page_size);
67 $OUTPUT->set_env('pagecount', $pages);
68 $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count));
72 $mbox = $IMAP->get_mailbox_name();
73 $OUTPUT->command('set_unread_count', $mbox, $IMAP->messagecount($mbox, 'UNSEEN'));
75 if ($_action=='moveto' && $target)
76 $OUTPUT->command('set_unread_count', $target, $IMAP->messagecount($target, 'UNSEEN'));
78 $OUTPUT->command('set_quota', $IMAP->get_quota());
80 // add new rows from next page (if any)
81 if ($_POST['_from']!='show' && $pages>1 && $IMAP->list_page < $pages)
83 $sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col'];
84 $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
86 $a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order);
87 $a_headers = array_slice($a_headers, -$count, $count);
89 rcmail_js_message_list($a_headers);