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