From: ebullient Date: Fri, 5 Mar 2004 18:47:14 +0000 (+0000) Subject: Fix for moving last message in a folder. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b2811304a7a54da99a8b8d34e930ae995aad5ce5;p=squirrelmail.git Fix for moving last message in a folder. Rather than change how messages are indexed, this confines changes to read_body ... move_messages.php is used to move the last message in the index. This is the same function that is used when moving messages from the list index. If there is a "next" message, read_body deletes the message itself.. (theoretically, we could use move_messages here, too, and just change the resulting location.... will have to think about that.. ) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6749 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/src/read_body.php b/src/read_body.php index 1189b6f7..96426d34 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -1,5 +1,4 @@ )'; } - $menu_row .= $topbar_delimiter.$delete_link; + $menu_row .= $topbar_delimiter.$delete_link . "\n"; // Add top move link $menu_row .= ''; - if (!(isset($passed_ent_id) && $passed_ent_id)) { - $menu_row .= '
'. + if ( !(isset($passed_ent_id) && $passed_ent_id) ) { + // If we have a next message, move, and then go to next. + // Otherwise, use move_messages to move, and then return to index. + + $current_box = 'mailbox='.$mailbox.'&sort='.$sort.'&startMessage='.$startMessage; + $action = $base_uri; + if ( isset($next) && $next >= 0 ) { + $action .= 'src/read_body.php?passed_id='.$next.'&'; + } else { + $action .= 'src/move_messages.php?'; + } + $action .= $current_box; + + $menu_row .= ''. ''. - ''._("Move to:") . + ''._("Move to:") . ' '. - ''. - '
'; + $menu_row .= ' '; + + // If we'll be using move_messages.php, also add location to form + if ( !isset($next) || $next < 0 ) { + $menu_row .= ''; + } + + $menu_row .= getButton('SUBMIT', 'moveButton',_("Move")) . "\n" . ''; } $menu_row .= ''; @@ -802,8 +818,13 @@ if ( sqgetGlobalVar('delete_id', $delete_id, SQ_GET) ) { * Process Move from delete-move-next * but only if move_id and target_mailbox were set */ -if ( sqgetGlobalVar('move_id', $move_id, SQ_POST) && - sqgetGlobalVar('targetMailbox', $targetMailbox, SQ_POST) ) { +if ( sqgetGlobalVar('moveButton', $moveButton, SQ_POST) && + sqgetGlobalVar('msg', $msg, SQ_POST) && + sqgetGlobalVar('targetMailbox', $targetMailbox, SQ_POST) && + is_array($msg) && !empty($msg) ) { + + $move_id = $msg[0]; + // Move message sqimap_messages_copy($imapConnection, $move_id, $move_id, $targetMailbox); sqimap_messages_flag($imapConnection, $move_id, $move_id, 'Deleted', true);