X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Faddr_block.cgi;h=46b12e65f155de0525c49cc798c857dfbb16874f;hb=8688a1fe1b157c1061e928823d81ba1b7f34cde8;hp=7a935191857d82558ba1de582ad062e4f7d73e52;hpb=4d709feddbaa29d9429ad0bfbdd96991e89ba91f;p=freeside.git
diff --git a/httemplate/browse/addr_block.cgi b/httemplate/browse/addr_block.cgi
index 7a9351918..46b12e65f 100644
--- a/httemplate/browse/addr_block.cgi
+++ b/httemplate/browse/addr_block.cgi
@@ -1,91 +1,161 @@
-<% include('/elements/header.html', 'Address Blocks') %>
-
-<% include('/elements/error.html') %>
-
-<% include('/elements/table-grid.html') %>
-% my $bgcolor1 = '#eeeeee';
-% my $bgcolor2 = '#ffffff';
-% my $bgcolor = '';
-
-
- Address block(s) |
- Router |
- Action(s) |
-
-
-% foreach $block (sort {$a->NetAddr cmp $b->NetAddr} @addr_block) {
-% if ( $bgcolor eq $bgcolor1 ) {
-% $bgcolor = $bgcolor2;
-% } else {
-% $bgcolor = $bgcolor1;
-% }
-
-
- <%$block->NetAddr%> |
-
-% if (my $router = $block->router) {
-%
-% if (scalar($block->svc_broadband) == 0) {
-
-
- <%$router->routername%>
- |
-
-
- |
-% } else {
-
-
- <%$router->routername%>
- |
-% }
-%
-% } else {
-
-
-
- |
-
-
- |
-
-% }
-
-
-% }
-
-
-
-
-
+);
+
+my $allocate_text = sub { my $block = shift;
+ my $router = $block->router;
+ my $result = '';
+ if ($router) {
+ $result = '(deallocate)'
+ unless scalar($block->svc_broadband);
+ }else{
+ $result .= '(allocate)'
+ }
+ $result;
+};
+
+my $allocate_link = sub {
+ my $block = shift;
+ if ($block->router) {
+ if (scalar($block->svc_broadband) == 0) {
+ &{$confirm}('deallocate', $block->blocknum);
+ } else {
+ "";
+ }
+ } else {
+ include( '/elements/popup_link_onclick.html',
+ 'action' => "${p2}edit/allocate.html?blocknum=". $block->blocknum,
+ 'actionlabel' => 'Allocate block to router',
+ );
+ }
+};
+
+my $split_link = sub {
+ my $block = shift;
+ my $ref = [ '', '' ];
+ $ref = [ &{$confirm}('split', $block->blocknum), '' ]
+ unless ($block->router);
+ $ref;
+};
+
+my $autoassign_link = sub {
+ my $block = shift;
+ my $url = "$path/manual_flag.cgi?manual_flag=";
+ $url .= $block->manual_flag ? '' : 'Y';
+ [ "$url;blocknum=", 'blocknum' ];
+};
+
%init>