Changeset 653
- Timestamp:
- 12/17/14 18:04:01 (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r652 r653 500 500 my $custsth = $dbh->prepare("SELECT count(*) FROM customers WHERE custid = ?"); 501 501 502 # snag some more details 503 my $substh = $dbh->prepare("SELECT count(*) FROM allocations WHERE cidr <<= ? AND type='rm' AND master_id = ? AND NOT cidr = ? "); 504 my $alsth = $dbh->prepare("SELECT count(*) FROM allocations WHERE cidr <<= ? ". 505 "AND NOT type='rm' AND NOT type='mm' AND master_id = ?"); 506 my $freesth = $dbh->prepare("SELECT count(*) FROM freeblocks WHERE cidr <<= ? AND master_id = ?"); 507 my $lfreesth = $dbh->prepare("SELECT masklen(cidr) AS maskbits FROM freeblocks WHERE cidr <<= ?". 508 " AND master_id = ? ORDER BY masklen(cidr) LIMIT 1"); 509 502 510 my @blocklist; 503 while (my ($cidr,$city,$type,$custid,$swip,$desc,$id ) = $sth->fetchrow_array()) {511 while (my ($cidr,$city,$type,$custid,$swip,$desc,$id,$mid) = $sth->fetchrow_array()) { 504 512 $custsth->execute($custid); 505 513 my ($ncust) = $custsth->fetchrow_array(); 514 $substh->execute($cidr, $mid, $cidr); 515 my ($cont) = $substh->fetchrow_array(); 516 $alsth->execute($cidr, $mid); 517 my ($alloc) = $alsth->fetchrow_array(); 518 $freesth->execute($cidr, $mid); 519 my ($free) = $freesth->fetchrow_array(); 520 $lfreesth->execute($cidr, $mid); 521 my ($lfree) = $lfreesth->fetchrow_array(); 522 $lfree = "/$lfree" if $lfree; 523 $lfree = '<NONE>' if !$lfree; 506 524 my %row = ( 507 525 block => $cidr, 526 subcontainers => $cont, 527 suballocs => $alloc, 528 subfree => $free, 529 lfree => $lfree, 508 530 city => $city, 509 531 type => $disp_alloctypes{$type}, -
trunk/templates/showsubs.tmpl
r627 r653 31 31 <td><TMPL_VAR NAME=desc></td> 32 32 </tr> 33 <TMPL_IF hassubs> 34 <tr class="row<TMPL_IF __odd__>0<TMPL_ELSE>1</TMPL_IF>"> 35 <td colspan=4> 36 Containers: <TMPL_VAR NAME=subcontainers>, Allocations: <TMPL_VAR NAME=suballocs>, Free: <TMPL_VAR NAME=subfree>, Largest free: <TMPL_VAR ESCAPE=HTML NAME=lfree> 37 </td><td colspan=2></td></tr> 38 </TMPL_IF> 33 39 </TMPL_LOOP> 34 40 </table>
Note:
See TracChangeset
for help on using the changeset viewer.