Changeset 41 for trunk


Ignore:
Timestamp:
12/03/09 17:59:06 (15 years ago)
Author:
Kris Deugau
Message:

/trunk

Look-n-feel cleanup, checkpoint

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r39 r41  
    7474
    7575# NB:  these must match the field name and SQL ascend/descend syntax respectively
    76 my $sortfield = "domains";
    77 my $sortorder = "asc";
     76my $sortby = "domain";
     77my $sortorder = "ASC";
    7878
    7979my ($dbh,$msg) = connectDB("dnsdb","dnsdb","secret","dbhost");
     
    663663# le sigh.  and we need to strip any previous action
    664664  $tmp_ruri =~ s/\&action=[^&]+//g;
     665# and any bits from the "starts with" letter block - (ab)using this widget
     666# to fill the bulk of the URI so the template doesn't grow to insanity
     667  $tmp_ruri =~ s/\&startwith=[a-z09-]+//g;
    665668#  $page->param(whereami => $ENV{REQUEST_URI});
    666669  $page->param(whereami => $tmp_ruri);
     
    860863##fixme
    861864  if ($offset eq 'all') {
    862     push @debugbits, "foo!  wanna see'em all\n";
     865# uhm....
    863866  } else {
    864867    # all these bits only have sensible behaviour if offset is numeric. err, probably.
     
    901904
    902905sub listdomains {
     906
     907##fixme:  account for searches and starts-with filters
    903908  my $sth = $dbh->prepare("SELECT count(*) FROM domains WHERE group_id=?");
    904909  $sth->execute($curgroup);
     
    910915  fill_fpnla($count);
    911916
    912 ##fixme - group
     917# sort/order
     918  $sortby= $webvar{sortby} if $webvar{sortby};
     919  $sortorder = $webvar{order} if $webvar{order};
     920
     921if ($sortby eq 'domain') {
     922  $page->param(domorder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC'));
     923  $page->param(statorder => 'ASC');
     924  $page->param(grporder => 'ASC');
     925  $page->param(sortdomain => 1);
     926} elsif ($sortby eq 'status') {
     927  $page->param(domorder => 'ASC');
     928  $page->param(statorder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC'));
     929  $page->param(grporder => 'ASC');
     930  $page->param(sortstatus => 1);
     931} elsif ($sortby eq 'group') {
     932  $page->param(domorder => 'ASC');
     933  $page->param(statorder => 'ASC');
     934  $page->param(grporder => ($sortorder eq 'ASC' ? 'DESC' : 'ASC'));
     935  $page->param(sortgroup => 1);
     936} else {
     937  $page->param(domorder => 'ASC');
     938  $page->param(statorder => 'ASC');
     939  $page->param(grporder => 'ASC');
     940}
     941
     942  $page->param(sortorder => $sortorder);
     943  # hack! hack! pthbttt.  have to rethink the status column storage,
     944  # or inactive comes "before" active.  *sigh*
     945  $sortorder = ($sortorder eq 'ASC' ? 'DESC' : 'ASC') if $sortby eq 'status';
     946
     947  $page->param("start$webvar{startwith}" => 1) if $webvar{startwith} && $webvar{startwith} =~ /^[a-z]$/;
     948
     949  $page->param(filter => $webvar{filter}) if $webvar{filter};
     950
     951##fixme
     952##fixme  push the SQL and direct database fiddling off into a sub in DNSDB.pm
     953##fixme
     954
    913955  $page->param(group => $curgroup);
    914956  my @domlist;
    915   $sth = $dbh->prepare("SELECT domain_id,domain,status,groups.group_name FROM domains".
     957  my $sql = "SELECT domain_id,domain,status,groups.group_name AS group FROM domains".
    916958        " INNER JOIN groups ON domains.group_id=groups.group_id".
    917959        " WHERE domains.group_id=?".
    918         " ORDER BY domain".($offset eq 'all' ? '' : " LIMIT $perpage OFFSET ".$offset*$perpage));
     960##fixme:  don't do variable subs in SQL, use placeholders and params in ->execute()
     961        (defined($webvar{startwith}) ? " AND domain ~* '^[$webvar{startwith}]'" : '').
     962        (defined($webvar{filter}) ? " AND domain ~* '$webvar{filter}'" : '').
     963        " ORDER BY ".($sortby eq 'group' ? 'groups.group_name' : $sortby).
     964        " $sortorder ".($offset eq 'all' ? '' : " LIMIT $perpage OFFSET ".$offset*$perpage);
     965  $sth = $dbh->prepare($sql);
    919966  $sth->execute($curgroup);
    920967  my $rownum = 0;
     
    10291076  my $rownum = 0;
    10301077  while (my @data = $sth->fetchrow_array) {
     1078    no warnings "uninitialized";        # Just In Case something stupid happens and a user gets no first or last name
    10311079    my %row;
    10321080    $row{userid} = $data[0];
  • trunk/templates/dns.css

    r39 r41  
    115115        background-color: #e0e0e0;
    116116}
     117td.leftthird {
     118        width: 36%;
     119        text-align: left;
     120}
     121td.rightthird {
     122        width: 36%;
     123        text-align: right;
     124}
    117125
    118126.meat {
     
    126134        margin-left: 10px;
    127135        padding: 0px;
    128         list-style-type:none;
    129 }
    130 
     136}
     137/* F*** ME BUT THIS LOOKS LIKE CRAP! */
     138/* Need to find a way to vertically centre the plus image on the text.  >:(  */
     139li.hassub {
     140        list-style: none outside url('../images/plus.gif');
     141}
     142li.leaf {
     143        list-style: none outside none;
     144}
     145#grptree {
     146        margin-left: 15px;
     147}
    131148/* general classes */
    132149.errmsg {
     
    190207}
    191208/* somewhat generic/reusable */
    192 #borderme {
    193         border: thin solid #666666;
     209#datatablewrapper {
     210        border: none;
    194211        width: 98%;
    195         float:left;
    196         clear:left;
    197 }
     212        margin-left: 1%;
     213        margin:right: 1%;
     214}
  • trunk/templates/domlist.tmpl

    r40 r41  
    99 </TMPL_IF>
    1010
    11 <div id="borderme">
     11<div id="datatablewrapper">
    1212
    1313<table width="98%">
    1414<tr><th colspan="3" align="center">Domain list</th></tr>
    15 <tr><td align="left"><TMPL_INCLUDE NAME="pgcount.tmpl"></td>
    16 <td align="center">
    17 <TMPL_INCLUDE NAME="fpnla.tmpl">
    18 </td><td align="right">insert search box here</td></tr>
    19 
     15<tr>
     16<td class="leftthird"><TMPL_INCLUDE NAME="pgcount.tmpl"></td>
     17<td align="center"><TMPL_INCLUDE NAME="fpnla.tmpl"></td>
     18<td class="rightthird"><TMPL_INCLUDE NAME="sbox.tmpl"></td>
     19</tr>
    2020<tr><td colspan="3" align="center"><TMPL_INCLUDE NAME="lettsearch.tmpl"></td></tr>
    21 
    2221<tr><td colspan="3" align="right"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=newdomain">New Domain</a></td></tr>
    2322</table>
     
    4241</TMPL_LOOP>
    4342<TMPL_ELSE>
    44 <tr><td colspan="5">No domains found</td></tr>
     43<tr><td colspan="5" align="center">No domains found</td></tr>
    4544</TMPL_IF>
    4645</table>
  • trunk/templates/grpman.tmpl

    r40 r41  
    99 </TMPL_IF>
    1010
    11 <div id="borderme">
     11<div id="datatablewrapper">
    1212
    1313<table width="98%">
    14 <tr><td colspan="3" align="center"><span class="pgtitle">Manage groups</span></td></tr>
    15 <tr><td><TMPL_INCLUDE NAME="pgcount.tmpl"></td>
    16 <td>
    17 <TMPL_INCLUDE NAME="fpnla.tmpl">
    18 </td><td align="right">insert search box here</td></tr>
    19 
     14<tr><th colspan="3" align="center">Manage groups</th></tr>
     15<tr>
     16<td class="leftthird"><TMPL_INCLUDE NAME="pgcount.tmpl"></td>
     17<td align="center"><TMPL_INCLUDE NAME="fpnla.tmpl"></td>
     18<td class="rightthird"><TMPL_INCLUDE NAME="sbox.tmpl"></td>
     19</tr>
    2020<tr><td colspan="3" align="center"><TMPL_INCLUDE NAME="lettsearch.tmpl"></td></tr>
    21 
    2221<tr><td colspan="3" align="right"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=newgrp">New Group</a></td></tr>
    2322</table>
    2423
    25 <table border="0" cellspacing="5" cellpadding="3">
     24<table width="98%" border="0" cellspacing="4" cellpadding="3">
    2625<tr>
    27 <TMPL_IF NAME=foobarbaz>
    28 <!-- This block to be un-TMPL_IF'ed once we care about sort order - by default, we sort by domain, ascending -->
    29         <td class="underline"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=domlist&amp;offset=<TMPL_VAR NAME=offset>">Domain<TMPL_IF NAME=sortdomain>&nbsp;<img border=0 alt='<TMPL_VAR NAME=sortorder>' src="images/<TMPL_VAR NAME=sortorder>.png"></TMPL_IF></a></td>
    30         <td class="underline"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=domlist&amp;offset=<TMPL_VAR NAME=offset>">Status<TMPL_IF NAME=sortstatus>&nbsp;<img border=0 alt='<TMPL_VAR NAME=sortorder>' src="images/<TMPL_VAR NAME=sortorder>.png"></TMPL_IF></a></td>
    31         <td class="underline" align="center"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=domlist&amp;offset=<TMPL_VAR NAME=offset>">Group<TMPL_IF NAME=sortgroup>&nbsp;<img border=0 alt='<TMPL_VAR NAME=sortorder>' src="images/<TMPL_VAR NAME=sortorder>.png"></TMPL_IF></a></td> <TMPL_ELSE>
    32         <td class="underline">Group</td>
    33         <td class="underline">Parent Group</td>
    34         <td class="underline">Users</td>
    35         <td class="underline" align="center">Domains</td>
    36 </TMPL_IF>
    37         <td class="underline">Delete</td>
     26        <td class="datahead_l"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=grpman&amp;<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=group&amp;order=<TMPL_VAR NAME=grporder>">Domain</a><TMPL_IF NAME=sortgrp>&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=grpman&amp;<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=parent&amp;order=<TMPL_VAR NAME=parentorder>">Parent Group</a><TMPL_IF NAME=sortparent>&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=grpman&amp;<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=nusers&amp;order=<TMPL_VAR NAME=nusersorder>">Users</a><TMPL_IF NAME=sortnusers>&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=grpman&amp;<TMPL_IF NAME=offset>offset=<TMPL_VAR NAME=offset>&amp;</TMPL_IF>sortby=ndomains&amp;order=<TMPL_VAR NAME=ndomainsorder>">Domains</a><TMPL_IF NAME=sortndomains>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>" src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td>
     30        <td class="datahead_s">Delete</td>
    3831</tr>
    3932<TMPL_IF name=grouptable>
     
    4841</TMPL_LOOP>
    4942<TMPL_ELSE>
    50 <tr><td colspan="5">No groups found</td></tr>
     43<tr><td colspan="5" align="center">No groups found</td></tr>
    5144</TMPL_IF>
    5245</table>
  • trunk/templates/grptree.tmpl

    r24 r41  
    11<ul>
    2 <TMPL_LOOP NAME=treelvl><li<TMPL_IF NAME=subs> class="hassub"</TMPL_IF>><TMPL_VAR NAME=grpname>
     2<TMPL_LOOP NAME=treelvl><li class="<TMPL_IF NAME=subs>hassub<TMPL_ELSE>leaf</TMPL_IF>"><TMPL_VAR NAME=grpname>
    33<TMPL_VAR NAME=subs></li>
    44</TMPL_LOOP></ul>
  • trunk/templates/menu.tmpl

    r38 r41  
    2222<hr />
    2323<a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=grpman">Manage groups</a><br />
    24 <TMPL_VAR NAME=grptree>
     24<div id="grptree"><TMPL_VAR NAME=grptree></div>
    2525<!-- hmm:  <TMPL_VAR NAME=groupname> -->
    2626<hr />
  • trunk/templates/useradmin.tmpl

    r40 r41  
    99 </TMPL_IF>
    1010
    11 <div id="borderme">
     11<div id="datatablewrapper">
    1212
    1313<table width="98%">
    14 <tr><td colspan="3" align="center"><span class="pgtitle">Manage users</span></td></tr>
    15 <tr><td><TMPL_INCLUDE NAME="pgcount.tmpl"></td>
    16 <td>
    17 <TMPL_INCLUDE NAME="fpnla.tmpl">
    18 </td><td align="right">insert search box here</td></tr>
    19 
     14<tr><th colspan="3" align="center">Manage users</th></tr>
     15<tr>
     16<td class="leftthird"><TMPL_INCLUDE NAME="pgcount.tmpl"></td>
     17<td align="center"><TMPL_INCLUDE NAME="fpnla.tmpl"></td>
     18<td class="rightthird"><TMPL_INCLUDE NAME="sbox.tmpl"></td>
     19</tr>
    2020<tr><td colspan="3" align="center"><TMPL_INCLUDE NAME="lettsearch.tmpl"></td></tr>
    21 
    2221<tr><td colspan="3" align="right"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=newuser">New User</a></td></tr>
    2322</table>
    2423
    25 <table border="0" cellspacing="5" cellpadding="3">
     24<table width="98%" border="0" cellspacing="4" cellpadding="3">
    2625<tr>
    27 <TMPL_IF NAME=foobarbaz>
    28 <!-- This block to be un-TMPL_IF'ed once we care about sort order - by default, we sort by domain, ascending -->
    29         <td class="underline" nowrap><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=domlist&amp;offset=<TMPL_VAR NAME=offset>">Domain<TMPL_IF NAME=sortdomain>&nbsp;<img alt='<TMPL_VAR NAME=sortorder>' src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></a></td>
    30         <td class="underline" nowrap><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=domlist&amp;offset=<TMPL_VAR NAME=offset>">Status<TMPL_IF NAME=sortstatus>&nbsp;<img alt='<TMPL_VAR NAME=sortorder>' src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></a></td>
    31         <td class="underline" align="center" nowrap><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=domlist&amp;offset=<TMPL_VAR NAME=offset>">Group<TMPL_IF NAME=sortuser>&nbsp;<img alt='<TMPL_VAR NAME=sortorder>' src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></a></td> <TMPL_ELSE>
    32         <td>Username</td>
    33         <td>Full name</td>
    34         <td>Type</td>
    35         <td>Group</td>
    36         <td>Status</td>
    37 </TMPL_IF>
    38         <td>Delete</td>
     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>
     31        <td class="datahead_s">Delete</td>
    3932</tr>
    4033<TMPL_IF name=usertable>
     
    5043</TMPL_LOOP>
    5144<TMPL_ELSE>
    52 <tr><td colspan="5">No users found</td></tr>
     45<tr><td colspan="6">No users found</td></tr>
    5346</TMPL_IF>
    5447</table>
Note: See TracChangeset for help on using the changeset viewer.