Changeset 397
- Timestamp:
- 05/10/10 17:33:13 (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/assign.html
r345 r397 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> -
trunk/cgi-bin/IPDB.pm
r371 r397 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 -
trunk/cgi-bin/ipdb.psql
r388 r397 213 213 "auto" character(1) DEFAULT 'y' 214 214 ); 215 216 -- Network nodes - allows finding customers affected by a broken <x> quickly 217 CREATE TABLE noderef ( 218 block inet NOT NULL PRIMARY KEY, 219 node_id integer 220 ); 221 222 CREATE TABLE nodes ( 223 node_id serial NOT NULL PRIMARY KEY, 224 node_type character varying(2), 225 node_name character varying(40), 226 node_ip inet 227 ); -
trunk/cgi-bin/main.cgi
r380 r397 126 126 elsif($webvar{action} eq 'finaldelete') { 127 127 finalDelete(); 128 } 129 elsif ($webvar{action} eq 'nodesearch') { 130 open HTML, "<../nodesearch.html"; 131 my $html = join('',<HTML>); 132 close HTML; 133 134 $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id"); 135 $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n"; 136 my $nodes = ''; 137 while (my ($nid,$nname) = $sth->fetchrow_array()) { 138 $nodes .= "<option value='$nid'>$nname</option>\n"; 139 } 140 $html =~ s/\$\$NODELIST\$\$/$nodes/; 141 142 print $html; 128 143 } 129 144 … … 613 628 } 614 629 $html =~ s|\$\$ALLCITIES\$\$|$cities|g; 630 631 ## node hack 632 $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id"); 633 $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n"; 634 my $nodes = ''; 635 while (my ($nid,$nname) = $sth->fetchrow_array()) { 636 $nodes .= "<option value='$nid'>$nname</option>\n"; 637 } 638 $html =~ s/\$\$NODELIST\$\$/$nodes/; 639 ## end node hack 615 640 616 641 my $i = 0; … … 779 804 close HTML; 780 805 806 ## node hack 807 if ($webvar{node} && $webvar{node} ne '-') { 808 $sth = $ip_dbh->prepare("SELECT node_name FROM nodes WHERE node_id=?"); 809 $sth->execute($webvar{node}); 810 my ($nodename) = $sth->fetchrow_array(); 811 $html =~ s/\$\$NODENAME\$\$/$nodename/; 812 $html =~ s/\$\$NODEID\$\$/$webvar{node}/; 813 } else { 814 $html =~ s/\$\$NODENAME\$\$//; 815 $html =~ s/\$\$NODEID\$\$//; 816 } 817 ## end node hack 818 781 819 ### gotta fix this in final 782 820 # Stick in customer info as necessary - if it's blank, it just ends … … 841 879 my ($code,$msg) = allocateBlock($ip_dbh, $webvar{fullcidr}, $webvar{alloc_from}, 842 880 $webvar{custid}, $webvar{alloctype}, $webvar{city}, $webvar{desc}, $webvar{notes}, 843 $webvar{circid}, $webvar{privdata} );881 $webvar{circid}, $webvar{privdata}, $webvar{node}); 844 882 845 883 if ($code eq 'OK') { … … 1006 1044 $html =~ s/\$\$TYPESELECT\$\$/$disp_alloctypes{$data[2]}<input type=hidden name=alloctype value="$data[2]">/g; 1007 1045 } 1046 ## node hack 1047 $sth = $ip_dbh->prepare("SELECT node_id FROM noderef WHERE block='$webvar{block}'"); 1048 $sth->execute; 1049 my ($nodeid) = $sth->fetchrow_array(); 1050 if ($nodeid) { 1051 $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id"); 1052 $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n"; 1053 my $nodes = "<select name=node>\n"; 1054 while (my ($nid,$nname) = $sth->fetchrow_array()) { 1055 $nodes .= "<option".($nodeid == $nid ? ' selected' : '')." value='$nid'>$nname</option>\n"; 1056 } 1057 $nodes .= "</select>\n"; 1058 $html =~ s/\$\$NODE\$\$/$nodes/; 1059 } else { 1060 if ($data[2] eq 'fr' || $data[2] eq 'bi') { 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<option value=>--</option>\n"; 1064 while (my ($nid,$nname) = $sth->fetchrow_array()) { 1065 $nodes .= "<option value='$nid'>$nname</option>\n"; 1066 } 1067 $nodes .= "</select>\n"; 1068 $html =~ s/\$\$NODE\$\$/$nodes/; 1069 } else { 1070 $html =~ s|\$\$NODE\$\$|N/A|; 1071 } 1072 } 1073 ## end node hack 1008 1074 $html =~ s/\$\$OLDCUSTID\$\$/$data[9]/g; 1009 1075 $html =~ s/\$\$CITY\$\$/<input type=text name=city value="$data[3]">/g; … … 1012 1078 $html =~ s|\$\$NOTES\$\$|<textarea rows="8" cols="64" name="notes" class="regular">$data[6]</textarea>|g; 1013 1079 } else { 1080 ## node hack 1081 if ($data[2] eq 'fr' || $data[2] eq 'bi') { 1082 $sth = $ip_dbh->prepare("SELECT node_name FROM nodes INNER JOIN noderef". 1083 " ON nodes.node_id=noderef.node_id WHERE noderef.block='$webvar{block}'"); 1084 $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n"; 1085 my ($node) = $sth->fetchrow_array; 1086 $html =~ s/\$\$NODE\$\$/$node/; 1087 } else { 1088 $html =~ s|\$\$NODE\$\$|N/A|; 1089 } 1090 ## end node hack 1014 1091 $html =~ s/\$\$CUSTID\$\$/$data[1]/g; 1015 1092 $html =~ s/\$\$OLDCUSTID\$\$/$data[9]/g; … … 1110 1187 $sth = $ip_dbh->prepare($sql); 1111 1188 $sth->execute; 1189 ## node hack 1190 if ($webvar{node}) { 1191 $ip_dbh->do("DELETE FROM noderef WHERE block='$webvar{block}'"); 1192 $sth = $ip_dbh->prepare("INSERT INTO noderef (block,node_id) VALUES (?,?)"); 1193 $sth->execute($webvar{block},$webvar{node}); 1194 } 1195 ## end node hack 1112 1196 $ip_dbh->commit; 1113 1197 }; -
trunk/cgi-bin/search.cgi
r382 r397 187 187 printError "No matches found. Try eliminating one of the criteria,". 188 188 " or making one or more criteria more general."; 189 } else { 190 # Add the limit/offset clauses 191 $sql .= " order by cidr"; 192 $sql .= " limit $RESULTS_PER_PAGE offset $offset" if $RESULTS_PER_PAGE != 0; 193 # And tell the user. 194 print "<div class=heading>Searching...............</div>\n"; 195 queryResults($sql, $webvar{page}, $count); 196 } 197 198 } elsif ($webvar{stype} eq 'n') { 199 # Node search. 200 201 my $sql = "SELECT cidr,custid,type,city,description FROM searchme". 202 " WHERE cidr IN (SELECT block FROM noderef WHERE node_id=$webvar{node})"; 203 204 # Find the offset for multipage results 205 my $offset = ($webvar{page}-1)*$RESULTS_PER_PAGE; 206 207 # Find out how many rows the "core" query will return. 208 my $count = countRows($sql); 209 210 if ($count == 0) { 211 printError "No customers currently listed as connected through this node."; 189 212 } else { 190 213 # Add the limit/offset clauses -
trunk/confirm.html
r345 r397 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> -
trunk/editDisplay.html
r320 r397 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> -
trunk/fb-assign.html
r345 r397 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"> -
trunk/header.inc
r380 r397 60 60 </tr> 61 61 </tbody></table> 62 <table width="98%" border=0><tr><td align=right><a href="javascript:popNotes('/ip/changes.html')">Recent Changes</a></td></tr></table> 62 <table width="98%" border=0><tr><td align=right> 63 <a href="/ip/cgi-bin/main.cgi?action=nodesearch">Find by connection point</a> 64 <a href="javascript:popNotes('/ip/changes.html')">Recent Changes</a> 65 </td></tr></table> 63 66 <br> -
trunk/ipdb.css
r371 r397 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.