Changeset 915
- Timestamp:
- 04/27/18 15:28:45 (7 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r913 r915 35 35 &getBlockRDNS &getRDNSbyIP &getRevID 36 36 &getNodeList &getNodeName &getNodeInfo 37 &getBlockNotices 37 38 &mailNotify 38 39 ); … … 51 52 &getBlockRDNS &getRDNSbyIP &getRevID 52 53 &getNodeList &getNodeName &getNodeInfo 54 &getBlockNotices 53 55 &mailNotify 54 56 )] … … 3553 3555 3554 3556 3557 ## IPDB::getBlockNotices() 3558 # Retrieve any infonotes for a block and all of its parents 3559 # Takes the block ID to trace down the stack 3560 # Returns an arrayref to the block and all of its parents, containing the CIDR, 3561 # description, and notice (if any) associated to each block. 3562 sub getBlockNotices { 3563 my $dbh = shift; 3564 my $bid = shift; 3565 my $nlist = $dbh->selectall_arrayref(q( 3566 WITH RECURSIVE blockparents (id, cidr, description, parent_id, notice, depth) AS ( 3567 SELECT a.id, a.cidr, a.description, a.parent_id, bn.notice, 1 AS depth FROM allocations a 3568 LEFT JOIN blocknotices bn ON a.id = bn.alloc_id 3569 WHERE a.id = ? 3570 UNION 3571 SELECT b.id, b.cidr, b.description, b.parent_id, bn2.notice, t.depth AS depth FROM allocations b 3572 JOIN blockparents t ON t.parent_id = b.id 3573 LEFT JOIN blocknotices bn2 ON b.id = bn2.alloc_id 3574 ) SELECT id, cidr, description, parent_id, notice FROM blockparents ORDER BY depth DESC; 3575 ), {Slice=>{}}, $bid); 3576 3577 return $nlist; 3578 } # end getBlockNotices() 3579 3580 3555 3581 ## IPDB::mailNotify() 3556 3582 # Sends notification mail to recipients regarding an IPDB operation -
trunk/cgi-bin/admin.cgi
r906 r915 149 149 ($fbid, $fb, $fbparent) = findAllocateFrom($ip_dbh, $maskbits, $webvar{alloctype}, '','', 150 150 (gimme => "$cidr", allowpriv => 1)); 151 152 # retrieve any notices 153 my $nlist = getBlockNotices($ip_dbh, $fbparent); 154 my @notices; 155 foreach (@$nlist) { 156 push @notices, $_->{notice} if $_->{notice}; 157 } 158 my $blockmsg = join("<br>\n", @notices); 159 $page->param(blockmsg => $blockmsg); 160 151 161 $page->param(fbid => $fbid); 152 162 $page->param(parid => $fbparent); … … 205 215 goto ERRJUMP; 206 216 } 217 218 # retrieve any notices 219 my $nlist = getBlockNotices($ip_dbh, $webvar{parent}); 220 my @notices; 221 foreach (@$nlist) { 222 push @notices, $_->{notice} if $_->{notice}; 223 } 224 my $blockmsg = join("<br>\n", @notices); 225 $page->param(blockmsg => $blockmsg); 207 226 208 227 my ($retcode,$msg) = allocateBlock($ip_dbh, cidr => $webvar{cidr}, fbid => $webvar{fbid}, -
trunk/cgi-bin/ipdb.psql
r865 r915 116 116 ALTER TABLE ONLY freeblocks 117 117 ADD CONSTRAINT freeblocks_pkey PRIMARY KEY (cidr, parent_id); 118 119 -- Table for arbitrary infonotices tagged to an allocation 120 CREATE TABLE blocknotices ( 121 alloc_id integer NOT NULL, 122 ipflag boolean DEFAULT false NOT NULL, 123 notice text DEFAULT ''::text NOT NULL 124 ); 125 126 ALTER TABLE ONLY blocknotices 127 ADD CONSTRAINT blocknotices_pkey PRIMARY KEY (alloc_id, ipflag); 118 128 119 129 -- Network nodes - allows finding customers affected by a broken <x> quickly -
trunk/templates/admin/alloc.tmpl
r642 r915 1 <TMPL_IF blockmsg><br><div class="strongwarning blockcenter w70"><TMPL_VAR NAME=blockmsg></div><br></TMPL_IF> 2 1 3 <TMPL_IF errmsg> 2 4 <TMPL_VAR NAME=errmsg> -
trunk/templates/admin/confirm.tmpl
r517 r915 1 <TMPL_IF blockmsg><br><div class="strongwarning blockcenter w70"><TMPL_VAR NAME=blockmsg></div><br></TMPL_IF> 2 1 3 <TMPL_IF locerr> 2 4 <TMPL_VAR NAME=locerr>
Note:
See TracChangeset
for help on using the changeset viewer.