Changeset 98 for branches/stable/cgi-bin/main.cgi
- Timestamp:
- 12/02/04 16:02:23 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/cgi-bin/main.cgi
r97 r98 71 71 my @citylist; 72 72 my @poplist; 73 my %disp_alloctypes; 74 my %list_alloctypes; 73 75 my %allocated; # Count for allocated blocks in a master block 74 76 my %free; # Count for free blocks (routed and unrouted) in a master block … … 104 106 if ($data[1] eq 'y') { 105 107 $poplist[$j++] = $data[0]; 108 } 109 } 110 111 # Initialize alloctypes hashes 112 $sth = $ip_dbh->prepare("select * from alloctypes order by listorder"); 113 $sth->execute; 114 while (my @data = $sth->fetchrow_array) { 115 $disp_alloctypes{$data[0]} = $data[2]; 116 if ($data[3] < 900) { 117 $list_alloctypes{$data[0]} = $data[1]; 106 118 } 107 119 } … … 375 387 } 376 388 my @row = (qq(<a href="/ip/cgi-bin/main.cgi?action=edit&block=$data[0]">$data[0]</a>), 377 $data[1], $ full_alloc_types{$data[2]}, $data[3], $data[4]);389 $data[1], $disp_alloctypes{$data[2]}, $data[3], $data[4]); 378 390 # Allow listing of pool if desired/required. 379 391 if ($data[2] =~ /^[cdsmw]p$/) { … … 664 676 665 677 my @row = ("<a href=\"/ip/cgi-bin/main.cgi?action=edit&block=$data[0]\">$data[0]</a>", 666 $data[3], $ full_alloc_types{$data[2]}, $data[1], $data[4]);678 $data[3], $disp_alloctypes{$data[2]}, $data[1], $data[4]); 667 679 # If the allocation is a pool, allow listing of the IPs in the pool. 668 680 if ($data[2] =~ /^[cdsmw]p$/) { … … 731 743 732 744 print qq(<center><div class="heading">Listing pool IPs for $cidr<br>\n). 733 qq(($ full_alloc_types{$type} in $data[3])</div></center><br>\n);745 qq(($disp_alloctypes{$type} in $data[3])</div></center><br>\n); 734 746 print qq(<div class="indent"><b>Reserved IPs:</b><br>\n); 735 747 print qq(<div class="indent"><table><tr class=color1><td>Network IP:</td><td>). … … 789 801 $html =~ s|\$\$BLOCK\$\$|$block|g; 790 802 $html =~ s|\$\$MASKBITS\$\$|$block->masklen|; 803 my $typelist = ''; 804 $sth = $ip_dbh->prepare("select type,listname from alloctypes where listorder < 500 and type not like '_i' order by listorder"); 805 $sth->execute; 806 my @data = $sth->fetchrow_array; 807 $typelist .= "<option value='$data[0]' selected>$data[1]</option>\n"; 808 while (my @data = $sth->fetchrow_array) { 809 $typelist .= "<option value='$data[0]'>$data[1]</option>\n"; 810 } 811 $html =~ s|\$\$TYPELIST\$\$|$typelist|g; 791 812 } else { 792 813 open HTML, "../assign.html" … … 805 826 } 806 827 $html =~ s|\$\$POPLIST\$\$|$pops|g; 828 my $typelist = ''; 829 $sth = $ip_dbh->prepare("select type,listname from alloctypes where listorder < 900 order by listorder"); 830 $sth->execute; 831 my @data = $sth->fetchrow_array; 832 $typelist .= "<option value='$data[0]' selected>$data[1]</option>\n"; 833 while (my @data = $sth->fetchrow_array) { 834 $typelist .= "<option value='$data[0]'>$data[1]</option>\n"; 835 } 836 $html =~ s|\$\$TYPELIST\$\$|$typelist|g; 807 837 } 808 838 my $cities = ''; … … 956 986 # Stick in the allocation data 957 987 $html =~ s|\$\$ALLOC_TYPE\$\$|$webvar{alloctype}|g; 958 $html =~ s|\$\$TYPEFULL\$\$|$ full_alloc_types{$webvar{alloctype}}|g;988 $html =~ s|\$\$TYPEFULL\$\$|$disp_alloctypes{$webvar{alloctype}}|g; 959 989 $html =~ s|\$\$ALLOC_FROM\$\$|$alloc_from|g; 960 990 $html =~ s|\$\$CIDR\$\$|$cidr|g; … … 1019 1049 syslog "notice", "$authuser allocated $cidr to $webvar{custid}"; 1020 1050 # Notify tech@example.com 1021 mailNotify('tech@example.com',"$ full_alloc_types{$webvar{alloctype}} allocation",1022 "$ full_alloc_types{$webvar{alloctype}} $cidr allocated to customer $webvar{custid}");1051 mailNotify('tech@example.com',"$disp_alloctypes{$webvar{alloctype}} allocation", 1052 "$disp_alloctypes{$webvar{alloctype}} $cidr allocated to customer $webvar{custid}"); 1023 1053 1024 1054 } else { # end IP-from-pool allocation … … 1070 1100 syslog "err", "Allocation of '$webvar{fullcidr}' to '$webvar{custid}' as ". 1071 1101 "'$webvar{alloctype}' by $authuser failed: '$@'"; 1072 printAndExit("Allocation of $cidr as $ full_alloc_types{$webvar{alloctype}} failed.\n");1102 printAndExit("Allocation of $cidr as $disp_alloctypes{$webvar{alloctype}} failed.\n"); 1073 1103 } 1074 1104 … … 1136 1166 syslog "err", "Allocation of '$webvar{fullcidr}' to '$webvar{custid}' as ". 1137 1167 "'$webvar{alloctype}' by $authuser failed: '$@'"; 1138 printAndExit("Allocation of $cidr as $ full_alloc_types{$webvar{alloctype}} failed.\n");1168 printAndExit("Allocation of $cidr as $disp_alloctypes{$webvar{alloctype}} failed.\n"); 1139 1169 } 1140 1170 syslog "notice", "$authuser allocated '$webvar{fullcidr}' to '$webvar{custid}' as '$webvar{alloctype}'"; … … 1161 1191 eval { $ip_dbh->rollback; }; 1162 1192 syslog "err", "Initialization of pool '$webvar{fullcidr}' by $authuser failed: '$@'"; 1163 printAndExit("$ full_alloc_types{$webvar{alloctype}} $webvar{fullcidr} not completely initialized.");1164 } 1165 syslog "notice", "$ full_alloc_types{$webvar{alloctype}} '$webvar{fullcidr}' successfully initialized by $authuser";1166 1167 print qq(<div class="center"><div class="heading">The block $webvar{fullcidr} was sucessfully added as type '$webvar{alloctype}' ($ full_alloc_types{$webvar{alloctype}})</div></div>);1193 printAndExit("$disp_alloctypes{$webvar{alloctype}} $webvar{fullcidr} not completely initialized."); 1194 } 1195 syslog "notice", "$disp_alloctypes{$webvar{alloctype}} '$webvar{fullcidr}' successfully initialized by $authuser"; 1196 1197 print qq(<div class="center"><div class="heading">The block $webvar{fullcidr} was sucessfully added as type '$webvar{alloctype}' ($disp_alloctypes{$webvar{alloctype}})</div></div>); 1168 1198 1169 1199 } # end static-IP vs netblock allocation … … 1284 1314 $html =~ s/\$\$TYPESELECT\$\$/$blockoptions/g; 1285 1315 } else { 1286 $html =~ s/\$\$TYPESELECT\$\$/$ full_alloc_types{$data[2]}<input type=hidden name=alloctype value="$data[2]">/g;1316 $html =~ s/\$\$TYPESELECT\$\$/$disp_alloctypes{$data[2]}<input type=hidden name=alloctype value="$data[2]">/g; 1287 1317 } 1288 1318 … … 1343 1373 $html =~ s/\$\$CITY\$\$/$webvar{city}/g; 1344 1374 $html =~ s/\$\$ALLOCTYPE\$\$/$webvar{alloctype}/g; 1345 $html =~ s/\$\$TYPEFULL\$\$/$ full_alloc_types{$webvar{alloctype}}/g;1375 $html =~ s/\$\$TYPEFULL\$\$/$disp_alloctypes{$webvar{alloctype}}/g; 1346 1376 $html =~ s/\$\$CUSTID\$\$/$webvar{custid}/g; 1347 1377 $webvar{circid} = desanitize($webvar{circid}); … … 1426 1456 $html =~ s|Please confirm|Please confirm <b>removal</b> of|; 1427 1457 $html =~ s|\$\$BLOCK\$\$|$cidr|g; 1428 $html =~ s|\$\$TYPEFULL\$\$|$ full_alloc_types{$alloctype}|g;1458 $html =~ s|\$\$TYPEFULL\$\$|$disp_alloctypes{$alloctype}|g; 1429 1459 $html =~ s|\$\$ALLOCTYPE\$\$|$alloctype|g; 1430 1460 $html =~ s|\$\$CITY\$\$|$city|g;
Note:
See TracChangeset
for help on using the changeset viewer.