6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Prints the page header (duh)
14 require_once('../functions/strings.php');
15 require_once('../functions/imap_utf7_decode_local.php');
17 /* Always set up the language before calling these functions */
18 function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ) {
20 global $theme_css, $custom_css, $base_uri;
22 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' .
23 "\n\n<HTML>\n<HEAD>\n";
25 if ( !isset( $custom_css ) ||
$custom_css == 'none' ) {
26 if ($theme_css != '') {
27 echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"$theme_css\">";
30 echo '<LINK REL="stylesheet" TYPE="text/css" HREF="' .
31 $base_uri . 'themes/css/'.$custom_css.'">';
34 echo "\n<title>$title</title>$xtra</head>\n\n";
37 function displayInternalLink($path, $text, $target='') {
41 $target = " target=\"$target\"";
44 echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
47 function displayPageHeader($color, $mailbox, $xtra='') {
49 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top,
50 $compose_new_win, $username, $datadir, $compose_width, $compose_height;
52 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
53 if ($qmark = strpos($module, '?')) {
54 $module = substr($module, 0, $qmark);
56 if (!isset($frame_top)) {
61 Locate the first displayable form element
64 case 'src/read_body.php':
65 if ($compose_new_win == '1') {
66 if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
67 $compose_width = '640';
69 if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
70 $compose_height = '550';
72 $js = "\n".'<script language="JavaScript" type="text/javascript">' .
74 $js .= "function comp_in_new() {\n".
75 " var newwin = window.open(\"".$base_uri."src/compose.php\"".
76 ", \"compose_window\",
77 \"width=".$compose_width.",height=$compose_height".
78 ",scrollbars=yes,resizable=yes\");\n".
82 displayHtmlHeader ('Squirrelmail', $js);
88 $js = '<script language="JavaScript" type="text/javascript">' .
90 "function checkForm() {\n".
91 "var f = document.forms.length;\n".
94 "while( pos == -1 && i < f ) {\n".
95 "var e = document.forms[i].elements.length;\n".
97 "while( pos == -1 && j < e ) {\n".
98 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
105 "if( pos >= 0 ) {\n".
106 "document.forms[i-1].elements[pos].focus();\n".
110 if (isset($attachemessages) && isset($session)) {
111 $compose_uri = 'compose.php?mailbox='. urlencode($mailbox).'&attachedmessages=true&session='."$session";
113 $compose_uri = 'src/compose.php';
116 if ($compose_new_win == '1') {
117 if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
118 $compose_width = '640';
120 if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
121 $compose_height = '550';
123 $js .= "function comp_in_new() {\n".
124 ' var newwin = window.open("'.$base_uri.$compose_uri . '"' .
126 "width='.$compose_width.",height=$compose_height".
127 ",scrollbars=yes,resizable=yes\");\n".
132 $onload = "onLoad=\"checkForm();\"";
133 displayHtmlHeader ('Squirrelmail', $js);
138 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";
139 /** Here is the header and wrapping table **/
140 $shortBoxName = imap_utf7_decode_local(
141 readShortMailboxName($mailbox, $delimiter));
142 if ( $shortBoxName == 'INBOX' ) {
143 $shortBoxName = _("INBOX");
145 echo "<A NAME=pagetop></A>\n"
146 . "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n"
147 . " <TR BGCOLOR=\"$color[9]\" >\n"
148 . " <TD ALIGN=left>\n";
149 if ( $shortBoxName <> '' && strtolower( $shortBoxName ) <> 'none' ) {
150 echo ' ' . _("Current Folder") . ": <B>$shortBoxName </B>\n";
155 . ' <TD ALIGN=right><b>';
156 displayInternalLink ('src/signout.php', _("Sign Out"), $frame_top);
159 . " <TR BGCOLOR=\"$color[4]\">\n"
160 . " <TD ALIGN=left>\n";
161 $urlMailbox = urlencode($mailbox);
162 if ($compose_new_win == '1') {
163 echo "<a href=$base_uri". "src/compose.php?mailbox=$urlMailbox target=".
164 '"compose_window" onClick="comp_in_new()">'. _("Compose"). '</a>';
167 displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
169 echo " \n";
170 displayInternalLink ("src/addressbook.php", _("Addresses"), 'right');
171 echo " \n";
172 displayInternalLink ("src/folders.php", _("Folders"), 'right');
173 echo " \n";
174 displayInternalLink ("src/options.php", _("Options"), 'right');
175 echo " \n";
176 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), 'right');
177 echo " \n";
178 displayInternalLink ("src/help.php", _("Help"), 'right');
179 echo " \n";
183 echo " </TD>\n <TD ALIGN=\"right\">";
184 echo ($hide_sm_attributions ?
' ' :
185 '<A HREF="http://www.squirrelmail.org/" TARGET="_blank">SquirrelMail</A>');
191 /* blatently copied/truncated/modified from the above function */
192 function compose_Header($color, $mailbox) {
194 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top, $compose_new_win;
197 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
198 if (!isset($frame_top)) {
203 Locate the first displayable form element
206 case 'src/search.php':
207 $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
208 $onload = "onLoad=\"document.forms[$pos].elements[2].focus();\"";
209 displayHtmlHeader (_("Compose"));
212 $js = '<script language="JavaScript" type="text/javascript">' .
214 "function checkForm() {\n".
215 "var f = document.forms.length;\n".
218 "while( pos == -1 && i < f ) {\n".
219 "var e = document.forms[i].elements.length;\n".
221 "while( pos == -1 && j < e ) {\n".
222 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
229 "if( pos >= 0 ) {\n".
230 "document.forms[i-1].elements[pos].focus();\n".
235 $onload = "onLoad=\"checkForm();\"";
236 displayHtmlHeader (_("Compose"), $js);
241 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";