Index: src/move_messages.php =================================================================== --- src/move_messages.php (revision 748) +++ src/move_messages.php (working copy) @@ -130,11 +130,16 @@ sqgetGlobalVar('msgs', $msgs, SQ_SESSION); sqgetGlobalVar('composesession', $composesession, SQ_SESSION); -sqgetGlobalVar('lastTargetMailbox', $lastTargetMailbox, SQ_SESSION); +if (!sqgetGlobalVar('lastTargetMailbox', $lastTargetMailbox, SQ_SESSION)) { + $lastTargetMailbox = 'INBOX'; +} + sqgetGlobalVar('moveButton', $moveButton, SQ_POST); +sqgetGlobalVar('moveButton2', $moveButton2, SQ_POST); sqgetGlobalVar('expungeButton', $expungeButton, SQ_POST); sqgetGlobalVar('targetMailbox', $targetMailbox, SQ_POST); +sqgetGlobalVar('targetMailbox2', $targetMailbox2, SQ_POST); sqgetGlobalVar('expungeButton', $expungeButton, SQ_POST); sqgetGlobalVar('undeleteButton', $undeleteButton, SQ_POST); sqgetGlobalVar('markRead', $markRead, SQ_POST); @@ -156,13 +161,14 @@ // make sure that cache is not used $location = set_url_var($location,'use_mailbox_cache',null,false); -/* remember changes to mailbox setting */ -if (!isset($lastTargetMailbox)) { - $lastTargetMailbox = 'INBOX'; -} +/** + * If user changes target mailbox and selects action which is not related to + * targetMailbox, remember top targetMailbox selection. If bottom targetMailbox + * is selected, it will be modified later + */ if ($targetMailbox != $lastTargetMailbox) { - $lastTargetMailbox = $targetMailbox; - sqsession_register($lastTargetMailbox, 'lastTargetMailbox'); + // save target mailbox in session + sqsession_register($targetMailbox, 'lastTargetMailbox'); } $exception = false; @@ -199,19 +205,25 @@ } else { $exception = true; } -} elseif (!isset($moveButton)) { +} elseif (!isset($moveButton) && !isset($moveButton2)) { + // It is not move action if (count($id)) { $cnt = count($id); if (!isset($attache)) { if (isset($markRead)) { + // mark as read action sqimap_toggle_flag($imapConnection, $id, '\\Seen',true,true); } elseif (isset($markUnread)) { + // mark as unread action sqimap_toggle_flag($imapConnection, $id, '\\Seen',false,true); } elseif (isset($markFlagged)) { + // flag action sqimap_toggle_flag($imapConnection, $id, '\\Flagged',true,true); } elseif (isset($markUnflagged)) { + // unflag action sqimap_toggle_flag($imapConnection, $id, '\\Flagged',false,true); } else { + // FIXME: default delete action sqimap_msgs_list_delete($imapConnection, $mailbox, $id); if ($auto_expunge) { $cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, true); @@ -225,6 +237,7 @@ } } } else { + // forward action $composesession = attachSelectedMessages($id, $imapConnection); $location = set_url_var($location, 'session', $composesession, false); if ($compose_new_win) { @@ -237,7 +250,15 @@ } else { $exception = true; } -} else { // Move messages +} else { + // Move messages + + // bottom form action + if (isset($moveButton2)) { + $targetMailbox = $targetMailbox2; + sqsession_register($targetMailbox2, 'lastTargetMailbox'); + } + if (count($id)) { // move messages only when target mailbox is not the same as source mailbox if ($mailbox!=$targetMailbox) { @@ -260,6 +281,7 @@ $exception = true; } } + // Log out this session sqimap_logout($imapConnection); if ($exception) { Index: functions/mailbox_display.php =================================================================== --- functions/mailbox_display.php (revision 696) +++ functions/mailbox_display.php (working copy) @@ -900,7 +900,7 @@ /** Print second set of controls only when more than 10 messages are displayed */ if ($num_msgs > 10) { echo ''; - nsm_print_mailbox_controls($mailbox, $sort); + nsm_print_mailbox_controls($mailbox, $sort, true); echo '