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