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