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