c6ad3c387abcb4f55738c49c2f5cb00f084ae4d6
[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     <META HTTP-Equiv="Cache-Control" Content="no-cache">
29     <META HTTP-Equiv="Pragma" Content="no-cache">
30     <META HTTP-Equiv="Expires" Content="0"> 
31 % if ( $mobile ) {
32     <META NAME="viewport" content="width=device-width height=device-height user-scalable=yes">
33 % }
34
35     <% include('menu.html', 'freeside_baseurl' => $fsurl,
36                             'position'         => $menu_position,
37                             'nocss'            => $nocss,
38                             'mobile'           => $mobile,
39               ) |n
40     %>
41
42     <% include('init_overlib.html') |n %>
43     <% include('rs_init_object.html') |n %>
44     <% include('logout.html') |n %>
45 %   my $timeout =  $conf->config('logout-timeout');
46 %   if ( $timeout && $timeout =~ /^\s*\d+\s*$/ ) {
47       <script type="text/javascript">
48         setTimeout('logout()', <% 60000 * $timeout %>);
49       </script>
50 %   }
51
52     <% $head |n %>
53
54   </HEAD>
55   <BODY BGCOLOR="#f8f8f8" <% $etc |n %> STYLE="margin-top:0; margin-bottom:0; margin-left:0px; margin-right:0px">
56     <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0px; padding-right:4px" CLASS="fshead">
57       <tr>
58         <td BGCOLOR="#ffffff"><IMG BORDER=0 ALT="freeside" HEIGHT="36" SRC="<%$fsurl%>view/REAL_logo.cgi"></td>
59         <td align=left BGCOLOR="#ffffff"> <!-- valign="top" -->
60           <font size=6><% $company_name || 'ExampleCo' %></font>
61         </td>
62         <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>
63 %         if ( $conf->config("ticket_system")
64 %              && FS::TicketSystem->access_right(\%session, 'ModifySelf') ) {
65             | <a href="<%$fsurl%>rt/Prefs/Other.html" STYLE="color: #000000">Ticketing preferences</a>
66 %         }
67           <BR></FONT>
68         </td>
69       </tr>
70     </table>
71
72     <TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0>
73
74 <link href="<%$fsurl%>elements/freeside-menu.css" type="text/css" rel="stylesheet">
75
76 % if ( $menu_position eq 'top' ) {
77
78       <TR CLASS="fsmenubar">
79
80 %       if ( $mobile ) {
81
82         <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#cccccc">
83           <SCRIPT TYPE="text/javascript">
84             document.write(myBar.toString());
85           </SCRIPT>
86         </TD>
87         <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#cccccc">
88             <% include('searchbar-combined.html') |n %>
89         </TD>
90
91 %       } else {
92
93         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#cccccc">
94           <SCRIPT TYPE="text/javascript">
95             document.write(myBar);
96           </SCRIPT>
97         </TD>
98
99       </TR>
100
101       <TR CLASS="fssearchbar">
102
103         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px">
104           <% include('searchbar-prospect.html') |n %>
105         </TD>
106
107         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px">
108           <% include('searchbar-cust_main.html') |n %>
109         </TD>
110
111         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="center">
112           <% include('searchbar-address2.html') |n %>
113         </TD>
114
115         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right">
116           <% include('searchbar-cust_bill.html') |n %>
117         </TD>
118
119         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px">
120           <% include('searchbar-cust_svc.html') |n %>
121         </TD>
122
123         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px;padding-right:2px">
124           <% include('searchbar-ticket.html') |n %>
125         </TD>
126 %       }
127
128       </TR>
129     </TABLE>
130
131 % } else { #$menu_position eq 'left'
132
133       <TR CLASS="fsmenubar">
134
135         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#cccccc">
136         </TD>
137
138       </TR>
139
140 % }
141
142
143     <TABLE WIDTH="100%" HEIGHT="100%" CELLSPACING=0 CELLPADDING=4>
144
145       <TR HEIGHT="100%">
146
147 % if ( $menu_position eq 'left' ) {
148
149         <TD BGCOLOR="#cccccc" ALIGN="left" HEIGHT="100%" WIDTH="154" VALIGN="top" ALIGN="right" CLASS="fsmenubar">
150           <SCRIPT TYPE="text/javascript">
151             document.write(myBar);
152           </SCRIPT>
153
154           <BR>
155           <% include('searchbar-prospect.html') |n %>
156           <% include('searchbar-cust_main.html') |n %>
157           <% include('searchbar-address2.html') |n %>
158           <% include('searchbar-cust_bill.html') |n %>
159           <% include('searchbar-cust_svc.html') |n %>
160           <% include('searchbar-ticket.html') |n %>
161
162         </TD>
163
164 % }
165 %# page content starts here
166         <TD CLASS="background" HEIGHT="100%" VALIGN="top"> <!-- WIDTH="100%"> -->
167
168           <FONT SIZE=6>
169             <% $title |h %>
170           </FONT>
171
172 % unless ( $nobr ) {
173           <BR><BR>
174 % }
175
176           <% $menubar !~ /^\s*$/ ? "$menubar<BR><BR>" : '' %>
177 <%init>
178
179 my( $title, $menubar, $etc, $head ) = ( '', '', '', '' );
180 my( $nobr, $nocss ) = ( 0, 0 );
181
182 my $mobile;
183
184 if ( ref($_[0]) ) {
185   my $opt = shift;
186   $title   = $opt->{title};
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;
214 my @agentnums = $curuser->agentnums;
215 if ( scalar(@agentnums) == 1 ) {
216   $company_name = $conf->config('company_name', $agentnums[0] );
217 } else {
218   $company_name = $conf->config('company_name');
219 }
220 </%init>