X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Frouter.cgi;h=541e967ddf34ef2b6cebe1fdcaf83b7df4792139;hp=8864936d92f60abb927fc996a2dba0c973376ea8;hb=6873aec01740ea7c70a5e20a3f3bce6e76bca410;hpb=0354f39ed0e74fd2eae1d9da13906625b4f56591 diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi index 8864936d9..541e967dd 100644 --- a/httemplate/browse/router.cgi +++ b/httemplate/browse/router.cgi @@ -1,37 +1,52 @@ -<%= header('Routers', menubar('Main Menu' => $p)) %> -<% +<% 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> -my @router = qsearch('router', {}); -my $p2 = popurl(2); +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Broadband configuration') + || $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration'); -%> +my $p2 = popurl(2); +my $extra_sql = ''; -<% if ($cgi->param('error')) { %> - Error: <%=$cgi->param('error')%> -

-<% } %> +my @menubar = ( 'Add a new router', "${p2}edit/router.cgi" ); -Add a new router

+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(); +} -<%=table()%> - -<% foreach $router (sort {$a->routernum <=> $b->routernum} @router) { %> - - - - <%=$router->routername%> - - - -<% } %> - - - +my $count_sql = $extra_sql. ( $extra_sql =~ /WHERE/ ? ' AND' : 'WHERE' ). + $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'Broadband global configuration', + ); +