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