Changeset 483


Ignore:
Timestamp:
03/14/13 17:05:52 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Object conversion of DNSDB.pm, part 15. See #11.

  • log-retrieval subs getLogCount() and getLogEntries(), miscellaneous retrieval subs getRevPattern() and getTypelist(), and mailNotify()
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r481 r483  
    39983998# - Entity ID and entity type as the primary log "slice"
    39993999sub getLogCount {
    4000   my $dbh = shift;
     4000  my $self = shift;
     4001  my $dbh = $self->{dbh};
    40014002
    40024003  my %args = @_;
     
    40344035# - offset for pagination
    40354036sub getLogEntries {
    4036   my $dbh = shift;
     4037  my $self = shift;
     4038  my $dbh = $self->{dbh};
    40374039
    40384040  my %args = @_;
     
    40734075# Get the narrowest template pattern applicable to a passed CIDR address (may be a netblock or an IP)
    40744076sub getRevPattern {
    4075   my $dbh = shift;
     4077  my $self = shift;
     4078  my $dbh = $self->{dbh};
    40764079  my $cidr = shift;
    40774080  my $group = shift || 1;       # just in case
     
    40944097# Returns an arrayref to list of hashrefs perfect for HTML::Template
    40954098sub getTypelist {
    4096   my $dbh = shift;
     4099  my $self = shift;
     4100  my $dbh = $self->{dbh};
    40974101  my $recgroup = shift;
    40984102  my $type = shift || $reverse_typemap{A};
     
    53015305# Sends notification mail to recipients regarding a DNSDB operation
    53025306sub mailNotify {
    5303   my $dbh = shift;
     5307  my $self = shift;
     5308  my $dbh = $self->{dbh};
    53045309  my ($subj,$message) = @_;
    53055310
  • trunk/dns-rpc.cgi

    r481 r483  
    621621  _commoncheck(\%args, 'y');
    622622
    623   return DNSDB::getRevPattern($dbh, $args{cidr}, $args{group});
     623  return $dnsdb->getRevPattern($args{cidr}, $args{group});
    624624}
    625625
  • trunk/dns.cgi

    r481 r483  
    365365
    366366  if ($code eq 'OK') {
    367     mailNotify($dbh, "New ".($webvar{makeactive} eq 'on' ? 'Active' : 'Inactive')." Domain Created",
     367    $dnsdb->mailNotify("New ".($webvar{makeactive} eq 'on' ? 'Active' : 'Inactive')." Domain Created",
    368368        ($webvar{makeactive} eq 'on' ? 'Active' : 'Inactive').qq( domain "$webvar{domain}" added by ).
    369369        $session->param("username"));
     
    686686    $page->param(port           => $recdata->{port});
    687687    $page->param(ttl            => $recdata->{ttl});
    688     $page->param(typelist       => getTypelist($dbh, $webvar{revrec}, $recdata->{type}));
     688    $page->param(typelist       => $dnsdb->getTypelist($webvar{revrec}, $recdata->{type}));
    689689
    690690    if ($webvar{defrec} eq 'n') {
     
    14601460
    14611461  $page->param(qfor => $webvar{qfor}) if $webvar{qfor};
    1462   $page->param(typelist => getTypelist($dbh, 'l', ($webvar{type} ? $webvar{type} : undef)));
     1462  $page->param(typelist => $dnsdb->getTypelist('l', ($webvar{type} ? $webvar{type} : undef)));
    14631463  $page->param(nrecurse => $webvar{nrecurse}) if $webvar{nrecurse};
    14641464  $page->param(resolver => $webvar{resolver}) if $webvar{resolver};
     
    16491649  }
    16501650  $webvar{ltype} = 'group' if !$webvar{ltype};
    1651   my $lcount = getLogCount($dbh, (id => $id, logtype => $webvar{ltype})) or push @debugbits, $DNSDB::errstr;
     1651  my $lcount = $dnsdb->getLogCount(id => $id, logtype => $webvar{ltype}) or push @debugbits, $dnsdb->errstr;
    16521652
    16531653  $page->param(id => $id);
     
    16731673
    16741674##fixme:  increase per-page limit or use separate limit for log?  some ops give *lots* of entries...
    1675   my $logentries = getLogEntries($dbh, (id => $id, logtype => $webvar{ltype},
    1676         offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder));
     1675  my $logentries = $dnsdb->getLogEntries(id => $id, logtype => $webvar{ltype},
     1676        offset => $webvar{offset}, sortby => $sortby, sortorder => $sortorder);
    16771677  $page->param(logentries => $logentries);
    16781678
     
    19181918
    19191919sub fill_recdata {
    1920   $page->param(typelist => getTypelist($dbh, $webvar{revrec}, $webvar{type}));
     1920  $page->param(typelist => $dnsdb->getTypelist($webvar{revrec}, $webvar{type}));
    19211921
    19221922# le sigh.  we may get called with many empty %webvar keys
Note: See TracChangeset for help on using the changeset viewer.