Changeset 394 for branches/stable/cgi-bin/main.cgi
- Timestamp:
- 02/19/10 13:10:34 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 };
Note:
See TracChangeset
for help on using the changeset viewer.