Changeset 43 for trunk/dns.cgi


Ignore:
Timestamp:
12/09/09 17:08:46 (14 years ago)
Author:
Kris Deugau
Message:

/trunk

Fix grouplist brokenness in menu (first entry was being set to current group

instead of login group)
-> may be a way to compress that further

Compact and generalize process of filling table headings for lists - users,

domains, groups; records should be able to use this too

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r42 r43  
    651651  $page->param(group => $curgroup);
    652652  $page->param(groupname => groupName($dbh,$curgroup));
     653  $page->param(logingrp => groupName($dbh,$logingroup));
    653654
    654655  # group tree.  should go elsewhere, probably
     
    10441045my @cols = ('group','parent','nusers','ndomains');
    10451046
     1047my %colnames = (group => 'Group', parent => 'Parent Group', nusers => 'Users', ndomains => 'Domains');
     1048
     1049fill_colheads(\@cols, \%colnames);
     1050
     1051if (0) {
    10461052my @headings;
    10471053
    10481054  $sortorder = $webvar{sortorder} if $webvar{sortorder};
    1049 foreach my $colhead (@cols) {
     1055foreach my $col (@cols) {
    10501056  my %coldata;
    1051   $coldata{firstcol} = 1 if $colhead eq $cols[0];
     1057  $coldata{firstcol} = 1 if $col eq $cols[0];
    10521058  $coldata{sid} = $sid;
    10531059  $coldata{page} = $webvar{page};
    10541060  $coldata{offset} = $webvar{offset} if $webvar{offset};
    1055   $coldata{sortby} = $colhead;
    1056   if ($colhead eq $sortby) {
    1057 push @debugbits, "$colhead $sortby $sortorder<br>\n";
     1061  $coldata{sortby} = $col;
     1062  $coldata{colname} = $colnames{$col};
     1063  if ($col eq $sortby) {
    10581064    $coldata{order} = ($sortorder eq 'ASC' ? 'DESC' : 'ASC');
    10591065    $coldata{sortorder} = $sortorder;
     
    10651071
    10661072$page->param(colheads => \@headings);
     1073
     1074} # temp
    10671075
    10681076  my @grouplist;
     
    11571165  $page->param(usertable => \@userlist);
    11581166}
     1167
     1168# Generate all of the glop necessary to add or not the appropriate marker/flag for
     1169# the sort order and column in domain, user, group, and record lists
     1170# Takes an array ref and hash ref
     1171sub fill_colheads {
     1172  my $cols = shift;
     1173  my $colnames = shift;
     1174
     1175  my @headings;
     1176
     1177  foreach my $col (@$cols) {
     1178    my %coldata;
     1179    $coldata{firstcol} = 1 if $col eq $cols->[0];
     1180    $coldata{sid} = $sid;
     1181    $coldata{page} = $webvar{page};
     1182    $coldata{offset} = $webvar{offset} if $webvar{offset};
     1183    $coldata{sortby} = $col;
     1184    $coldata{colname} = $colnames->{$col};
     1185    if ($col eq $sortby) {
     1186      $coldata{order} = ($sortorder eq 'ASC' ? 'DESC' : 'ASC');
     1187      $coldata{sortorder} = $sortorder;
     1188    } else {
     1189      $coldata{order} = 'ASC';
     1190    }
     1191    push @headings, \%coldata;
     1192  }
     1193
     1194  $page->param(colheads => \@headings);
     1195
     1196} # end gentableheadings
Note: See TracChangeset for help on using the changeset viewer.