RT#39694 Checkpoint for v3 backport
[freeside.git] / httemplate / elements / header.html
1 <%doc>
2
3 Example:
4
5   include( '/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   include( '/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 |h %>
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 %   if ( $jquery ) {
46       <link rel="stylesheet" href="<% $fsurl %>elements/jquery-ui.min.css">
47       <SCRIPT SRC="<% $fsurl %>elements/jquery.js"></SCRIPT>
48       <SCRIPT SRC="<% $fsurl %>elements/jquery-ui.min.js"></SCRIPT>
49 %   }
50
51     <% include('init_overlib.html') |n %>
52     <% include('rs_init_object.html') |n %>
53     <% include('logout.html') |n %>
54 %   my $timeout =  $conf->config('logout-timeout');
55 %   if ( $timeout && $timeout =~ /^\s*\d+\s*$/ ) {
56       <script type="text/javascript">
57         setTimeout('logout()', <% 60000 * $timeout %>);
58       </script>
59 %   }
60
61     <% $head |n %>
62
63   </HEAD>
64   <BODY BGCOLOR="#f8f8f8" <% $etc |n %> STYLE="margin-top:0; margin-bottom:0; margin-left:0px; margin-right:0px">
65     <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0px; padding-right:4px" CLASS="fshead">
66       <tr>
67         <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>
68         <td align=left BGCOLOR="#ffffff"> <!-- valign="top" -->
69           <font size=6><% $company_name || 'ExampleCo' %></font>
70         </td>
71         <td align=right valign=top BGCOLOR="#ffffff"><FONT SIZE="-1">Logged in as <b><% getotaker %>&nbsp;</b> <FONT SIZE="-2"><a href="javascript:void(0);" onClick="logout();">logout</a></FONT><br></FONT><FONT SIZE="-2"><a href="<%$fsurl%>pref/pref.html" STYLE="color: #000000">Preferences</a>
72 %         if ( $conf->config("ticket_system")
73 %              && FS::TicketSystem->access_right(\%session, 'ModifySelf') ) {
74             | <a href="<%$fsurl%>rt/Prefs/Other.html" STYLE="color: #000000">Ticketing preferences</a>
75 %         }
76           <BR></FONT>
77         </td>
78       </tr>
79     </table>
80
81     <TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0>
82
83 <link href="<%$fsurl%>elements/freeside-menu.css" type="text/css" rel="stylesheet">
84
85 % if ( $menu_position eq 'top' ) {
86
87       <TR CLASS="fsmenubar">
88
89 %       if ( $mobile ) {
90
91         <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#cccccc">
92           <SCRIPT TYPE="text/javascript">
93             document.write(myBar.toString());
94           </SCRIPT>
95         </TD>
96         <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#cccccc">
97             <% include('searchbar-combined.html') |n %>
98         </TD>
99
100 %       } else {
101
102         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#cccccc">
103           <SCRIPT TYPE="text/javascript">
104             document.write(myBar);
105           </SCRIPT>
106         </TD>
107
108       </TR>
109
110       <TR CLASS="fssearchbar">
111
112         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px">
113           <% include('searchbar-prospect.html') |n %>
114         </TD>
115
116         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px">
117           <% include('searchbar-cust_main.html') |n %>
118         </TD>
119
120         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="center">
121           <% include('searchbar-address2.html') |n %>
122         </TD>
123
124         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right">
125           <% include('searchbar-cust_bill.html') |n %>
126         </TD>
127
128         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px">
129           <% include('searchbar-cust_svc.html') |n %>
130         </TD>
131
132         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px;padding-right:2px">
133           <% include('searchbar-ticket.html') |n %>
134         </TD>
135 %       }
136
137       </TR>
138     </TABLE>
139
140 % } else { #$menu_position eq 'left'
141
142       <TR CLASS="fsmenubar">
143
144         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#cccccc">
145         </TD>
146
147       </TR>
148
149 % }
150
151
152     <TABLE WIDTH="100%" HEIGHT="100%" CELLSPACING=0 CELLPADDING=4>
153
154       <TR HEIGHT="100%">
155
156 % if ( $menu_position eq 'left' ) {
157
158         <TD BGCOLOR="#cccccc" ALIGN="left" HEIGHT="100%" WIDTH="154" VALIGN="top" ALIGN="right" CLASS="fsmenubar">
159           <SCRIPT TYPE="text/javascript">
160             document.write(myBar);
161           </SCRIPT>
162
163           <BR>
164           <% include('searchbar-prospect.html') |n %>
165           <% include('searchbar-cust_main.html') |n %>
166           <% include('searchbar-address2.html') |n %>
167           <% include('searchbar-cust_bill.html') |n %>
168           <% include('searchbar-cust_svc.html') |n %>
169           <% include('searchbar-ticket.html') |n %>
170
171         </TD>
172
173 % }
174 %# page content starts here
175         <TD CLASS="background" HEIGHT="100%" VALIGN="top"> <!-- WIDTH="100%"> -->
176
177           <FONT SIZE=6>
178             <% $title |h %>
179           </FONT>
180
181 % unless ( $nobr ) {
182           <BR><BR>
183 % }
184
185           <% $menubar !~ /^\s*$/ ? "$menubar<BR><BR>" : '' %>
186 <%init>
187
188 my( $title, $menubar, $etc, $head ) = ( '', '', '', '' );
189 my( $nobr, $nocss ) = ( 0, 0 );
190 my $jquery = 0;
191
192 my $mobile;
193
194 if ( ref($_[0]) ) {
195   my $opt = shift;
196   $title   = $opt->{title};
197   $menubar = $opt->{menubar};
198   $etc     = $opt->{etc};
199   $head    = $opt->{head};
200   $nobr    = $opt->{nobr};
201   $nocss   = $opt->{nocss};
202   $mobile  = $opt->{mobile};
203   $jquery  = $opt->{jquery};
204 } else {
205   ($title, $menubar) = ( shift, shift );
206   $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc.
207   $head = @_ ? shift : ''; #$head is for things that go in the <HEAD> section
208 }
209
210 my $conf = new FS::Conf;
211
212 my $curuser = $FS::CurrentUser::CurrentUser;
213
214 my $menu_position = $curuser->option('menu_position')
215                     || 'top'; #new default for 1.9
216
217 if ( !defined($mobile) ) {
218   $mobile = $curuser->option('mobile_menu',1) && FS::UI::Web::is_mobile();
219 }
220 if ( $cgi->param('mobile') =~ /^(\d)$/ ) { # allow client to override
221   $mobile = $1;
222 }
223
224 my($company_name, $company_url);
225 my @agentnums = $curuser->agentnums;
226 if ( scalar(@agentnums) == 1 ) {
227   $company_name = $conf->config('company_name', $agentnums[0] );
228   $company_url  = $conf->config('company_url',  $agentnums[0] );
229 } else {
230   $company_name = $conf->config('company_name');
231   $company_url  = $conf->config('company_url');
232 }
233 </%init>