The auto focus module has been a little bit improved in order
[squirrelmail.git] / functions / page_header.php
CommitLineData
59177427 1<?php
7350889b 2
35586184 3/**
4 * page_header.php
5 *
15e6162e 6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
35586184 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * Prints the page header (duh)
10 *
11 * $Id$
12 */
13
35586184 14// Always set up the language before calling these functions
a07cd1a4 15function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ) {
692155b7 16
17 global $theme_css;
18
19 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' .
20 "\n\n<HTML>\n<HEAD>\n";
21
22 if ($theme_css != '') {
23 echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"$theme_css\">\n";
24 }
25
26 if( $do_hook ) {
27 do_hook ("generic_header");
28 }
29
30 echo "<title>$title</title>$xtra</head>\n\n";
a07cd1a4 31}
32
33function displayInternalLink($path, $text, $target='') {
34 global $base_uri;
35
36 if ($target != '') {
37 $target = " target=\"$target\"";
38 }
39
40 echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
41}
42
43function displayPageHeader($color, $mailbox) {
715225af 44
45 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF;
46
a07cd1a4 47 displayHtmlHeader ();
48
715225af 49 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
50
51 /*
52 Locate the first displayable form element
53 */
54 switch ( $module ) {
55 case 'src/search.php':
56 $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
57 $onload = "onLoad=\"document.forms[$pos].elements[2].focus();\"";
58 break;
59 default:
60 echo '
61<script language="JavaScript">
62<!--
63function checkForm() {
64
65 var f = document.forms.length;
66 var i = 0;
67 var pos = -1;
68 while( pos == -1 && i < f ) {
69 var e = document.forms[i].elements.length;
70 var j = 0;
71 while( pos == -1 && j < e ) {
72 if ( document.forms[i].elements[j].type == \'text\' ) {
73 pos = j;
74 }
75 j++;
76 }
77 i++;
78 }
79 if( pos >= 0 ) {
80 // document.write( "Si tio" );
81 document.forms[i-1].elements[pos].focus();
82 }
83
84}
85-->
86</script>
87 ';
88 $onload = "onLoad=\"checkForm();\"";
89 break;
90
91 }
92
93 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";
a07cd1a4 94
95 /** Here is the header and wrapping table **/
96 $shortBoxName = readShortMailboxName($mailbox, $delimiter);
97 echo "<A NAME=pagetop></A>\n"
98 . "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n"
99 . " <TR BGCOLOR=\"$color[9]\" >\n"
100 . " <TD ALIGN=left>\n"
101 . ' ' . _("Current Folder") . ": <B>$shortBoxName&nbsp;</B>\n"
102 . " </TD>\n"
103 . " <TD ALIGN=right><b>\n";
104 displayInternalLink ('src/signout.php', _("Sign Out"), '_top');
105 echo " </b></TD>\n"
106 . " </TR>\n"
107 . " <TR BGCOLOR=\"$color[4]\">\n"
108 . " <TD ALIGN=left>\n";
109 $urlMailbox = urlencode($mailbox);
110 displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
111 echo "&nbsp;&nbsp;\n";
112 displayInternalLink ("src/addressbook.php", _("Addresses"), 'right');
113 echo "&nbsp;&nbsp;\n";
114 displayInternalLink ("src/folders.php", _("Folders"), 'right');
115 echo "&nbsp;&nbsp;\n";
116 displayInternalLink ("src/options.php", _("Options"), 'right');
117 echo "&nbsp;&nbsp;\n";
118 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), 'right');
119 echo "&nbsp;&nbsp;\n";
120 displayInternalLink ("src/help.php", _("Help"), 'right');
121 echo "&nbsp;&nbsp;\n";
122
123 do_hook("menuline");
124
125 echo " </TD><TD ALIGN=right>\n";
126 echo ($hide_sm_attributions ? '&nbsp;' :
826b7f71 127 "<A HREF=\"http://www.squirrelmail.org/\" TARGET=\"_blank\">SquirrelMail</A>\n");
a07cd1a4 128 echo " </TD>\n".
129 " </TR>\n".
130 "</TABLE>\n\n";
131}
2ba13803 132
a07cd1a4 133?>