Ignore:
Timestamp:
08/12/25 15:47:28 (31 hours ago)
Author:
Kris Deugau
Message:

/branches/secondaryzones

First chunk of adding secondary zone management

  • Menu link
  • Zone list page
  • Extend getZoneCount() and getZoneList() to read the secondary zone table
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/secondaryzones/dns.cgi

    r909 r911  
    606606    changepage(page => "revzones");
    607607  }
     608
     609} elsif ($webvar{page} eq 'secondaryzones') {
     610
     611#  $page->param(domlist => 1);
     612
     613# hmm.  seeing problems in some possibly-not-so-corner cases.
     614# this currently only handles "domain on", "domain off"
     615  if (defined($webvar{zonestatus})) {
     616    # security check - does the user have permission to access this entity?
     617    my $flag = 0;
     618    foreach (@viewablegroups) {
     619      $flag = 1 if $dnsdb->isParent($_, 'group', $webvar{id}, 'secondary');
     620    }
     621    if ($flag && ($permissions{admin} || $permissions{domain_edit})) {
     622      my $stat = $dnsdb->secondaryzoneStatus($webvar{id}, 'n', $webvar{zonestatus});
     623      $page->param(resultmsg => $DNSDB::resultstr);
     624    } else {
     625      $page->param(errmsg => "You are not permitted to view or change the requested domain");
     626    }
     627    $uri_self =~ s/\&zonestatus=[^&]*//g;   # clean up URL for stuffing into templates
     628  }
     629
     630  show_msgs();
     631
     632  $page->param(curpage => $webvar{page});
     633
     634  listsecondaryzones();
     635
    608636
    609637} elsif ($webvar{page} eq 'reclist') {
     
    19671995##fixme
    19681996  $page->param(mayrdns => 1);
     1997  $page->param(maysecondary => 1);
    19691998
    19701999  $page->param(mayloc => ($permissions{admin} || $permissions{location_view}));
     
    23592388
    23602389
     2390sub listsecondaryzones {
     2391# ACLs
     2392  $page->param(secondary_create => ($permissions{admin} || $permissions{domain_create}) );
     2393  $page->param(secondary_edit   => ($permissions{admin} || $permissions{domain_edit}) );
     2394  $page->param(secondary_delete => ($permissions{admin} || $permissions{domain_delete}) );
     2395
     2396  my @childgroups;
     2397  $dnsdb->getChildren($curgroup, \@childgroups, 'all') if $searchsubs;
     2398  my $childlist = join(',',@childgroups);
     2399
     2400#  my $count = $dnsdb->getSecondaryZoneCount(childlist => $childlist, curgroup => $curgroup,
     2401  my $count = $dnsdb->getZoneCount(childlist => $childlist, curgroup => $curgroup, secondary => 'y',
     2402        filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef) );
     2403
     2404# fill page count and first-previous-next-last-all bits
     2405  fill_pgcount($count, 'secondary zone(s)', $dnsdb->groupName($curgroup));
     2406  fill_fpnla($count);
     2407
     2408  $sortby = 'zone';
     2409# sort/order
     2410  $session->param($webvar{page}.'sortby', $webvar{sortby}) if $webvar{sortby};
     2411  $session->param($webvar{page}.'order', $webvar{order}) if $webvar{order};
     2412
     2413  $sortby = $session->param($webvar{page}.'sortby') if $session->param($webvar{page}.'sortby');
     2414  $sortorder = $session->param($webvar{page}.'order') if $session->param($webvar{page}.'order');
     2415
     2416# set up the headers
     2417  my @cols = ('secondary', 'primaryserver', 'status', 'group');
     2418  my %colheads = (secondary => 'Secondary zone', primaryserver => 'Primary server(s)', status => 'Status', group => 'Group');
     2419  fill_colheads($sortby, $sortorder, \@cols, \%colheads);
     2420
     2421  # hack! hack! pthbttt.  have to rethink the status column storage,
     2422  # or inactive comes "before" active.  *sigh*
     2423  $sortorder = ($sortorder eq 'ASC' ? 'DESC' : 'ASC') if $sortby eq 'status';
     2424
     2425# waffle, waffle - keep state on these as well as sortby, sortorder?
     2426##fixme:  put this higher so the count doesn't get munched?
     2427  $page->param("start$startwith" => 1) if $startwith && $startwith =~ /^(?:[a-z]|0-9)$/;
     2428
     2429  $page->param(filter => $filter) if $filter;
     2430  $page->param(searchsubs => $searchsubs) if $searchsubs;
     2431
     2432  $page->param(group => $curgroup);
     2433
     2434#  my $zonelist = $dnsdb->getSecondaryZoneList(childlist => $childlist, curgroup => $curgroup,
     2435  my $zonelist = $dnsdb->getZoneList(childlist => $childlist, curgroup => $curgroup, secondary => 'y',
     2436        filter => ($filter ? $filter : undef), startwith => ($startwith ? $startwith : undef),
     2437        offset => $offset, sortby => $sortby, sortorder => $sortorder
     2438        );
     2439# probably don't need this, keeping for reference for now
     2440#  foreach my $rec (@$zonelist) {
     2441#  }
     2442  $page->param(zonetable => $zonelist);
     2443} # end listsecondaryzones()
     2444
     2445
    23612446sub listgroups {
    23622447
Note: See TracChangeset for help on using the changeset viewer.