Changeset 314 for trunk/dns.cgi
- Timestamp:
- 04/24/12 16:43:39 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r313 r314 1947 1947 my $childlist = join(',',@childgroups); 1948 1948 1949 my $sql = "SELECT count(*) FROM groups WHERE parent_group_id IN ($curgroup".($childlist ? ",$childlist" : '').")". 1950 ($startwith ? " AND group_name ~* ?" : ''). 1951 ($filter ? " AND group_name ~* ?" : ''); 1952 my $sth = $dbh->prepare($sql); 1953 $sth->execute(@filterargs); 1954 my ($count) = ($sth->fetchrow_array); 1949 my ($count) = getGroupCount($dbh, (childlist => $childlist, curgroup => $curgroup, 1950 filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef) ) ); 1955 1951 1956 1952 # fill page count and first-previous-next-last-all bits … … 1969 1965 1970 1966 # set up the headers 1971 my @cols = ('group','parent','nusers','ndomains' );1972 my %colnames = (group => 'Group', parent => 'Parent Group', nusers => 'Users', ndomains => 'Domains' );1967 my @cols = ('group','parent','nusers','ndomains','nrevzones'); 1968 my %colnames = (group => 'Group', parent => 'Parent Group', nusers => 'Users', ndomains => 'Domains', nrevzones => 'Reverse Zones'); 1973 1969 fill_colheads($sortby, $sortorder, \@cols, \%colnames); 1974 1970 … … 1983 1979 $sortby = 'g2.group_name' if $sortby eq 'parent'; 1984 1980 1985 my @grouplist; 1986 $sql = "SELECT g.group_id, g.group_name, g2.group_name, ". 1987 "count(distinct(u.username)) AS nusers, count(distinct(d.domain)) AS ndomains ". 1988 "FROM groups g ". 1989 "INNER JOIN groups g2 ON g2.group_id=g.parent_group_id ". 1990 "LEFT OUTER JOIN users u ON u.group_id=g.group_id ". 1991 "LEFT OUTER JOIN domains d ON d.group_id=g.group_id ". 1992 "WHERE g.parent_group_id IN ($curgroup".($childlist ? ",$childlist" : '').") ". 1993 ($startwith ? " AND g.group_name ~* ?" : ''). 1994 ($filter ? " AND g.group_name ~* ?" : ''). 1995 " GROUP BY g.group_id, g.group_name, g2.group_name ". 1996 " ORDER BY $sortby $sortorder ". 1997 ($offset eq 'all' ? '' : " LIMIT $perpage OFFSET ".$offset*$perpage); 1998 $sth = $dbh->prepare($sql); 1999 $sth->execute(@filterargs); 2000 2001 my $rownum = 0; 2002 while (my @data = $sth->fetchrow_array) { 2003 my %row; 2004 $row{groupid} = $data[0]; 2005 $row{groupname} = $data[1]; 2006 $row{pgroup} = $data[2]; 2007 $row{nusers} = $data[3]; 2008 $row{ndomains} = $data[4]; 2009 $row{bg} = ($rownum++)%2; 2010 $row{sid} = $sid; 2011 $row{edgrp} = ($permissions{admin} || $permissions{group_edit}); 2012 $row{delgrp} = ($permissions{admin} || $permissions{group_delete}); 2013 push @grouplist, \%row; 2014 } 2015 $page->param(grouptable => \@grouplist); 1981 my $glist = getGroupList($dbh, (childlist => $childlist, curgroup => $curgroup, 1982 filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef), 1983 sortby => $sortby, sortorder => $sortorder) ); 1984 1985 $page->param(grouptable => $glist); 2016 1986 } # end listgroups() 2017 1987
Note:
See TracChangeset
for help on using the changeset viewer.