Ok, this should fix the subsent folders left panel 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
8f1ba72b 17 global $theme_css, $custom_css;
18
19 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' .
20 "\n\n<HTML>\n<HEAD>\n";
21
a714cb95 22 if ( !isset( $custom_css ) || $custom_css == 'none' ) {
692155b7 23 if ($theme_css != '') {
24 echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"$theme_css\">\n";
25 }
8f1ba72b 26 } else {
27 echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"../themes/css/$custom_css\">\n";
28 }
29
30 if( $do_hook ) {
31 do_hook ("generic_header");
32 }
33
34 echo "<title>$title</title>$xtra</head>\n\n";
a07cd1a4 35}
36
37function displayInternalLink($path, $text, $target='') {
38 global $base_uri;
39
40 if ($target != '') {
41 $target = " target=\"$target\"";
42 }
43
44 echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
45}
46
47function displayPageHeader($color, $mailbox) {
715225af 48
49 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF;
50
a07cd1a4 51 displayHtmlHeader ();
52
715225af 53 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
54
55 /*
56 Locate the first displayable form element
57 */
58 switch ( $module ) {
59 case 'src/search.php':
60 $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
61 $onload = "onLoad=\"document.forms[$pos].elements[2].focus();\"";
62 break;
63 default:
64 echo '
65<script language="JavaScript">
66<!--
67function checkForm() {
68
69 var f = document.forms.length;
70 var i = 0;
71 var pos = -1;
72 while( pos == -1 && i < f ) {
73 var e = document.forms[i].elements.length;
74 var j = 0;
75 while( pos == -1 && j < e ) {
76 if ( document.forms[i].elements[j].type == \'text\' ) {
77 pos = j;
78 }
79 j++;
80 }
81 i++;
82 }
83 if( pos >= 0 ) {
715225af 84 document.forms[i-1].elements[pos].focus();
85 }
86
87}
88-->
89</script>
90 ';
91 $onload = "onLoad=\"checkForm();\"";
92 break;
93
94 }
95
96 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";
a07cd1a4 97
98 /** Here is the header and wrapping table **/
99 $shortBoxName = readShortMailboxName($mailbox, $delimiter);
100 echo "<A NAME=pagetop></A>\n"
101 . "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n"
102 . " <TR BGCOLOR=\"$color[9]\" >\n"
103 . " <TD ALIGN=left>\n"
104 . ' ' . _("Current Folder") . ": <B>$shortBoxName&nbsp;</B>\n"
105 . " </TD>\n"
106 . " <TD ALIGN=right><b>\n";
107 displayInternalLink ('src/signout.php', _("Sign Out"), '_top');
108 echo " </b></TD>\n"
109 . " </TR>\n"
110 . " <TR BGCOLOR=\"$color[4]\">\n"
111 . " <TD ALIGN=left>\n";
112 $urlMailbox = urlencode($mailbox);
113 displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
114 echo "&nbsp;&nbsp;\n";
115 displayInternalLink ("src/addressbook.php", _("Addresses"), 'right');
116 echo "&nbsp;&nbsp;\n";
117 displayInternalLink ("src/folders.php", _("Folders"), 'right');
118 echo "&nbsp;&nbsp;\n";
119 displayInternalLink ("src/options.php", _("Options"), 'right');
120 echo "&nbsp;&nbsp;\n";
121 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), 'right');
122 echo "&nbsp;&nbsp;\n";
123 displayInternalLink ("src/help.php", _("Help"), 'right');
124 echo "&nbsp;&nbsp;\n";
125
126 do_hook("menuline");
127
128 echo " </TD><TD ALIGN=right>\n";
129 echo ($hide_sm_attributions ? '&nbsp;' :
826b7f71 130 "<A HREF=\"http://www.squirrelmail.org/\" TARGET=\"_blank\">SquirrelMail</A>\n");
a07cd1a4 131 echo " </TD>\n".
132 " </TR>\n".
133 "</TABLE>\n\n";
134}
2ba13803 135
a07cd1a4 136?>