Changeset 422 for branches


Ignore:
Timestamp:
10/10/12 13:41:00 (12 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Merge plaintext record list feature from /trunk r420 and r421,
with minor changes to account for no reverse records.
Bump patch version.

Location:
branches/stable
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/stable

  • branches/stable/DNSDB.pm

    r419 r422  
    3232use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
    3333
    34 $VERSION        = 1.0.2;        ##VERSION##
     34$VERSION        = 1.0.3;        ##VERSION##
    3535@ISA            = qw(Exporter);
    3636@EXPORT_OK      = qw(
     
    13151315  $sql .= "default_" if $type eq 'y';
    13161316  $sql .= "records r ";
     1317
     1318  # whee!  multisort means just passing comma-separated fields in sortby!
     1319  my $newsort = '';
     1320  foreach my $sf (split /,/, $order) {
     1321    $sf = "r.$sf";
     1322    $sf =~ s/r\.type/t.alphaorder/;
     1323    $newsort .= ",$sf";
     1324  }
     1325  $newsort =~ s/^,//;
     1326
    13171327  $sql .= "INNER JOIN rectypes t ON r.type=t.val ";     # for sorting by type alphabetically
    13181328  if ($type eq 'y') {
     
    13241334  $sql .= " AND host ~* ?" if $filter;
    13251335  # use alphaorder column for "correct" ordering of sort-by-type instead of DNS RR type number
    1326   $sql .= " ORDER BY ".($order eq 'type' ? 't.alphaorder' : "r.$order")." $direction";
     1336  $sql .= " ORDER BY $newsort $direction";
    13271337  $sql .= " LIMIT $nrecs OFFSET ".($nstart*$nrecs) if $nstart ne 'all';
    13281338
  • branches/stable/Makefile

    r419 r422  
    33
    44PKGNAME=dnsadmin
    5 VERSION=1.0.2
     5VERSION=1.0.3
    66RELEASE=1
    77
  • branches/stable/templates/reclist.tmpl

    r151 r422  
    4444</tr>
    4545<tr class="darkrowheader">
    46         <td colspan="4">Records</td>
     46        <td colspan="3">Records</td>
     47        <td align="center"><a href="textrecs.cgi?sid=<TMPL_VAR NAME=sid>&amp;id=<TMPL_VAR NAME=id>&amp;defrec=<TMPL_VAR NAME=defrec>">Plain text</a></td>
    4748<TMPL_IF record_create> <td align="right"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=record&amp;parentid=<TMPL_VAR NAME=id>&amp;defrec=<TMPL_VAR NAME=defrec>&amp;recact=new">Add record</a></td></TMPL_IF>
    4849        <td align="right"><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=log&amp;id=<TMPL_VAR NAME=id><TMPL_IF logdom>&amp;ltype=dom</TMPL_IF>">View log</a></td>
  • branches/stable/textrecs.cgi

    r420 r422  
    4646# shut up some warnings, in case we arrive somewhere we forgot to set this
    4747$webvar{defrec} = 'n' if !$webvar{defrec};      # non-default records
    48 $webvar{revrec} = 'n' if !$webvar{revrec};      # non-reverse (domain) records
     48#$webvar{revrec} = 'n' if !$webvar{revrec};     # non-reverse (domain) records
    4949
    5050# load some local system defaults (mainly DB connect info)
     
    7070
    7171my $zone;
    72 $zone = ($webvar{revrec} eq 'n' ? domainName($dbh, $webvar{id}) : revName($dbh, $webvar{id}))
    73         if $webvar{defrec} eq 'n';
     72$zone = domainName($dbh, $webvar{id}) if $webvar{defrec} eq 'n';
    7473$zone = "group ".groupName($dbh, $webvar{id}) if $webvar{defrec} eq 'y';
    7574
     
    8281print "Content-type: text/plain\n\n";
    8382print "Plaintext version of records for $zone.\n" if $webvar{defrec} eq 'n';
    84 print "Plaintext version of default ".($webvar{revrec} eq 'y' ? 'reverse ' : '')."records for $zone.\n"
    85         if $webvar{defrec} eq 'y';
     83print "Plaintext version of default records for $zone.\n" if $webvar{defrec} eq 'y';
    8684print qq(Press the "Back" button to return to the standard record list.\n\n);
    8785
    88 my $reclist = getDomRecs($dbh, (defrec => $webvar{defrec}, revrec => $webvar{revrec}, id => $webvar{id},
    89         sortby => ($webvar{revrec} eq 'n' ? 'type,host' : 'type,val'), sortorder => 'ASC') );
     86my $reclist = getDomRecs($dbh, $webvar{defrec}, $webvar{id}, 0, 'all', 'type,host', 'ASC');
     87
    9088foreach my $rec (@$reclist) {
    9189  $rec->{type} = $typemap{$rec->{type}};
    92   $rec->{val} .= '.' if $rec->{type} ne 'A' && $webvar{revrec} eq 'n' && $rec->{val} !~ /\.$/;
    93   $rec->{host} .= '.' if $webvar{revrec} eq 'y' && $rec->{val} !~ /\.$/;
     90  $rec->{val} .= '.' if $rec->{type} ne 'A' && $rec->{val} !~ /\.$/;
     91  $rec->{host} .= '.' if $rec->{val} !~ /\.$/;
    9492  $rec->{val} = "$rec->{distance}  $rec->{val}" if $rec->{type} eq 'MX';
    9593  $rec->{val} = "$rec->{distance}  $rec->{weight}  $rec->{port}  $rec->{val}" if $rec->{type} eq 'SRV';
Note: See TracChangeset for help on using the changeset viewer.