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=9d856f67c8b1d9297764f78b7dcf94cea0ce33ca;hp=a52f609a10844dfd3c19c262c585c03760338234;hb=2eda79fb265b3acdde85881f1160f6daa73f2d84;hpb=8333462f80da553234ef53076a932e9f417e6ad2
diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi
index a52f609a1..9d856f67c 100644
--- a/httemplate/browse/router.cgi
+++ b/httemplate/browse/router.cgi
@@ -1,76 +1,43 @@
-<% include('/elements/header.html', 'Routers') %>
-
-<% 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';
-%}
-
-Add a new router | <%$hideurl%>
-
-<% include('/elements/table-grid.html') %>
-% my $bgcolor1 = '#eeeeee';
-% my $bgcolor2 = '#ffffff';
-% my $bgcolor = '';
-
-
- 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, ' ';
-% }
-%
-% if ( $bgcolor eq $bgcolor1 ) {
-% $bgcolor = $bgcolor2;
-% } else {
-% $bgcolor = $bgcolor1;
-% }
-
-
-
-
- <%$router->routername%>
- |
-
-
-
-
-% foreach my $block ( @addr_block ) {
-
-
- <%UNIVERSAL::isa($block, 'FS::addr_block') ? $block->NetAddr : ' '%> |
-
-% }
-
- |
-
-
-
-% }
-
-
-
-<% include('/elements/footer.html') %>
-
+<% 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 $extra_sql",
+ 'header' => [ 'Router name',
+ 'Address block(s)',
+ ],
+ 'fields' => [ 'routername',
+ sub { join( '
', map { $_->NetAddr }
+ shift->addr_block
+ );
+ },
+ ],
+ 'links' => [ [ "${p2}edit/router.cgi?", 'routernum' ],
+ '',
+ ],
+ )
+%>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
-my @router = qsearch('router', {});
my $p2 = popurl(2);
+my $extra_sql = '';
+
+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);
+ push @menubar, 'Show customer routers', $cgi->self_url();
+} else {
+ $cgi->param('hidecustomerrouters', 1);
+ push @menubar, 'Hide customer routers', $cgi->self_url();
+}
%init>