+ $par_ent_id = $message->parent->entity_id;
+ $up_link = '';
+ if ($par_ent_id) {
+ $par_ent_id = substr($par_ent_id,0,-2);
+ if ( $par_ent_id != 0 ) {
+ $up_link = $topbar_delimiter;
+ $url = set_url_var($PHP_SELF, 'passed_ent_id',$par_ent_id);
+ $up_link .= '<a href="'.$url.'">'._("Up").'</a>';
+ }
+ }
+
+ $nav_row .= $prev_link . $up_link . $topbar_delimiter . $next_link;
+ $nav_row .= $double_delimiter . '[<a href="'.$url.'">'._("View Message").'</a>]';
+
+ // Prev/Next links for regular messages
+ } else if ( !(isset($where) && isset($what)) ) {
+ $prev = findPreviousMessage($mbx_response['EXISTS'], $passed_id);
+ $next = findNextMessage($passed_id);
+
+ $prev_link = _("Previous");
+ if ($prev >= 0) {
+ $uri = $base_uri . 'src/read_body.php?passed_id='.$prev.
+ '&mailbox='.$urlMailbox.'&sort='.$sort.
+ '&startMessage='.$startMessage.'&show_more=0';
+ $prev_link = '<a href="'.$uri.'">'.$prev_link.'</a>';
+ }
+
+ $next_link = _("Next");
+ if ($next >= 0) {
+ $uri = $base_uri . 'src/read_body.php?passed_id='.$next.
+ '&mailbox='.$urlMailbox.'&sort='.$sort.
+ '&startMessage='.$startMessage.'&show_more=0';
+ $next_link = '<a href="'.$uri.'">'.$next_link.'</a>';
+ }
+
+ // Only bother with Delete & Prev and Delete & Next IF
+ // top display is enabled.
+ if ( $delete_prev_next_display == 1 ) {
+ $del_prev_link = _("Delete & Prev");
+ if ($prev >= 0) {
+ $uri = $base_uri . 'src/read_body.php?passed_id='.$prev.
+ '&mailbox='.$urlMailbox.'&sort='.$sort.
+ '&startMessage='.$startMessage.'&show_more=0'.
+ '&delete_id='.$passed_id;
+ $del_prev_link = '<a href="'.$uri.'">'.$del_prev_link.'</a>';
+ }
+
+ $del_next_link = _("Delete & Next");
+ if ($next >= 0) {
+ $uri = $base_uri . 'src/read_body.php?passed_id='.$next.
+ '&mailbox='.$urlMailbox.'&sort='.$sort.
+ '&startMessage='.$startMessage.'&show_more=0'.
+ '&delete_id='.$passed_id;
+ $del_next_link = '<a href="'.$uri.'">'.$del_next_link.'</a>';
+ }
+ }
+
+ $nav_row .= '['.$prev_link.$topbar_delimiter.$next_link.']';
+ if ( isset($del_prev_link) && isset($del_next_link) )
+ $nav_row .= $double_delimiter.'['.$del_prev_link.$topbar_delimiter.$del_next_link.']';
+ }
+
+ // Start with Search Results or Message List link.
+ if (isset($where) && isset($what)) {
+ $msgs_url .= 'search.php?where=' . urlencode($where) .
+ '&what=' . urlencode($what) . '&mailbox=' . $urlMailbox;
+ $msgs_str = _("Search Results");
+ } else {
+ $msgs_url .= 'right_main.php?sort=' . $sort . '&startMessage=' .
+ $startMessage . '&mailbox=' . $urlMailbox;
+ $msgs_str = _("Message List");
+ }
+ $nav_row .= $double_delimiter .
+ '[<a href="' . $msgs_url . '">' . $msgs_str . '</a>]';
+
+ $nav_row .= '</small></td></tr>';
+
+
+ // 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 .
+ '&mailbox=' . $urlMailbox .
+ '&startMessage=' . $startMessage .
+ (isset($passed_ent_id) ? '&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.'><small>'."\n";
+
+ // If Draft folder - create Resume link
+ if (($mailbox == $draft_folder) && ($save_as_draft)) {
+ $new_button = 'smaction_draft';
+ $comp_alt_string = _("Resume Draft");
+ } else if (handleAsSent($mailbox)) {
+ // If in Sent folder, 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_string))
+ $menu_row .= getButton('SUBMIT', $new_button, $comp_alt_string, $on_click) . "\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">' . _("Attachment") ."\n";
+
+ $menu_row .= '</form>'.' '."\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"><small>';
+
+ if (!(isset($passed_ent_id) && $passed_ent_id)) {
+ $menu_row .= '<input type="hidden" name="message" value="'.$passed_id.'" />';
+
+ if ($where && $what) {
+ $menu_row .= '<input type="hidden" name="where" value="'.$where.'" />';
+ $menu_row .= '<input type="hidden" name="what" value="'.$what.'" />';
+ } else {
+ $menu_row .= '<input type="hidden" name="sort" value="'.$sort.'" />';
+ $menu_row .= '<input type="hidden" name="startMessage" value="'.$startMessage.'" />';
+ }
+ $menu_row .= getButton('SUBMIT', 'delete', _("Delete"));
+ $menu_row .= '<input type="checkbox" name="bypass_trash">' . _("Bypass Trash");
+ }
+ else
+ $menu_row .= getButton('SUBMIT', 'delete', _("Delete"), '', FALSE) . "\n"; // delete button is disabled
+
+ $menu_row .= '</form>' . "\n";
+
+
+ // Add top move link
+ $menu_row .= '</small></td><td align="right">';
+ 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="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> ';
+
+ $menu_row .= getButton('SUBMIT', 'moveButton',_("Move")) . "\n" . '</form>';
+ }
+ $menu_row .= '</td></tr>';
+
+ // echo rows, with hooks
+ $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";
+ do_hook('read_body_menu_bottom');