Changeset 43 for trunk


Ignore:
Timestamp:
12/09/09 17:08:46 (15 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

Location:
trunk
Files:
3 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
  • trunk/templates/grpman.tmpl

    r42 r43  
    4646NAME=sid>&amp;page=<TMPL_VAR NAME=page><TMPL_IF NAME=offset>&amp;offset=<TMPL_VAR
    4747NAME=offset></TMPL_IF>&amp;sortby=<TMPL_VAR NAME=sortby>&amp;order=<TMPL_VAR NAME=order>"><TMPL_VAR
    48 NAME=colname><TMPL_VAR NAME=sortby></a><TMPL_IF NAME=sortorder>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>"
     48NAME=colname></a><TMPL_IF NAME=sortorder>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>"
    4949src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
    5050</TMPL_LOOP>
  • trunk/templates/menu.tmpl

    r42 r43  
    2222<hr />
    2323<a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=grpman">Manage groups</a><br />
    24 <div id="grptree"><ul><TMPL_IF inlogingrp><b><TMPL_VAR NAME=groupname></b><TMPL_ELSE><TMPL_VAR NAME=groupname></TMPL_IF><TMPL_VAR NAME=grptree></ul></div>
     24<div id="grptree">
     25<ul>
     26<li><TMPL_IF inlogingrp><b><TMPL_VAR NAME=logingrp></b><TMPL_ELSE><TMPL_VAR NAME=logingrp></TMPL_IF>
     27<TMPL_VAR NAME=grptree>
     28</li>
     29</ul>
     30</div>
    2531<!-- hmm:  <TMPL_VAR NAME=groupname> -->
    2632<hr />
Note: See TracChangeset for help on using the changeset viewer.