Changeset 476
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r475 r476 1746 1746 # Takes a database handle, entity type, entity ID, and new group ID 1747 1747 sub changeGroup { 1748 my $dbh = shift; 1748 my $self = shift; 1749 my $dbh = $self->{dbh}; 1749 1750 my $type = shift; 1750 1751 my $id = shift; … … 2328 2329 sub addGroup { 2329 2330 $errstr = ''; 2330 my $dbh = shift; 2331 my $self = shift; 2332 my $dbh = $self->{dbh}; 2331 2333 my $groupname = shift; 2332 2334 my $pargroup = shift; … … 2428 2430 # Returns a status code and message 2429 2431 sub delGroup { 2430 my $dbh = shift; 2432 my $self = shift; 2433 my $dbh = $self->{dbh}; 2431 2434 my $groupid = shift; 2432 2435 … … 2494 2497 sub getChildren { 2495 2498 $errstr = ''; 2496 my $dbh = shift; 2499 my $self = shift; 2500 my $dbh = $self->{dbh}; 2497 2501 my $rootgroup = shift; 2498 2502 my $groupdest = shift; … … 2515 2519 while (my ($group) = $sth->fetchrow_array) { 2516 2520 push @$groupdest, $group; 2517 getChildren($dbh,$group,$groupdest) if $immed eq 'all';2521 $self->getChildren($group, $groupdest) if $immed eq 'all'; 2518 2522 } 2519 2523 } … … 2546 2550 # Returns an integer count of the resulting group list. 2547 2551 sub getGroupCount { 2548 my $dbh = shift; 2552 my $self = shift; 2553 my $dbh = $self->{dbh}; 2549 2554 2550 2555 my %args = @_; … … 2571 2576 # Returns an arrayref containing hashrefs suitable for feeding straight to HTML::Template 2572 2577 sub getGroupList { 2573 my $dbh = shift; 2578 my $self = shift; 2579 my $dbh = $self->{dbh}; 2574 2580 2575 2581 my %args = @_; -
trunk/dns-rpc.cgi
r468 r476 200 200 }; 201 201 ## optional $inhert arg? 202 my ($code,$msg) = DNSDB::addGroup($dbh,$args{groupname}, $args{parent_id}, $perms);202 my ($code,$msg) = $dnsdb->addGroup($args{groupname}, $args{parent_id}, $perms); 203 203 die $msg if $code eq 'FAIL'; 204 204 return $msg; … … 214 214 # Let's be nice; delete based on groupid OR group name. Saves an RPC call round-trip, maybe. 215 215 if ($args{group} =~ /^\d+$/) { 216 ($code,$msg) = DNSDB::delGroup($dbh,$args{group});216 ($code,$msg) = $dnsdb->delGroup($args{group}); 217 217 } else { 218 218 my $grpid = DNSDB::groupID($dbh, $args{group}); 219 219 die "Can't find group\n" if !$grpid; 220 ($code,$msg) = DNSDB::delGroup($dbh,$grpid);220 ($code,$msg) = $dnsdb->delGroup($grpid); 221 221 } 222 222 die $msg if $code eq 'FAIL'; -
trunk/dns.cgi
r474 r476 874 874 # https://secure.deepnet.cx/trac/dnsadmin/ticket/8 for the UI enhancement 875 875 # that will make this variable. 876 my ($code,$msg) = addGroup($dbh,$webvar{newgroup}, $webvar{pargroup}, \%newperms, 1);876 my ($code,$msg) = $dnsdb->addGroup($webvar{newgroup}, $webvar{pargroup}, \%newperms, 1); 877 877 if ($code eq 'OK') { 878 878 if ($alterperms) { … … 917 917 918 918 } elsif ($webvar{del} eq 'ok') { 919 my ($code,$msg) = delGroup($dbh,$webvar{id});919 my ($code,$msg) = $dnsdb->delGroup($webvar{id}); 920 920 if ($code eq 'OK') { 921 921 ##fixme: need to clean up log when deleting a major container … … 1060 1060 # Do the $webvar{bulkaction} 1061 1061 my ($code, $msg); 1062 ($code, $msg) = changeGroup($dbh,'domain', $webvar{$_}, $webvar{destgroup})1062 ($code, $msg) = $dnsdb->changeGroup('domain', $webvar{$_}, $webvar{destgroup}) 1063 1063 if $webvar{bulkaction} eq 'move'; 1064 1064 if ($webvar{bulkaction} eq 'deactivate' || $webvar{bulkaction} eq 'activate') { … … 1766 1766 1767 1767 my $grptree = HTML::Template->new(filename => 'templates/grptree.tmpl'); 1768 getChildren($dbh,$root,\@childlist,'immediate');1768 $dnsdb->getChildren($root, \@childlist, 'immediate'); 1769 1769 return if $#childlist == -1; 1770 1770 my @grouplist; … … 2032 2032 2033 2033 my @childgroups; 2034 getChildren($dbh,$curgroup, \@childgroups, 'all') if $searchsubs;2034 $dnsdb->getChildren($curgroup, \@childgroups, 'all') if $searchsubs; 2035 2035 my $childlist = join(',',@childgroups); 2036 2036 … … 2090 2090 2091 2091 my @childgroups; 2092 getChildren($dbh,$curgroup, \@childgroups, 'all') if $searchsubs;2092 $dnsdb->getChildren($curgroup, \@childgroups, 'all') if $searchsubs; 2093 2093 my $childlist = join(',',@childgroups); 2094 2094 2095 my ($count) = getGroupCount($dbh,(childlist => $childlist, curgroup => $curgroup,2096 filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef) ) );2095 my ($count) = $dnsdb->getGroupCount(childlist => $childlist, curgroup => $curgroup, 2096 filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef) ); 2097 2097 2098 2098 # fill page count and first-previous-next-last-all bits … … 2125 2125 $sortby = 'g2.group_name' if $sortby eq 'parent'; 2126 2126 2127 my $glist = getGroupList($dbh,(childlist => $childlist, curgroup => $curgroup,2127 my $glist = $dnsdb->getGroupList(childlist => $childlist, curgroup => $curgroup, 2128 2128 filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef), 2129 offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder) );2129 offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder); 2130 2130 2131 2131 $page->param(grouptable => $glist); … … 2145 2145 2146 2146 my @childlist; 2147 getChildren($dbh,$root,\@childlist,'immediate');2147 $dnsdb->getChildren($root, \@childlist, 'immediate'); 2148 2148 return if $#childlist == -1; 2149 2149 foreach (@childlist) { … … 2188 2188 2189 2189 my @childgroups; 2190 getChildren($dbh,$curgroup, \@childgroups, 'all') if $searchsubs;2190 $dnsdb->getChildren($curgroup, \@childgroups, 'all') if $searchsubs; 2191 2191 my $childlist = join(',',@childgroups); 2192 2192 … … 2235 2235 2236 2236 my @childgroups; 2237 getChildren($dbh,$curgroup, \@childgroups, 'all') if $searchsubs;2237 $dnsdb->getChildren($curgroup, \@childgroups, 'all') if $searchsubs; 2238 2238 my $childlist = join(',',@childgroups); 2239 2239
Note:
See TracChangeset
for help on using the changeset viewer.