Changeset 397 for trunk/cgi-bin/main.cgi
- Timestamp:
- 05/10/10 17:33:13 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 };
Note:
See TracChangeset
for help on using the changeset viewer.