Changeset 155 for branches


Ignore:
Timestamp:
02/04/05 17:35:56 (20 years ago)
Author:
Kris Deugau
Message:

/branches/sql-cleanup

Fixed (most) of the last of the semi-"legacy" checks on
pool/static-ip types to allow simple addition of new types via
the alloctypes table rather than having to modify code. Two
legacy checks remain, which add 'i' to poolips.ptype values and
which should never trigger with the updated arrangment for the
poolips table.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sql-cleanup/cgi-bin/main.cgi

    r154 r155  
    325325    # Fix up types from pools (which are single-char)
    326326    # Fixing the database would be...  painful.  :(
     327##fixme LEGACY CODE
    327328    if ($data[2] =~ /^[cdsmw]$/) {
    328329      $data[2] .= 'i';
     
    787788#  + Different flavours of netblock
    788789
    789   if ($webvar{alloctype} =~ /^[cdsmw]i$/) {
     790  if ($webvar{alloctype} =~ /^.i$/) {
    790791    my ($base,undef) = split //, $webvar{alloctype};    # split into individual chars
    791792    my $sql;
     
    849850##fixme
    850851# This section needs serious Pondering.
    851         if ($webvar{alloctype} =~ /^[cdsmw]p$/) {
     852        if ($webvar{alloctype} =~ /^.[pd]$/) {
    852853          if (($webvar{city} !~ /^(Sudbury|North Bay)$/) && ($webvar{alloctype} eq 'dp')) {
    853854            printError("You must chose Sudbury or North Bay for DSL pools.");
     
    894895      $cidr = $subblocks[0];
    895896    }
    896   } # if ($webvar{alloctype} =~ /^[cdsmw]i$/)
     897  } # if ($webvar{alloctype} =~ /^.i$/)
    897898
    898899  open HTML, "../confirm.html"
     
    10521053  $data[2] =~ s/\s//;
    10531054
     1055##fixme LEGACY CODE
    10541056  # Postfix "i" on pool IP types
    10551057  if ($data[2] =~ /^[cdsmw]$/) {
     
    11141116    # Relatively simple SQL transaction here.
    11151117    my $sql;
    1116     if (my $pooltype = ($webvar{alloctype} =~ /^([cdsmw])i$/) ) {
     1118    if (my $pooltype = ($webvar{alloctype} =~ /^(.)i$/) ) {
    11171119      # Note the hack ( available='n' ) to work around "update" additions
    11181120      # to static IP space.  Eww.
     
    12041206    $desc = "N/A";
    12051207    $notes = "N/A";
    1206   } elsif ($webvar{alloctype} =~ /^[cdsmw]i$/) { # done with alloctype=rr
     1208  } elsif ($webvar{alloctype} =~ /^.i$/) { # done with alloctype=rr
    12071209
    12081210    # Unassigning a static IP
     
    12171219    $alloctype .="i";
    12181220
    1219   } else { # done with alloctype=[cdsmw]i
     1221  } else { # done with alloctype=~ /^.i$/
    12201222
    12211223    my $sth = $ip_dbh->prepare("select cidr,custid,type,city,circuitid,description,notes from ".
     
    12421244
    12431245  # Set the warning text.
    1244   if ($alloctype =~ /^[cdsmw]p$/) {
     1246  if ($alloctype =~ /^.[pd]$/) {
    12451247    $html =~ s|<!--warn-->|<tr bgcolor="black"><td colspan="2"><div class="red">Warning: clicking confirm will remove this record entirely.<br>Any IPs allocated from this pool will also be removed!</div></td></tr>|;
    12461248  } else {
Note: See TracChangeset for help on using the changeset viewer.