Changeset 225 for trunk/dns.cgi


Ignore:
Timestamp:
01/26/12 14:58:49 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Move some SQL into DNSDB.pm (see #1):
fill_rectypes is now getTypelist, and updated for reverse zones
and the custom DNS record types
Also apply a couple of small nitpick fixes in formatting and spelling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r224 r225  
    601601    $page->param(port           => $recdata->{port});
    602602    $page->param(ttl            => $recdata->{ttl});
    603     fill_rectypes($recdata->{type});
     603    $page->param(typelist       => getTypelist($dbh, $webvar{revrec}, $webvar{type}));
    604604
    605605  } elsif ($webvar{recact} eq 'update') {
     
    13841384
    13851385  $page->param(qfor => $webvar{qfor}) if $webvar{qfor};
    1386   fill_rectypes($webvar{type} ? $webvar{type} : '', 1);
     1386  $page->param(typelist => getTypelist($dbh, 'l', ($webvar{type} ? $webvar{type} : undef)));
    13871387  $page->param(nrecurse => $webvar{nrecurse}) if $webvar{nrecurse};
    13881388  $page->param(resolver => $webvar{resolver}) if $webvar{resolver};
     
    17781778}
    17791779
    1780 # fill in record type list on add/update/edit record template
    1781 sub fill_rectypes {
    1782   my $type = shift || $reverse_typemap{A};
    1783   my $soaflag = shift || 0;
    1784 
    1785   my $sth = $dbh->prepare("SELECT val,name FROM rectypes WHERE stdflag=1 ORDER BY listorder");
    1786   $sth->execute;
    1787   my @typelist;
    1788   while (my ($rval,$rname) = $sth->fetchrow_array()) {
    1789     my %row = ( recval => $rval, recname => $rname );
    1790     $row{tselect} = 1 if $rval == $type;
    1791     push @typelist, \%row;
    1792   }
    1793   if ($soaflag) {
    1794     my %row = ( recval => $reverse_typemap{SOA}, recname => 'SOA' );
    1795     $row{tselect} = 1 if $reverse_typemap{SOA} == $type;
    1796     push @typelist, \%row;
    1797   }
    1798   $page->param(typelist => \@typelist);
    1799 } # fill_rectypes
    1800 
    18011780sub fill_recdata {
    1802   fill_rectypes($webvar{type});
     1781  $page->param(typelist => getTypelist($dbh, $webvar{revrec}, $webvar{type}));
    18031782
    18041783# le sigh.  we may get called with many empty %webvar keys
Note: See TracChangeset for help on using the changeset viewer.