Changeset 44 for trunk/dns.cgi


Ignore:
Timestamp:
12/09/09 18:02:18 (15 years ago)
Author:
Kris Deugau
Message:

/trunk

Clean up header-munger code and templates for users, groups, domains
Still need to convert record list to use general-case

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r43 r44  
    922922  $sortorder = $webvar{order} if $webvar{order};
    923923
    924 if ($sortby eq 'domain') {
    925   $page->param(domorder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC'));
    926   $page->param(statorder => 'ASC');
    927   $page->param(grporder => 'ASC');
    928   $page->param(sortdomain => 1);
    929 } elsif ($sortby eq 'status') {
    930   $page->param(domorder => 'ASC');
    931   $page->param(statorder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC'));
    932   $page->param(grporder => 'ASC');
    933   $page->param(sortstatus => 1);
    934 } elsif ($sortby eq 'group') {
    935   $page->param(domorder => 'ASC');
    936   $page->param(statorder => 'ASC');
    937   $page->param(grporder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC'));
    938   $page->param(sortgroup => 1);
    939 } else {
    940   $page->param(domorder => 'ASC');
    941   $page->param(statorder => 'ASC');
    942   $page->param(grporder => 'ASC');
    943 }
     924# set up the headers
     925  my @cols = ('domain', 'status', 'group');
     926  my %colheads = (domain => 'Domain', status => 'Status', group => 'Group');
     927  fill_colheads(\@cols, \%colheads);
    944928
    945929  $page->param(sortorder => $sortorder);
     
    1007991  $sortorder = $webvar{order} if $webvar{order};
    1008992
    1009 if (0){
    1010 ##fixme: yick
    1011   if ($sortby eq 'group') {
    1012     $page->param(grporder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC'));
    1013     $page->param(parentorder => 'ASC');
    1014     $page->param(nusersorder => 'ASC');
    1015     $page->param(ndomainsorder => 'ASC');
    1016     $page->param(sortgrp => 1);
    1017   } elsif ($sortby eq 'parent') {
    1018     $page->param(grporder => 'ASC');
    1019     $page->param(parentorder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC'));
    1020     $page->param(nusersorder => 'ASC');
    1021     $page->param(ndomainsorder => 'ASC');
    1022     $page->param(sortparent => 1);
    1023   } elsif ($sortby eq 'nusers') {
    1024     $page->param(grporder => 'ASC');
    1025     $page->param(parentorder => 'ASC');
    1026     $page->param(nusersorder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC'));
    1027     $page->param(ndomainsorder => 'ASC');
    1028     $page->param(sortnusers => 1);
    1029   } elsif ($sortby eq 'ndomains') {
    1030     $page->param(grporder => 'ASC');
    1031     $page->param(parentorder => 'ASC');
    1032     $page->param(nusersorder => 'ASC');
    1033     $page->param(ndomainsorder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC'));
    1034     $page->param(sortndomains => 1);
    1035   } else {
    1036     $page->param(grporder => 'ASC');
    1037     $page->param(parentorder => 'ASC');
    1038     $page->param(nusersorder => 'ASC');
    1039     $page->param(ndomainsorder => 'ASC');
    1040   }
    1041 
    1042   $page->param(sortorder => $sortorder);
    1043 }
    1044 
    1045 my @cols = ('group','parent','nusers','ndomains');
    1046 
    1047 my %colnames = (group => 'Group', parent => 'Parent Group', nusers => 'Users', ndomains => 'Domains');
    1048 
    1049 fill_colheads(\@cols, \%colnames);
    1050 
    1051 if (0) {
    1052 my @headings;
    1053 
    1054   $sortorder = $webvar{sortorder} if $webvar{sortorder};
    1055 foreach my $col (@cols) {
    1056   my %coldata;
    1057   $coldata{firstcol} = 1 if $col eq $cols[0];
    1058   $coldata{sid} = $sid;
    1059   $coldata{page} = $webvar{page};
    1060   $coldata{offset} = $webvar{offset} if $webvar{offset};
    1061   $coldata{sortby} = $col;
    1062   $coldata{colname} = $colnames{$col};
    1063   if ($col eq $sortby) {
    1064     $coldata{order} = ($sortorder eq 'ASC' ? 'DESC' : 'ASC');
    1065     $coldata{sortorder} = $sortorder;
    1066   } else {
    1067     $coldata{order} = 'ASC';
    1068   }
    1069   push @headings, \%coldata;
    1070 }
    1071 
    1072 $page->param(colheads => \@headings);
    1073 
    1074 } # temp
     993# set up the headers
     994  my @cols = ('group','parent','nusers','ndomains');
     995  my %colnames = (group => 'Group', parent => 'Parent Group', nusers => 'Users', ndomains => 'Domains');
     996  fill_colheads(\@cols, \%colnames);
    1075997
    1076998  my @grouplist;
     
    11411063  fill_fpnla($count);
    11421064
     1065  $sortby = 'user';
     1066# sort/order
     1067  $sortby = $webvar{sortby} if $webvar{sortby};
     1068  $sortorder = $webvar{order} if $webvar{order};
     1069
     1070# set up the headers
     1071  my @cols = ('user','fname','type','group','status');
     1072  my %colnames = (user => 'Username', fname => 'Full Name', type => 'Type', group => 'Group', status => 'Status');
     1073  fill_colheads(\@cols, \%colnames);
     1074
    11431075  my @userlist;
    11441076  $sth = $dbh->prepare("SELECT u.user_id, u.username, u.firstname, u.lastname, u.type, g.group_name, u.status ".
Note: See TracChangeset for help on using the changeset viewer.