summaryrefslogtreecommitdiff
path: root/httemplate/browse/addr_range.html
blob: d657f32ecf903243124217de8811471174af7b19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<& elements/browse.html,
  'title'         => 'Address Ranges',
  'name_singular' => 'address range',
  'html_init'     => $html_init,
  'html_foot'     => $html_foot,
  'query'         => { 'table'     => 'addr_range',
                       'order_by'  => $order_by,
                     },
  'count_query'   => "SELECT count(*) from addr_range",
  'header'        => [ 'From',
                       '', # the dash
                       'To',
                       'Status',
                       # would be nice to show whether any addresses in the 
                       # range are assigned, but that's ugly
                     ],
  'fields'        => [ 'start',
                       sub { '&ndash;' },
                       'end',
                       'desc',
                     ],
  'links'         => [
                       [ '#' ],
                       '',
                       [ '#' ],
                     ],
  'link_onclicks' => [ $edit_link,
                       '',
                       $edit_link,
                       '',
                     ],
&>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Broadband global configuration');
# addr_ranges are ALWAYS global, else there will be chaos

my $order_by = "ORDER BY inet(start)"; # Pg-ism
# though we could also make the field itself inet-type...
# this would simplify a lot of things.

my $html_init = include('/elements/error.html');

my $edit_link = sub {
  my $addr_range = shift;
  include('/elements/popup_link_onclick.html',
    action      => $p.'edit/addr_range.html?rangenum='.
                   $addr_range->rangenum,
    actionlabel => 'Edit address range',
    width       => 650,
    height      => 420,
  );
};

my $add_link = include('/elements/popup_link_onclick.html',
    action      => $p.'edit/addr_range.html',
    actionlabel => 'Edit address range',
    width       => 650,
    height      => 420,
);

my $html_foot = qq!<A HREF="#" onclick="$add_link">
<I>Add a new address range</I></A>!;

</%init>