X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Frouter.cgi;h=354111875af333d9daa285adaba303e913df9a1f;hb=83cad295d38b0c764b59b62bc4840dcf666b7de9;hp=ef8ad3160e02a99215b6ef22ae2d9b245650e49d;hpb=e5fcc68aab310814b0ba5444bc97ef504e6e16da;p=freeside.git diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi index ef8ad3160..354111875 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, @@ -43,13 +28,35 @@ 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, encode_entities($_->{'label'}); + push @fields, encode_entities($_->{'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',