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   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              'no_jquery' => #for use from RT, which loads its own
13            }
14          );
15
16   #old-style
17   include( '/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
55     <% include('init_overlib.html') |n %>
56     <% include('rs_init_object.html') |n %>
57     <% include('logout.html') |n %>
58 %   my $timeout =  $conf->config('logout-timeout');
59 %   if ( $timeout && $timeout =~ /^\s*\d+\s*$/ ) {
60       <script type="text/javascript">
61         setTimeout('logout()', <% 60000 * $timeout %>);
62       </script>
63 %   }
64
65     <% $head |n %>
66
67     <SCRIPT SRC="<% $fsurl %>elements/validate.min.js"></SCRIPT>
68
69 %# announce our base path, and the Mason comp path of this page
70   <script type="text/javascript">
71   window.fsurl = <% $fsurl |js_string %>;
72   window.request_comp_path = <% $m->request_comp->path |js_string %>;
73   </script>
74
75   </HEAD>
76   <BODY BGCOLOR="#f8f8f8" <% $etc |n %> STYLE="margin-top:0; margin-bottom:0; margin-left:0px; margin-right:0px">
77     <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0px; padding-right:4px" CLASS="fshead">
78       <tr>
79         <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>
80         <td align=left BGCOLOR="#ffffff"> <!-- valign="top" -->
81           <font size=6><% $company_name || 'ExampleCo' %></font>
82         </td>
83         <td align="right" BGCOLOR="#ffffff">
84           <& notify-tickets.html &>
85         </td>
86         <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>
87 %         if ( $conf->config("ticket_system")
88 %              && FS::TicketSystem->access_right(\%session, 'ModifySelf') ) {
89             | <a href="<%$fsurl%>rt/Prefs/Other.html" STYLE="color: #000000">Ticketing preferences</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="#cccccc">
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="#cccccc">
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="#cccccc">
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="#cccccc" ALIGN="right" STYLE="padding-left:2px">
128           <% include('searchbar-prospect.html') |n %>
129         </TD>
130
131         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px">
132           <% include('searchbar-cust_main.html') |n %>
133         </TD>
134
135         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="center">
136           <% include('searchbar-address2.html') |n %>
137         </TD>
138
139         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right">
140           <% include('searchbar-cust_bill.html') |n %>
141         </TD>
142
143         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px">
144           <% include('searchbar-cust_svc.html') |n %>
145         </TD>
146
147         <TD COLSPAN=1 BGCOLOR="#cccccc" 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="#cccccc">
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="#cccccc" 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 % }
189 %# page content starts here
190         <TD CLASS="background" HEIGHT="100%" VALIGN="top"> <!-- WIDTH="100%"> -->
191
192           <FONT SIZE=6>
193             <% $title_noescape || encode_entities($title) %>
194           </FONT>
195
196 % unless ( $nobr ) {
197           <BR><BR>
198 % }
199
200           <% $menubar !~ /^\s*$/ ? "$menubar<BR><BR>" : '' %>
201
202 <%init>
203
204 my( $title, $title_noescape, $menubar, $etc, $head ) = ( '', '', '', '', '' );
205 my( $nobr, $nocss, $no_jquery ) = ( 0, 0, 0 );
206
207 my $mobile;
208
209 if ( ref($_[0]) ) {
210   my $opt = shift;
211   $title   = $opt->{title};
212   $title_noescape = $opt->{title_noescape};
213   $menubar    = $opt->{menubar};
214   $etc        = $opt->{etc};
215   $head       = $opt->{head};
216   $nobr       = $opt->{nobr};
217   $nocss      = $opt->{nocss};
218   $mobile     = $opt->{mobile};
219   $no_jquery  = exists($opt->{no_jquery}) ? $opt->{no_jquery} : 1; #v3 only, 0 on v4+
220 } else {
221   ($title, $menubar) = ( shift, shift );
222   $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc.
223   $head = @_ ? shift : ''; #$head is for things that go in the <HEAD> section
224 }
225
226 my $conf = new FS::Conf;
227
228 my $curuser = $FS::CurrentUser::CurrentUser;
229
230 my $menu_position = $curuser->option('menu_position')
231                     || 'top'; #new default for 1.9
232
233 if ( !defined($mobile) ) {
234   $mobile = $curuser->option('mobile_menu',1) && FS::UI::Web::is_mobile();
235 }
236 if ( $cgi->param('mobile') =~ /^(\d)$/ ) { # allow client to override
237   $mobile = $1;
238 }
239
240 my($company_name, $company_url);
241 my @agentnums = $curuser->agentnums;
242 if ( scalar(@agentnums) == 1 ) {
243   $company_name = $conf->config('company_name', $agentnums[0] );
244   $company_url  = $conf->config('company_url',  $agentnums[0] );
245 } else {
246   $company_name = $conf->config('company_name');
247   $company_url  = $conf->config('company_url');
248 }
249
250 </%init>