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