X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Frouter.cgi;h=85512f8df1a2835b45c6023eb589862118f83d5f;hb=f4209091a9f7120f1961ab2d2efd4d3a00b94268;hp=8864936d92f60abb927fc996a2dba0c973376ea8;hpb=c0567c688084e89fcd11bf82348b6c418f1254ac;p=freeside.git
diff --git a/httemplate/browse/router.cgi b/httemplate/browse/router.cgi
index 8864936d9..85512f8df 100644
--- a/httemplate/browse/router.cgi
+++ b/httemplate/browse/router.cgi
@@ -1,37 +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()%>
-
-<% foreach $router (sort {$a->routernum <=> $b->routernum} @router) { %>
-