-displayPageHeader($color, $mailbox);
-formatMenuBar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response);
-formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee);
-echo '<table width="100%" cellpadding="0" cellspacing="0" align="center" border="0">';
-echo ' <tr><td>';
-echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="'.$color[9].'">';
-echo ' <tr><td>';
-echo ' <table width="100%" cellpadding="3" cellspacing="0" align="center" border="0">';
-echo ' <tr bgcolor="'.$color[4].'"><td>';
-// echo ' <table cellpadding="1" cellspacing="5" align="left" border="0">';
-echo html_tag( 'table' ,'' , 'left', '', 'cellpadding="1" cellspacing="5" border="0"' );
-echo ' <tr>' . html_tag( 'td', '<br>'. $messagebody."\n", 'left')
- . '</tr>';
-echo ' </table>';
-echo ' </td></tr>';
-echo ' </table></td></tr>';
-echo ' </table>';
-echo ' </td></tr>';
-
-echo '<TR><TD HEIGHT="5" COLSPAN="2" BGCOLOR="'.
- $color[4].'"></TD></TR>'."\n";
-
-$attachmentsdisplay = formatAttachments($message,$ent_ar,$mailbox, $passed_id);
-if ($attachmentsdisplay) {
- echo ' </table>';
- echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center"'.' border="0" bgcolor="'.$color[9].'">';
- echo ' <tr><td>';
- echo ' <table width="100%" cellpadding="0" cellspacing="0" align="center" border="0" bgcolor="'.$color[4].'">';
- echo ' <tr>' . html_tag( 'td', '', 'left', $color[9] );
- echo ' <b>' . _("Attachments") . ':</b>';
- echo ' </td></tr>';
- echo ' <tr><td>';
- echo ' <table width="100%" cellpadding="2" cellspacing="2" align="center"'.' border="0" bgcolor="'.$color[0].'"><tr><td>';
- echo $attachmentsdisplay;
- echo ' </td></tr></table>';
- echo ' </td></tr></table>';
- echo ' </td></tr>';
- echo '<TR><TD HEIGHT="5" COLSPAN="2" BGCOLOR="'.
- $color[4].'"></TD></TR>';
-}
-echo '</table>';
+/**
+ * Write mailbox with updated seen flag information back to cache.
+ */
+$mailbox_cache[$iAccount.'_'.$aMailbox['NAME']] = $aMailbox;
+sqsession_register($mailbox_cache,'mailbox_cache');
+$_SESSION['mailbox_cache'] = $mailbox_cache;
+
+// message list URI is used in page header when on read_body
+$oTemplate->assign('message_list_href', get_message_list_uri($aMailbox['NAME'], $startMessage, $what));
+
+displayPageHeader($color, $mailbox,'','');
+
+/* this is the non-javascript version of printer friendly */
+if ( sqgetGlobalVar('print', $print, SQ_GET) ) {
+ $oTemplate->display('read_message_print.tpl');
+} else {
+ formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message,false);
+}
+formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee);
+
+$oTemplate->assign('message_body', $messagebody);
+$oTemplate->display('read_message_body.tpl');
+
+formatAttachments($message,$ent_ar,$mailbox, $passed_id);