ChangeLog
[squirrelmail.git] / src / read_body.php
index 916df1679ecc14e2ac9c91b5bf559bd2ec68f83a..a4588362c4a0b64eb3ebaeb0c7e3b11b82054287 100644 (file)
@@ -1,9 +1,8 @@
 <?php
-
 /**
  * read_body.php
  *
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This file is used for reading the msgs array and displaying
@@ -633,27 +632,26 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
 
     // Show Alt URI for Draft/Sent
     if (isset($comp_alt_uri)) {
-        $menu_row .= $topbar_delimiter;
         $menu_row .= makeComposeLink($comp_alt_uri, $comp_alt_string);
-        $menu_row .= $topbar_delimiter;
+        $menu_row .= $topbar_delimiter . "\n";
     }
 
     $comp_action_uri = $comp_uri . '&amp;smaction=reply';
-    $menu_row .= makeComposeLink($comp_action_uri, _("Reply"));
+    $menu_row .= makeComposeLink($comp_action_uri, _("Reply")) . "\n";
 
     $comp_action_uri = $comp_uri . '&amp;smaction=reply_all';
     $menu_row .= $topbar_delimiter;
-    $menu_row .= makeComposeLink($comp_action_uri, _("Reply All"));
+    $menu_row .= makeComposeLink($comp_action_uri, _("Reply All")) . "\n";
 
 
     $comp_action_uri = $comp_uri . '&amp;smaction=forward';
     $menu_row .= $topbar_delimiter;
-    $menu_row .= makeComposeLink($comp_action_uri, _("Forward"));
+    $menu_row .= makeComposeLink($comp_action_uri, _("Forward")) . "\n";
 
     if ($enable_forward_as_attachment) {
         $comp_action_uri = $comp_uri . '&amp;smaction=forward_as_attachment';
         $menu_row .= $topbar_delimiter;
-        $menu_row .= makeComposeLink($comp_action_uri, _("Forward as Attachment"));
+        $menu_row .= makeComposeLink($comp_action_uri, _("Forward as Attachment")) . "\n";
     }
 
     $delete_link = _("Delete");
@@ -671,29 +669,49 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
                         ._("Bypass Trash").'</a>)';
         
     }
-    $menu_row .= $topbar_delimiter.$delete_link;
+    $menu_row .= $topbar_delimiter.$delete_link . "\n";
 
 
     // Add top move link
     $menu_row .= '</small></td><td align="right">';
-    if (!(isset($passed_ent_id) && $passed_ent_id)) {
-        $menu_row .= '<form action="read_body.php?mailbox='.$mailbox.'&sort='.$sort.'&startMessage='.$startMessage.'&passed_id='.$next.'" method="post">'.
+    if ( !(isset($passed_ent_id) && $passed_ent_id) ) {
+        
+        $current_box = 'mailbox='.$mailbox.'&sort='.$sort.'&startMessage='.$startMessage;
+
+        // Set subsequent location based on whether or not there is a 'next' message.
+        if ( isset($next) && $next >= 0 ) {
+          $location = $base_uri . 'src/read_body.php?passed_id='.$next.'&';
+        } else {
+          $location = $base_uri . 'src/right_main.php?';
+        }
+
+        $menu_row .= '<form action="'.$base_uri.'src/move_messages.php?'.$current_box.'" method="post">'.
               '<small><input type="hidden" name="show_more" value="0" />'.
-              '<input type="hidden" name="move_id" value="'.$passed_id.'" />'._("Move to:") .
+              '<input type="hidden" name="location" value="'.$location.$current_box.'" />'.
+              '<input type="hidden" name="msg[0]" value="'.$passed_id.'" />'._("Move to:") .
               '<select name="targetMailbox" style="padding: 0px; margin: 0px">';
+
         if (isset($lastTargetMailbox) && !empty($lastTargetMailbox)) {
             $menu_row .= sqimap_mailbox_option_list($imapConnection, array(strtolower($lastTargetMailbox)));
         } else {
             $menu_row .= sqimap_mailbox_option_list($imapConnection);
         }
-        $menu_row .= '</select> '.
-              '<input type="submit" value="' . _("Move") . '" style="padding: 0px; margin: 0px"/>'.
-              '</small></form>';
+        $menu_row .= '</select> ';
+
+        $menu_row .= getButton('SUBMIT', 'moveButton',_("Move")) . "\n" . '</form>';
     }
     $menu_row .= '</td></tr>';
 
     // echo rows, with hooks
-    do_hook('read_body_menu_top');
+    $ret = do_hook_function('read_body_menu_top', array($nav_row, $menu_row));
+    if (is_array($ret)) {
+        if (isset($ret[0]) && !empty($ret[0])) {
+            $nav_row = $ret[0];
+        }
+        if (isset($ret[1]) && !empty($ret[1])) {
+            $menu_row = $ret[1];
+        }
+    }
     echo '<table width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
     echo $nav_on_top ? $nav_row . $menu_row : $menu_row . $nav_row;
     echo '</table>'."\n";
@@ -790,25 +808,6 @@ if ( sqgetGlobalVar('delete_id', $delete_id, SQ_GET) ) {
     sqimap_mailbox_expunge_dmn($delete_id);
 }
 
-/**
- * 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) ) {
-    // Move message
-    sqimap_messages_copy($imapConnection, $move_id, $move_id, $targetMailbox);
-    sqimap_messages_flag($imapConnection, $move_id, $move_id, 'Deleted', true);
-
-    sqimap_mailbox_expunge_dmn($move_id);
-
-    if ($targetMailbox != $lastTargetMailbox) {
-        $lastTargetMailbox = $targetMailbox;
-        sqsession_register('lastTargetMailbox' , $lastTargetMailbox);
-    }
-}
-
-
 /**
  * $message contains all information about the message
  * including header and body