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');
16 // Always set up the language before calling these functions
17 function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ) {
19 global $theme_css, $custom_css, $base_uri;
21 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' .
22 "\n\n<HTML>\n<HEAD>\n";
24 if ( !isset( $custom_css ) ||
$custom_css == 'none' ) {
25 if ($theme_css != '') {
26 echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"$theme_css\">\n";
29 echo '<LINK REL="stylesheet" TYPE="text/css" HREF="' .
30 $base_uri . "themes/css/$custom_css\">\n";
34 do_hook ("generic_header");
37 echo "<title>$title</title>$xtra</head>\n\n";
40 function displayInternalLink($path, $text, $target='') {
44 $target = " target=\"$target\"";
47 echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
50 function displayPageHeader($color, $mailbox) {
52 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top, $compose_new_win, $username, $datadir;
56 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
57 if (!isset($frame_top)) {
62 Locate the first displayable form element
65 case 'src/search.php':
66 $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
67 $onload = "onLoad=\"document.forms[$pos].elements[2].focus();\"";
70 echo '<script language="JavaScript">' .
72 "function checkForm() {\n".
73 "var f = document.forms.length;\n".
76 "while( pos == -1 && i < f ) {\n".
77 "var e = document.forms[i].elements.length;\n".
79 "while( pos == -1 && j < e ) {\n".
80 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
88 "document.forms[i-1].elements[pos].focus();\n".
91 if ($compose_new_win == '1') {
92 $width= getPref($username, $datadir, 'editor_size', 76);
98 $pix_width = intval($width).'0';
100 echo "function comp_in_new() {\n".
101 " var newwin = window.open(\"".$base_uri."src/compose.php\"".
102 ", \"compose_window\", \"width=".$pix_width.",height=650".
103 ",scrollbars=yes,resizable=yes\");\n".
108 $onload = "onLoad=\"checkForm();\"";
113 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";
114 /** Here is the header and wrapping table **/
115 $shortBoxName = readShortMailboxName($mailbox, $delimiter);
116 if ( $shortBoxName == 'INBOX' ) {
117 $shortBoxName = _("INBOX");
119 echo "<A NAME=pagetop></A>\n"
120 . "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n"
121 . " <TR BGCOLOR=\"$color[9]\" >\n"
122 . " <TD ALIGN=left>\n";
123 if ( $shortBoxName <> '' && strtolower( $shortBoxName ) <> 'none' ) {
124 echo ' ' . _("Current Folder") . ": <B>$shortBoxName </B>\n";
129 . " <TD ALIGN=right><b>\n";
130 displayInternalLink ('src/signout.php', _("Sign Out"), $frame_top);
133 . " <TR BGCOLOR=\"$color[4]\">\n"
134 . " <TD ALIGN=left>\n";
135 $urlMailbox = urlencode($mailbox);
136 if ($compose_new_win == '1') {
137 echo "<a href=$base_uri". "src/compose.php?mailbox=$urlMailbox target=".
138 '"compose_window" onClick="comp_in_new()">'. _("Compose"). '</a>';
141 displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
143 echo " \n";
144 displayInternalLink ("src/addressbook.php", _("Addresses"), 'right');
145 echo " \n";
146 displayInternalLink ("src/folders.php", _("Folders"), 'right');
147 echo " \n";
148 displayInternalLink ("src/options.php", _("Options"), 'right');
149 echo " \n";
150 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), 'right');
151 echo " \n";
152 displayInternalLink ("src/help.php", _("Help"), 'right');
153 echo " \n";
157 echo " </TD><TD ALIGN=right>\n";
158 echo ($hide_sm_attributions ?
' ' :
159 "<A HREF=\"http://www.squirrelmail.org/\" TARGET=\"_blank\">SquirrelMail</A>\n");
165 /* blatently copied/truncated/modified from the above function */
166 function compose_Header($color, $mailbox) {
168 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top, $compose_new_win;
170 displayHtmlHeader (_("Compose"));
172 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
173 if (!isset($frame_top)) {
178 Locate the first displayable form element
181 case 'src/search.php':
182 $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
183 $onload = "onLoad=\"document.forms[$pos].elements[2].focus();\"";
186 echo '<script language="JavaScript">' .
188 "function checkForm() {\n".
189 "var f = document.forms.length;\n".
192 "while( pos == -1 && i < f ) {\n".
193 "var e = document.forms[i].elements.length;\n".
195 "while( pos == -1 && j < e ) {\n".
196 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
203 "if( pos >= 0 ) {\n".
204 "document.forms[i-1].elements[pos].focus();\n".
207 if ($compose_new_win == '1') {
208 $width= getPref($username, $datadir, 'editor_size', 76);
213 $width = (.9*$width);
214 $pix_width = intval($width).'0';
216 echo "function comp_in_new() {\n".
217 " var newwin = window.open(\"".$base_uri."src/compose.php\"".
218 ", \"compose_window\", \"width=".$pix_width.",height=650".
219 ",scrollbars=yes,resizable=yes\");\n".
224 $onload = "onLoad=\"checkForm();\"";
229 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";