diff options
author | levinse <levinse> | 2011-06-22 23:39:36 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-06-22 23:39:36 +0000 |
commit | 87b88389a0b457d1ba8ca5655696939e1adf652c (patch) | |
tree | fa378dffce8dde67e1e2191b7bc0b9f9003e5682 /httemplate | |
parent | eed7932c6d70767a8b4ae3d04ec19312ad81d885 (diff) |
add router and addr_block delete features, RT13197
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/addr_block.cgi | 19 | ||||
-rw-r--r-- | httemplate/misc/delete-addr_block.html | 19 | ||||
-rw-r--r-- | httemplate/misc/delete-router.html | 19 |
3 files changed, 57 insertions, 0 deletions
diff --git a/httemplate/browse/addr_block.cgi b/httemplate/browse/addr_block.cgi index 1bbcdcbc1..7ff0eaa21 100644 --- a/httemplate/browse/addr_block.cgi +++ b/httemplate/browse/addr_block.cgi @@ -14,6 +14,7 @@ 'Action(s)', '', '', + '', ], 'fields' => [ 'NetAddr', sub { my $block = shift; @@ -28,22 +29,37 @@ $allocate_text, sub { shift->router ? '' : '<FONT SIZE="-2">(split)</FONT>' }, sub { '<FONT SIZE="-2">('. (shift->manual_flag ? 'allow' : 'prevent'). ' automatic ip assignment)</FONT>' }, + sub { + my $block = shift; + if(!$block->router && scalar($block->svc_broadband) == 0) { + return '<FONT SIZE="-2">(delete)</FONT>'; + } + ''; + }, ], 'links' => [ '', '', [ 'javascript:void(0)', '' ], $split_link, $autoassign_link, + sub { + my $block = shift; + if(!$block->router && scalar($block->svc_broadband) == 0) { + [ "${p}misc/delete-addr_block.html?", 'blocknum' ]; + } + }, ], 'link_onclicks' => [ '', '', $allocate_link, '', + '', ], 'cell_styles' => [ '', '', 'border-right:none;', 'border-left:none;', + '', ], 'agent_virt' => 1, 'agent_null_right' => 'Broadband global configuration', @@ -142,4 +158,7 @@ my $autoassign_link = sub { [ "$url;blocknum=", 'blocknum' ]; }; +my $delete_link = sub { +}; + </%init> diff --git a/httemplate/misc/delete-addr_block.html b/httemplate/misc/delete-addr_block.html new file mode 100644 index 000000000..83a4b6823 --- /dev/null +++ b/httemplate/misc/delete-addr_block.html @@ -0,0 +1,19 @@ +% if ( $error ) { +% errorpage($error); +% } else { +<% $cgi->redirect("${p}browse/addr_block.cgi") %> +% } +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Broadband configuration') + || $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration'); + +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal blocknum"; +my $blocknum = $1; + +my $addr_block = qsearchs('addr_block',{'blocknum'=>$blocknum}); +my $error = $addr_block->delete; + +</%init> diff --git a/httemplate/misc/delete-router.html b/httemplate/misc/delete-router.html new file mode 100644 index 000000000..eb1754b4a --- /dev/null +++ b/httemplate/misc/delete-router.html @@ -0,0 +1,19 @@ +% if ( $error ) { +% errorpage($error); +% } else { +<% $cgi->redirect("${p}browse/router.cgi") %> +% } +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Broadband configuration') + || $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration'); + +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal routernum"; +my $routernum = $1; + +my $router = qsearchs('router',{'routernum'=>$routernum}); +my $error = $router->delete; + +</%init> |