Removed extra SMALL tags, they were already incased in a
[squirrelmail.git] / src / read_body.php
index d9203819a10e7ea560c795f9842df9cca7dacbe9..bc4a6aba079f9221876a30aec7edf0b179e7a22d 100644 (file)
@@ -90,10 +90,9 @@ function findPreviousMessage($numMessages, $passed_id) {
     if ($thread_sort_messages || $allow_server_sort ) {
         foreach($server_sort_array as $key=>$value) {
             if ($passed_id == $value) {
-                if ($key == 0) {
-                    break;
+                if ($key != 0) {
+                    $result = $server_sort_array[$key - 1];
                 }
-                $result = $server_sort_array[$key - 1];
                 break;
             }
         }
@@ -489,18 +488,13 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
     global $base_uri, $draft_folder, $where, $what, $color, $sort,
            $startMessage, $PHP_SELF, $save_as_draft, 
            $enable_forward_as_attachment, $imapConnection, $lastTargetMailbox,
-           $data_dir, $username, $delete_prev_next_display;
+           $data_dir, $username, $delete_prev_next_display,
+           $compose_new_win, $javascript_on;
 
     $topbar_delimiter = ' | ';
     $double_delimiter = '    ';
     $urlMailbox = urlencode($mailbox);
 
-    $comp_uri = 'src/compose.php' .
-                '?passed_id=' . $passed_id .
-                '&mailbox=' . $urlMailbox .
-                '&startMessage=' . $startMessage .
-                 (isset($passed_ent_id)?'&passed_ent_id='.$passed_ent_id:'');
-
     $msgs_url = $base_uri . 'src/';
 
     // BEGIN NAV ROW - PREV/NEXT, DEL PREV/NEXT, LINKS TO INDEX, etc.
@@ -619,57 +613,70 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
 
     // BEGIN MENU ROW - DELETE/REPLY/FORWARD/MOVE/etc.
     $menu_row = '<tr bgcolor="'.$color[9].'"><td><small>';
+    $comp_uri = $base_uri.'src/compose.php' .
+                '?passed_id=' . $passed_id .
+                '&amp;mailbox=' . $urlMailbox .
+                '&amp;startMessage=' . $startMessage .
+                 (isset($passed_ent_id) ? '&amp;passed_ent_id='.$passed_ent_id : '');
+    // Start form for reply/reply all/forward.. 
+    $target = '';
+    $on_click='';
+    $method='method="post" ';
+    if ($compose_new_win == '1') {
+        if ( $javascript_on ) {
+          $on_click=' onclick="comp_in_new_form(\''.$comp_uri.'\', this, this.form)"';
+          $comp_uri = 'javascript:void(0)';
+          $method='method="get" ';
+        } else {
+          $target = 'target="_blank"';
+        }
+    }
+
+    $menu_row .= "\n".'<form name="composeForm" action="'.$comp_uri.'" '.$method.$target.' style="display: inline">'."\n";
 
     // If Draft folder - create Resume link
     if (($mailbox == $draft_folder) && ($save_as_draft)) {
-        $comp_alt_uri = $comp_uri . '&amp;smaction=draft';
+        $new_button = 'smaction_draft';
         $comp_alt_string = _("Resume Draft");
     } else if (handleAsSent($mailbox)) {
     // If in Sent folder, edit as new
-        $comp_alt_uri = $comp_uri . '&amp;smaction=edit_as_new';
+        $new_button = 'smaction_edit_new';
         $comp_alt_string = _("Edit Message as New");
     }
-
     // Show Alt URI for Draft/Sent
-    if (isset($comp_alt_uri)) {
-        $menu_row .= makeComposeLink($comp_alt_uri, $comp_alt_string);
-        $menu_row .= $topbar_delimiter . "\n";
-    }
-
-    $comp_action_uri = $comp_uri . '&amp;smaction=reply';
-    $menu_row .= makeComposeLink($comp_action_uri, _("Reply")) . "\n";
+    if (isset($comp_alt_string))
+        $menu_row .= getButton('SUBMIT', $new_button, $comp_alt_string, $on_click) . "\n";
 
-    $comp_action_uri = $comp_uri . '&amp;smaction=reply_all';
-    $menu_row .= $topbar_delimiter;
-    $menu_row .= makeComposeLink($comp_action_uri, _("Reply All")) . "\n";
+    $menu_row .= getButton('SUBMIT', 'smaction_reply', _("Reply"), $on_click) . "\n";
+    $menu_row .= getButton('SUBMIT', 'smaction_reply_all', _("Reply All"), $on_click) ."\n";
+    $menu_row .= getButton('SUBMIT', 'smaction_forward', _("Forward"), $on_click);
+    if ($enable_forward_as_attachment)
+        $menu_row .= '<input type="checkbox" name="smaction_attache">' . _("As Attachment") .'&nbsp;&nbsp;'."\n";
 
+    $menu_row .= '</form>&nbsp;';
 
-    $comp_action_uri = $comp_uri . '&amp;smaction=forward';
-    $menu_row .= $topbar_delimiter;
-    $menu_row .= makeComposeLink($comp_action_uri, _("Forward")) . "\n";
+    // Form for deletion
+    $delete_url = $base_uri . 'src/delete_message.php?mailbox=' . $urlMailbox;
+    $menu_row .= '<form action="'.$delete_url.'" method="post" style="display: inline">';
 
-    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")) . "\n";
-    }
-
-    $delete_link = _("Delete");
     if (!(isset($passed_ent_id) && $passed_ent_id)) {
-        $delete_url = $base_uri . 'src/delete_message.php?mailbox=' . $urlMailbox .
-                  '&amp;message=' . $passed_id . '&amp;';
+        $menu_row .= '<input type="hidden" name="message" value="'.$passed_id.'" />';
 
         if ($where && $what) {
-            $delete_url .= 'where=' . urlencode($where) . '&amp;what=' . urlencode($what);
+            $menu_row .= '<input type="hidden" name="where" value="'.$where.'" />';
+            $menu_row .= '<input type="hidden" name="what" value="'.$what.'" />';
         } else {
-            $delete_url .= 'sort=' . $sort . '&amp;startMessage=' . $startMessage;
+            $menu_row .= '<input type="hidden" name="sort" value="'.$sort.'" />';
+            $menu_row .= '<input type="hidden" name="startMessage" value="'.$startMessage.'" />';
         }
-        $delete_link = '<a href="' . $delete_url . '">' . $delete_link . '</a>';
-        $delete_link .= '&nbsp;(<a href="' . $delete_url.'&amp;bypass_trash=1">'
-                        ._("Bypass Trash").'</a>)';
-        
+        $menu_row .= getButton('SUBMIT', 'delete', _("Delete"));
+        $menu_row .= '<input type="checkbox" name="bypass_trash">' . _("Bypass Trash");
     }
-    $menu_row .= $topbar_delimiter.$delete_link . "\n";
+    else
+      $menu_row .= getButton('SUBMIT', 'delete', _("Delete"), '', FALSE) . "\n"; // delete button is disabled
+
+    $menu_row .= '</form>';
 
 
     // Add top move link
@@ -680,13 +687,16 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
 
         // 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.'&';
+            $location = $base_uri . 'src/read_body.php?passed_id='.$next.'&';
+        } elseif (isset($prev) && $prev >= 0) {
+            $location = $base_uri . 'src/read_body.php?passed_id='.$prev.'&';
         } else {
-          $location = $base_uri . 'src/right_main.php?';
+            $location = $base_uri . 'src/right_main.php?';
         }
 
-        $menu_row .= '<form action="'.$base_uri.'src/move_messages.php?'.$current_box.'" method="post">'.
+        $menu_row .= '<form action="'.$base_uri.'src/move_messages.php?'.$current_box.'" method="post" style="display: inline">'.
               '<small><input type="hidden" name="show_more" value="0" />'.
+              '<input type="hidden" name="dmn" value="1" />'.
               '<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">';