Changeset 327
- Timestamp:
- 05/02/12 18:19:57 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r326 r327 2003 2003 my $cur = shift || $curgroup; 2004 2004 2005 my @childgroups; 2006 getChildren($dbh, $logingroup, \@childgroups, 'all'); 2007 my $childlist = join(',',@childgroups); 2008 2009 ##fixme: need to reorder list so that we can display a pseudotree in group dropdowns 2010 2011 # weesa gonna discard parent_group_id for now 2012 my $sth = $dbh->prepare("SELECT group_id,parent_group_id,group_name FROM groups ". 2013 "WHERE group_id IN ($logingroup".($childlist ? ",$childlist" : '').")". 2014 "ORDER BY group_id"); 2015 $sth->execute; 2005 # little recursive utility sub-sub 2006 sub getgroupdrop { 2007 my $root = shift; 2008 my $cur = shift; # to tag the selected group 2009 my $grplist = shift; 2010 my $indent = shift || ' '; 2011 2012 my @childlist; 2013 getChildren($dbh,$root,\@childlist,'immediate'); 2014 return if $#childlist == -1; 2015 foreach (@childlist) { 2016 my %row; 2017 $row{groupval} = $_; 2018 $row{groupactive} = ($_ == $cur); 2019 $row{groupname} = $indent.groupName($dbh, $_); 2020 push @{$grplist}, \%row; 2021 getgroupdrop($_, $cur, $grplist, $indent.' '); 2022 } 2023 } 2024 2016 2025 my @grouplist; 2017 while (my ($groupid,$pargroup,$groupname) = $sth->fetchrow_array()) { 2018 my %row; 2019 $row{groupname} = $groupname; 2020 $row{groupval} = $groupid; 2021 ##fixme: need magic 2022 ## ... WTF? 2023 # $row{defgroup} = ''; 2024 $row{groupactive} = 1 if $groupid == $cur; 2025 push @grouplist, \%row; 2026 } 2026 push @grouplist, { groupval => $logingroup, groupactive => $logingroup == $curgroup, 2027 groupname => groupName($dbh, $logingroup) }; 2028 getgroupdrop($logingroup, $curgroup, \@grouplist); 2027 2029 2028 2030 $page->param("$template_var" => \@grouplist); 2029 2030 2031 } # end fill_grouplist() 2031 2032
Note:
See TracChangeset
for help on using the changeset viewer.