Changeset 243 for trunk/dns.cgi


Ignore:
Timestamp:
02/24/12 15:35:07 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Fixing up delRec() and caller to handle reverse records. See #26.

  • make sure to pass $webvar{revrec} around everywhere
  • extend getRecLine to properly retrieve information for any record
  • make sure another couple of changepage() calls bounce you to the right place
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r242 r243  
    619619    $page->param(id             => $webvar{id});
    620620    $page->param(defrec         => $webvar{defrec});
    621     my $recdata = getRecLine($dbh, $webvar{defrec}, $webvar{id});
     621    $page->param(revrec         => $webvar{revrec});
     622    my $recdata = getRecLine($dbh, $webvar{defrec}, $webvar{revrec}, $webvar{id});
    622623    $page->param(name           => $recdata->{host});
    623624    $page->param(address        => $recdata->{val});
     
    638639
    639640    # get current/previous record info so we can log "updated 'foo A 1.2.3.4' to 'foo A 2.3.4.5'"
    640     my $oldrec = getRecLine($dbh, $webvar{defrec}, $webvar{id});
     641    my $oldrec = getRecLine($dbh, $webvar{defrec}, $webvar{revrec}, $webvar{id});
    641642
    642643    my ($code,$msg) = updateRec($dbh,$webvar{defrec},$webvar{id},
     
    694695  # This is a complete separate segment since it uses a different template from add/edit records above
    695696
    696   changepage(page => "reclist", errmsg => "You are not permitted to delete records", id => $webvar{parentid})
     697  changepage(page => "reclist", errmsg => "You are not permitted to delete records", id => $webvar{parentid},
     698                revrec => $webvar{revrec})
    697699        unless ($permissions{admin} || $permissions{record_delete});
    698700
     
    704706  $page->param(id => $webvar{id});
    705707  $page->param(defrec => $webvar{defrec});
     708  $page->param(revrec => $webvar{revrec});
    706709  $page->param(parentid => $webvar{parentid});
    707710  # first pass = confirm y/n (sorta)
    708711  if (!defined($webvar{del})) {
    709712    $page->param(del_getconf => 1);
    710     my $rec = getRecLine($dbh,$webvar{defrec},$webvar{id});
     713    my $rec = getRecLine($dbh, $webvar{defrec}, $webvar{revrec}, $webvar{id});
    711714    $page->param(host => $rec->{host});
    712715    $page->param(ftype => $typemap{$rec->{type}});
     
    714717  } elsif ($webvar{del} eq 'ok') {
    715718# get rec data before we try to delete it
    716     my $rec = getRecLine($dbh,$webvar{defrec},$webvar{id});
    717     my ($code,$msg) = delRec($dbh,$webvar{defrec},$webvar{id});
     719    my $rec = getRecLine($dbh, $webvar{defrec}, $webvar{revrec}, $webvar{id});
     720    my ($code,$msg) = delRec($dbh, $webvar{defrec}, $webvar{revrec}, $webvar{id});
    718721    if ($code eq 'OK') {
    719722      if ($webvar{defrec} eq 'y') {
     
    725728        my $restr = "Deleted record '$rec->{host} $typemap{$rec->{type}} $rec->{val}', TTL $rec->{ttl}";
    726729        logaction($rec->{parid}, $session->param("username"), parentID($rec->{parid}, 'dom', 'group'), $restr);
    727         changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec}, resultmsg => $restr);
     730        changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec},
     731                revrec => $webvar{revrec}, resultmsg => $restr);
    728732      }
    729733    } else {
     
    740744      }
    741745      changepage(page => "reclist", id => $webvar{parentid}, defrec => $webvar{defrec},
    742                 errmsg => "Error deleting record: $msg");
     746                revrec => $webvar{revrec}, errmsg => "Error deleting record: $msg");
    743747    }
    744748  } else {
Note: See TracChangeset for help on using the changeset viewer.