X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Frouter.cgi;h=c7713f31340f28f531ee5f3947e21bea1a4df7ba;hb=0df2eac272aa26a62431f5cd830c1cb7b1018e32;hp=9f7167329b7d12c9fe4fc9fcf42e41ee93fa1939;hpb=a1871d3d13c1dafa93b956762c0d23728d261da7;p=freeside.git diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi index 9f7167329..c7713f313 100644 --- a/httemplate/browse/router.cgi +++ b/httemplate/browse/router.cgi @@ -7,28 +7,21 @@ 'extra_sql' => $extra_sql, }, 'count_query' => "SELECT count(*) from router $count_sql", - 'header' => [ 'Router name', - 'Address block(s)', - ], - 'fields' => [ 'routername', - sub { join( '
', map { $_->NetAddr } - shift->addr_block - ); - }, - ], - 'links' => [ [ "${p2}edit/router.cgi?", 'routernum' ], - '', - ], + 'header' => [ @header_fields ], + 'fields' => [ @fields ], + 'links' => [ @links ], 'agent_virt' => 1, - 'agent_null_right'=> "Engineering global configuration", + 'agent_null_right'=> "Broadband global configuration", 'agent_pos' => 1, ) %> <%init> +use CGI qw(escapeHTML); + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Engineering configuration') - || $FS::CurrentUser::CurrentUser->access_right('Engineering global configuration'); + unless $FS::CurrentUser::CurrentUser->access_right('Broadband configuration') + || $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration'); my $p2 = popurl(2); my $extra_sql = ''; @@ -37,16 +30,39 @@ my @menubar = ( 'Add a new router', "${p2}edit/router.cgi" ); if ($cgi->param('hidecustomerrouters') eq '1') { $extra_sql = 'WHERE svcnum > 0'; - $cgi->param('hidecustomerrouters', 0); + $cgi->delete('hidecustomerrouters'); push @menubar, 'Show customer routers', $cgi->self_url(); + $cgi->param('hidecustomerrouters', 1); } else { $cgi->param('hidecustomerrouters', 1); push @menubar, 'Hide customer routers', $cgi->self_url(); + $cgi->delete('hidecustomerrouters'); } +my @header_fields = ('Router name', 'Address block(s)', 'IP addressing'); +my @fields = ( 'routername', + sub { join( '
', map { $_->NetAddr } shift->addr_block); }, + sub { shift->manual_addr ? 'Manual' : 'Automatic' }, + ); +my @links = ( [ "${p2}edit/router.cgi?", 'routernum' ], + '', + '', + ); + +foreach (FS::router->virtual_fields_hash) { + push @header_fields, escapeHTML($_->{'label'}); + push @fields, escapeHTML($_->{'name'}); + push @links, ''; +} + +push @header_fields, 'Action'; +push @fields, sub { 'Delete' }; +push @links, [ "${p}misc/delete-router.html?", 'routernum' ]; + my $count_sql = $extra_sql. ( $extra_sql =~ /WHERE/ ? ' AND' : 'WHERE' ). $FS::CurrentUser::CurrentUser->agentnums_sql( - 'null_right' => 'Engineering global configuration', + 'null_right' => 'Broadband global configuration', ); +