more ACL and re-skinning work, now with RT!
[freeside.git] / httemplate / elements / header.html
1 <%
2   my($title, $menubar) = ( shift, shift );
3   my $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc.
4   my $head = @_ ? shift : ''; #$head is for things that go in the <HEAD> section
5   my $conf = new FS::Conf;
6 %>
7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
8 <HTML>
9   <HEAD>
10     <TITLE>
11       <%= $title %>
12     </TITLE>
13     <META HTTP-Equiv="Cache-Control" Content="no-cache">
14     <META HTTP-Equiv="Pragma" Content="no-cache">
15     <META HTTP-Equiv="Expires" Content="0"> 
16     <script type="text/javascript" src="<%=$fsurl%>elements/cssexpr.js"></script>
17     <script type="text/javascript" src="<%=$fsurl%>elements/xmenu.js"></script>
18     <link href="<%=$fsurl%>elements/xmenu.css" type="text/css" rel="stylesheet">
19     <link href="<%=$fsurl%>elements/freeside.css" type="text/css" rel="stylesheet">
20     <%
21
22       tie my %report_menu, 'Tie::IxHash',
23         'Report one' => [ 'there', 'theretip' ],
24         'Report too' => [ 'here',  'heretip'  ],
25       ;
26
27       tie my %config_employees, 'Tie::IxHash',
28         'View/Edit employees' => [ $fsurl.'browse/access_user.html', 'Setup internal users' ],
29         'View/Edit employee groups' => [ $fsurl.'browse/access_group.html', 'Employee groups allow you to control access to the backend' ],
30       ;
31
32       tie my %config_export_svc_pkg, 'Tie::IxHash',
33         'View/Edit exports'             => [ $fsurl.'browse/part_export.cgi', 'Provisioning services to external machines, databases and APIs' ],
34         'View/Edit service definitions' => [ $fsurl.'browse/part_svc.cgi', 'Services are items you offer to your customers' ],
35         'View/Edit package definitions' => [ $fsurl.'browse/part_pkg.cgi', 'One or more services are grouped together into a package and given pricing information. Customers purchase packages, not services' ],
36         'View/Edit package classes'     => [ $fsurl.'browse/pkg_class.html', 'Package classes define groups of packages, for reporting and convenience purposes.' ],
37       ;
38
39       tie my %config_agent, 'Tie::IxHash',
40         'View/Edit agent types' => [ $fsurl.'browse/agent_type.cgi', 'Agent types define groups of package definitions that you can then assign to particular agents' ],
41         'View/Edit agents'      => [ $fsurl.'browse/agent.cgi', 'Agents are resellers of your service. Agents may be limited to a subset of your full offerings (via their type)' ],
42       ;
43
44       tie my %config_billing, 'Tie::IxHash',
45         'View/Edit payment gateways'         => [ $fsurl.'browse/payment_gateway.html', 'Credit card and electronic check processors' ],
46         'View/Edit invoice events'           => [ $fsurl.'browse/part_bill_event.cgi', 'Actions for overdue invoices' ],
47         'View/Edit prepaid cards'            => [ $fsurl.'browse/prepay_credit.html', 'View outstanding cards, generate new cards' ],
48         'View/Edit call rates and regions'   => [ $fsurl.'browse/rate.cgi', 'Manage rate plans, regions and prefixes for VoIP and call billing' ],
49         'View/Edit locales and tax rates'    => [ $fsurl.'browse/cust_main_county.cgi', 'Change tax rates, or break down a country into states, or a state into counties and assign different tax rates to each' ],
50       ;
51
52       tie my %config_dialup, 'Tie::IxHash',
53         'View/Edit access numbers' => [ $fsurl.'browse/svc_acct_pop.cgi', 'Points of Presence' ],
54       ;
55
56       tie my %config_broadband, 'Tie::IxHash',
57         'View/Edit routers'        => [ $fsurl.'browse/router.cgi', 'Broadband access routers' ],
58         'View/Edit address blocks' => [ $fsurl.'browse/addr_block.cgi', 'Manage address blocks and block assignments to broadband routers' ],
59       ;
60
61       tie my %config_misc, 'Tie::IxHash',
62         'View/Edit advertising sources' => [ $fsurl.'browse/part_referral.cgi', 'Where a customer heard about your service.  Tracked for informational purposes' ],
63         'View/Edit virtual fields' => [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ],
64         'View/Edit message catalog' => [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ],
65         'View/Edit inventory classes and inventory' => [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ],
66       ;
67
68       tie my %config_menu, 'Tie::IxHash',
69         'Settings'      => [ $fsurl.'config/config-view.cgi', 'XXXconfigittip' ],
70         'separator'     => '', #its a separator!
71         'Employees'     => [ \%config_employees, 'XXXtooltip' ],
72         'Provisioning, services and packages'
73                         => [ \%config_export_svc_pkg, 'XXXtootip'    ],
74         'Resellers'     => [ \%config_agent, 'XXXtootip'    ],
75         'Billing'       => [ \%config_billing, 'XXXtootip'    ],
76         'Dialup'        => [ \%config_dialup, 'XXXtootip'    ],
77         'Fixed (username-less) broadband'
78                         => [ \%config_broadband, 'XXXtootip'    ],
79         'Miscellaneous' => [ \%config_misc, 'XXXtootip'    ],
80       ;
81
82       tie my %menu, 'Tie::IxHash',
83         'Home'          => [ $fsurl, 'hometip', ],
84         'Top item one'  => [ 'nowhere_yet', 'nowheretip', ],
85         'Top item too'  => [ 'nowhere_yet_either', 'eithertip', ],
86         'Reports'       => [ \%report_menu, 'reportmenutip' ],
87         'Configuration' => [ \%config_menu, 'configmenutip' ],
88       ;
89
90       use vars qw($gmenunum);
91       $gmenunum = 0;
92
93       sub submenu {
94         my($submenu, $title) = @_;
95         my $menunum = $gmenunum++;
96
97         #return two args: html, menuname
98
99         "var myMenu$menunum = new WebFXMenu;\n".
100         #"myMenu$menunum.useAutoPosition = true;\n".
101         "myMenu$menunum.emptyText = '$title';\n".
102
103         (
104           join("\n", map {
105   
106             if ( !ref( $submenu->{$_} ) ) {
107   
108               "myMenu$menunum.add(new WebFXMenuSeparator());";
109   
110             } else {
111   
112               my($url_or_submenu, $tooltip ) = @{ $submenu->{$_} };
113               if ( ref($url_or_submenu) ) {
114   
115                 my($subhtml, $submenuname ) = submenu($url_or_submenu, $_); #mmm, recursion
116   
117                 "$subhtml\n".
118                 "myMenu$menunum.add(new WebFXMenuItem(\"$_\", null, \"$tooltip\", $submenuname ));";
119   
120               } else {
121   
122                 "myMenu$menunum.add(new WebFXMenuItem(\"$_\", \"$url_or_submenu\", \"$tooltip\" ));";
123   
124               }
125   
126             }
127   
128           } keys %$submenu )
129         ). "\n".
130         "myMenu$menunum.width = 224\n",
131
132         "myMenu$menunum";
133
134       }
135
136     %>
137     <SCRIPT TYPE="text/javascript">
138
139       webfxMenuImagePath      = "<%=$fsurl%>images/";
140       webfxMenuUseHover       = 1;
141       webfxMenuShowTime       = 300;
142       webfxMenuHideTime       = 500;
143
144       var myBar = new WebFXMenuBar;
145
146       <% foreach my $item ( keys %menu ) {
147
148            my( $url_or_submenu, $tooltip ) = @{ $menu{$item} };
149
150            if ( ref($url_or_submenu) ) {
151
152              warn $item;
153
154              my( $subhtml, $submenuname ) = submenu($url_or_submenu, $item);
155
156       %>
157
158              <%= $subhtml %>
159              myBar.add(new WebFXMenuButton("<%= $item %>", null, "<%= $tooltip %>", <%= $submenuname %> ));
160
161       <%   } else { %>
162         
163              myBar.add(new WebFXMenuButton("<%= $item %>", "<%= $url_or_submenu %>", "<%= $tooltip %>" ));
164
165       <%   }
166
167         }
168       %>
169
170       myBar.show( null, 'vertical' );
171       //myBar.show( null, 'horizontal' );
172
173       //var myMenu = new WebFXMenu;
174       //myMenu.add(new WebFXMenuItem("Menu Item 1", "http://www.domain.com", "Tool tip to show"));
175       //myMenu.add(new WebFXMenuSeparator());
176       //myMenu.add(new WebFXMenuItem("Menu Item 2", "http://www.domain.com", "Tool tip to show"));
177       
178       //var mySubMenu = new WebFXMenu;
179       //mySubMenu.add(new WebFXMenuItem("Menu Item 3", "http://www.domain.com", "Tool tip to show"));
180       //myMenu.add(new WebFXMenuItem("Menu Item 4 with sub menu", null, "Tool tip to show", mySubMenu));
181
182       myBar.width = 154;
183
184     </SCRIPT>
185
186     <SCRIPT TYPE="text/javascript">
187       function clearhint_search_cust (what) {
188         if ( what.value = '(cust #, name or company)' )
189           what.value = '';
190       }
191     </SCRIPT>
192
193     <SCRIPT TYPE="text/javascript">
194       function clearhint_search_ticket (what) {
195         if ( what.value = '(ticket # or subject string)' )
196           what.value = '';
197       }
198     </SCRIPT>
199
200     <%= $head %>
201
202   </HEAD>
203   <BODY BACKGROUND="<%=$fsurl%>images/background-cheat.png" <%= $etc %> STYLE="margin-top:0; margin-bottom:0; margin-left:0; margin-right:0">
204     <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0; padding-right:4">
205       <tr>
206         <td rowspan=2 BGCOLOR="#ffffff">
207           <IMG BORDER=0 ALT="freeside" SRC="<%=$fsurl%>images/small-logo.png">
208         </td>
209         <td align=left rowspan=2 BGCOLOR="#ffffff"> <!-- valign="top" -->
210           <font size=6><%= $conf->config('company_name') || 'ExampleCo' %></font>
211         </td>
212         <td align=right valign=top BGCOLOR="#ffffff">Logged in as <b><%= getotaker %>&nbsp</b><br><FONT SIZE="-2"><a href="<%=$fsurl%>pref/XXXwritethis">Preferences</a>&nbsp;<BR><BR></FONT>
213         </td>
214       </tr>
215       <tr>
216         <td align=right valign=bottom BGCOLOR="#ffffff">
217   
218           <table>
219             <tr>
220               <td align=right BGCOLOR="#ffffff">
221                 <FONT SIZE="-2">
222                  <A HREF="http://www.sisd.com/freeside">Freeside</A>&nbsp;v<%= $FS::VERSION %><BR>
223                  <A HREF="<%= $fsurl %>docs/">Documentation</A><BR>
224                 </FONT>
225               </td>
226               <% if ( $conf->config('ticket_system') eq 'RT_Internal' ) { %>
227               <% eval "use RT;"; %>
228                 <td bgcolor=#000000></td>
229                 <td align=left>
230                   <FONT SIZE="-2">
231                    <A HREF="http://www.bestpractical.com/rt">RT<A>&nbsp;v<%= $RT::VERSION %><BR>
232                    <A HREF="http://wiki.bestpractical.com/">Documentation</A><BR>
233                   </FONT>
234                 </td>
235               <% } %>
236   
237             </tr>
238           </table>
239   
240         </td>
241       </tr>
242     </table>
243
244     <TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=4>
245       <TR>
246         <TD COLSPAN=4 WIDTH="100%" STYLE="padding:0"><IMG BORDER=0 ALT="" SRC="<%=$fsurl%>images/black-gradient.png" HEIGHT="13" WIDTH="100%"></TD>
247       </TR>
248       <TR>
249         <TD COLSPAN=1 BGCOLOR="#000000" WIDTH="154">
250         </TD>
251         <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right">
252           <FORM ACTION="<%=$fsurl%>edit/cust_main.cgi" METHOD="GET" STYLE="margin:0">
253             <INPUT TYPE="submit" VALUE="New customer">
254           </FORM>
255         </TD>
256         <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right">
257           <FORM ACTION="<%=$fsurl%>search/cust_main.cgi" METHOD="GET" STYLE="margin:0">
258             <INPUT NAME="search_cust" TYPE="text" VALUE="(cust #, name or company)" SIZE="23" onFocus="clearhint_search_cust(this);" onClick="clearhint_search_cust(this);" STYLE="text-align:right">
259             <INPUT TYPE="submit" VALUE="Search customers">
260           </FORM>
261         </TD>
262         <TD COLSPAN=1 BGCOLOR="#000000" ALIGN="right">
263           <FORM ACTION="<%=$fsurl%>rt/index.html" METHOD="GET" STYLE="margin:0">
264             <INPUT NAME="q" TYPE="text" VALUE="(ticket # or subject string)" onFocus="clearhint_search_ticket(this);" onClick="clearhint_search_ticket(this);" STYLE="text-align:right">
265             <INPUT TYPE="submit" VALUE="Search tickets">
266           </FORM>
267         </TD>
268       </TR>
269     </TABLE>
270     <TABLE WIDTH="100%" HEIGHT="100%" CELLSPACING=0 CELLPADDING=4>
271       <TR>
272         <TD BGCOLOR="#000000" STYLE="padding:0" WIDTH="154"></TD>
273         <TD STYLE="padding:0" WIDTH="13"><IMG BORDER=0 ALT="" SRC="<%=$fsurl%>images/black-gray-corner.png"></TD>
274         <TD STYLE="padding:0"><IMG BORDER=0 ALT="" SRC="<%=$fsurl%>images/black-gray-top.png" HEIGHT="13" WIDTH="100%"></TD>
275       </TR>
276       <TR HEIGHT="100%">
277         <TD BGCOLOR="#000000" ALIGN="left" HEIGHT="100%" WIDTH="154" VALIGN="top" ALIGN="right">
278           <SCRIPT TYPE="text/javascript">
279             document.write(myBar);
280           </SCRIPT>
281           <BR>
282           <IMG SRC="<%=$fsurl%>images/32clear.gif" HEIGHT="1" WIDTH="154">
283
284         </TD>
285         <TD STYLE="padding:0" HEIGHT="100%" WIDTH=13 VALIGN="top"><IMG WIDTH="13" HEIGHT="100%" BORDER=0 ALT="" SRC="<%=$fsurl%>images/black-gray-side.png"></TD>
286         <TD BGCOLOR="#e8e8e8" HEIGHT="100%"> <!-- WIDTH="100%"> -->
287
288           <FONT SIZE=6>
289             <%= $title %>
290           </FONT>
291
292           <BR><BR>
293           <%= $menubar !~ /^\s*$/ ? "$menubar<BR><BR>" : '' %>