fix title escaping
[freeside.git] / httemplate / elements / header.html
1 <%doc>
2
3 Example:
4
5   <& /elements/header.html',
6        {
7          'title'   => 'Title',
8          'menubar' => \@menubar,
9          'etc'     => '', #included in <BODY> tag, for things like onLoad=
10          'head'    => '', #included before closing </HEAD> tag
11          'nobr'    => 0,  #1 for no <BR><BR> after the title
12        }
13   &>
14
15   %#old-style
16   <& /elements/header.html, 'Title', $menubar, $etc, $head &>
17
18 </%doc>
19 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
20 %#<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
21 %# above is what RT declares, should we switch now? hopefully no glitches result
22 %# or just fuck it, XHTML died anyway, HTML 5 or bust?
23 <HTML>
24   <HEAD>
25     <TITLE>
26       <% $title_noescape || encode_entities($title) %>
27     </TITLE>
28     <!-- per RT, to prevent IE compatibility mode -->
29     <meta http-equiv="X-UA-Compatible" content="IE=edge" />
30     <!-- The X-UA-Compatible <meta> tag above must be very early in <head> -->
31     <META HTTP-Equiv="Cache-Control" Content="no-cache">
32     <META HTTP-Equiv="Pragma" Content="no-cache">
33     <META HTTP-Equiv="Expires" Content="0"> 
34 % if ( $mobile ) {
35     <META NAME="viewport" content="width=device-width height=device-height user-scalable=yes">
36 % }
37
38     <% include('menu.html', 'freeside_baseurl' => $fsurl,
39                             'position'         => $menu_position,
40                             'nocss'            => $nocss,
41                             'mobile'           => $mobile,
42               ) |n
43     %>
44
45     <SCRIPT SRC="<% $fsurl %>elements/jquery.js"></SCRIPT>
46     <% include('init_overlib.html') |n %>
47     <% include('rs_init_object.html') |n %>
48
49     <% $head |n %>
50
51   </HEAD>
52   <BODY BGCOLOR="#f8f8f8" <% $etc |n %> STYLE="margin-top:0; margin-bottom:0; margin-left:0px; margin-right:0px">
53     <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0px; padding-right:4px" CLASS="fshead">
54       <tr>
55         <td BGCOLOR="#ffffff"><% $company_url ? qq(<A HREF="$company_url">) : '' |n %><IMG BORDER=0 ALT="freeside" HEIGHT="36" SRC="<%$fsurl%>view/REAL_logo.cgi"><% $company_url ? '</A>' : '' |n %></td>
56         <td align=left BGCOLOR="#ffffff"> <!-- valign="top" -->
57           <font size=6><% $company_name || 'ExampleCo' %></font>
58         </td>
59         <td align=right valign=top BGCOLOR="#ffffff"><FONT SIZE="-1">Logged in as <b><% $FS::CurrentUser::CurrentUser->username |h %>&nbsp;</b> <FONT SIZE="-2"><a href="<%$fsurl%>loginout/logout.html">logout</a></FONT><br></FONT><FONT SIZE="-2"><a href="<%$fsurl%>pref/pref.html" STYLE="color: #000000">Preferences</a>
60 %         if ( $conf->config("ticket_system")
61 %              && FS::TicketSystem->access_right(\%session, 'ModifySelf') ) {
62             | <a href="<%$fsurl%>rt/Prefs/Other.html" STYLE="color: #000000">Ticketing preferences</a>
63 %         }
64           <BR></FONT>
65         </td>
66       </tr>
67     </table>
68
69     <TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0>
70
71 <link href="<%$fsurl%>elements/freeside-menu.css" type="text/css" rel="stylesheet">
72
73 % if ( $menu_position eq 'top' ) {
74
75       <TR CLASS="fsmenubar">
76
77 %       if ( $mobile ) {
78
79         <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#dddddd">
80           <SCRIPT TYPE="text/javascript">
81             document.write(myBar.toString());
82           </SCRIPT>
83         </TD>
84         <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#dddddd">
85             <% include('searchbar-combined.html') |n %>
86         </TD>
87
88 %       } else {
89
90         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#dddddd">
91           <SCRIPT TYPE="text/javascript">
92             document.write(myBar);
93           </SCRIPT>
94         </TD>
95
96       </TR>
97
98       <TR CLASS="fssearchbar">
99
100         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right" STYLE="padding-left:2px">
101           <% include('searchbar-prospect.html') |n %>
102         </TD>
103
104         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right" STYLE="padding-left:2px">
105           <% include('searchbar-cust_main.html') |n %>
106         </TD>
107
108         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="center">
109           <% include('searchbar-address2.html') |n %>
110         </TD>
111
112         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right">
113           <% include('searchbar-cust_bill.html') |n %>
114         </TD>
115
116         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right" STYLE="padding-left:2px">
117           <% include('searchbar-cust_svc.html') |n %>
118         </TD>
119
120         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right" STYLE="padding-left:2px;padding-right:2px">
121           <% include('searchbar-ticket.html') |n %>
122         </TD>
123 %       }
124
125       </TR>
126     </TABLE>
127
128 % } else { #$menu_position eq 'left'
129
130       <TR CLASS="fsmenubar">
131
132         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#dddddd">
133         </TD>
134
135       </TR>
136
137 % }
138
139
140     <TABLE WIDTH="100%" HEIGHT="100%" CELLSPACING=0 CELLPADDING=4>
141
142       <TR HEIGHT="100%">
143
144 % if ( $menu_position eq 'left' ) {
145
146         <TD BGCOLOR="#dddddd" ALIGN="left" HEIGHT="100%" WIDTH="154" VALIGN="top" ALIGN="right" CLASS="fsmenubar">
147           <SCRIPT TYPE="text/javascript">
148             document.write(myBar);
149           </SCRIPT>
150
151           <BR>
152           <% include('searchbar-prospect.html') |n %>
153           <% include('searchbar-cust_main.html') |n %>
154           <% include('searchbar-address2.html') |n %>
155           <% include('searchbar-cust_bill.html') |n %>
156           <% include('searchbar-cust_svc.html') |n %>
157           <% include('searchbar-ticket.html') |n %>
158
159         </TD>
160
161 % } else { #$menu_position eq 'top'
162     <BR>
163 % }
164 %# page content starts here
165         <TD CLASS="background" HEIGHT="100%" VALIGN="top"> <!-- WIDTH="100%"> -->
166
167           <H1>
168             <% $title_noescape || encode_entities($title) %>
169           </H1>
170
171 % unless ( $nobr ) {
172           <BR>
173 % }
174
175           <% $menubar !~ /^\s*$/ ? "$menubar<BR><BR>" : '' %>
176 <%init>
177
178 my( $title, $title_noescape, $menubar, $etc, $head ) = ( '', '', '', '', '' );
179 my( $nobr, $nocss ) = ( 0, 0 );
180
181 my $mobile;
182
183 if ( ref($_[0]) ) {
184   my $opt = shift;
185   $title   = $opt->{title};
186   $title_noescape = $opt->{title_noescape};
187   $menubar = $opt->{menubar};
188   $etc     = $opt->{etc};
189   $head    = $opt->{head};
190   $nobr    = $opt->{nobr};
191   $nocss   = $opt->{nocss};
192   $mobile  = $opt->{mobile};
193 } else {
194   ($title, $menubar) = ( shift, shift );
195   $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc.
196   $head = @_ ? shift : ''; #$head is for things that go in the <HEAD> section
197 }
198
199 my $conf = new FS::Conf;
200
201 my $curuser = $FS::CurrentUser::CurrentUser;
202
203 my $menu_position = $curuser->option('menu_position')
204                     || 'top'; #new default for 1.9
205
206 if ( !defined($mobile) ) {
207   $mobile = $curuser->option('mobile_menu',1) && FS::UI::Web::is_mobile();
208 }
209 if ( $cgi->param('mobile') =~ /^(\d)$/ ) { # allow client to override
210   $mobile = $1;
211 }
212
213 my($company_name, $company_url);
214 my @agentnums = $curuser->agentnums;
215 if ( scalar(@agentnums) == 1 ) {
216   $company_name = $conf->config('company_name', $agentnums[0] );
217   $company_url  = $conf->config('company_url',  $agentnums[0] );
218 } else {
219   $company_name = $conf->config('company_name');
220   $company_url  = $conf->config('company_url');
221 }
222 </%init>