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