1 <% include('elements/browse.html',
2 'title' => 'Address Blocks',
3 'name' => 'address block',
4 'html_init' => $html_init,
5 'html_form' => $html_form,
6 'query' => { 'table' => 'addr_block',
8 'extra_sql' => $extra_sql,
9 'order_by' => $order_by,
11 'count_query' => "SELECT count(*) from addr_block $extra_sql",
12 'header' => [ 'Address Block',
17 'fields' => [ 'NetAddr',
18 sub { my $block = shift;
19 my $router = $block->router;
22 $result .= $router->routername. ' (';
23 $result .= scalar($block->svc_broadband). ' services)';
28 sub { shift->router ? '' : '<FONT SIZE="-2">(split)</FONT>' },
32 [ 'javascript:void(0)', '' ],
35 'link_onclicks' => [ '',
40 'cell_styles' => [ '',
50 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
53 my $path = $p2 . "edit/process/addr_block";
56 my $order_by = "ORDER BY ";
57 $order_by .= "inet(ip_gateway), " if driver_name =~ /^Pg/i;
58 $order_by .= "inet_aton(ip_gateway), " if driver_name =~ /^mysql/i;
59 $order_by .= "ip_netmask";
63 function addr_block_areyousure(href, word) {
64 if(confirm("Are you sure you want to "+word+" this address block?") == true)
65 window.location.href = href;
70 $html_init .= include('/elements/error.html');
73 my ($verb, $num) = (shift, shift);
74 "javascript:addr_block_areyousure('$path/$verb.cgi?blocknum=$num', '$verb')";
78 <FORM ACTION="$path/add.cgi" METHOD="POST">
80 <INPUT TYPE="text" NAME="ip_gateway" SIZE="15">/<INPUT TYPE="text" NAME="ip_netmask" SIZE="2">
81 <INPUT TYPE="submit" NAME="submit" VALUE="Add">
85 my $allocate_text = sub { my $block = shift;
86 my $router = $block->router;
89 $result = '<FONT SIZE="-2">(deallocate)</FONT>'
90 unless scalar($block->svc_broadband);
92 $result .= '<FONT SIZE="-2">(allocate)</FONT>'
97 my $allocate_link = sub {
100 if (scalar($block->svc_broadband) == 0) {
101 &{$confirm}('deallocate', $block->blocknum);
106 include( '/elements/popup_link_onclick.html',
107 'action' => "${p2}edit/allocate.html?blocknum=". $block->blocknum,
108 'actionlabel' => 'Allocate block to router',
113 my $split_link = sub {
115 my $ref = [ '', '' ];
116 $ref = [ &{$confirm}('split', $block->blocknum), '' ]
117 unless ($block->router);