optionally scale to the page width when printing, #71301
[freeside.git] / httemplate / elements / header-full.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          'no_jquery' => #for use from RT, which loads its own
13        }
14   &>
15
16   %#old-style
17   <& /elements/header.html, 'Title', $menubar, $etc, $head &>
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       <% encode_entities($title) || $title_noescape |n %>
28     </TITLE>
29     <!-- per RT, to prevent IE compatibility mode -->
30     <meta http-equiv="X-UA-Compatible" content="IE=edge" />
31     <!-- The X-UA-Compatible <meta> tag above must be very early in <head> -->
32     <META HTTP-Equiv="Cache-Control" Content="no-cache">
33     <META HTTP-Equiv="Pragma" Content="no-cache">
34     <META HTTP-Equiv="Expires" Content="0"> 
35 % if ( $mobile ) {
36     <META NAME="viewport" content="width=device-width height=device-height user-scalable=yes">
37 % }
38
39     <% include('menu.html', 'freeside_baseurl' => $fsurl,
40                             'position'         => $menu_position,
41                             'nocss'            => $nocss,
42                             'mobile'           => $mobile,
43               ) |n
44     %>
45
46 %   unless ( $no_jquery ) {
47       <link rel="stylesheet" href="<% $fsurl %>elements/jquery-ui.min.css">
48       <SCRIPT SRC="<% $fsurl %>elements/jquery.js"></SCRIPT>
49       <SCRIPT SRC="<% $fsurl %>elements/jquery-ui.min.js"></SCRIPT>
50 %     if ( $FS::CurrentUser::CurrentUser->option('printtofit') ) {
51       <SCRIPT SRC="<% $fsurl %>elements/printtofit.js"></SCRIPT>
52 %     }
53 %   }
54     <% include('init_overlib.html') |n %>
55     <% include('rs_init_object.html') |n %>
56
57     <% $head |n %>
58
59 %# announce our base path, and the Mason comp path of this page
60   <script type="text/javascript">
61   window.fsurl = <% $fsurl |js_string %>;
62   window.request_comp_path = <% $m->request_comp->path |js_string %>;
63   </script>
64
65   </HEAD>
66   <BODY BGCOLOR="#f8f8f8" <% $etc |n %> STYLE="margin-top:0; margin-bottom:0; margin-left:0px; margin-right:0px">
67     <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0px; padding-right:4px" CLASS="fshead">
68       <tr>
69         <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>
70         <td align=left BGCOLOR="#ffffff"> <!-- valign="top" -->
71           <font size=6><% $company_name || 'ExampleCo' %></font>
72         </td>
73         <td align="right" BGCOLOR="#ffffff">
74           <& notify-tickets.html &>
75         </td>
76         <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>
77 %         if ( $conf->config("ticket_system")
78 %              && FS::TicketSystem->access_right(\%session, 'ModifySelf') ) {
79             | <a href="<%$fsurl%>rt/Prefs/Other.html" STYLE="color: #000000">Ticketing preferences</a>
80 %         }
81           <BR></FONT>
82         </td>
83       </tr>
84     </table>
85
86     <TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0>
87
88 <link href="<%$fsurl%>elements/freeside-menu.css" type="text/css" rel="stylesheet">
89
90 % if ( $menu_position eq 'top' ) {
91
92       <TR CLASS="fsmenubar">
93
94 %       if ( $mobile ) {
95
96         <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#dddddd">
97           <SCRIPT TYPE="text/javascript">
98             document.write(myBar.toString());
99           </SCRIPT>
100         </TD>
101         <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#dddddd">
102             <% include('searchbar-combined.html') |n %>
103         </TD>
104
105 %       } else {
106
107         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#dddddd">
108           <SCRIPT TYPE="text/javascript">
109             document.write(myBar);
110           </SCRIPT>
111         </TD>
112
113       </TR>
114
115       <TR CLASS="fssearchbar">
116
117         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right" STYLE="padding-left:2px">
118           <% include('searchbar-prospect.html') |n %>
119         </TD>
120
121         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right" STYLE="padding-left:2px">
122           <% include('searchbar-cust_main.html') |n %>
123         </TD>
124
125         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="center">
126           <% include('searchbar-address2.html') |n %>
127         </TD>
128
129         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right">
130           <% include('searchbar-cust_bill.html') |n %>
131         </TD>
132
133         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right" STYLE="padding-left:2px">
134           <% include('searchbar-cust_svc.html') |n %>
135         </TD>
136
137         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right" STYLE="padding-left:2px;padding-right:2px">
138           <% include('searchbar-ticket.html') |n %>
139         </TD>
140 %       }
141
142       </TR>
143     </TABLE>
144
145 % } else { #$menu_position eq 'left'
146
147       <TR CLASS="fsmenubar">
148
149         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#dddddd">
150         </TD>
151
152       </TR>
153
154 % }
155
156
157     <TABLE WIDTH="100%" HEIGHT="100%" CELLSPACING=0 CELLPADDING=4>
158
159       <TR HEIGHT="100%">
160
161 % if ( $menu_position eq 'left' ) {
162
163         <TD BGCOLOR="#dddddd" ALIGN="left" HEIGHT="100%" WIDTH="154" VALIGN="top" ALIGN="right" CLASS="fsmenubar">
164           <SCRIPT TYPE="text/javascript">
165             document.write(myBar);
166           </SCRIPT>
167
168           <BR>
169           <% include('searchbar-prospect.html') |n %>
170           <% include('searchbar-cust_main.html') |n %>
171           <% include('searchbar-address2.html') |n %>
172           <% include('searchbar-cust_bill.html') |n %>
173           <% include('searchbar-cust_svc.html') |n %>
174           <% include('searchbar-ticket.html') |n %>
175
176         </TD>
177
178 % } else { #$menu_position eq 'top'
179     <BR>
180 % }
181 %# page content starts here
182         <TD CLASS="background" HEIGHT="100%" VALIGN="top"> <!-- WIDTH="100%"> -->
183
184           <H1>
185             <% $title_noescape || encode_entities($title) %>
186           </H1>
187
188 % unless ( $nobr ) {
189           <BR>
190 % }
191
192           <% $menubar !~ /^\s*$/ ? "$menubar<BR><BR>" : '' %>
193
194 <%init>
195
196 my( $title, $title_noescape, $menubar, $etc, $head ) = ( '', '', '', '', '' );
197 my( $nobr, $nocss, $no_jquery ) = ( 0, 0, 0 );
198
199 my $mobile;
200
201 if ( ref($_[0]) ) {
202   my $opt = shift;
203   $title   = $opt->{title};
204   $title_noescape = $opt->{title_noescape};
205   $menubar    = $opt->{menubar};
206   $etc        = $opt->{etc};
207   $head       = $opt->{head};
208   $nobr       = $opt->{nobr};
209   $nocss      = $opt->{nocss};
210   $mobile     = $opt->{mobile};
211   $no_jquery  = $opt->{no_jquery};
212 } else {
213   ($title, $menubar) = ( shift, shift );
214   $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc.
215   $head = @_ ? shift : ''; #$head is for things that go in the <HEAD> section
216 }
217
218 my $conf = new FS::Conf;
219
220 my $curuser = $FS::CurrentUser::CurrentUser;
221
222 my $menu_position = $curuser->option('menu_position')
223                     || 'top'; #new default for 1.9
224
225 if ( !defined($mobile) ) {
226   $mobile = $curuser->option('mobile_menu',1) && FS::UI::Web::is_mobile();
227 }
228 if ( $cgi->param('mobile') =~ /^(\d)$/ ) { # allow client to override
229   $mobile = $1;
230 }
231
232 my($company_name, $company_url);
233 my @agentnums = $curuser->agentnums;
234 if ( scalar(@agentnums) == 1 ) {
235   $company_name = $conf->config('company_name', $agentnums[0] );
236   $company_url  = $conf->config('company_url',  $agentnums[0] );
237 } else {
238   $company_name = $conf->config('company_name');
239   $company_url  = $conf->config('company_url');
240 }
241
242 </%init>