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