This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / httemplate / browse / router.cgi
1 <% include('elements/browse.html',
2                 'title'           => 'Routers',
3                 'menubar'         => [ @menubar ],
4                 'name_singular'   => 'router',
5                 'query'           => { 'table'     => 'router',
6                                        'hashref'   => {},
7                                        'extra_sql' => $extra_sql,
8                                      },
9                 'count_query'     => "SELECT count(*) from router $count_sql",
10                 'header'          => [ 'Router name',
11                                        'Address block(s)',
12                                      ],
13                 'fields'          => [ 'routername',
14                                        sub { join( '<BR>', map { $_->NetAddr }
15                                                                shift->addr_block
16                                                  );
17                                            },
18                                      ],
19                 'links'           => [ [ "${p2}edit/router.cgi?", 'routernum' ],
20                                        '',
21                                      ],
22                 'agent_virt'      => 1,
23                 'agent_null_right'=> "Broadband global configuration",
24                 'agent_pos'       => 1,
25           )
26 %>
27 <%init>
28
29 die "access denied"
30   unless $FS::CurrentUser::CurrentUser->access_right('Broadband configuration')
31   || $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration');
32
33 my $p2 = popurl(2);
34 my $extra_sql = '';
35
36 my @menubar = ( 'Add a new router', "${p2}edit/router.cgi" );
37
38 if ($cgi->param('hidecustomerrouters') eq '1') {
39   $extra_sql = 'WHERE svcnum > 0';
40   $cgi->param('hidecustomerrouters', 0);
41   push @menubar, 'Show customer routers', $cgi->self_url();
42 } else {
43   $cgi->param('hidecustomerrouters', 1);
44   push @menubar, 'Hide customer routers', $cgi->self_url();
45 }
46
47 my $count_sql = $extra_sql.  ( $extra_sql =~ /WHERE/ ? ' AND' : 'WHERE' ).
48   $FS::CurrentUser::CurrentUser->agentnums_sql(
49     'null_right' => 'Broadband global configuration',
50   );
51
52 </%init>