4 +-----------------------------------------------------------------------+
5 | program/steps/mail/move_del.inc |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2005, 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 269 2006-06-29 23:41:40Z richs $
22 $REMOTE_REQUEST = TRUE;
25 if ($_action=='moveto' && $_GET['_uid'] && $_GET['_target_mbox'])
27 $count = sizeof(explode(',', $_GET['_uid']));
28 $moved = $IMAP->move_message($_GET['_uid'], $_GET['_target_mbox'], $_GET['_mbox']);
33 $commands = "this.list_mailbox();\n";
34 $commands .= show_message('errormoving', 'error');
35 rcube_remote_response($commands);
41 else if ($_action=='delete' && $_GET['_uid'])
43 $count = sizeof(explode(',', $_GET['_uid']));
44 $del = $IMAP->delete_message($_GET['_uid'], $_GET['_mbox']);
49 $commands = "this.list_mailbox();\n";
50 $commands .= show_message('errordeleting', 'error');
51 rcube_remote_response($commands);
56 // unknown action or missing query param
63 // update message count display
64 $pages = ceil($IMAP->messagecount()/$IMAP->page_size);
65 $commands = sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text());
66 $commands .= sprintf("this.set_env('pagecount', %d);\n", $pages);
70 $mbox = $IMAP->get_mailbox_name();
71 $commands .= sprintf("this.set_unread_count('%s', %d);\n", $mbox, $IMAP->messagecount($mbox, 'UNSEEN'));
73 if ($_action=='moveto')
74 $commands .= sprintf("this.set_unread_count('%s', %d);\n", $_GET['_target_mbox'], $IMAP->messagecount($_GET['_target_mbox'], 'UNSEEN'));
76 $commands .= sprintf("this.set_quota('%s');\n", $IMAP->get_quota());
78 // add new rows from next page (if any)
79 if ($_GET['_from']!='show' && $pages>1 && $IMAP->list_page < $pages)
81 $a_headers = $IMAP->list_headers($mbox, null, $_SESSION['sort_col'], $_SESSION['sort_order']);
82 $a_headers = array_slice($a_headers, -$count, $count);
83 $commands .= rcmail_js_message_list($a_headers);
88 rcube_remote_response($commands);