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