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