Changeset 380 for trunk/cgi-bin/main.cgi


Ignore:
Timestamp:
01/22/08 16:11:01 (16 years ago)
Author:
Kris Deugau
Message:

/trunk

Merge bugfixes/updates from /branches/stable r317 through r379

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/main.cgi

    r371 r380  
    400400  $sth->execute();
    401401
     402  # hack hack hack
     403  # set up to flag swip=y records if they don't actually have supporting data in the customers table
     404  my $custsth = $ip_dbh->prepare("select count(*) from customers where custid=?");
     405
    402406  my $count=0;
    403407  while (my @data = $sth->fetchrow_array()) {
     
    408412#    $data[2] =~ s/\s+//g;
    409413
     414    $custsth->execute($data[3]);
     415    my ($ncust) = $custsth->fetchrow_array();
     416
    410417    # Prefix subblocks with "Sub "
    411418    my @row = ( (($data[2] =~ /^.r$/) ? 'Sub ' : '').
    412419        qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>),
    413420        $data[1], $disp_alloctypes{$data[2]}, $data[3],
    414         ($data[4] eq 'y' ? 'Yes' : 'No'), $data[5]);
     421        ($data[4] eq 'y' ? ($ncust == 0 ? 'Yes<small>*</small>' : 'Yes') : 'No'), $data[5]);
    415422    # If the allocation is a pool, allow listing of the IPs in the pool.
    416423    if ($data[2] =~ /^.[pd]$/) {
     
    841848      print qq(<div class="center"><div class="heading">The IP $msg has been allocated to customer $webvar{custid}</div>).
    842849        ( ($webvar{alloctype} eq 'di' && $webvar{billinguser}) ?
    843                 qq(<div><a href="https://billing.example.com/extserv.pl?).
     850                qq(<div><a href="https://billing.example.com/radius.pl?).
    844851                "action=new_radius_user&custid=$webvar{custid}&userid=$webvar{billinguser}".
    845852                qq(&ipdb=1&ip=$msg">Add this IP to RADIUS user table</a></div>)
     
    854861        "sucessfully added as: $disp_alloctypes{$webvar{alloctype}}</div>".
    855862        ( ($webvar{alloctype} eq 'pr' && $webvar{billinguser}) ?
    856                 qq(<div><a href="https://billing.example.com/extserv.pl?).
     863                qq(<div><a href="https://billing.example.com/radius.pl?).
    857864                "action=new_radius_user&custid=$webvar{custid}&userid=$webvar{billinguser}".
    858865                "&route_subnet=".$netblock->addr."&subnet_slash=".$netblock->masklen.
     
    11201127  my $html = join('', <HTML>);
    11211128
     1129  # Link back to browse-routed or list-pool page on "Update complete" page.
     1130  my $backlink = "/ip/cgi-bin/main.cgi?action=";
     1131  my $cblock;   # to contain the CIDR of the container block we're retrieving.
     1132  my $sql;
     1133  if (my $pooltype = ($webvar{alloctype} =~ /^(.)i$/) ) {
     1134    $sql = "select pool from poolips where ip='$webvar{block}'";
     1135    $backlink .= "listpool&pool=";
     1136  } else {
     1137    $sql = "select cidr from routed where cidr >>= '$webvar{block}'";
     1138    $backlink .= "showrouted&block=";
     1139  }
     1140  # I define there to be no errors on this operation...  so we don't need to check for them.
     1141  $sth = $ip_dbh->prepare($sql);
     1142  $sth->execute;
     1143  $sth->bind_columns(\$cblock);
     1144  $sth->fetch();
     1145  $sth->finish;
     1146  $backlink .= $cblock;
     1147
    11221148my $swiptmp = ($webvar{swip} eq 'on' ? 'Yes' : 'No');
    11231149  $html =~ s/\$\$BLOCK\$\$/$webvar{block}/g;
     
    11341160  $webvar{notes} = desanitize($webvar{notes});
    11351161  $html =~ s/\$\$NOTES\$\$/$webvar{notes}/g;
     1162  $html =~ s/\$\$BACKLINK\$\$/$backlink/g;
     1163  $html =~ s/\$\$BACKBLOCK\$\$/$cblock/g;
    11361164
    11371165  if ($IPDBacl{$authuser} =~ /s/) {
Note: See TracChangeset for help on using the changeset viewer.