X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Frouter.cgi;h=541e967ddf34ef2b6cebe1fdcaf83b7df4792139;hp=7ed0963db006c74e22a64d27ce2f86a1a66d468e;hb=6873aec01740ea7c70a5e20a3f3bce6e76bca410;hpb=2a6aa24137ddd389c1e644f5ece325c5b5dbaf3a diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi index 7ed0963db..541e967dd 100644 --- a/httemplate/browse/router.cgi +++ b/httemplate/browse/router.cgi @@ -1,58 +1,52 @@ -<% include("/elements/header.html",'Routers', menubar('Main Menu' => $p)) %> -% -%my @router = qsearch('router', {}); -%my $p2 = popurl(2); - -<% include('/elements/error.html') %> - -%my $hidecustomerrouters = 0; -%my $hideurl = ''; -%if ($cgi->param('hidecustomerrouters') eq '1') { -% $hidecustomerrouters = 1; -% $cgi->param('hidecustomerrouters', 0); -% $hideurl = 'Show customer routers'; -%} else { -% $hidecustomerrouters = 0; -% $cgi->param('hidecustomerrouters', 1); -% $hideurl = 'Hide customer routers'; -%} -% - +<% include('elements/browse.html', + 'title' => 'Routers', + 'menubar' => [ @menubar ], + 'name_singular' => 'router', + 'query' => { 'table' => 'router', + 'hashref' => {}, + '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' ], + '', + ], + 'agent_virt' => 1, + 'agent_null_right'=> "Broadband global configuration", + 'agent_pos' => 1, + ) +%> +<%init> -Add a new router | <%$hideurl%> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Broadband configuration') + || $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration'); -<%table()%> - - Router name - Address block(s) - -% foreach my $router (sort {$a->routernum <=> $b->routernum} @router) { -% next if $hidecustomerrouters && $router->svcnum; -% my @addr_block = $router->addr_block; -% if (scalar(@addr_block) == 0) { -% push @addr_block, ' '; -% } -% +my $p2 = popurl(2); +my $extra_sql = ''; - - - <%$router->routername%> - - -% foreach my $block ( @addr_block ) { +my @menubar = ( 'Add a new router', "${p2}edit/router.cgi" ); - - <%UNIVERSAL::isa($block, 'FS::addr_block') ? $block->NetAddr : ' '%> - -% } +if ($cgi->param('hidecustomerrouters') eq '1') { + $extra_sql = 'WHERE svcnum > 0'; + $cgi->param('hidecustomerrouters', 0); + push @menubar, 'Show customer routers', $cgi->self_url(); +} else { + $cgi->param('hidecustomerrouters', 1); + push @menubar, 'Hide customer routers', $cgi->self_url(); +} - -% } +my $count_sql = $extra_sql. ( $extra_sql =~ /WHERE/ ? ' AND' : 'WHERE' ). + $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'Broadband global configuration', + ); - - - -<%init> -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration');