Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r325 r326 44 44 &getGroupCount &getGroupList 45 45 &addUser &updateUser &delUser &userFullName &userStatus &getUserData 46 &getUserCount &getUserList 46 &getUserCount &getUserList &getUserDropdown 47 47 &getSOA &updateSOA &getRecLine &getDomRecs &getRecCount 48 48 &addRec &updateRec &delRec … … 69 69 &getGroupCount &getGroupList 70 70 &addUser &updateUser &delUser &userFullName &userStatus &getUserData 71 &getUserCount &getUserList 71 &getUserCount &getUserList &getUserDropdown 72 72 &getSOA &updateSOA &getRecLine &getDomRecs &getRecCount 73 73 &addRec &updateRec &delRec … … 2427 2427 return $ulist; 2428 2428 } # end getUserList() 2429 2430 2431 ## DNSDB::getUserDropdown() 2432 # Get a list of usernames for use in a dropdown menu. 2433 # Takes a database handle, current group, and optional "tag this as selected" flag. 2434 # Returns a reference to a list of hashrefs suitable to feeding to HTML::Template 2435 sub getUserDropdown { 2436 my $dbh = shift; 2437 my $grp = shift; 2438 my $sel = shift || 0; 2439 2440 my $sth = $dbh->prepare("SELECT username,user_id FROM users WHERE group_id=?"); 2441 $sth->execute($grp); 2442 2443 my @userlist; 2444 while (my ($username,$uid) = $sth->fetchrow_array) { 2445 my %row = ( 2446 username => $username, 2447 uid => $uid, 2448 selected => ($sel == $uid ? 1 : 0) 2449 ); 2450 push @userlist, \%row; 2451 } 2452 return \@userlist; 2453 } # end getUserDropdown() 2429 2454 2430 2455 -
trunk/dns.cgi
r325 r326 1828 1828 1829 1829 sub fill_clonemelist { 1830 my $sth = $dbh->prepare("SELECT username,user_id FROM users WHERE group_id=$curgroup");1831 $sth->execute;1832 1833 1830 # shut up some warnings, but don't stomp on caller's state 1834 1831 local $webvar{clonesrc} = 0 if !defined($webvar{clonesrc}); 1835 1832 1836 my @clonesrc; 1837 while (my ($username,$uid) = $sth->fetchrow_array) { 1838 my %row = ( 1839 username => $username, 1840 uid => $uid, 1841 selected => ($webvar{clonesrc} == $uid ? 1 : 0) 1842 ); 1843 push @clonesrc, \%row; 1844 } 1845 $page->param(clonesrc => \@clonesrc); 1833 my $clones = getUserDropdown($dbh, $curgroup, $webvar{clonesrc}); 1834 $page->param(clonesrc => $clones); 1846 1835 } 1847 1836
Note:
See TracChangeset
for help on using the changeset viewer.