7e63f0af9c2b9af27b9955da29aec17e331c488e
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');
18 /* Always set up the language before calling these functions */
19 function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ) {
21 global $theme_css, $custom_css, $base_uri;
23 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' .
24 "\n\n<HTML>\n<HEAD>\n";
26 if ( !isset( $custom_css ) ||
$custom_css == 'none' ) {
27 if ($theme_css != '') {
28 echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"$theme_css\">";
31 echo '<LINK REL="stylesheet" TYPE="text/css" HREF="' .
32 $base_uri . 'themes/css/'.$custom_css.'">';
35 echo "\n<title>$title</title>$xtra</head>\n\n";
38 function displayInternalLink($path, $text, $target='') {
42 $target = " target=\"$target\"";
45 echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
48 function displayPageHeader($color, $mailbox, $xtra='') {
50 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top,
51 $compose_new_win, $username, $datadir, $compose_width, $compose_height, $session, $attachemessages;
53 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
54 if (!isset($frame_top)) {
59 Locate the first displayable form element
63 $js = '<script language="JavaScript" type="text/javascript">' .
65 "function checkForm() {\n".
66 "var f = document.forms.length;\n".
69 "while( pos == -1 && i < f ) {\n".
70 "var e = document.forms[i].elements.length;\n".
72 "while( pos == -1 && j < e ) {\n".
73 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
81 "document.forms[i-1].elements[pos].focus();\n".
85 if (isset($attachemessages) && isset($session)) {
86 $compose_uri = 'compose.php?mailbox='. urlencode($mailbox).'&attachedmessages=true&session='."$session";
88 $compose_uri = 'src/compose.php';
91 if ($compose_new_win == '1') {
92 if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
93 $compose_width = '640';
95 if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
96 $compose_height = '550';
98 $js .= "function comp_in_new() {\n".
99 ' var newwin = window.open("'.$base_uri.$compose_uri . '"' .
101 "width='.$compose_width.",height=$compose_height".
102 ",scrollbars=yes,resizable=yes\");\n".
107 $onload = "onLoad=\"checkForm();\"";
108 displayHtmlHeader ('Squirrelmail', $js);
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 = imap_utf7_decode_local(readShortMailboxName($mailbox, $delimiter));
117 if ( $shortBoxName == 'INBOX' ) {
118 $shortBoxName = _("INBOX");
120 echo "<A NAME=pagetop></A>\n"
121 . "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n"
122 . " <TR BGCOLOR=\"$color[9]\" >\n"
123 . " <TD ALIGN=left>\n";
124 if ( $shortBoxName <> '' && strtolower( $shortBoxName ) <> 'none' ) {
125 echo ' ' . _("Current Folder") . ": <B>$shortBoxName </B>\n";
130 . ' <TD ALIGN=right><b>';
131 displayInternalLink ('src/signout.php', _("Sign Out"), $frame_top);
134 . " <TR BGCOLOR=\"$color[4]\">\n"
135 . " <TD ALIGN=left>\n";
136 $urlMailbox = urlencode($mailbox);
137 if ($compose_new_win == '1') {
138 echo "<a href=$base_uri". "src/compose.php?mailbox=$urlMailbox target=".
139 '"compose_window" onClick="comp_in_new()">'. _("Compose"). '</a>';
142 displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
144 echo " \n";
145 displayInternalLink ("src/addressbook.php", _("Addresses"), 'right');
146 echo " \n";
147 displayInternalLink ("src/folders.php", _("Folders"), 'right');
148 echo " \n";
149 displayInternalLink ("src/options.php", _("Options"), 'right');
150 echo " \n";
151 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), 'right');
152 echo " \n";
153 displayInternalLink ("src/help.php", _("Help"), 'right');
154 echo " \n";
158 echo " </TD>\n <TD ALIGN=\"right\">";
159 echo ($hide_sm_attributions ?
' ' :
160 '<A HREF="http://www.squirrelmail.org/" TARGET="_blank">SquirrelMail</A>');
166 /* blatently copied/truncated/modified from the above function */
167 function compose_Header($color, $mailbox) {
169 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top, $compose_new_win;
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();\"";
184 displayHtmlHeader (_("Compose"));
187 $js = '<script language="JavaScript" type="text/javascript">' .
189 "function checkForm() {\n".
190 "var f = document.forms.length;\n".
193 "while( pos == -1 && i < f ) {\n".
194 "var e = document.forms[i].elements.length;\n".
196 "while( pos == -1 && j < e ) {\n".
197 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
204 "if( pos >= 0 ) {\n".
205 "document.forms[i-1].elements[pos].focus();\n".
210 $onload = "onLoad=\"checkForm();\"";
211 displayHtmlHeader (_("Compose"), $js);
216 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";