Changeset 488


Ignore:
Timestamp:
09/23/10 17:23:31 (14 years ago)
Author:
Kris Deugau
Message:

/branches/htmlform

Removed a few stray obsolete subs and blocks. admin.cgi pretty much done conversion
to HTML::Template. Validation failures are limited to the user ACL table and
block-tweaking table, both of which require complete forms which only span a single
row of the table. See #3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/htmlform/cgi-bin/admin.cgi

    r487 r488  
    243243
    244244} elsif ($webvar{action} eq 'alloctweak') {
     245
    245246  fix_allocfrom();
    246247  showAllocs($webvar{allocfrom});
     248
    247249} elsif ($webvar{action} eq 'update') {
     250
    248251  update();
    249 } elsif ($webvar{action} eq 'assign') {
    250   # Display a list of possible blocks within the requested block.
    251   open (HTML, "../admin_alloc.html")
    252         or croak "Could not open admin_alloc.html :$!";
    253   my $html = join('', <HTML>);
    254   $html =~ s/\$\$MASK\$\$/$webvar{masklen}/g;
    255   $html =~ s/\$\$ALLOCFROM\$\$/$webvar{allocfrom}/g;
    256 
    257   my $from = new NetAddr::IP $webvar{allocfrom};
    258   my @blocklist = $from->split($webvar{masklen});
    259   my $availblocks;
    260   foreach (@blocklist) {
    261     $availblocks .= qq(<tr><td colspan=2 align=center><input type=radio name=block value="$_">$_</td></tr>\n);
    262   }
    263   $html =~ s/\$\$BLOCKLIST\$\$/$availblocks/g;
    264 
    265   print $html;
    266252
    267253} elsif ($webvar{action} eq 'touch') {
     
    547533
    548534
    549 # List free blocks in a /24 for arbitrary manual allocation
    550 sub showfree($) {
    551   my $cidr = new NetAddr::IP $_[0];
    552   print "Showing free blocks in $cidr<br>\n".
    553         "<table border=1>\n";
    554   $sth = $ip_dbh->prepare("select * from freeblocks where cidr <<= '$cidr' order by cidr");
    555   $sth->execute;
    556   while (my @data = $sth->fetchrow_array) {
    557     my $temp = new NetAddr::IP $data[0];
    558     print "<tr><form action=admin.cgi method=POST><input type=hidden name=action value=assign>\n".
    559         qq(<td>$temp<input type=hidden name=allocfrom value="$temp"></td>\n).
    560         "<td>".
    561         (($temp->masklen == 30) ? '<input type=hidden name=masklen value=30>30'
    562           : "<select name=masklen><option>30</option>\n<option>29</option>\n") .
    563         (($temp->masklen < 29) ? "<option>28</option>\n" : '') .
    564         (($temp->masklen < 28) ? "<option>27</option>\n" : '') .
    565         (($temp->masklen < 27) ? "<option>26</option>\n" : '') .
    566         (($temp->masklen < 26) ? "<option>25</option>\n" : '') .
    567         (($temp->masklen < 25) ? "<option>24</option>\n" : '') .
    568         "</td>".
    569         qq(<td>$data[2]</td><td><input type=submit value="Allocate from here"></td>).
    570         "\n</form></tr>\n";
    571   }
    572   print "</table>\n";
    573 }
    574 
    575 
    576535# Show allocations to allow editing.
    577536sub showAllocs {
Note: See TracChangeset for help on using the changeset viewer.