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:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/stable

  • 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.