summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-05-30 15:10:35 +0000
committeralecpl <alec@alec.pl>2009-05-30 15:10:35 +0000
commitdc2fc082d372cc58f6d660d89fa19788be0d4c34 (patch)
treefb5e8ec72cfaf09eb8e81753dd94029804e5a654 /program/steps
parent7ef05f4df1870155573f860ecb8e1399cb467afc (diff)
- After move/delete from 'show' action display next message instead of messages list (#1485887)
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/move_del.inc61
1 files changed, 38 insertions, 23 deletions
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index 399d41f65..c4294b01f 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -37,7 +37,8 @@ if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_targe
if (!$moved) {
// send error message
- $OUTPUT->command('list_mailbox');
+ if ($_POST['_from'] != 'show')
+ $OUTPUT->command('list_mailbox');
$OUTPUT->show_message('errormoving', 'error');
$OUTPUT->send();
exit;
@@ -54,7 +55,8 @@ else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) {
if (!$del) {
// send error message
- $OUTPUT->command('list_mailbox');
+ if ($_POST['_from'] != 'show')
+ $OUTPUT->command('list_mailbox');
$OUTPUT->show_message('errordeleting', 'error');
$OUTPUT->send();
exit;
@@ -66,41 +68,51 @@ else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) {
else {
exit;
}
+
// refresh saved search set after moving some messages
if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set) {
$_SESSION['search'][$search_request] = $IMAP->refresh_search();
}
-$msg_count = $IMAP->messagecount();
-$pages = ceil($msg_count / $IMAP->page_size);
-$nextpage_count = $old_count - $IMAP->page_size * $IMAP->list_page;
-$remaining = $msg_count - $IMAP->page_size * ($IMAP->list_page - 1);
-
-// jump back one page (user removed the whole last page)
-if ($IMAP->list_page > 1 && $nextpage_count <= 0 && $remaining == 0) {
+if ($_POST['_from'] == 'show')
+{
+ if ($next = get_input_value('_next_uid', RCUBE_INPUT_GPC))
+ $OUTPUT->command('show_message', $next);
+ else
+ $OUTPUT->command('command', 'list');
+}
+else
+{
+ $msg_count = $IMAP->messagecount();
+ $pages = ceil($msg_count / $IMAP->page_size);
+ $nextpage_count = $old_count - $IMAP->page_size * $IMAP->list_page;
+ $remaining = $msg_count - $IMAP->page_size * ($IMAP->list_page - 1);
+
+ // jump back one page (user removed the whole last page)
+ if ($IMAP->list_page > 1 && $nextpage_count <= 0 && $remaining == 0) {
$IMAP->set_page($IMAP->list_page-1);
$_SESSION['page'] = $IMAP->list_page;
$jump_back = true;
-}
+ }
-// update message count display
-$OUTPUT->set_env('pagecount', $pages);
-$OUTPUT->set_env('messagecount', $msg_count);
-$OUTPUT->set_env('current_page', $IMAP->list_page);
-$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count));
+ // update message count display
+ $OUTPUT->set_env('messagecount', $msg_count);
+ $OUTPUT->set_env('current_page', $IMAP->list_page);
+ $OUTPUT->set_env('pagecount', $pages);
-// update mailboxlist
-$mbox = $IMAP->get_mailbox_name();
-$OUTPUT->command('set_unread_count', $mbox, $IMAP->messagecount($mbox, 'UNSEEN'), ($mbox == 'INBOX'));
+ // update mailboxlist
+ $mbox = $IMAP->get_mailbox_name();
+ $OUTPUT->command('set_unread_count', $mbox, $IMAP->messagecount($mbox, 'UNSEEN'), ($mbox == 'INBOX'));
-if ($RCMAIL->action=='moveto' && $target) {
+ if ($RCMAIL->action=='moveto' && $target) {
$OUTPUT->command('set_unread_count', $target, $IMAP->messagecount($target, 'UNSEEN'));
-}
+ }
-$OUTPUT->command('set_quota', rcmail_quota_content($IMAP->get_quota()));
+ $OUTPUT->command('set_quota', rcmail_quota_content($IMAP->get_quota()));
+ $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count));
-// add new rows from next page (if any)
-if ($addrows && $_POST['_from']!='show' && ($jump_back || $nextpage_count > 0)) {
+ // add new rows from next page (if any)
+ if ($addrows && ($jump_back || $nextpage_count > 0)) {
$sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col'];
$sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
@@ -109,7 +121,10 @@ if ($addrows && $_POST['_from']!='show' && ($jump_back || $nextpage_count > 0))
$a_headers = array_slice($a_headers, -$count, $count);
}
rcmail_js_message_list($a_headers, false, false);
+ }
}
// send response
$OUTPUT->send();
+
+?>