Changeset 72 for trunk


Ignore:
Timestamp:
02/16/11 18:04:21 (14 years ago)
Author:
Kris Deugau
Message:

/trunk

Checkpoint - adding sort-on-title-click to record list columns

  • HTML seems complete
  • Still need to store sort type, direction in session
  • Still need to pass sort info into record retrieval sub in DNSDB.pm
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r67 r72  
    927927## for order, need to map input to column names
    928928  my $order = shift || 'host';
     929  my $direction = shift || 'ASC';
    929930
    930931  my $sql = "SELECT record_id,host,type,val,distance,weight,port,ttl FROM ";
     
    934935    $sql .= " records where domain_id=$id";
    935936  }
    936   $sql .= " and not type=$reverse_typemap{SOA} order by $order";
     937  $sql .= " and not type=$reverse_typemap{SOA} order by $order $direction";
    937938##fixme:  need to set nstart properly (offset is not internally multiplied with limit)
    938939  $sql .= " limit $nrecs offset ".($nstart*$nrecs) if $nstart ne 'all';
  • trunk/dns.cgi

    r70 r72  
    252252    my ($count) = ($sth->fetchrow_array);
    253253
     254##work
     255# set up the headers
     256  my @cols = ('host', 'type', 'val', 'distance', 'weight', 'port', 'ttl');
     257  my %colheads = (host => 'Name', type => 'Type', val => 'Address',
     258        distance => 'Distance', weight => 'Weight', port => 'Port', ttl => 'TTL');
     259  my %custom = (id => $webvar{id}, defrec => $webvar{defrec});
     260  fill_colheads($sortby, $sortorder, \@cols, \%colheads, \%custom);
     261
    254262# fill the page-count and first-previous-next-last-all details
    255263  fill_pgcount($count,"records",domainName($dbh,$webvar{id}));
     
    10971105  $page->param(minttl   => $soa{minttl});
    10981106  $page->param(ttl      => $soa{ttl});
     1107
     1108  $startwith = $session->param($webvar{page}.'startwith');
     1109  $filter = $session->param($webvar{page}.'filter');
    10991110
    11001111#  my @foo2 = getDomRecs($dbh,'def',1);
     
    14841495  my $cols = shift;
    14851496  my $colnames = shift;
     1497  my $custom = shift;
    14861498
    14871499  my @headings;
     
    15011513      $coldata{order} = 'ASC';
    15021514    }
     1515    if ($custom) {
     1516      foreach my $ckey (keys %$custom) {
     1517        $coldata{$ckey} = $custom->{$ckey};
     1518      }
     1519    }
    15031520    push @headings, \%coldata;
    15041521  }
  • trunk/templates/reclist.tmpl

    r71 r72  
    5050<TMPL_IF reclist>
    5151<tr class="darkrowheader">
    52         <td>Name</td>
     52<TMPL_LOOP NAME=colheads>
     53        <!-- td class="datahead_<TMPL_IF firstcol>l<TMPL_ELSE>s</TMPL_IF>" -->
     54<td><a href="dns.cgi?sid=<TMPL_VAR
     55NAME=sid>&amp;page=<TMPL_VAR NAME=page><TMPL_IF NAME=offset>&amp;offset=<TMPL_VAR
     56NAME=offset></TMPL_IF>&amp;sortby=<TMPL_VAR NAME=sortby>&amp;order=<TMPL_VAR
     57NAME=order>&amp;id=<TMPL_VAR NAME=id>&amp;defrec=<TMPL_VAR NAME=defrec>"><TMPL_VAR
     58NAME=colname></a><TMPL_IF NAME=sortorder>&nbsp;<img alt="<TMPL_VAR NAME=sortorder>"
     59src="images/<TMPL_VAR NAME=sortorder>.png" /></TMPL_IF></td></TMPL_LOOP>
     60
     61<!--    <td>Name</td>
    5362        <td>Type</td>
    5463        <td>Address</td>
    55         <td>Distance</td><td>Weight</td><td>Port</td><td>TTL</td><td>Delete</td></tr>
     64        <td>Distance</td><td>Weight</td><td>Port</td><td>TTL</td> -->
     65
     66        <td>Delete</td>
     67</tr>
    5668<TMPL_LOOP NAME=reclist>
    5769<tr class="row<TMPL_VAR NAME=row>">
Note: See TracChangeset for help on using the changeset viewer.