1 <% include('elements/browse.html',
2 'title' => 'Address Blocks',
3 'name' => 'address block',
4 'html_init' => $html_init,
5 'html_foot' => $html_foot,
6 'query' => { 'table' => 'addr_block',
8 'extra_sql' => $extra_sql,
9 'order_by' => $order_by,
11 'count_query' => "SELECT count(*) from addr_block $count_sql",
12 'header' => [ 'Address Block',
19 'fields' => [ 'NetAddr',
20 sub { my $block = shift;
21 my $router = $block->router;
24 $result .= $router->routername. ' (';
25 $result .= scalar($block->svc_broadband). ' services)';
30 sub { shift->router ? '' : '<FONT SIZE="-2">(split)</FONT>' },
31 sub { '<FONT SIZE="-2">('. (shift->manual_flag ? 'allow' : 'prevent'). ' automatic ip assignment)</FONT>' },
34 if(!$block->router && scalar($block->svc_broadband) == 0) {
35 return '<FONT SIZE="-2">(delete)</FONT>';
42 [ 'javascript:void(0)', '' ],
47 if(!$block->router && scalar($block->svc_broadband) == 0) {
48 [ "${p}misc/delete-addr_block.html?", 'blocknum' ];
52 'link_onclicks' => [ '',
58 'cell_styles' => [ '',
65 'agent_null_right' => 'Broadband global configuration',
72 unless $FS::CurrentUser::CurrentUser->access_right('Broadband configuration')
73 || $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration');
76 my $path = $p2 . "edit/process/addr_block";
80 my $count_sql = "WHERE ". $FS::CurrentUser::CurrentUser->agentnums_sql(
81 'null_right' => 'Broadband global configuration',
84 my $order_by = "ORDER BY ";
85 $order_by .= "inet(ip_gateway), " if driver_name =~ /^Pg/i;
86 $order_by .= "inet_aton(ip_gateway), " if driver_name =~ /^mysql/i;
87 $order_by .= "ip_netmask";
91 function addr_block_areyousure(href, word) {
92 if(confirm("Are you sure you want to "+word+" this address block?") == true)
93 window.location.href = href;
98 $html_init .= include('/elements/error.html');
101 my ($verb, $num) = (shift, shift);
102 "javascript:addr_block_areyousure('$path/$verb.cgi?blocknum=$num', '$verb')";
106 <FORM ACTION="$path/add.cgi" METHOD="POST">
108 <INPUT TYPE="text" NAME="ip_gateway" SIZE="15">/<INPUT TYPE="text" NAME="ip_netmask" SIZE="2">
110 $html_foot .= include( '/elements/select-agent.html',
111 'agent_null_right' => 'Broadband global configuration',
114 <INPUT TYPE="submit" NAME="submit" VALUE="Add">
118 my $allocate_text = sub { my $block = shift;
119 my $router = $block->router;
122 $result = '<FONT SIZE="-2">(deallocate)</FONT>'
123 unless scalar($block->svc_broadband);
125 $result .= '<FONT SIZE="-2">(allocate)</FONT>'
130 my $allocate_link = sub {
132 if ($block->router) {
133 if (scalar($block->svc_broadband) == 0) {
134 &{$confirm}('deallocate', $block->blocknum);
139 include( '/elements/popup_link_onclick.html',
140 'action' => "${p2}edit/allocate.html?blocknum=". $block->blocknum,
141 'actionlabel' => 'Allocate block to router',
146 my $split_link = sub {
148 my $ref = [ '', '' ];
149 $ref = [ &{$confirm}('split', $block->blocknum), '' ]
150 unless ($block->router);
154 my $autoassign_link = sub {
156 my $url = "$path/manual_flag.cgi?manual_flag=";
157 $url .= $block->manual_flag ? '' : 'Y';
158 [ "$url;blocknum=", 'blocknum' ];