Changeset 54 for trunk


Ignore:
Timestamp:
12/29/09 13:06:01 (15 years ago)
Author:
Kris Deugau
Message:

/trunk

Pronouncing starts with, search/show subgroups, and filter/search "sufficiently

complete"

  • moved state for all three into per-page session variables
  • deliberately leaving offset out of this set as "offset==all" could theoretically produce a very long page

Fixed buglet in first display of user list where no column was apparently

being used to sort

Explicitly pass sortby and sortorder to fill_colheads rather than relying on

magic globals (lots of this left to do)

Fixed group list to actually show subgroups in the current group, not just the

current group, by default (regression introduced <n> revisions ago, don't care
to track down the specifics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r53 r54  
    5252  $session->param('domlistsortby','domain');
    5353  $session->param('domlistorder','ASC');
    54   $session->param('useradminsortby','username');
     54  $session->param('useradminsortby','user');
    5555  $session->param('useradminorder','ASC');
    5656  $session->param('grpmansortby','group');
     
    6767my $group = ($webvar{group} ? $webvar{group} : 1);
    6868
     69# per-page startwith, filter, searchsubs
     70$session->param($webvar{page}.'startwith', $webvar{startwith}) if $webvar{startwith};
     71$session->param($webvar{page}.'filter', $webvar{filter}) if $webvar{filter};
     72$webvar{searchsubs} =~ s/^n ?// if $webvar{searchsubs};
     73$session->param($webvar{page}.'searchsubs', $webvar{searchsubs}) if $webvar{searchsubs};
     74
     75my $startwith = $session->param($webvar{page}.'startwith');
     76my $filter = $session->param($webvar{page}.'filter');
     77my $searchsubs = $session->param($webvar{page}.'searchsubs');
     78
     79
     80
     81if (0) {
    6982# filter, starts with, search subgroups
    7083$session->param('filter', "$webvar{page}:filter$webvar{filter}") if defined($webvar{filter});
     
    8093my $searchsubs = $session->param('searchsubs');
    8194$searchsubs = ($searchsubs =~ /^$webvar{page}:searchsubs(.+)$/ ? $1 : '');
     95}
     96
     97
    8298
    8399# nrgh, can't handle login here because we don't have a database handle to check the user/pass with yet
     
    10221038  my @cols = ('domain', 'status', 'group');
    10231039  my %colheads = (domain => 'Domain', status => 'Status', group => 'Group');
    1024   fill_colheads(\@cols, \%colheads);
     1040  fill_colheads($sortby, $sortorder, \@cols, \%colheads);
    10251041
    10261042#  $page->param(sortorder => $sortorder);
     
    10761092  my $childlist = join(',',@childgroups);
    10771093
    1078   my $sql = "SELECT count(*) FROM groups WHERE group_id IN ($logingroup".($childlist ? ",$childlist" : '').")".
     1094  my $sql = "SELECT count(*) FROM groups WHERE parent_group_id IN ($logingroup".($childlist ? ",$childlist" : '').")".
    10791095        ($startwith ? " AND group_name ~* '^[$startwith]'" : '').
    10801096        ($filter ? " AND group_name ~* '$filter'" : '');
     
    10991115  my @cols = ('group','parent','nusers','ndomains');
    11001116  my %colnames = (group => 'Group', parent => 'Parent Group', nusers => 'Users', ndomains => 'Domains');
    1101   fill_colheads(\@cols, \%colnames);
     1117  fill_colheads($sortby, $sortorder, \@cols, \%colnames);
    11021118
    11031119# waffle, waffle - keep state on these as well as sortby, sortorder?
     
    11181134        "LEFT OUTER JOIN users u ON u.group_id=g.group_id ".
    11191135        "LEFT OUTER JOIN domains d ON d.group_id=g.group_id ".
    1120         "WHERE g.group_id IN ($logingroup".($childlist ? ",$childlist" : '').") ".
     1136        "WHERE g.parent_group_id IN ($logingroup".($childlist ? ",$childlist" : '').") ".
    11211137##fixme:  don't do variable subs in SQL, use placeholders and params in ->execute()
    11221138        ($startwith ? " AND g.group_name ~* '^[$startwith]'" : '').
     
    12011217  my @cols = ('user','fname','type','group','status');
    12021218  my %colnames = (user => 'Username', fname => 'Full Name', type => 'Type', group => 'Group', status => 'Status');
    1203   fill_colheads(\@cols, \%colnames);
     1219  fill_colheads($sortby, $sortorder, \@cols, \%colnames);
    12041220
    12051221# waffle, waffle - keep state on these as well as sortby, sortorder?
     
    12501266# Takes an array ref and hash ref
    12511267sub fill_colheads {
     1268  my $sortby = shift;
     1269  my $sortorder = shift;
    12521270  my $cols = shift;
    12531271  my $colnames = shift;
     
    12741292  $page->param(colheads => \@headings);
    12751293
    1276 } # end gentableheadings
     1294} # end fill_colheads()
Note: See TracChangeset for help on using the changeset viewer.