Changeset 44 for trunk


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

Location:
trunk
Files:
4 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 ".
  • trunk/templates/domlist.tmpl

    r41 r44  
    2424<table width="98%" border="0" cellspacing="4" cellpadding="3">
    2525<tr>
    26         <td class="datahead_l"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=domlist&amp;<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=domain&amp;order=<TMPL_VAR NAME=domorder>">Domain</a><TMPL_IF NAME=sortdomain>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
    27         <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=domlist&amp;<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=status&amp;order=<TMPL_VAR NAME=statorder>">Status</a><TMPL_IF NAME=sortstatus>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
    28         <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=domlist&amp;<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=group&amp;order=<TMPL_VAR NAME=grporder>">Group</a><TMPL_IF NAME=sortgroup>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
     26<TMPL_LOOP NAME=colheads>
     27<td class="datahead_<TMPL_IF firstcol>l<TMPL_ELSE>s</TMPL_IF>"><a href="dns.cgi?sid=<TMPL_VAR
     28NAME=sid>&amp;page=<TMPL_VAR NAME=page><TMPL_IF NAME=offset>&amp;offset=<TMPL_VAR
     29NAME=offset></TMPL_IF>&amp;sortby=<TMPL_VAR NAME=sortby>&amp;order=<TMPL_VAR NAME=order>"><TMPL_VAR
     30NAME=colname></a><TMPL_IF NAME=sortorder>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>"
     31src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
     32</TMPL_LOOP>
    2933        <td class="datahead_s">Change Status</td>
    3034        <td class="datahead_s">Delete</td>
  • trunk/templates/grpman.tmpl

    r43 r44  
    2424<table width="98%" border="0" cellspacing="4" cellpadding="3">
    2525<tr>
    26 <TMPL_IF foobarbaz>
    27         <td class="datahead_l"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=grpman&amp;<TMPL_IF
    28 NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=group&amp;order=<TMPL_VAR
    29 NAME=grporder>">Group</a><TMPL_IF NAME=sortgrp>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR
    30 NAME=sortorder>.png" /></TMPL_IF></td>
    31         <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=grpman&amp;<TMPL_IF
    32 NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=parent&amp;order=<TMPL_VAR
    33 NAME=parentorder>">Parent Group</a><TMPL_IF NAME=sortparent>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>"
    34 src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
    35         <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=grpman&amp;<TMPL_IF
    36 NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=nusers&amp;order=<TMPL_VAR
    37 NAME=nusersorder>">Users</a><TMPL_IF NAME=sortnusers>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>"
    38 src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
    39         <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=grpman&amp;<TMPL_IF
    40 NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=ndomains&amp;order=<TMPL_VAR
    41 NAME=ndomainsorder>">Domains</a><TMPL_IF NAME=sortndomains>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>"
    42 src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
    43 <TMPL_ELSE>
    4426<TMPL_LOOP NAME=colheads>
    45 <td class="datahead_<TMPL_IF firstcol>l<TMPL_ELSE>s</TMPL_IF>"><a href="dns.cgi?sid=<TMPL_VAR
    46 NAME=sid>&amp;page=<TMPL_VAR NAME=page><TMPL_IF NAME=offset>&amp;offset=<TMPL_VAR
    47 NAME=offset></TMPL_IF>&amp;sortby=<TMPL_VAR NAME=sortby>&amp;order=<TMPL_VAR NAME=order>"><TMPL_VAR
    48 NAME=colname></a><TMPL_IF NAME=sortorder>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>"
    49 src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
    50 </TMPL_LOOP>
    51 </TMPL_IF>
     27        <td class="datahead_<TMPL_IF firstcol>l<TMPL_ELSE>s</TMPL_IF>"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=<TMPL_VAR NAME=page><TMPL_IF NAME=offset>&amp;offset=<TMPL_VAR NAME=offset></TMPL_IF>&amp;sortby=<TMPL_VAR NAME=sortby>&amp;order=<TMPL_VAR NAME=order>"><TMPL_VAR NAME=colname></a><TMPL_IF NAME=sortorder>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td></TMPL_LOOP>
    5228        <td class="datahead_s">Delete</td>
    5329</tr>
     
    5531<TMPL_LOOP name=grouptable>
    5632<tr class="row<TMPL_VAR name=bg>">
    57         <td><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=grpman&amp;action=chgroup&amp;group=<TMPL_VAR NAME=groupid>"><TMPL_VAR NAME=groupname></a></td>
     33        <td align="left"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=grpman&amp;action=chgroup&amp;group=<TMPL_VAR NAME=groupid>"><TMPL_VAR NAME=groupname></a></td>
    5834        <td><TMPL_VAR name=pgroup></td>
    5935        <td><TMPL_VAR name=nusers></td>
  • trunk/templates/useradmin.tmpl

    r41 r44  
    2424<table width="98%" border="0" cellspacing="4" cellpadding="3">
    2525<tr>
    26         <td class="datahead_l"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=useradmin&amp;<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=username&amp;order=<TMPL_VAR NAME=userorder>">Username</a><TMPL_IF NAME=sortuser>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
    27         <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=useradmin&amp;<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=fullname&amp;order=<TMPL_VAR NAME=fnameorder>">Full Name</a><TMPL_IF NAME=sortfname>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
    28         <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=useradmin&amp;<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=type&amp;order=<TMPL_VAR NAME=typeorder>">Type</a><TMPL_IF NAME=sorttype>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
    29         <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=useradmin&amp;<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=group&amp;order=<TMPL_VAR NAME=grouporder>">Group</a><TMPL_IF NAME=sortgroup>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
    30         <td class="datahead_s"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=useradmin&amp;<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=status&amp;order=<TMPL_VAR NAME=statusorder>">Full Name</a><TMPL_IF NAME=sortstatus>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
     26<TMPL_LOOP NAME=colheads>
     27        <td class="datahead_<TMPL_IF firstcol>l<TMPL_ELSE>s</TMPL_IF>"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=<TMPL_VAR NAME=page><TMPL_IF NAME=offset>&amp;offset=<TMPL_VAR NAME=offset></TMPL_IF>&amp;sortby=<TMPL_VAR NAME=sortby>&amp;order=<TMPL_VAR NAME=order>"><TMPL_VAR NAME=colname></a><TMPL_IF NAME=sortorder>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td></TMPL_LOOP>
    3128        <td class="datahead_s">Delete</td>
    3229</tr>
     
    3431<TMPL_LOOP name=usertable>
    3532<tr class="row<TMPL_VAR name=bg>">
    36         <td><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=userman&amp;action=chuser&amp;user=<TMPL_VAR NAME=userid>"><TMPL_VAR NAME=username></a></td>
     33        <td align="left"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=userman&amp;action=chuser&amp;user=<TMPL_VAR NAME=userid>"><TMPL_VAR NAME=username></a></td>
    3734        <td><TMPL_VAR name=userfull></td>
    3835        <td><TMPL_VAR name=usertype></td>
Note: See TracChangeset for help on using the changeset viewer.