Changeset 224 for trunk/dns.cgi
- Timestamp:
- 01/24/12 17:59:24 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r216 r224 52 52 53 53 # shut up some warnings, in case we arrive somewhere we forgot to set this 54 $webvar{defrec} = 'n' if !$webvar{defrec}; 54 $webvar{defrec} = 'n' if !$webvar{defrec}; # non-default records 55 $webvar{revrec} = 'n' if !$webvar{revrec}; # non-reverse (domain) records 55 56 56 57 # load some local system defaults (mainly DB connect info) … … 268 269 269 270 # I hate special cases. 271 ##fixme: probably need to handle webvar{revrec}=='y' too 270 272 if ($webvar{page} eq 'reclist' && $webvar{defrec} eq 'y') { 271 273 my %args = (page => $webvar{page}, id => $curgroup, defrec => $webvar{defrec}); … … 438 440 $page->param(curpage => $webvar{page}); 439 441 440 my $count = getRecCount($dbh, $webvar{defrec}, $webvar{ id}, $filter);442 my $count = getRecCount($dbh, $webvar{defrec}, $webvar{revrec}, $webvar{id}, $filter); 441 443 442 444 $sortby = 'host'; … … 449 451 450 452 # set up the headers 451 my @cols = ('host', 'type', 'val', 'distance', 'weight', 'port', 'ttl'); 452 my %colheads = (host => 'Name', type => 'Type', val => 'Address', 453 my @cols; 454 my %colheads; 455 if ($webvar{revrec} eq 'n') { 456 @cols = ('host', 'type', 'val', 'distance', 'weight', 'port', 'ttl'); 457 %colheads = (host => 'Name', type => 'Type', val => 'Address', 453 458 distance => 'Distance', weight => 'Weight', port => 'Port', ttl => 'TTL'); 454 my %custom = (id => $webvar{id}, defrec => $webvar{defrec}); 459 } else { 460 @cols = ('host', 'type', 'val', 'ttl'); 461 %colheads = (host => 'IP Address', type => 'Type', val => 'Hostname', ttl => 'TTL'); 462 } 463 my %custom = (id => $webvar{id}, defrec => $webvar{defrec}, revrec => $webvar{revrec}); 455 464 fill_colheads($sortby, $sortorder, \@cols, \%colheads, \%custom); 456 465 457 466 # fill the page-count and first-previous-next-last-all details 458 467 fill_pgcount($count,"records", 459 ($webvar{defrec} eq 'y' ? "group ".groupName($dbh,$webvar{id}) : domainName($dbh,$webvar{id}))); 468 ($webvar{defrec} eq 'y' ? "group ".groupName($dbh,$webvar{id}) : 469 ($webvar{revrec} eq 'y' ? revName($dbh,$webvar{id}) : domainName($dbh,$webvar{id})) 470 )); 460 471 fill_fpnla($count); # should put some params on this sub... 461 472 462 473 $page->param(defrec => $webvar{defrec}); 474 showzone($webvar{defrec}, $webvar{revrec}, $webvar{id}); 463 475 if ($webvar{defrec} eq 'y') { 464 showdomain('y',$curgroup);465 476 } else { 466 showdomain('n',$webvar{id});477 # showzone('n',$webvar{id}); 467 478 ##fixme: permission for viewing logs? 479 ##fixme: determine which slice of the log we view (group, domain, revzone) 468 480 $page->param(logdom => 1); 469 481 } … … 1584 1596 $page->param(logingrp_num => $logingroup); 1585 1597 1598 ##fixme 1599 $page->param(mayrdns => 1); 1600 1586 1601 $page->param(maydefrec => $permissions{admin}); 1587 1602 $page->param(mayimport => $permissions{admin} || $permissions{domain_create}); … … 1725 1740 } 1726 1741 1727 sub show domain{1742 sub showzone { 1728 1743 my $def = shift; 1744 my $rev = shift; 1729 1745 my $id = shift; 1730 1746 1731 1747 # get the SOA first 1732 my %soa = getSOA($dbh,$def,$ id);1748 my %soa = getSOA($dbh,$def,$rev,$id); 1733 1749 1734 1750 $page->param(contact => $soa{contact}); … … 1740 1756 $page->param(ttl => $soa{ttl}); 1741 1757 1742 my $foo2 = getDomRecs($dbh,$def,$ id,$perpage,$webvar{offset},$sortby,$sortorder,$filter);1758 my $foo2 = getDomRecs($dbh,$def,$rev,$id,$perpage,$webvar{offset},$sortby,$sortorder,$filter); 1743 1759 1744 1760 my $row = 0; … … 1747 1763 $rec->{row} = $row % 2; 1748 1764 $rec->{defrec} = $def; 1765 $rec->{revrec} = $rev; 1749 1766 $rec->{sid} = $webvar{sid}; 1750 1767 $rec->{id} = $id; 1768 $rec->{fwdzone} = $rev eq 'n'; 1751 1769 $rec->{distance} = 'n/a' unless ($rec->{type} eq 'MX' || $rec->{type} eq 'SRV'); 1752 1770 $rec->{weight} = 'n/a' unless ($rec->{type} eq 'SRV');
Note:
See TracChangeset
for help on using the changeset viewer.