X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Frouter.cgi;fp=httemplate%2Fbrowse%2Frouter.cgi;h=c7713f31340f28f531ee5f3947e21bea1a4df7ba;hp=85512f8df1a2835b45c6023eb589862118f83d5f;hb=a7a22257d456394125eed32f8261c75a7f393ec2;hpb=772656864b377bbd2ef2febd40891ef1206b5be0 diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi index 85512f8df..c7713f313 100644 --- a/httemplate/browse/router.cgi +++ b/httemplate/browse/router.cgi @@ -7,24 +7,9 @@ 'extra_sql' => $extra_sql, }, 'count_query' => "SELECT count(*) from router $count_sql", - 'header' => [ 'Router name', - 'Address block(s)', - 'IP addressing', - 'Action', - ], - 'fields' => [ 'routername', - sub { join( '
', map { $_->NetAddr } - shift->addr_block - ); - }, - sub { shift->manual_addr ? 'Manual' : 'Automatic' }, - sub { 'Delete' }, - ], - 'links' => [ [ "${p2}edit/router.cgi?", 'routernum' ], - '', - '', - [ "${p}misc/delete-router.html?", 'routernum' ], - ], + 'header' => [ @header_fields ], + 'fields' => [ @fields ], + 'links' => [ @links ], 'agent_virt' => 1, 'agent_null_right'=> "Broadband global configuration", 'agent_pos' => 1, @@ -32,6 +17,8 @@ %> <%init> +use CGI qw(escapeHTML); + die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Broadband configuration') || $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration'); @@ -52,6 +39,26 @@ if ($cgi->param('hidecustomerrouters') eq '1') { $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' => 'Broadband global configuration',