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