From e2ee874843b19f6c5221f5ce0af90979dba34e57 Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Fri, 29 Jun 2018 13:04:33 -0500 Subject: RT# 30783 Clean up json code for free_addrs --- httemplate/elements/tr-select-router_block_ip.html | 2 +- httemplate/json/free_addresses_in_block.json.html | 18 ------------------ .../misc/xmlhttp-free_addresses_in_block.json.html | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 httemplate/json/free_addresses_in_block.json.html create mode 100644 httemplate/misc/xmlhttp-free_addresses_in_block.json.html (limited to 'httemplate') diff --git a/httemplate/elements/tr-select-router_block_ip.html b/httemplate/elements/tr-select-router_block_ip.html index 535e953c4..eac41cfad 100644 --- a/httemplate/elements/tr-select-router_block_ip.html +++ b/httemplate/elements/tr-select-router_block_ip.html @@ -71,7 +71,7 @@ function populate_ip_select() { % } if ( blocknum && $.isNumeric(blocknum) && ! e.is(':hidden')) { $.getJSON( - '<% $p %>json/free_addresses_in_block.json.html', + '<% $p %>misc/xmlhttp-free_addresses_in_block.json.html', {blocknum: blocknum}, function(ip_json) { $.each( ip_json, function(idx, val) { diff --git a/httemplate/json/free_addresses_in_block.json.html b/httemplate/json/free_addresses_in_block.json.html deleted file mode 100644 index 6785aac6b..000000000 --- a/httemplate/json/free_addresses_in_block.json.html +++ /dev/null @@ -1,18 +0,0 @@ -<%doc> - Return a json array containing all free ip addresses within a given block - Unless block is larger than /24 - Does somebody really want to populate - 65k addresses into a HTML selectbox? - -<% encode_rest($json) %>\ -<%init> - -my $json = []; - -my $blocknum = $cgi->param('blocknum'); - -my $addr_block = qsearchs( addr_block => { blocknum => $blocknum }); - -$json = $addr_block->free_addrs - if ref $addr_block && $addr_block->ip_netmask >= 24; - - diff --git a/httemplate/misc/xmlhttp-free_addresses_in_block.json.html b/httemplate/misc/xmlhttp-free_addresses_in_block.json.html new file mode 100644 index 000000000..801718d35 --- /dev/null +++ b/httemplate/misc/xmlhttp-free_addresses_in_block.json.html @@ -0,0 +1,18 @@ +<%doc> + Return a json array containing all free ip addresses within a given block + Unless block is larger than /24 - Does somebody really want to populate + 65k addresses into a HTML selectbox? + +<% encode_json($json) %>\ +<%init> + +my $json = []; + +my $blocknum = $cgi->param('blocknum'); + +my $addr_block = qsearchs( addr_block => { blocknum => $blocknum }); + +$json = $addr_block->free_addrs + if ref $addr_block && $addr_block->ip_netmask >= 24; + + -- cgit v1.2.1