RT# 21110 Unparsable age error. Added javascript to validate field prior to submittin...
[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     <script type="text/javascript" src="<% $fsurl %>elements/topreload.js"></script>
57     <% $head |n %>
58
59     <SCRIPT SRC="<% $fsurl %>elements/validate.min.js"></SCRIPT>
60
61 %# announce our base path, and the Mason comp path of this page
62   <script type="text/javascript">
63   window.fsurl = <% $fsurl |js_string %>;
64   window.request_comp_path = <% $m->request_comp->path |js_string %>;
65   </script>
66
67   </HEAD>
68   <BODY BGCOLOR="#f8f8f8" <% $etc |n %> STYLE="margin-top:0; margin-bottom:0; margin-left:0px; margin-right:0px">
69     <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0px; padding-right:4px" CLASS="fshead">
70       <tr>
71         <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>
72         <td align=left BGCOLOR="#ffffff"> <!-- valign="top" -->
73           <font size=6><% $company_name || 'ExampleCo' %></font>
74         </td>
75         <td align="right" BGCOLOR="#ffffff">
76           <& notify-tickets.html &>
77         </td>
78         <td align=right valign=top BGCOLOR="#ffffff">
79           <FONT SIZE="-1"><% mt('Logged in as') |h %>
80             <b><% $FS::CurrentUser::CurrentUser->username |h %>&nbsp;</b>
81             <FONT SIZE="-2"><a href="<%$fsurl%>loginout/logout.html">
82               <% mt('logout') |h %>
83             </a></FONT>
84           <br>
85           </FONT>
86           <FONT SIZE="-2"><a href="<%$fsurl%>pref/pref.html" STYLE="color: #000000"><% mt('Preferences') |h %></a>
87 %         if ( $conf->config("ticket_system")
88 %              && FS::TicketSystem->access_right(\%session, 'ModifySelf') ) {
89             | <a href="<%$fsurl%>rt/Prefs/Other.html" STYLE="color: #000000"><% mt('Ticketing preferences') |h %></a>
90 %         }
91           <BR></FONT>
92         </td>
93       </tr>
94     </table>
95
96     <TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0>
97
98 <link href="<%$fsurl%>elements/freeside-menu.css" type="text/css" rel="stylesheet">
99
100 % if ( $menu_position eq 'top' ) {
101
102       <TR CLASS="fsmenubar">
103
104 %       if ( $mobile ) {
105
106         <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#dddddd">
107           <SCRIPT TYPE="text/javascript">
108             document.write(myBar.toString());
109           </SCRIPT>
110         </TD>
111         <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#dddddd">
112             <% include('searchbar-combined.html') |n %>
113         </TD>
114
115 %       } else {
116
117         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#dddddd">
118           <SCRIPT TYPE="text/javascript">
119             document.write(myBar);
120           </SCRIPT>
121         </TD>
122
123       </TR>
124
125       <TR CLASS="fssearchbar">
126
127         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right" STYLE="padding-left:2px">
128           <% include('searchbar-prospect.html') |n %>
129         </TD>
130
131         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right" STYLE="padding-left:2px">
132           <% include('searchbar-cust_main.html') |n %>
133         </TD>
134
135         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="center">
136           <% include('searchbar-address2.html') |n %>
137         </TD>
138
139         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right">
140           <% include('searchbar-cust_bill.html') |n %>
141         </TD>
142
143         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right" STYLE="padding-left:2px">
144           <% include('searchbar-cust_svc.html') |n %>
145         </TD>
146
147         <TD COLSPAN=1 BGCOLOR="#dddddd" ALIGN="right" STYLE="padding-left:2px;padding-right:2px">
148           <% include('searchbar-ticket.html') |n %>
149         </TD>
150 %       }
151
152       </TR>
153     </TABLE>
154
155 % } else { #$menu_position eq 'left'
156
157       <TR CLASS="fsmenubar">
158
159         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#dddddd">
160         </TD>
161
162       </TR>
163
164 % }
165
166
167     <TABLE WIDTH="100%" HEIGHT="100%" CELLSPACING=0 CELLPADDING=4>
168
169       <TR HEIGHT="100%">
170
171 % if ( $menu_position eq 'left' ) {
172
173         <TD BGCOLOR="#dddddd" ALIGN="left" HEIGHT="100%" WIDTH="154" VALIGN="top" ALIGN="right" CLASS="fsmenubar">
174           <SCRIPT TYPE="text/javascript">
175             document.write(myBar);
176           </SCRIPT>
177
178           <BR>
179           <% include('searchbar-prospect.html') |n %>
180           <% include('searchbar-cust_main.html') |n %>
181           <% include('searchbar-address2.html') |n %>
182           <% include('searchbar-cust_bill.html') |n %>
183           <% include('searchbar-cust_svc.html') |n %>
184           <% include('searchbar-ticket.html') |n %>
185
186         </TD>
187
188 % } else { #$menu_position eq 'top'
189     <BR>
190 % }
191 %# page content starts here
192         <TD CLASS="background" HEIGHT="100%" VALIGN="top"> <!-- WIDTH="100%"> -->
193
194           <H1>
195             <% $title_noescape || encode_entities($title) %>
196           </H1>
197
198 % my %cookies = CGI::Cookie->fetch($r);
199 % if ( $cookies{freeside_status} ) {
200     <BR>
201 %   foreach my $status_msg ( $cookies{freeside_status}->value ) {
202       <TABLE CLASS="fsinnerbox" STYLE="background-color:#eeffee"><TR>
203         <TD><IMG SRC="<% $fsurl %>images/tick.png"> <% $status_msg |h %></TD>
204       </TR></TABLE>
205 %   }
206     <script src="<% $fsurl %>elements/js.cookie.js"></script>
207     <SCRIPT TYPE="text/javascript">
208       Cookies.remove('freeside_status', { path: '/' });
209     </SCRIPT>
210 % }
211
212 % unless ( $nobr ) {
213           <BR>
214 % }
215
216           <% $menubar !~ /^\s*$/ ? "$menubar<BR><BR>" : '' %>
217
218 <%init>
219
220 my( $title, $title_noescape, $menubar, $etc, $head ) = ( '', '', '', '', '' );
221 my( $nobr, $nocss, $no_jquery ) = ( 0, 0, 0 );
222
223 my $mobile;
224
225 if ( ref($_[0]) ) {
226   my $opt = shift;
227   $title   = $opt->{title};
228   $title_noescape = $opt->{title_noescape};
229   $menubar    = $opt->{menubar};
230   $etc        = $opt->{etc};
231   $head       = $opt->{head};
232   $nobr       = $opt->{nobr};
233   $nocss      = $opt->{nocss};
234   $mobile     = $opt->{mobile};
235   $no_jquery  = $opt->{no_jquery};
236 } else {
237   ($title, $menubar) = ( shift, shift );
238   $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc.
239   $head = @_ ? shift : ''; #$head is for things that go in the <HEAD> section
240 }
241
242 my $conf = new FS::Conf;
243
244 my $curuser = $FS::CurrentUser::CurrentUser;
245
246 my $menu_position = $curuser->option('menu_position')
247                     || 'top'; #new default for 1.9
248
249 if ( !defined($mobile) ) {
250   $mobile = $curuser->option('mobile_menu',1) && FS::UI::Web::is_mobile();
251 }
252 if ( $cgi->param('mobile') =~ /^(\d)$/ ) { # allow client to override
253   $mobile = $1;
254 }
255
256 my($company_name, $company_url);
257 my @agentnums = $curuser->agentnums;
258 if ( scalar(@agentnums) == 1 ) {
259   $company_name = $conf->config('company_name', $agentnums[0] );
260   $company_url  = $conf->config('company_url',  $agentnums[0] );
261 } else {
262   $company_name = $conf->config('company_name');
263   $company_url  = $conf->config('company_url');
264 }
265
266 </%init>