X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Frouter.cgi;h=85512f8df1a2835b45c6023eb589862118f83d5f;hb=bfd03694e81b9bc09b24d288adde0a038fc93288;hp=4eee96167ed50893bbd2ede3070bf4c2c6523413;hpb=6f2e2ea05362732731d08bc2fdeb26946fa4d3bc;p=freeside.git
diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi
index 4eee96167..85512f8df 100644
--- a/httemplate/browse/router.cgi
+++ b/httemplate/browse/router.cgi
@@ -1,42 +1,61 @@
-<%= 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)',
+ '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' ],
+ ],
+ 'agent_virt' => 1,
+ 'agent_null_right'=> "Broadband global configuration",
+ 'agent_pos' => 1,
+ )
+%>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Broadband configuration')
+ || $FS::CurrentUser::CurrentUser->access_right('Broadband global 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('error')) { %>
- Error: <%=$cgi->param('error')%>
-
-<% } %>
+if ($cgi->param('hidecustomerrouters') eq '1') {
+ $extra_sql = 'WHERE svcnum > 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');
+}
-Add a new router
+my $count_sql = $extra_sql. ( $extra_sql =~ /WHERE/ ? ' AND' : 'WHERE' ).
+ $FS::CurrentUser::CurrentUser->agentnums_sql(
+ 'null_right' => 'Broadband global configuration',
+ );
-<%=table()%>
-