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\">";
29 echo '<LINK REL="stylesheet" TYPE="text/css" HREF="' .
30 $base_uri . 'themes/css/'.$custom_css.'">';
33 echo "\n<title>$title</title>$xtra</head>\n\n";
36 function displayInternalLink($path, $text, $target='') {
40 $target = " target=\"$target\"";
43 echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
46 function displayPageHeader($color, $mailbox, $xtra='') {
48 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top, $compose_new_win, $username, $datadir;
50 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
51 if (!isset($frame_top)) {
56 Locate the first displayable form element
59 case 'src/search.php':
60 $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
61 $onload = "onLoad=\"document.forms[$pos].elements[2].focus();\"";
65 $js = '<script language="JavaScript" type="text/javascript">' .
67 "function checkForm() {\n".
68 "var f = document.forms.length;\n".
71 "while( pos == -1 && i < f ) {\n".
72 "var e = document.forms[i].elements.length;\n".
74 "while( pos == -1 && j < e ) {\n".
75 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
83 "document.forms[i-1].elements[pos].focus();\n".
87 if ($compose_new_win == '1') {
88 $width= getPref($username, $datadir, 'editor_size', 76);
94 $pix_width = intval($width).'0';
96 $js .= "function comp_in_new() {\n".
97 " var newwin = window.open(\"".$base_uri."src/compose.php\"".
98 ", \"compose_window\", \"width=".$pix_width.",height=650".
99 ",scrollbars=yes,resizable=yes\");\n".
104 $onload = "onLoad=\"checkForm();\"";
105 displayHtmlHeader ('Squirrelmail', $js);
110 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";
111 /** Here is the header and wrapping table **/
112 $shortBoxName = readShortMailboxName($mailbox, $delimiter);
113 if ( $shortBoxName == 'INBOX' ) {
114 $shortBoxName = _("INBOX");
116 echo "<A NAME=pagetop></A>\n"
117 . "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n"
118 . " <TR BGCOLOR=\"$color[9]\" >\n"
119 . " <TD ALIGN=left>\n";
120 if ( $shortBoxName <> '' && strtolower( $shortBoxName ) <> 'none' ) {
121 echo ' ' . _("Current Folder") . ": <B>$shortBoxName </B>\n";
126 . ' <TD ALIGN=right><b>';
127 displayInternalLink ('src/signout.php', _("Sign Out"), $frame_top);
130 . " <TR BGCOLOR=\"$color[4]\">\n"
131 . " <TD ALIGN=left>\n";
132 $urlMailbox = urlencode($mailbox);
133 if ($compose_new_win == '1') {
134 echo "<a href=$base_uri". "src/compose.php?mailbox=$urlMailbox target=".
135 '"compose_window" onClick="comp_in_new()">'. _("Compose"). '</a>';
138 displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
140 echo " \n";
141 displayInternalLink ("src/addressbook.php", _("Addresses"), 'right');
142 echo " \n";
143 displayInternalLink ("src/folders.php", _("Folders"), 'right');
144 echo " \n";
145 displayInternalLink ("src/options.php", _("Options"), 'right');
146 echo " \n";
147 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), 'right');
148 echo " \n";
149 displayInternalLink ("src/help.php", _("Help"), 'right');
150 echo " \n";
154 echo " </TD>\n <TD ALIGN=\"right\">";
155 echo ($hide_sm_attributions ?
' ' :
156 '<A HREF="http://www.squirrelmail.org/" TARGET="_blank">SquirrelMail</A>');
162 /* blatently copied/truncated/modified from the above function */
163 function compose_Header($color, $mailbox) {
165 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top, $compose_new_win;
168 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
169 if (!isset($frame_top)) {
174 Locate the first displayable form element
177 case 'src/search.php':
178 $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
179 $onload = "onLoad=\"document.forms[$pos].elements[2].focus();\"";
180 displayHtmlHeader (_("Compose"));
183 $js = '<script language="JavaScript" type="text/javascript">' .
185 "function checkForm() {\n".
186 "var f = document.forms.length;\n".
189 "while( pos == -1 && i < f ) {\n".
190 "var e = document.forms[i].elements.length;\n".
192 "while( pos == -1 && j < e ) {\n".
193 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
200 "if( pos >= 0 ) {\n".
201 "document.forms[i-1].elements[pos].focus();\n".
206 $onload = "onLoad=\"checkForm();\"";
207 displayHtmlHeader (_("Compose"), $js);
212 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";