move most of the crap on the "main menu" to the sidebar
[freeside.git] / httemplate / elements / menu.html
1 <%
2   my( %opt ) = @_;
3   my $conf = new FS::Conf;
4   my $fsurl = $opt{'freeside_baseurl'};
5
6   #Active tickets not assigned to a customer
7
8   tie my %report_customers_lists, 'Tie::IxHash',
9     'by customer number' => [ $fsurl. 'search/cust_main.cgi?browse=custnum', '' ],
10     'by last name' => [ $fsurl. 'search/cust_main.cgi?browse=last', '' ],
11     'by company name' => [ $fsurl. 'search/cust_main.cgi?browse=company', '' ],
12     'by active trouble tickets' => [ $fsurl. 'search/cust_main.cgi?browse=tickets', '' ],
13   ;
14
15   tie my %report_customers_search, 'Tie::IxHash',
16     'by ordering employee' => [ $fsurl. 'search/cust_main-otaker.cgi' ],
17   ;
18
19   tie my %report_customers, 'Tie::IxHash',
20     'List customers' => [ \%report_customers_lists, 'List customers' ],
21     'Search customers' => [ \%report_customers_search, 'Search customers' ],
22     'Zip code distribution' => [ $fsurl.'search/report_cust_main-zip.html', 'Zip codes by number of customers' ],
23   ;
24
25   tie my %report_invoices_open, 'Tie::IxHash',
26     'All open invoices' => [ $fsurl.'search/cust_bill.html?OPEN_date', 'All invoices with an unpaid balance' ],
27     '15 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN15_date', 'Invoices 15 days or older with an unpaid balance' ],
28     '30 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN30_date', 'Invoices 30 days or older with an unpaid balance' ],
29     '60 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN60_date', 'Invoices 60 days or older with an unpaid balance' ],
30     '90 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN90_date', 'Invoices 90 days or older with an unpaid balance' ],
31     '120 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN120_date', 'Invoices 120 days or older with an unpaid balance' ],
32   ;
33
34   tie my %report_invoices, 'Tie::IxHash',
35     'Open invoices' => [ \%report_invoices_open, 'Open invoices' ],
36     'All invoices'  => [ $fsurl. 'search/cust_bill.html?date', 'List all invoices' ],
37     'Advanced invoice reports' => [ $fsurl.'search/report_cust_bill.html', 'by agent, date range, etc.' ],
38   ;
39
40   tie my %report_services_acct, 'Tie::IxHash',
41     'All accounts by username' => [ $fsurl.'search/svc_acct.cgi?username', '' ],
42     'All accounts by UID'      => [ $fsurl.'search/svc_acct.cgi?uid', '' ],
43     'Unlinked accounts'        => [ $fsurl.'search/svc_acct.cgi?UN_uid', 'Pre-Freeside accounts without a customer record' ],
44   ;
45
46   tie my %report_services_domain, 'Tie::IxHash',
47     'All domains'      => [ $fsurl.'search/svc_domain.cgi?domain', '' ],
48     'Unlinked domains' => [ $fsurl.'search/svc_domain.cgi?UN_domain', 'Pre-Freeside domains without a customer record' ],
49   ;
50
51   tie my %report_services_forward, 'Tie::IxHash',
52     'All mail forwards'      => [ $fsurl.'search/svc_forward.cgi?svcnum', '' ],
53     'Unlinked mail forwards' => [ $fsurl.'search/svc_forward.cgi?UN_svcnum', 'Pre-Freeside mail forwards without a customer record' ],
54   ;
55
56   tie my %report_services_www, 'Tie::IxHash',
57     'All virtual hosts'     => [ $fsurl.'search/svc_www.cgi?svcnum', '' ],
58     'Unlinked virtual hosts' => [ $fsurl.'search/svc_www.cgi?UN_svcnum', 'Pre-Freeside virtual hosts without a customer record' ],
59   ;
60
61   tie my %report_services_broadband, 'Tie::IxHash',
62     'All broadband services' => [ $fsurl.'search/svc_broadband.cgi?svcnum', '' ],
63     #'Unlinked domain' => [ $fsurl.'search/svc_acct.cgi?UN_uid', 'Pre-Freeside domains without a customer record' ],
64   ;
65
66   tie my %report_services_external, 'Tie::IxHash',
67     'All external services' => [ $fsurl.'search/svc_external.cgi?id', '' ],
68     'Unlinked external services' => [ $fsurl.'search/svc_external.cgi?UN_id', 'Pre-Freeside domains without a customer record' ],
69   ;
70
71   tie my %report_services, 'Tie::IxHash',
72     'Service definitions' => [ $fsurl.'browse/part_svc.cgi?orderby=active', 'Service definitions by number of active packages' ],
73     'separator' => '',
74     'Accounts'            => [ \%report_services_acct, 'Access accounts and mailboxes' ],
75     'Domains'             => [ \%report_services_domain, 'Domains', ],
76     'Mail forwards'       => [ \%report_services_forward, 'Mail forwards', ],
77     'Virtual hosts'       => [ \%report_services_www, 'Virtual hosting', ],
78     'Broadband services'  => [ \%report_services_broadband, 'Fixed (username-less) broadband services', ],
79     'External services'   => [ \%report_services_external, 'External services', ],
80   ;
81
82   tie my %report_packages, 'Tie::IxHash',
83     'Package definitions' => [ $fsurl.'browse/part_pkg.cgi?active=1', 'Package definitions by number of active packages' ],
84     'separator' => '',
85     'All customer packages' => [ $fsurl.'search/cust_pkg.cgi?pkgnum', 'List all customer packages', ],
86     'Suspended customer packages' => [ $fsurl.'search/cust_pkg.cgi?magic=suspended', 'List suspended packages' ],
87     'Customer packages with unconfigured services' => [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ],
88     'By next bill date' => [ $fsurl.'search/cust_pkg_report.cgi', 'Search packages by next bill date' ],
89   ;
90
91   tie my %report_financial, 'Tie::IxHash', 
92     'Sales, Credits and Receipts' => [ $fsurl.'graph/report_money_time.html', 'Sales, credits and receipts summary graph' ],
93     'Sales Report' => [ $fsurl.'graph/report_cust_bill_pkg.html', 'Sales report and graph (by agent, package class and/or date range)' ],
94     'Credit Report' => [ $fsurl.'search/report_cust_credit.html', 'Credit report (by employee and/or date range)' ],
95     'Payment Report' => [ $fsurl.'search/report_cust_pay.html', 'Credit report (by type and/or date range)' ],
96     'A/R Aging' => [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ],
97     'Prepaid Income' => [ $fsurl.'search/report_prepaid_income.html', 'Prepaid income (unearned revenue)  report' ],
98     'Sales Tax Liability' => [ $fsurl.'search/report_tax.html', 'Sales tax liability report' ],
99   ;
100
101   tie my %report_menu, 'Tie::IxHash',
102     'Customers' => [ \%report_customers,  'Customer reports'  ],
103     'Invoices'  => [ \%report_invoices,   'Invoice reports'   ],
104     'Packages'  => [ \%report_packages,   'Package reports'   ],
105     'Services'  => [ \%report_services,   'Services reports'   ],
106     'Financial' => [ \%report_financial,  'Financial reports' ],
107   ;
108
109   tie my %tools_importing, 'Tie::IxHash',
110     'Import customers from CSV file' => [ $fsurl.'misc/cust_main-import.cgi', '' ],
111     'Import one-time charges from CSV file' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ],
112   ;
113
114   tie my %tools_exporting, 'Tie::IxHash',
115     'Download database dump' => [ $fsurl. 'misc/dump.cgi', '' ],
116   ;
117   
118   #    <!-- <BR>View active NAS ports: 
119   #      <A HREF="browse/nas.cgi">session server</A> -->
120   #      <!-- or <A HREF="browse/nas-sqlradius.cgi">RADIUS</A>
121   #    <BR> -->
122
123   tie my %tools_menu, 'Tie::IxHash',
124     'Job Queue' => [ $fsurl.'search/queue.html', 'View pending job queue' ],
125     'Importing' => [ \%tools_importing, 'Import tools' ],
126     'Exporting' => [ \%tools_exporting, 'Export tools' ],
127   ;
128
129   tie my %config_employees, 'Tie::IxHash',
130     'View/Edit employees' => [ $fsurl.'browse/access_user.html', 'Setup internal users' ],
131     'View/Edit employee groups' => [ $fsurl.'browse/access_group.html', 'Employee groups allow you to control access to the backend' ],
132   ;
133
134   tie my %config_export_svc_pkg, 'Tie::IxHash',
135     'View/Edit exports'             => [ $fsurl.'browse/part_export.cgi', 'Provisioning services to external machines, databases and APIs' ],
136     'View/Edit service definitions' => [ $fsurl.'browse/part_svc.cgi', 'Services are items you offer to your customers' ],
137     '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' ],
138     'View/Edit package classes'     => [ $fsurl.'browse/pkg_class.html', 'Package classes define groups of packages, for reporting and convenience purposes.' ],
139   ;
140
141   tie my %config_agent, 'Tie::IxHash',
142     'View/Edit agent types' => [ $fsurl.'browse/agent_type.cgi', 'Agent types define groups of package definitions that you can then assign to particular agents' ],
143     '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)' ],
144   ;
145
146   tie my %config_billing, 'Tie::IxHash',
147     'View/Edit payment gateways'         => [ $fsurl.'browse/payment_gateway.html', 'Credit card and electronic check processors' ],
148     'View/Edit invoice events'           => [ $fsurl.'browse/part_bill_event.cgi', 'Actions for overdue invoices' ],
149     'View/Edit prepaid cards'            => [ $fsurl.'browse/prepay_credit.html', 'View outstanding cards, generate new cards' ],
150     'View/Edit call rates and regions'   => [ $fsurl.'browse/rate.cgi', 'Manage rate plans, regions and prefixes for VoIP and call billing' ],
151     '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' ],
152   ;
153
154   tie my %config_dialup, 'Tie::IxHash',
155     'View/Edit access numbers' => [ $fsurl.'browse/svc_acct_pop.cgi', 'Points of Presence' ],
156   ;
157
158   tie my %config_broadband, 'Tie::IxHash',
159     'View/Edit routers'        => [ $fsurl.'browse/router.cgi', 'Broadband access routers' ],
160     'View/Edit address blocks' => [ $fsurl.'browse/addr_block.cgi', 'Manage address blocks and block assignments to broadband routers' ],
161   ;
162
163   tie my %config_misc, 'Tie::IxHash',
164     'View/Edit advertising sources' => [ $fsurl.'browse/part_referral.cgi', 'Where a customer heard about your service.  Tracked for informational purposes' ],
165     'View/Edit virtual fields' => [ $fsurl.'browse/part_virtual_field.cgi', 'Locally defined fields', ],
166     'View/Edit message catalog' => [ $fsurl.'browse/msgcat.cgi', 'Change error messages and other customizable labels' ],
167     'View/Edit inventory classes and inventory' => [ $fsurl.'browse/inventory_class.html', 'Setup inventory classes and stock inventory' ],
168   ;
169
170   tie my %config_menu, 'Tie::IxHash',
171     'Settings'      => [ $fsurl.'config/config-view.cgi', 'XXXconfigittip' ],
172     'separator'     => '', #its a separator!
173     'Employees'     => [ \%config_employees, 'XXXtooltip' ],
174     'Provisioning, services and packages'
175                     => [ \%config_export_svc_pkg, 'XXXtootip'    ],
176     'Resellers'     => [ \%config_agent, 'XXXtootip'    ],
177     'Billing'       => [ \%config_billing, 'XXXtootip'    ],
178     'Dialup'        => [ \%config_dialup, 'XXXtootip'    ],
179     'Fixed (username-less) broadband'
180                     => [ \%config_broadband, 'XXXtootip'    ],
181     'Miscellaneous' => [ \%config_misc, 'XXXtootip'    ],
182   ;
183
184   tie my %menu, 'Tie::IxHash',
185     'Billing Main'   => [ $fsurl, 'Billing start page', ],
186     'Ticketing Main' => [ 
187                           ( $conf->config('ticket_system') eq 'RT_External'
188                             ? FS::TicketSystem->baseurl()
189                             : $fsurl.'rt/'
190                           ),
191                           'Ticketing start page',
192                         ],
193     'Reports'        => [ \%report_menu, 'Lists, reporting and graphing' ],
194     'Tools'          => [ \%tools_menu, 'Tools' ],
195     'Configuration'  => [ \%config_menu, 'Configuraiton and setup' ],
196   ;
197
198   use vars qw($gmenunum);
199   $gmenunum = 0;
200
201   sub submenu {
202     my($submenu, $title) = @_;
203     my $menunum = $gmenunum++;
204
205     #return two args: html, menuname
206
207     "var myMenu$menunum = new WebFXMenu;\n".
208     #"myMenu$menunum.useAutoPosition = true;\n".
209     "myMenu$menunum.emptyText = '$title';\n".
210
211     (
212       join("\n", map {
213
214         if ( !ref( $submenu->{$_} ) ) {
215
216           "myMenu$menunum.add(new WebFXMenuSeparator());";
217
218         } else {
219
220           my($url_or_submenu, $tooltip ) = @{ $submenu->{$_} };
221           if ( ref($url_or_submenu) ) {
222
223             my($subhtml, $submenuname ) = submenu($url_or_submenu, $_); #mmm, recursion
224
225             "$subhtml\n".
226             "myMenu$menunum.add(new WebFXMenuItem(\"$_\", null, \"$tooltip\", $submenuname ));";
227
228           } else {
229
230             "myMenu$menunum.add(new WebFXMenuItem(\"$_\", \"$url_or_submenu\", \"$tooltip\" ));";
231
232           }
233
234         }
235
236       } keys %$submenu )
237     ). "\n".
238     "myMenu$menunum.width = 224\n",
239
240     "myMenu$menunum";
241
242   }
243
244 %>
245
246 <script type="text/javascript" src="<%=$fsurl%>elements/cssexpr.js"></script>
247 <script type="text/javascript" src="<%=$fsurl%>elements/xmenu.js"></script>
248 <link href="<%=$fsurl%>elements/xmenu.css" type="text/css" rel="stylesheet">
249 <link href="<%=$fsurl%>elements/freeside.css" type="text/css" rel="stylesheet">
250
251 <SCRIPT TYPE="text/javascript">
252
253   webfxMenuImagePath      = "<%=$fsurl%>images/";
254   webfxMenuUseHover       = 1;
255   webfxMenuShowTime       = 300;
256   webfxMenuHideTime       = 500;
257
258   var myBar = new WebFXMenuBar;
259
260   <% foreach my $item ( keys %menu ) {
261
262        my( $url_or_submenu, $tooltip ) = @{ $menu{$item} };
263
264        if ( ref($url_or_submenu) ) {
265
266          warn $item;
267
268          my( $subhtml, $submenuname ) = submenu($url_or_submenu, $item);
269
270   %>
271
272          <%= $subhtml %>
273          myBar.add(new WebFXMenuButton("<%= $item %>", null, "<%= $tooltip %>", <%= $submenuname %> ));
274
275   <%   } else { %>
276     
277          myBar.add(new WebFXMenuButton("<%= $item %>", "<%= $url_or_submenu %>", "<%= $tooltip %>" ));
278
279   <%   }
280
281     }
282   %>
283
284   myBar.show( null, 'vertical' );
285   //myBar.show( null, 'horizontal' );
286
287   //var myMenu = new WebFXMenu;
288   //myMenu.add(new WebFXMenuItem("Menu Item 1", "http://www.domain.com", "Tool tip to show"));
289   //myMenu.add(new WebFXMenuSeparator());
290   //myMenu.add(new WebFXMenuItem("Menu Item 2", "http://www.domain.com", "Tool tip to show"));
291   
292   //var mySubMenu = new WebFXMenu;
293   //mySubMenu.add(new WebFXMenuItem("Menu Item 3", "http://www.domain.com", "Tool tip to show"));
294   //myMenu.add(new WebFXMenuItem("Menu Item 4 with sub menu", null, "Tool tip to show", mySubMenu));
295
296   myBar.width = 154;
297
298 </SCRIPT>