Changeset 282 for branches


Ignore:
Timestamp:
09/21/05 14:09:35 (19 years ago)
Author:
Kris Deugau
Message:

/branches/privdata

Add capability to enter priviledged or restricted data
directly for new allocations.

Location:
branches/privdata
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/privdata/assign.html

    r144 r282  
    3636</tr><tr class="color1">
    3737<td>Notes:&nbsp;</td><td><textarea name="notes" rows="3" cols="40"></textarea></td>
    38 </tr><tr class="color2">
     38</tr>
     39$$PRIVDATA$$
     40<tr class="$$BUTTONROWCOLOUR$$">
    3941<td class="center" colspan="2"><input type="submit" value="  Assign  "></td>
    4042<input type="hidden" name="action" value="confirm">
  • branches/privdata/cgi-bin/IPDB.pm

    r256 r282  
    184184# Does all of the magic of actually allocating a netblock
    185185# Requires database handle, block to allocate, custid, type, city,
    186 #       description, notes, circuit ID, block to allocate from,
     186#       description, notes, circuit ID, block to allocate from, private data
    187187# Returns a success code and optional error message.
    188188sub allocateBlock {
    189   my ($dbh,undef,undef,$custid,$type,$city,$desc,$notes,$circid) = @_;
    190  
     189  my ($dbh,undef,undef,$custid,$type,$city,$desc,$notes,$circid,$privdata) = @_;
     190
    191191  my $cidr = new NetAddr::IP $_[1];
    192192  my $alloc_from = new NetAddr::IP $_[2];
     
    220220      $sth = $dbh->prepare("update poolips set custid='$custid',".
    221221        "city='$city',available='n',description='$desc',notes='$notes',".
    222         "circuitid='$circid'".
     222        "circuitid='$circid',privdata='$privdata'".
    223223        " where ip='$cidr'");
    224224      $sth->execute;
     
    263263          }
    264264          $sth = $dbh->prepare("insert into allocations".
    265                 " (cidr,custid,type,city,description,notes,maskbits,circuitid)".
     265                " (cidr,custid,type,city,description,notes,maskbits,circuitid,privdata)".
    266266                " values ('$cidr','$custid','$type','$city','$desc','$notes',".
    267                 $cidr->masklen.",'$circid')");
     267                $cidr->masklen.",'$circid','$privdata')");
    268268          $sth->execute;
    269269
     
    361361          # Insert the allocations entry
    362362          $sth = $dbh->prepare("insert into allocations (cidr,custid,type,city,".
    363                 "description,notes,maskbits,circuitid)".
     363                "description,notes,maskbits,circuitid,privdata)".
    364364                " values ('$cidr','$custid','$type','$city','$desc','$notes',".
    365                 $cidr->masklen.",'$circid')");
     365                $cidr->masklen.",'$circid','$privdata')");
    366366          $sth->execute;
    367367
  • branches/privdata/cgi-bin/main.cgi

    r280 r282  
    626626  }
    627627  $html =~ s|\$\$ALLCITIES\$\$|$cities|g;
     628
     629  my $i = 0;
     630  $i++ if $webvar{fbtype} eq 'y';
     631  # Check to see if user is allowed to do anything with sensitive data
     632  my $privdata = '';
     633  if ($IPDBacl{$authuser} =~ /s/) {
     634    $privdata = qq(<tr class="color).($i%2).qq("><td>Restricted data:</td>).
     635        qq(<td class=regular><textarea rows="3" cols="64" name="privdata" class="regular">).
     636        qq(</textarea></td></tr>\n);
     637    $i++;
     638  }
     639  $html =~ s/\$\$PRIVDATA\$\$/$privdata/g;
     640
     641  $i = $i % 2;
     642  $html =~ s/\$\$BUTTONROWCOLOUR\$\$/color$i/;
    628643
    629644  print $html;
     
    789804  $html =~ s|\$\$ACTION\$\$|insert|g;
    790805
     806  my $i=1;
     807  # Check to see if user is allowed to do anything with sensitive data
     808  my $privdata = '';
     809  if ($IPDBacl{$authuser} =~ /s/) {
     810    $privdata = qq(<tr class="color).($i%2).qq("><td>Restricted data:</td>).
     811        qq(<td class=regular>$webvar{privdata}).
     812        qq(<input type=hidden name=privdata value="$webvar{privdata}"></td></tr>\n);
     813    $i++;
     814  }
     815  $html =~ s/\$\$PRIVDATA\$\$/$privdata/g;
     816
     817  $i = $i % 2;
     818  $html =~ s/\$\$BUTTONROWCOLOUR\$\$/color$i/;
     819
    791820  print $html;
    792821
     
    803832  return if !validateInput();
    804833
     834  if (!defined($webvar{privdata})) {
     835    $webvar{privdata} = '';
     836  }
    805837  # $code is "success" vs "failure", $msg contains OK for a
    806838  # successful netblock allocation, the IP allocated for static
     
    808840  my ($code,$msg) = allocateBlock($ip_dbh, $webvar{fullcidr}, $webvar{alloc_from},
    809841        $webvar{custid}, $webvar{alloctype}, $webvar{city}, $webvar{desc}, $webvar{notes},
    810         $webvar{circid});
     842        $webvar{circid}, $webvar{privdata});
    811843
    812844  if ($code eq 'OK') {
     
    11051137  }
    11061138
    1107   my ($cidr, $custid, $type, $city, $circid, $desc, $notes, $alloctype);
     1139  my ($cidr, $custid, $type, $city, $circid, $desc, $notes, $alloctype, $privdata);
    11081140
    11091141  if ($webvar{alloctype} eq 'rm') {
  • branches/privdata/confirm.html

    r74 r282  
    2121<td valign="top">Notes:&nbsp</td><td>&nbsp;$$NOTES$$<input type="hidden" name="notes" value="$$NOTES$$"></td>
    2222</tr>
     23$$PRIVDATA$$
    2324<!-- warn -->
    2425<input type="hidden" name="alloctype" value="$$ALLOC_TYPE$$">
    2526<input type="hidden" name="action" value="$$ACTION$$">
    26 <tr class="color1">
     27<tr class="$$BUTTONROWCOLOUR$$">
    2728<td class="center" colspan="2">
    2829<input type="button" value="Back" onclick="history.go(-1)"><input type="submit" value="Confirm">
  • branches/privdata/fb-assign.html

    r187 r282  
    2222</tr><tr class="color2">
    2323<td>Notes:&nbsp;</td><td><textarea name="notes" rows="3" cols="40"></textarea></td>
    24 </tr><tr class="color1">
     24</tr>
     25$$PRIVDATA$$
     26<tr class="$$BUTTONROWCOLOUR$$">
    2527<td class="center" colspan="2"><input type="submit" value="  Assign  "></td>
    2628<input type="hidden" name="action" value="confirm">
Note: See TracChangeset for help on using the changeset viewer.