add a logout link (RT 1330 & 5518)
[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
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       <% $title %>
28     </TITLE>
29     <META HTTP-Equiv="Cache-Control" Content="no-cache">
30     <META HTTP-Equiv="Pragma" Content="no-cache">
31     <META HTTP-Equiv="Expires" Content="0"> 
32
33     <% include('menu.html', 'freeside_baseurl' => $fsurl,
34                             'position'         => $menu_position,
35                             'nocss'            => $nocss,
36               ) |n
37     %>
38
39     <% include('init_overlib.html') |n %>
40     <% include('rs_init_object.html') |n %>
41     <% include('logout.html') |n %>
42
43     <SCRIPT TYPE="text/javascript">
44
45       function clearhint_search_prospect (what) {
46         if ( what.value == '<% $prospect_label |n %>' )
47           what.value = '';
48       }
49
50       function clearhint_search_cust (what) {
51         if ( what.value == '<% $cust_label |n %>' )
52           what.value = '';
53       }
54
55       function clearhint_search_address2 (what) {
56         if ( what.value == '<% $address2_label |n %>' )
57           what.value = '';
58       }
59
60       function clearhint_search_invoice (what) {
61         if ( what.value == '<% $inv_label |n %>' )
62           what.value = '';
63       }
64
65       function clearhint_search_svc (what) {
66         if ( what.value == '<% $svc_label |n %>' )
67           what.value = '';
68       }
69
70       function clearhint_search_ticket (what) {
71         if ( what.value == '<% $ticketing_label |n %>' )
72           what.value = '';
73       }
74
75     </SCRIPT>
76
77     <% $head |n %>
78
79   </HEAD>
80   <BODY <% $menu_position eq 'left' ? qq( BACKGROUND="${fsurl}images/background-cheat.png" ) : ' BGCOLOR="#e8e8e8" ' %> <% $etc |n %> STYLE="margin-top:0; margin-bottom:0; margin-left:0; margin-right:0">
81     <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0; padding-right:4">
82       <tr>
83         <td BGCOLOR="#ffffff"><IMG BORDER=0 ALT="freeside" HEIGHT="36" SRC="<%$fsurl%>view/REAL_logo.cgi"></td>
84         <td align=left BGCOLOR="#ffffff"> <!-- valign="top" -->
85           <font size=6><% $company_name || 'ExampleCo' %></font>
86         </td>
87         <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>
88 %         if ( $conf->config("ticket_system")
89 %              && FS::TicketSystem->access_right(\%session, 'ModifySelf') ) {
90             | <a href="<%$fsurl%>rt/User/Prefs.html" STYLE="color: #000000">Ticketing preferences</a>
91 %         }
92           <BR></FONT>
93         </td>
94       </tr>
95     </table>
96
97 <style type="text/css">
98 input.fsblackbutton {
99          background-color:#333333;
100          color: #ffffff;
101          border:1px solid;
102          border-top-color:#cccccc;
103          border-left-color:#cccccc;
104          border-right-color:#aaaaaa;
105          border-bottom-color:#aaaaaa;
106          font-family: Arial, Verdana, Helvetica, sans-serif;
107          font-weight:bold;
108          padding-left:12px;
109          padding-right:12px;
110          padding-top:0px;
111          padding-bottom:0px;
112          margin-left:0px;
113          margin-right:0px;
114          margin-top:2px;
115          margin-bottom:0px;
116          overflow:visible;
117          filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#ff333333',EndColorStr='#ff666666')
118 }
119
120 input.fsblackbuttonselected {
121          background-color:#7e0079;
122          color: #ffffff;
123          border:1px solid;
124          border-top-color:#cccccc;
125          border-left-color:#cccccc;
126          border-right-color:#aaaaaa;
127          border-bottom-color:#aaaaaa;
128          font-family: Arial, Verdana, Helvetica, sans-serif;
129          font-weight:bold;
130          padding-left:12px;
131          padding-right:12px;
132          padding-top:0px;
133          padding-bottom:0px;
134          margin-left:0px;
135          margin-right:0px;
136          margin-top:2px;
137          margin-bottom:0px;
138          overflow:visible;
139          filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#ff330033',EndColorStr='#ff7e0079')
140 }
141
142 input.fstext {
143          border: 2px inset #eee;
144          /*border-top-color:#aaaaaa;
145          border-left-color:#aaaaaa;
146          border-right-color:#cccccc;
147          border-bottom-color:#cccccc;
148          */
149          vertical-align:bottom;
150          text-align:right;
151          font-family: Arial,Verdana,Helvetica,sans-serif;
152          font-size: 13px;
153          padding-left: 0px;
154          padding-right: 0px;
155          padding-top: 0px;
156          padding-bottom: 0px;
157          margin-left:0px;
158          margin-right:0px;
159          margin-top:0px;
160          margin-bottom:1px;
161 }
162
163 </style>
164
165     <TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0>
166       <TR>
167         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:0"><IMG BORDER=0 ALT="" SRC="<%$fsurl%>images/black-gradient.png" HEIGHT="13" WIDTH="100%"></TD>
168       </TR>
169
170 % if ( $menu_position eq 'top' ) {
171
172       <TR>
173
174         <TD COLSPAN="5" WIDTH="100%" STYLE="padding:0" BGCOLOR="#000000">
175           <SCRIPT TYPE="text/javascript">
176             document.write(myBar);
177           </SCRIPT>
178         </TD>
179
180
181         <TD COLSPAN="2" ALIGN="right" STYLE="padding:0px 8px 0px 0px" BGCOLOR="#000000">
182           <TABLE CELLSPACING=0 CELLPADDING=0 BGCOLOR="#000000" BORDER=0>
183             <TR>
184               <TD ALIGN="right" STYLE="padding-right:3px;padding-bottom:1px;border-right:1px solid #999999"><% include('/elements/about_freeside.html') |n %></TD>
185               <TD ALIGN="left" STYLE="padding-left:3px;padding-bottom:1px"><% include('/elements/about_rt.html') |n %></TD>
186             </TR>
187           </TABLE>
188         </TD>
189
190       </TR>
191
192       <TR>
193         <TD COLSPAN="7" WIDTH="100%" HEIGHT="2px" STYLE="padding:0" BGCOLOR="#000000">
194         </TD>
195       </TR>
196       
197       <TR>
198         <TD COLSPAN="7" WIDTH="100%" HEIGHT="4px" STYLE="padding:0" BGCOLOR="#000000">
199         </TD>
200       </TR>
201
202 % }
203
204       <TR>
205
206         <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right" STYLE="padding-left:2px">
207 % if ( $curuser->access_right('List prospects') ) {
208           <FORM ACTION="<%$fsurl%>search/prospect_main.html" METHOD="GET" STYLE="margin:0">
209             <INPUT NAME="search_prospect" TYPE="text" VALUE="<% $prospect_label |n %>" STYLE="width:155px" onFocus="clearhint_search_prospect(this);" onClick="clearhint_search_prospect(this);" CLASS="fstext"><BR>
210             <A HREF="<%$fsurl%>search/report_prospect_main.html" STYLE="color: #ffffff; font-size: 11px">Adv</A>
211             <INPUT TYPE="submit" VALUE="Search prospects" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px;padding-left:1px;padding-right:1px"">
212           </FORM>
213 % }
214         </TD>
215
216         <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right" STYLE="padding-left:2px">
217 % if ( $curuser->access_right('List customers') ) {
218           <FORM ACTION="<%$fsurl%>search/cust_main.cgi" METHOD="GET" STYLE="margin:0">
219             <INPUT NAME="search_cust" TYPE="text" VALUE="<% $cust_label |n %>" STYLE="width:<%$cust_width%>px" onFocus="clearhint_search_cust(this);" onClick="clearhint_search_cust(this);" CLASS="fstext"><BR>
220             <A HREF="<%$fsurl%>search/report_cust_main.html" STYLE="color: #ffffff; font-size: 11px">Advanced</A>
221             <INPUT TYPE="submit" VALUE="Search customers" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px">
222           </FORM>
223 % }
224         </TD>
225
226         <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="center">
227 % if ( $conf->exists('address2-search') ) { 
228             <FORM ACTION="<%$fsurl%>search/cust_main.cgi" METHOD="GET" STYLE="margin:0;display:inline">
229               <INPUT TYPE="hidden" NAME="address2_on" VALUE="1">
230               <INPUT NAME="address2_text" TYPE="text" VALUE="<% $address2_label |n %>" STYLE="width:67px" onFocus="clearhint_search_address2(this);" onClick="clearhint_search_address2(this);" CLASS="fstext">
231               <BR>
232               <INPUT TYPE="submit" VALUE="Search units" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px;padding-left:1px;padding-right:1px;margin-top:3px">
233             </FORM>
234 % } 
235         </TD>
236
237         <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right">
238 % if ( $curuser->access_right('View invoices') ) { 
239             <FORM ACTION="<%$fsurl%>search/cust_bill.html" METHOD="GET" STYLE="margin:0;display:inline">
240               <INPUT NAME="invnum" TYPE="text" VALUE="<% $inv_label |n %>" STYLE="width:56px" onFocus="clearhint_search_invoice(this);" onClick="clearhint_search_invoice(this);" CLASS="fstext">
241 %   if ( $curuser->access_right('List invoices') ) { 
242               <A HREF="<%$fsurl%>search/report_cust_bill.html" STYLE="color: #ffffff; font-size: 11px">Adv</A>\
243 %   } 
244 <BR><INPUT TYPE="submit" VALUE="Search invoices" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px;padding-left:1px;padding-right:1px;margin-top:3px">
245             </FORM>
246 % } 
247         </TD>
248
249         <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right" STYLE="padding-left:2px">
250 % if ( $curuser->access_right('View customer services') ) {
251           <FORM ACTION="<%$fsurl%>search/cust_svc.html" METHOD="GET" STYLE="margin:0">
252             <INPUT NAME="search_svc" TYPE="text" VALUE="<% $svc_label |n %>" STYLE="width:271px" onFocus="clearhint_search_svc(this);" onClick="clearhint_search_svc(this);" CLASS="fstext"><BR>
253             <A NOTYET="<%$fsurl%>search/svc_Smarter.html" STYLE="color: #000000; font-size:11px">Advanced</A>
254             <INPUT TYPE="submit" VALUE="Search services" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px">
255           </FORM>
256 % }
257         </TD>
258
259         <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right" STYLE="padding-left:2px;padding-right:2px">
260 % if ( $conf->config("ticket_system") ) { 
261           <FORM ACTION="<% FS::TicketSystem->baseurl %>index.html" METHOD="GET" STYLE="margin:0">
262             <INPUT NAME="q" TYPE="text" VALUE="<% $ticketing_label |n %>" STYLE="width:223px" onFocus="clearhint_search_ticket(this);" onClick="clearhint_search_ticket(this);" CLASS="fstext"><BR>
263             <A HREF="<% FS::TicketSystem->baseurl %>Search/Build.html" STYLE="color: #ffffff; font-size:11px">Advanced</A>
264             <INPUT TYPE="submit" VALUE="Search tickets" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px">
265           </FORM>
266 % }
267         </TD>
268
269       </TR>
270     </TABLE>
271
272     <TABLE WIDTH="100%" HEIGHT="100%" CELLSPACING=0 CELLPADDING=4>
273
274       <TR>
275
276 % if ( $menu_position eq 'left' ) {
277
278         <TD BGCOLOR="#000000" STYLE="padding:0" WIDTH="154"></TD>
279         <TD STYLE="padding:0" WIDTH="13"><IMG BORDER=0 ALT="" SRC="<%$fsurl%>images/black-gray-corner.png"></TD>
280
281 % }
282
283         <TD STYLE="padding:0" WIDTH="100%"><IMG BORDER=0 ALT="" SRC="<%$fsurl%>images/black-gray-top.png" HEIGHT="13" WIDTH="100%"></TD>
284
285       </TR>
286
287       <TR HEIGHT="100%">
288
289 % if ( $menu_position eq 'left' ) {
290
291         <TD BGCOLOR="#000000" ALIGN="left" HEIGHT="100%" WIDTH="154" VALIGN="top" ALIGN="right">
292           <SCRIPT TYPE="text/javascript">
293             document.write(myBar);
294           </SCRIPT>
295           <BR>
296           <IMG SRC="<%$fsurl%>images/32clear.gif" HEIGHT="1" WIDTH="154">
297
298           <TABLE CELLSPACING=0 CELLPADDING=0 BGCOLOR="#000000" WIDTH="100%">
299             <TR>
300               <TD ALIGN="left" STYLE="padding-bottom:1px;border-bottom:1px solid #999999"><% include('/elements/about_freeside.html') |n %></TD>
301             </TR>
302             <TR>
303               <TD ALIGN="right" STYLE="padding-bottom:1px"><% include('/elements/about_rt.html') |n %></TD>
304             </TR>
305           </TABLE>
306
307         </TD>
308         <TD STYLE="padding:0" HEIGHT="100%" WIDTH=13 VALIGN="top"><IMG WIDTH="13" HEIGHT="100%" BORDER=0 ALT="" SRC="<%$fsurl%>images/black-gray-side.png"></TD>
309
310 % }
311
312         <TD BGCOLOR="#e8e8e8" HEIGHT="100%" VALIGN="top"> <!-- WIDTH="100%"> -->
313
314           <FONT SIZE=6>
315             <% $title %>
316           </FONT>
317
318 % unless ( $nobr ) {
319           <BR><BR>
320 % }
321
322           <% $menubar !~ /^\s*$/ ? "$menubar<BR><BR>" : '' %>
323 <%init>
324
325 my( $title, $menubar, $etc, $head ) = ( '', '', '', '' );
326 my( $nobr, $nocss ) = ( 0, 0 );
327 if ( ref($_[0]) ) {
328   my $opt = shift;
329   $title   = $opt->{title};
330   $menubar = $opt->{menubar};
331   $etc     = $opt->{etc};
332   $head    = $opt->{head};
333   $nobr    = $opt->{nobr};
334   $nocss   = $opt->{nocss};
335 } else {
336   ($title, $menubar) = ( shift, shift );
337   $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc.
338   $head = @_ ? shift : ''; #$head is for things that go in the <HEAD> section
339 }
340
341 my $conf = new FS::Conf;
342
343 my $curuser = $FS::CurrentUser::CurrentUser;
344
345 my $menu_position = $curuser->option('menu_position')
346                     || 'top'; #new default for 1.9
347
348 my $company_name;
349 my @agentnums = $curuser->agentnums;
350 if ( scalar(@agentnums) == 1 ) {
351   $company_name = $conf->config('company_name', $agentnums[0] );
352 } else {
353   $company_name = $conf->config('company_name');
354 }
355
356 my $prospect_label = '(name, company or phone)';
357
358 my $cust_width = 246;
359 my $cust_label = '(cust #, name, company';
360 if ( $conf->exists('address1-search') ) {
361   $cust_label .= ', address';
362   $cust_width += 56;
363 }
364 $cust_label .= ' or contact phone)';
365
366 my $address2_label = '(Unit #)';
367 my $inv_label = '(inv #)';
368 my $svc_label = '(user, email, ip, mac, domain or service phone)';
369 my $ticketing_label = '(ticket #, subject, email or fulltext:text)';
370
371 </%init>