Changeset 534 for trunk/cgi-bin/main.cgi
- Timestamp:
- 10/31/12 16:51:18 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/main.cgi
r533 r534 638 638 sub edit { 639 639 640 my $sql; 641 642 # Two cases: block is a netblock, or block is a static IP from a pool 643 # because I'm lazy, we'll try to make the SELECT's bring out identical)ish) data 644 ##fixme: allow "SWIP" (publication to rWHOIS) of static IP data 645 if ($webvar{block} =~ /\/32$/) { 646 $sql = "select ip,custid,type,city,circuitid,description,notes,modifystamp,privdata from poolips where ip='$webvar{block}'"; 647 } else { 648 $sql = "select cidr,custid,type,city,circuitid,description,notes,modifystamp,privdata,swip from allocations where cidr='$webvar{block}'" 649 } 650 651 # gotta snag block info from db 652 $sth = $ip_dbh->prepare($sql); 653 $sth->execute; 654 my @data = $sth->fetchrow_array; 655 656 # Clean up extra whitespace on alloc type 657 $data[2] =~ s/\s//; 658 659 # We can't let the city be changed here; this block is a part of 660 # a larger routed allocation and therefore by definition can't be moved. 661 # block and city are static. 662 ##fixme 663 # Needs thinking. Have to allow changes to city to correct errors, no? 664 # Also have areas where a routed block at a POP serves "many" cities/towns/named crossroads 665 666 # @data: cidr,custid,type,city,circuitid,description,notes,modifystamp,privdata,swip 640 # snag block info from db 641 my $blockinfo = getBlockData($ip_dbh, $webvar{block}); 642 643 # Clean up extra whitespace on alloc type. Mainly a legacy-data cleanup. 644 $blockinfo->{type} =~ s/\s//; 667 645 668 646 $page->param(block => $webvar{block}); 669 647 670 $page->param(custid => $data[1]);671 $page->param(city => $data[3]);672 $page->param(circid => $data[4]);673 $page->param(desc => $data[5]);674 $page->param(notes => $data[6]);648 $page->param(custid => $blockinfo->{custid}); 649 $page->param(city => $blockinfo->{city}); 650 $page->param(circid => $blockinfo->{circuitid}); 651 $page->param(desc => $blockinfo->{description}); 652 $page->param(notes => $blockinfo->{notes}); 675 653 676 654 ##fixme The check here should be built from the database 677 655 # Need to expand to support pool types too 678 if ($ data[2]=~ /^.[ne]$/ && $IPDBacl{$authuser} =~ /c/) {656 if ($blockinfo->{type} =~ /^.[ne]$/ && $IPDBacl{$authuser} =~ /c/) { 679 657 $page->param(changetype => 1); 680 658 $page->param(alloctype => [ 681 { selme => ($ data[2]eq 'me'), type => "me", disptype => "Dialup netblock" },682 { selme => ($ data[2]eq 'de'), type => "de", disptype => "Dynamic DSL netblock" },683 { selme => ($ data[2]eq 'ce'), type => "ce", disptype => "Dynamic cable netblock" },684 { selme => ($ data[2]eq 'we'), type => "we", disptype => "Dynamic wireless netblock" },685 { selme => ($ data[2]eq 'cn'), type => "cn", disptype => "Customer netblock" },686 { selme => ($ data[2]eq 'en'), type => "en", disptype => "End-use netblock" },687 { selme => ($ data[2]eq 'in'), type => "in", disptype => "Internal netblock" },659 { selme => ($blockinfo->{type} eq 'me'), type => "me", disptype => "Dialup netblock" }, 660 { selme => ($blockinfo->{type} eq 'de'), type => "de", disptype => "Dynamic DSL netblock" }, 661 { selme => ($blockinfo->{type} eq 'ce'), type => "ce", disptype => "Dynamic cable netblock" }, 662 { selme => ($blockinfo->{type} eq 'we'), type => "we", disptype => "Dynamic wireless netblock" }, 663 { selme => ($blockinfo->{type} eq 'cn'), type => "cn", disptype => "Customer netblock" }, 664 { selme => ($blockinfo->{type} eq 'en'), type => "en", disptype => "End-use netblock" }, 665 { selme => ($blockinfo->{type} eq 'in'), type => "in", disptype => "Internal netblock" }, 688 666 ] 689 667 ); 690 668 } else { 691 $page->param(disptype => $disp_alloctypes{$ data[2]});692 $page->param(type => $ data[2]);669 $page->param(disptype => $disp_alloctypes{$blockinfo->{type}}); 670 $page->param(type => $blockinfo->{type}); 693 671 } 694 672 … … 697 675 $page->param(havenodeid => $nodeid); 698 676 699 if ($ data[2] eq 'fr' || $data[2]eq 'bi') {677 if ($blockinfo->{type} eq 'fr' || $blockinfo->{type} eq 'bi') { 700 678 $page->param(typesupportsnodes => 1); 701 679 $page->param(nodename => $nodename); … … 715 693 ## end node hack 716 694 717 my ($lastmod,undef) = split /\s+/, $ data[7];695 my ($lastmod,undef) = split /\s+/, $blockinfo->{lastmod}; 718 696 $page->param(lastmod => $lastmod); 719 697 720 698 # not happy with the upside-down logic, but... 721 $page->param(swipable => $ data[2]!~ /.i/);722 $page->param(swip => $ data[10] ne 'n');699 $page->param(swipable => $blockinfo->{type} !~ /.i/); 700 $page->param(swip => $blockinfo->{swip} ne 'n') if $blockinfo->{swip}; 723 701 724 702 # Check to see if we can display sensitive data 725 703 $page->param(nocling => $IPDBacl{$authuser} =~ /s/); 726 $page->param(privdata => $ data[8]);704 $page->param(privdata => $blockinfo->{privdata}); 727 705 728 706 # ACL trickery - these two template booleans control the presence of all form/input tags
Note:
See TracChangeset
for help on using the changeset viewer.