combine ticket notification scrips, #15353
[freeside.git] / httemplate / elements / header.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            }
13          );
14
15   #old-style
16   include( '/elements/header.html', 'Title', $menubar, $etc, $head);
17
18 </%doc>
19 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
20 %#<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
21 %# above is what RT declares, should we switch now? hopefully no glitches result
22 %# or just fuck it, XHTML died anyway, HTML 5 or bust?
23 <HTML>
24   <HEAD>
25     <TITLE>
26       <% $title |h %>
27     </TITLE>
28     <META HTTP-Equiv="Cache-Control" Content="no-cache">
29     <META HTTP-Equiv="Pragma" Content="no-cache">
30     <META HTTP-Equiv="Expires" Content="0"> 
31 % if ( $mobile ) {
32     <META NAME="viewport" content="width=device-width height=device-height user-scalable=yes">
33 % }
34
35     <% include('menu.html', 'freeside_baseurl' => $fsurl,
36                             'position'         => $menu_position,
37                             'nocss'            => $nocss,
38                             'mobile'           => $mobile,
39               ) |n
40     %>
41
42     <% include('init_overlib.html') |n %>
43     <% include('rs_init_object.html') |n %>
44     <% include('logout.html') |n %>
45
46     <% $head |n %>
47
48   </HEAD>
49   <BODY BGCOLOR="#f8f8f8" <% $etc |n %> STYLE="margin-top:0; margin-bottom:0; margin-left:0px; margin-right:0px">
50     <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0px; padding-right:4px">
51       <tr>
52         <td BGCOLOR="#ffffff"><IMG BORDER=0 ALT="freeside" HEIGHT="36" SRC="<%$fsurl%>view/REAL_logo.cgi"></td>
53         <td align=left BGCOLOR="#ffffff"> <!-- valign="top" -->
54           <font size=6><% $company_name || 'ExampleCo' %></font>
55         </td>
56         <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>
57 %         if ( $conf->config("ticket_system")
58 %              && FS::TicketSystem->access_right(\%session, 'ModifySelf') ) {
59             | <a href="<%$fsurl%>rt/Prefs/Other.html" STYLE="color: #000000">Ticketing preferences</a>
60 %         }
61           <BR></FONT>
62         </td>
63       </tr>
64     </table>
65
66     <TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0>
67
68 <link href="<%$fsurl%>elements/freeside-menu.css" type="text/css" rel="stylesheet">
69
70 % if ( $menu_position eq 'top' ) {
71
72       <TR>
73
74 %       if ( $mobile ) {
75
76         <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#cccccc">
77           <SCRIPT TYPE="text/javascript">
78             document.write(myBar.toString());
79           </SCRIPT>
80         </TD>
81         <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#cccccc">
82             <% include('searchbar-combined.html') |n %>
83         </TD>
84
85 %       } else {
86
87         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#cccccc">
88           <SCRIPT TYPE="text/javascript">
89             document.write(myBar);
90           </SCRIPT>
91         </TD>
92
93       </TR>
94
95       <TR>
96
97         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px">
98           <% include('searchbar-prospect.html') |n %>
99         </TD>
100
101         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px">
102           <% include('searchbar-cust_main.html') |n %>
103         </TD>
104
105         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="center">
106           <% include('searchbar-address2.html') |n %>
107         </TD>
108
109         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right">
110           <% include('searchbar-cust_bill.html') |n %>
111         </TD>
112
113         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px">
114           <% include('searchbar-cust_svc.html') |n %>
115         </TD>
116
117         <TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px;padding-right:2px">
118           <% include('searchbar-ticket.html') |n %>
119         </TD>
120 %       }
121
122       </TR>
123     </TABLE>
124
125 % } else { #$menu_position eq 'left'
126
127       <TR>
128
129         <TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#cccccc">
130         </TD>
131
132       </TR>
133
134 % }
135
136
137     <TABLE WIDTH="100%" HEIGHT="100%" CELLSPACING=0 CELLPADDING=4>
138
139       <TR HEIGHT="100%">
140
141 % if ( $menu_position eq 'left' ) {
142
143         <TD BGCOLOR="#cccccc" ALIGN="left" HEIGHT="100%" WIDTH="154" VALIGN="top" ALIGN="right">
144           <SCRIPT TYPE="text/javascript">
145             document.write(myBar);
146           </SCRIPT>
147
148           <BR>
149           <% include('searchbar-prospect.html') |n %>
150           <% include('searchbar-cust_main.html') |n %>
151           <% include('searchbar-address2.html') |n %>
152           <% include('searchbar-cust_bill.html') |n %>
153           <% include('searchbar-cust_svc.html') |n %>
154           <% include('searchbar-ticket.html') |n %>
155
156         </TD>
157
158 % }
159
160         <TD CLASS="background" HEIGHT="100%" VALIGN="top"> <!-- WIDTH="100%"> -->
161
162           <FONT SIZE=6>
163             <% $title |h %>
164           </FONT>
165
166 % unless ( $nobr ) {
167           <BR><BR>
168 % }
169
170           <% $menubar !~ /^\s*$/ ? "$menubar<BR><BR>" : '' %>
171 <%init>
172
173 my( $title, $menubar, $etc, $head ) = ( '', '', '', '' );
174 my( $nobr, $nocss ) = ( 0, 0 );
175
176 my $mobile;
177
178 if ( ref($_[0]) ) {
179   my $opt = shift;
180   $title   = $opt->{title};
181   $menubar = $opt->{menubar};
182   $etc     = $opt->{etc};
183   $head    = $opt->{head};
184   $nobr    = $opt->{nobr};
185   $nocss   = $opt->{nocss};
186   $mobile  = $opt->{mobile};
187 } else {
188   ($title, $menubar) = ( shift, shift );
189   $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc.
190   $head = @_ ? shift : ''; #$head is for things that go in the <HEAD> section
191 }
192
193 my $conf = new FS::Conf;
194
195 my $curuser = $FS::CurrentUser::CurrentUser;
196
197 my $menu_position = $curuser->option('menu_position')
198                     || 'top'; #new default for 1.9
199
200 if ( !defined($mobile) ) {
201   $mobile = $curuser->option('mobile_menu',1) && FS::UI::Web::is_mobile();
202 }
203 if ( $cgi->param('mobile') =~ /^(\d)$/ ) { # allow client to override
204   $mobile = $1;
205 }
206
207 my $company_name;
208 my @agentnums = $curuser->agentnums;
209 if ( scalar(@agentnums) == 1 ) {
210   $company_name = $conf->config('company_name', $agentnums[0] );
211 } else {
212   $company_name = $conf->config('company_name');
213 }
214 </%init>