Changeset 394
- Timestamp:
- 02/19/10 13:10:34 (15 years ago)
- Location:
- branches/stable
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/assign.html
r286 r394 24 24 </tr><tr class="color1"> 25 25 <td>Route from/through: </td><td> 26 <select name="pop"><option selected >-</option>26 <select name="pop"><option selected value=>-</option> 27 27 $$POPLIST$$ 28 28 </select> 29 29 </td> 30 </tr><tr class="color2"> 30 </tr> 31 <tr class="hack"><td>Wifi tower/Fibre demarc</td><td> 32 <select name="node"><option selected>-</option> 33 $$NODELIST$$ 34 </select> 35 <a href="javascript:popNotes('/ip/newnode.html')">Add new location</a> 36 </td></tr> 37 <tr class="color2"> 31 38 <td>Route/allocate from this master: </td><td>$$MASTERLIST$$ 32 39 Allow automatic allocation from private IP ranges:<input type=checkbox name=allowpriv> -
branches/stable/cgi-bin/IPDB.pm
r387 r394 292 292 # Returns a success code and optional error message. 293 293 sub allocateBlock { 294 my ($dbh,undef,undef,$custid,$type,$city,$desc,$notes,$circid,$privdata ) = @_;294 my ($dbh,undef,undef,$custid,$type,$city,$desc,$notes,$circid,$privdata,$nodeid) = @_; 295 295 296 296 my $cidr = new NetAddr::IP $_[1]; … … 333 333 " where ip='$cidr'"); 334 334 $sth->execute; 335 # node hack 336 if ($nodeid && $nodeid ne '') { 337 $sth = $dbh->prepare("INSERT INTO noderef (block,node_id) VALUES (?,?)"); 338 $sth->execute("$cidr",$nodeid); 339 } 340 # end node hack 335 341 $dbh->commit; 336 342 }; … … 393 399 } # routing vs non-routing netblock 394 400 401 # node hack 402 if ($nodeid && $nodeid ne '') { 403 $sth = $dbh->prepare("INSERT INTO noderef (block,node_id) VALUES (?,?)"); 404 $sth->execute("$cidr",$nodeid); 405 } 406 # end node hack 395 407 $dbh->commit; 396 408 }; # end of eval … … 497 509 } # done with netblock alloctype != rm 498 510 511 # node hack 512 if ($nodeid && $nodeid ne '') { 513 $sth = $dbh->prepare("INSERT INTO noderef (block,node_id) VALUES (?,?)"); 514 $sth->execute("$cidr",$nodeid); 515 } 516 # end node hack 499 517 $dbh->commit; 500 518 }; # end eval -
branches/stable/cgi-bin/ipdb.psql
r377 r394 212 212 ); 213 213 214 -- Network nodes - allows finding customers affected by a broken <x> quickly 215 CREATE TABLE noderef ( 216 block inet NOT NULL PRIMARY KEY, 217 node_id integer 218 ); 219 220 CREATE TABLE nodes ( 221 node_id serial NOT NULL PRIMARY KEY, 222 node_type character varying(2), 223 node_name character varying(40), 224 node_ip inet 225 ); -
branches/stable/cgi-bin/main.cgi
r390 r394 614 614 } 615 615 $html =~ s|\$\$ALLCITIES\$\$|$cities|g; 616 617 ## node hack 618 $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id"); 619 $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n"; 620 my $nodes = ''; 621 while (my ($nid,$nname) = $sth->fetchrow_array()) { 622 $nodes .= "<option value='$nid'>$nname</option>\n"; 623 } 624 $html =~ s/\$\$NODELIST\$\$/$nodes/; 625 ## end node hack 616 626 617 627 my $i = 0; … … 780 790 close HTML; 781 791 792 ## node hack 793 if ($webvar{node} && $webvar{node} ne '-') { 794 $sth = $ip_dbh->prepare("SELECT node_name FROM nodes WHERE node_id=?"); 795 $sth->execute($webvar{node}); 796 my ($nodename) = $sth->fetchrow_array(); 797 $html =~ s/\$\$NODENAME\$\$/$nodename/; 798 $html =~ s/\$\$NODEID\$\$/$webvar{node}/; 799 } else { 800 $html =~ s/\$\$NODENAME\$\$//; 801 $html =~ s/\$\$NODEID\$\$//; 802 } 803 ## end node hack 804 782 805 ### gotta fix this in final 783 806 # Stick in customer info as necessary - if it's blank, it just ends … … 849 872 my ($code,$msg) = allocateBlock($ip_dbh, $webvar{fullcidr}, $webvar{alloc_from}, 850 873 $webvar{custid}, $webvar{alloctype}, $webvar{city}, $webvar{desc}, $webvar{notes}, 851 $webvar{circid}, $webvar{privdata} );874 $webvar{circid}, $webvar{privdata}, $webvar{node}); 852 875 853 876 if ($code eq 'OK') { … … 1031 1054 $html =~ s/\$\$TYPESELECT\$\$/$disp_alloctypes{$data[2]}<input type=hidden name=alloctype value="$data[2]">/g; 1032 1055 } 1056 ## node hack 1057 $sth = $ip_dbh->prepare("SELECT node_id FROM noderef WHERE block='$webvar{block}'"); 1058 $sth->execute; 1059 my ($nodeid) = $sth->fetchrow_array(); 1060 if ($nodeid) { 1061 $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id"); 1062 $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n"; 1063 my $nodes = "<select name=node>\n"; 1064 while (my ($nid,$nname) = $sth->fetchrow_array()) { 1065 $nodes .= "<option".($nodeid == $nid ? ' selected' : '')." value='$nid'>$nname</option>\n"; 1066 } 1067 $nodes .= "</select>\n"; 1068 $html =~ s/\$\$NODE\$\$/$nodes/; 1069 } else { 1070 if ($data[2] eq 'fr' || $data[2] eq 'bi') { 1071 $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id"); 1072 $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n"; 1073 my $nodes = "<select name=node>\n<option value=>--</option>\n"; 1074 while (my ($nid,$nname) = $sth->fetchrow_array()) { 1075 $nodes .= "<option value='$nid'>$nname</option>\n"; 1076 } 1077 $nodes .= "</select>\n"; 1078 $html =~ s/\$\$NODE\$\$/$nodes/; 1079 } else { 1080 $html =~ s|\$\$NODE\$\$|N/A|; 1081 } 1082 } 1083 ## end node hack 1033 1084 $html =~ s/\$\$OLDCUSTID\$\$/$data[9]/g; 1034 1085 $html =~ s/\$\$CITY\$\$/<input type=text name=city value="$data[3]">/g; … … 1037 1088 $html =~ s|\$\$NOTES\$\$|<textarea rows="8" cols="64" name="notes" class="regular">$data[6]</textarea>|g; 1038 1089 } else { 1090 ## node hack 1091 if ($data[2] eq 'fr' || $data[2] eq 'bi') { 1092 $sth = $ip_dbh->prepare("SELECT node_name FROM nodes INNER JOIN noderef". 1093 " ON nodes.node_id=noderef.node_id WHERE noderef.block='$webvar{block}'"); 1094 $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n"; 1095 my ($node) = $sth->fetchrow_array; 1096 $html =~ s/\$\$NODE\$\$/$node/; 1097 } else { 1098 $html =~ s|\$\$NODE\$\$|N/A|; 1099 } 1100 ## end node hack 1039 1101 $html =~ s/\$\$CUSTID\$\$/$data[1]/g; 1040 1102 $html =~ s/\$\$OLDCUSTID\$\$/$data[9]/g; … … 1135 1197 $sth = $ip_dbh->prepare($sql); 1136 1198 $sth->execute; 1199 ## node hack 1200 if ($webvar{node}) { 1201 $ip_dbh->do("DELETE FROM noderef WHERE block='$webvar{block}'"); 1202 $sth = $ip_dbh->prepare("INSERT INTO noderef (block,node_id) VALUES (?,?)"); 1203 $sth->execute($webvar{block},$webvar{node}); 1204 } 1205 ## end node hack 1137 1206 $ip_dbh->commit; 1138 1207 }; -
branches/stable/confirm.html
r286 r394 10 10 </tr><tr class="color1"> 11 11 <td>City: </td><td> $$CITY$$<input type="hidden" name="city" value="$$CITY$$"></td> 12 </tr><tr class="hack"> 13 <td>Demarc switch/wifi tower: </td><td> $$NODENAME$$<input type="hidden" name="node" value="$$NODEID$$"></td> 12 14 </tr><tr class="color2"> 13 15 <td>Allocation type: </td><td> $$TYPEFULL$$</td> -
branches/stable/editDisplay.html
r318 r394 11 11 12 12 <tr class="color1"><td class=heading>Type:</td><td class=regular>$$TYPESELECT$$</td></tr> 13 14 <tr class="hack"><td class=heading>Demarc/tower:</td><td class=regular>$$NODE$$</td></tr> 13 15 14 16 <tr class="color2"><td class=heading>CustID:</td><td class="regular">$$CUSTID$$</td></tr> -
branches/stable/fb-assign.html
r286 r394 18 18 </tr><tr class="color2"> 19 19 <td>Customer ID: </td><td><input type="text" name="custid" size="15" maxlength="15"> (Only required for Customer allocations)</td> 20 </tr><tr class="color1"> 20 </tr> 21 <tr class="hack"><td>Wifi tower/Fibre demarc</td><td> 22 <select name="node"><option selected>-</option> 23 $$NODELIST$$ 24 </select> 25 <a href="javascript:popNotes('/ip/newnode.html')">Add new location</a> 26 </td></tr> 27 <tr class="color1"> 21 28 <td valign="top">Description/Name: </td><td><input name="desc" size=40></td> 22 29 </tr><tr class="color2"> -
branches/stable/ipdb.css
r360 r394 33 33 tr.color2 { 34 34 background-color: #A8C4D0; 35 font-family: Verdana, Arial, Helvetica, sans-serif; 36 font-size: 90%; 37 } 38 39 tr.hack { 40 background-color: #E4EEE8; 35 41 font-family: Verdana, Arial, Helvetica, sans-serif; 36 42 font-size: 90%;
Note:
See TracChangeset
for help on using the changeset viewer.