b5e8bfe4f5b388cfa02c49da2fcdbdcd20a70b7c
[squirrelmail.git] / functions / page_header.php
1 <?php
2
3 /**
4 * page_header.php
5 *
6 * Copyright (c) 1999-2001 The Squirrelmail Development Team
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
14 /*****************************************************************/
15 /*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
16 /*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
17 /*** + Base level indent should begin at left margin, as ***/
18 /*** the first line of the function definition below. ***/
19 /*** + All identation should consist of four space blocks ***/
20 /*** + Tab characters are evil. ***/
21 /*** + all comments should use "slash-star ... star-slash" ***/
22 /*** style -- no pound characters, no slash-slash style ***/
23 /*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
24 /*** ALWAYS USE { AND } CHARACTERS!!! ***/
25 /*** + Please use ' instead of ", when possible. Note " ***/
26 /*** should always be used in _( ) function calls. ***/
27 /*** Thank you for your help making the SM code more readable. ***/
28 /*****************************************************************/
29
30 // Always set up the language before calling these functions
31 function displayHtmlHeader
32 ($title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ) {
33
34 global $theme_css;
35
36 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' .
37 "\n\n<HTML>\n<HEAD>\n";
38
39 if ($theme_css != '') {
40 echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"$theme_css\">\n";
41 }
42
43 if( $do_hook ) {
44 do_hook ("generic_header");
45 }
46
47 echo "<title>$title</title>$xtra</head>\n\n";
48
49 }
50
51 function displayInternalLink ($path, $text, $target='') {
52 global $base_uri;
53
54 if ($target != '')
55 $target = " target=\"$target\"";
56
57 echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
58 }
59
60 function displayPageHeader($color, $mailbox) {
61 global $delimiter, $hide_sm_attributions;
62 displayHtmlHeader ();
63
64 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" onLoad='if ( ( document.forms.length > 0 ) && ( document.forms[0].elements[0].type == \"text\" ) ) { document.forms[0].elements[0].focus(); }'>\n\n";
65
66 /** Here is the header and wrapping table **/
67 $shortBoxName = readShortMailboxName($mailbox, $delimiter);
68 echo "<A NAME=pagetop></A>\n"
69 . "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n"
70 . " <TR BGCOLOR=\"$color[9]\" >\n"
71 . " <TD ALIGN=left>\n"
72 . ' ' . _("Current Folder") . ": <B>$shortBoxName&nbsp;</B>\n"
73 . " </TD>\n"
74 . " <TD ALIGN=right><b>\n";
75 displayInternalLink ('src/signout.php', _("Sign Out"), '_top');
76 echo " </b></TD>\n"
77 . " </TR>\n"
78 . " <TR BGCOLOR=\"$color[4]\">\n"
79 . " <TD ALIGN=left>\n";
80 $urlMailbox = urlencode($mailbox);
81 displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), "right");
82 echo "&nbsp;&nbsp;\n";
83 displayInternalLink ("src/addressbook.php", _("Addresses"), "right");
84 echo "&nbsp;&nbsp;\n";
85 displayInternalLink ("src/folders.php", _("Folders"), "right");
86 echo "&nbsp;&nbsp;\n";
87 displayInternalLink ("src/options.php", _("Options"), "right");
88 echo "&nbsp;&nbsp;\n";
89 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), "right");
90 echo "&nbsp;&nbsp;\n";
91 displayInternalLink ("src/help.php", _("Help"), "right");
92 echo "&nbsp;&nbsp;\n";
93
94 do_hook("menuline");
95
96 echo " </TD><TD ALIGN=right>\n";
97 echo ($hide_sm_attributions ? '&nbsp;' :
98 "<A HREF=\"http://www.squirrelmail.org/\" TARGET=\"_blank\">SquirrelMail</A>\n");
99 echo " </TD>\n".
100 " </TR>\n".
101 "</TABLE>\n\n";
102 // echo "</td></tr></table>";
103 }
104
105 ?>