- Timestamp:
- 10/19/12 16:15:59 (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r518 r519 26 26 %allocated %free %routed %bigfree %IPDBacl %aclmsg 27 27 &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock &addMaster 28 &deleteBlock &getBlockData &mailNotify 28 &deleteBlock &getBlockData 29 &getNodeList 30 &mailNotify 29 31 ); 30 32 … … 34 36 @masterblocks %allocated %free %routed %bigfree %IPDBacl %aclmsg 35 37 &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock 36 &addMaster &deleteBlock &getBlockData &mailNotify 38 &addMaster &deleteBlock &getBlockData 39 &getNodeList 40 &mailNotify 37 41 )] 38 42 ); … … 832 836 833 837 838 ## IPDB::getNodeList() 839 # Gets a list of node ID+name pairs as an arrayref to a list of hashrefs 840 sub getNodeList { 841 my $dbh = shift; 842 843 my $ret = $dbh->selectall_arrayref("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id", 844 { Slice => {} }); 845 return $ret; 846 } # end getNodeList() 847 848 834 849 ## IPDB::mailNotify() 835 850 # Sends notification mail to recipients regarding an IPDB operation -
trunk/cgi-bin/main.cgi
r517 r519 155 155 } 156 156 elsif ($webvar{action} eq 'nodesearch') { 157 $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id"); 158 $sth->execute() or $page->param(errmsg => $sth->errstr); 159 my @nodelist; 160 while (my ($nid,$nname) = $sth->fetchrow_array()) { 161 my %row = (nodeid => $nid, nodename => $nname); 162 push @nodelist, \%row; 163 } 164 $page->param(nodelist => \@nodelist); 157 my $nodelist = getNodeList($ip_dbh); 158 $page->param(nodelist => $nodelist); 165 159 } 166 160 … … 201 195 } 202 196 203 197 $sth->finish if $sth; 204 198 # Clean up IPDB globals, DB handle, etc. 205 199 finish($ip_dbh); -
trunk/templates/nodesearch.tmpl
r517 r519 11 11 <td><select name="node"> 12 12 <option>--</option> 13 <TMPL_LOOP NAME=nodelist> <option value="<TMPL_VAR NAME=node id>"><TMPL_VAR NAME=nodename></option>13 <TMPL_LOOP NAME=nodelist> <option value="<TMPL_VAR NAME=node_id>"><TMPL_VAR NAME=node_name></option> 14 14 </TMPL_LOOP> 15 15 </select></td>
Note:
See TracChangeset
for help on using the changeset viewer.