Ignore:
Timestamp:
04/27/05 17:27:22 (19 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Semi-temporary change to allow SWIPing of existing netblocks.
SWIP process to be replaced with RWHOIS as soon as that can
be considered to be operating "correctly".

File:
1 edited

Legend:

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

    r242 r244  
    606606        qq($master ($data[0]):</div></center><br>\n);
    607607
    608   startTable('CIDR allocation','Customer Location','Type','CustID','Description/Name');
     608  startTable('CIDR allocation','Customer Location','Type','CustID','SWIPed?','Description/Name');
    609609
    610610  # Snag the allocations for this block
    611   $sth = $ip_dbh->prepare("select cidr,city,type,custid,description".
     611  $sth = $ip_dbh->prepare("select cidr,city,type,custid,swip,description".
    612612        " from allocations where cidr <<= '$master' order by cidr");
    613613  $sth->execute();
     
    615615  my $count=0;
    616616  while (my @data = $sth->fetchrow_array()) {
    617     # cidr,city,type,custid,description, as per the SELECT
     617    # cidr,city,type,custid,swip,description, as per the SELECT
    618618    my $cidr = new NetAddr::IP $data[0];
    619619
     
    624624    my @row = ( (($data[2] =~ /^.r$/) ? 'Sub ' : '').
    625625        qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>),
    626         $data[1], $disp_alloctypes{$data[2]}, $data[3], $data[4]);
     626        $data[1], $disp_alloctypes{$data[2]}, $data[3],
     627        ($data[4] eq 'y' ? 'Yes' : 'No'), $data[5]);
    627628    # If the allocation is a pool, allow listing of the IPs in the pool.
    628629    if ($data[2] =~ /^.[pd]$/) {
     
    11141115    $sql = "select ip,custid,type,city,circuitid,description,notes from poolips where ip='$webvar{block}'";
    11151116  } else {
    1116     $sql = "select cidr,custid,type,city,circuitid,description,notes from allocations where cidr='$webvar{block}'"
     1117    $sql = "select cidr,custid,type,city,circuitid,description,notes,swip from allocations where cidr='$webvar{block}'"
    11171118  }
    11181119
     
    11741175  }
    11751176
     1177## Hack time!  SWIP isn't going to stay, so I'm not going to integrate it with ACLs.
     1178if ($data[2] =~ /.i/) {
     1179  $html =~ s/\$\$SWIP\$\$/N\/A/;
     1180} else {
     1181  my $tmp = (($data[7] eq 'n') ? '<input type=checkbox name=swip>' :
     1182        '<input type=checkbox name=swip checked=yes>');
     1183  $html =~ s/\$\$SWIP\$\$/$tmp/;
     1184}
     1185
    11761186  # More ACL trickery - we can live with forms that don't submit,
    11771187  # but we can't leave the extra table rows there, and we *really*
     
    12221232      $sql = "update allocations set custid='$webvar{custid}',".
    12231233        "description='$webvar{desc}',notes='$webvar{notes}',city='$webvar{city}',".
    1224         "type='$webvar{alloctype}',circuitid='$webvar{circid}' where cidr='$webvar{block}'";
     1234        "type='$webvar{alloctype}',circuitid='$webvar{circid}',".
     1235        "swip='".($webvar{swip} eq 'on' ? 'y' : 'n')."' ".
     1236        " where cidr='$webvar{block}'";
    12251237    }
    12261238    # Log the details of the change.
     
    12451257  my $html = join('', <HTML>);
    12461258
     1259my $swiptmp = ($webvar{swip} eq 'on' ? 'Yes' : 'No');
    12471260  $html =~ s/\$\$BLOCK\$\$/$webvar{block}/g;
    12481261  $webvar{city} = desanitize($webvar{city});
     
    12511264  $html =~ s/\$\$TYPEFULL\$\$/$disp_alloctypes{$webvar{alloctype}}/g;
    12521265  $html =~ s/\$\$CUSTID\$\$/$webvar{custid}/g;
     1266  $html =~ s/\$\$SWIP\$\$/$swiptmp/g;
    12531267  $webvar{circid} = desanitize($webvar{circid});
    12541268  $html =~ s/\$\$CIRCID\$\$/$webvar{circid}/g;
Note: See TracChangeset for help on using the changeset viewer.