Changeset 32 for branches/stable/cgi-bin


Ignore:
Timestamp:
10/27/04 12:42:03 (20 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Merge select-a-master from /trunk r31

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/cgi-bin/main.cgi

    r29 r32  
    782782        or croak "Could not open assign.html: $!";
    783783    $html = join('',<HTML>);
     784    my $masterlist = "<select name=allocfrom><option selected>-</option>\n";
     785    foreach my $master (@masterblocks) {
     786      $masterlist .= "<option>$master</option>\n";
     787    }
     788    $masterlist .= "</select>\n";
     789    $html =~ s|\$\$MASTERLIST\$\$|$masterlist|g;
    784790    close HTML;
    785791  }
     
    857863      my $failmsg;
    858864      if ($webvar{alloctype} eq 'rr') {
    859         $sql = "select * from freeblocks where maskbits<=$webvar{maskbits} and routed='n'".
    860           " order by maskbits desc";
     865        if ($webvar{allocfrom} ne '-') {
     866          $sql = "select * from freeblocks where maskbits<=$webvar{maskbits} and routed='n'".
     867                " and cidr <<= '$webvar{allocfrom}' order by maskbits desc";
     868        } else {
     869          $sql = "select * from freeblocks where maskbits<=$webvar{maskbits} and routed='n'".
     870                " order by maskbits desc";
     871        }
    861872        $failmsg = "No suitable free block found.<br>\nWe do not have a free".
    862873          " routeable block of that size.<br>\nYou will have to either route".
     
    876887            " chose a smaller blocksize.";
    877888        }
    878         $sql = "select * from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".
    879           " and routed='y' order by cidr,maskbits desc";
     889        if ($webvar{allocfrom} ne '-') {
     890          $sql = "select * from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".
     891                " and cidr <<= '$webvar{allocfrom}' and routed='y' order by cidr,maskbits desc";
     892        } else {
     893          $sql = "select * from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".
     894                " and routed='y' order by cidr,maskbits desc";
     895        }
    880896      }
    881897      $sth = $ip_dbh->prepare($sql);
Note: See TracChangeset for help on using the changeset viewer.