Changeset 244 for branches/stable/cgi-bin/main.cgi
- Timestamp:
- 04/27/05 17:27:22 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/cgi-bin/main.cgi
r242 r244 606 606 qq($master ($data[0]):</div></center><br>\n); 607 607 608 startTable('CIDR allocation','Customer Location','Type','CustID',' Description/Name');608 startTable('CIDR allocation','Customer Location','Type','CustID','SWIPed?','Description/Name'); 609 609 610 610 # 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". 612 612 " from allocations where cidr <<= '$master' order by cidr"); 613 613 $sth->execute(); … … 615 615 my $count=0; 616 616 while (my @data = $sth->fetchrow_array()) { 617 # cidr,city,type,custid, description, as per the SELECT617 # cidr,city,type,custid,swip,description, as per the SELECT 618 618 my $cidr = new NetAddr::IP $data[0]; 619 619 … … 624 624 my @row = ( (($data[2] =~ /^.r$/) ? 'Sub ' : ''). 625 625 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]); 627 628 # If the allocation is a pool, allow listing of the IPs in the pool. 628 629 if ($data[2] =~ /^.[pd]$/) { … … 1114 1115 $sql = "select ip,custid,type,city,circuitid,description,notes from poolips where ip='$webvar{block}'"; 1115 1116 } 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}'" 1117 1118 } 1118 1119 … … 1174 1175 } 1175 1176 1177 ## Hack time! SWIP isn't going to stay, so I'm not going to integrate it with ACLs. 1178 if ($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 1176 1186 # More ACL trickery - we can live with forms that don't submit, 1177 1187 # but we can't leave the extra table rows there, and we *really* … … 1222 1232 $sql = "update allocations set custid='$webvar{custid}',". 1223 1233 "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}'"; 1225 1237 } 1226 1238 # Log the details of the change. … … 1245 1257 my $html = join('', <HTML>); 1246 1258 1259 my $swiptmp = ($webvar{swip} eq 'on' ? 'Yes' : 'No'); 1247 1260 $html =~ s/\$\$BLOCK\$\$/$webvar{block}/g; 1248 1261 $webvar{city} = desanitize($webvar{city}); … … 1251 1264 $html =~ s/\$\$TYPEFULL\$\$/$disp_alloctypes{$webvar{alloctype}}/g; 1252 1265 $html =~ s/\$\$CUSTID\$\$/$webvar{custid}/g; 1266 $html =~ s/\$\$SWIP\$\$/$swiptmp/g; 1253 1267 $webvar{circid} = desanitize($webvar{circid}); 1254 1268 $html =~ s/\$\$CIRCID\$\$/$webvar{circid}/g;
Note:
See TracChangeset
for help on using the changeset viewer.