fe30f23c3b06d1e7ae50acbc8b78815ac1c90a0b
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 ($compose_new_win == '1') {
111 if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
112 $compose_width = '640';
114 if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
115 $compose_height = '550';
117 $js .= "function comp_in_new() {\n".
118 " var newwin = window.open(\"".$base_uri."src/compose.php\"".
119 ", \"compose_window\",
120 \"width=".$compose_width.",height=$compose_height".
121 ",scrollbars=yes,resizable=yes\");\n".
126 $onload = "onLoad=\"checkForm();\"";
127 displayHtmlHeader ('Squirrelmail', $js);
132 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";
133 /** Here is the header and wrapping table **/
134 $shortBoxName = imap_utf7_decode_local(
135 readShortMailboxName($mailbox, $delimiter));
136 if ( $shortBoxName == 'INBOX' ) {
137 $shortBoxName = _("INBOX");
139 echo "<A NAME=pagetop></A>\n"
140 . "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n"
141 . " <TR BGCOLOR=\"$color[9]\" >\n"
142 . " <TD ALIGN=left>\n";
143 if ( $shortBoxName <> '' && strtolower( $shortBoxName ) <> 'none' ) {
144 echo ' ' . _("Current Folder") . ": <B>$shortBoxName </B>\n";
149 . ' <TD ALIGN=right><b>';
150 displayInternalLink ('src/signout.php', _("Sign Out"), $frame_top);
153 . " <TR BGCOLOR=\"$color[4]\">\n"
154 . " <TD ALIGN=left>\n";
155 $urlMailbox = urlencode($mailbox);
156 if ($compose_new_win == '1') {
157 echo "<a href=$base_uri". "src/compose.php?mailbox=$urlMailbox target=".
158 '"compose_window" onClick="comp_in_new()">'. _("Compose"). '</a>';
161 displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
163 echo " \n";
164 displayInternalLink ("src/addressbook.php", _("Addresses"), 'right');
165 echo " \n";
166 displayInternalLink ("src/folders.php", _("Folders"), 'right');
167 echo " \n";
168 displayInternalLink ("src/options.php", _("Options"), 'right');
169 echo " \n";
170 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), 'right');
171 echo " \n";
172 displayInternalLink ("src/help.php", _("Help"), 'right');
173 echo " \n";
177 echo " </TD>\n <TD ALIGN=\"right\">";
178 echo ($hide_sm_attributions ?
' ' :
179 '<A HREF="http://www.squirrelmail.org/" TARGET="_blank">SquirrelMail</A>');
185 /* blatently copied/truncated/modified from the above function */
186 function compose_Header($color, $mailbox) {
188 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top, $compose_new_win;
191 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
192 if (!isset($frame_top)) {
197 Locate the first displayable form element
200 case 'src/search.php':
201 $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
202 $onload = "onLoad=\"document.forms[$pos].elements[2].focus();\"";
203 displayHtmlHeader (_("Compose"));
206 $js = '<script language="JavaScript" type="text/javascript">' .
208 "function checkForm() {\n".
209 "var f = document.forms.length;\n".
212 "while( pos == -1 && i < f ) {\n".
213 "var e = document.forms[i].elements.length;\n".
215 "while( pos == -1 && j < e ) {\n".
216 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
223 "if( pos >= 0 ) {\n".
224 "document.forms[i-1].elements[pos].focus();\n".
229 $onload = "onLoad=\"checkForm();\"";
230 displayHtmlHeader (_("Compose"), $js);
235 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";