summaryrefslogtreecommitdiff
path: root/httemplate/misc
diff options
context:
space:
mode:
authorMitch Jackson <mitch@freeside.biz>2018-06-29 13:04:33 -0500
committerMitch Jackson <mitch@freeside.biz>2018-10-23 16:42:33 -0400
commit0ce4dcd4dad9777fe4c6436a3308a81496ae9ac3 (patch)
treeb11925ad33d37d53290c6aec04b0adee5e1ea88c /httemplate/misc
parentead0cc76f66c0806321443657b49f829034e23ae (diff)
RT# 30783 Clean up json code for free_addrs
Diffstat (limited to 'httemplate/misc')
-rw-r--r--httemplate/misc/xmlhttp-free_addresses_in_block.json.html18
1 files changed, 18 insertions, 0 deletions
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?
+</%doc>
+<% 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;
+
+</%init>