Changeset 110


Ignore:
Timestamp:
08/01/11 00:47:09 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Add "Bulk domain operations" area - move-to-group, activate/deactivate, delete

Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r107 r110  
    612612  getPermissions($dbh, 'group', $webvar{gid}, \%grpperms);
    613613  fill_permissions($page, \%grpperms);
     614
     615} elsif ($webvar{page} eq 'bulkdomain') {
     616  # Bulk operations on domains.  Note all but group move are available on the domain list.
     617
     618  changepage(page => "domlist", errmsg => "You are not permitted to make bulk domain changes")
     619        unless ($permissions{admin} || ($permissions{domain_edit} && $permissions{domain_create} && $permissions{domain_delete}));
     620
     621##fixme
     622##fixme  push the SQL and direct database fiddling off into a sub in DNSDB.pm
     623##fixme
     624
     625##fixme: un-hardcode the limit?
     626  $perpage = 50;
     627
     628  my $sth = $dbh->prepare("SELECT count(*) FROM domains WHERE group_id=?");
     629  $sth->execute($curgroup);
     630  my ($count) = ($sth->fetchrow_array);
     631
     632  $page->param(curpage => $webvar{page});
     633  fill_pgcount($count,'domains',groupName($dbh,$curgroup));
     634  fill_fpnla($count);
     635
     636  my @domlist;
     637  my $sql = "SELECT domain_id,domain FROM domains".
     638        " WHERE group_id=?".
     639        " ORDER BY domain".
     640        ($offset eq 'all' ? '' : " LIMIT $perpage OFFSET ".$offset*$perpage);
     641  $sth = $dbh->prepare($sql);
     642  $sth->execute($curgroup);
     643  my $rownum = 0;
     644  while (my @data = $sth->fetchrow_array) {
     645    my %row;
     646    $row{domid} = $data[0];
     647    $row{domain} = $data[1];
     648    $rownum++;  # putting this in the expression below causes failures.  *eyeroll*
     649    $row{newrow} = $rownum % 5 == 0;
     650    push @domlist, \%row;
     651  }
     652  $page->param(domtable => \@domlist);
     653# ACLs
     654  $page->param(maymove => ($permissions{admin} || ($permissions{domain_edit} && $permissions{domain_create} && $permissions{domain_delete})));
     655  $page->param(maystatus => $permissions{admin} || $permissions{domain_edit});
     656  $page->param(maydelete => $permissions{admin} || $permissions{domain_delete});
     657
     658##fixme:  need to clean up status indicator/usage/inversion
    614659
    615660} elsif ($webvar{page} eq 'useradmin') {
  • trunk/templates/menu.tmpl

    r99 r110  
    88<a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=reclist&amp;id=<TMPL_VAR NAME=group>&amp;defrec=y">Default Records</a><br />
    99<a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=axfr">AXFR Import</a><br />
     10<a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=bulkdomain">Bulk Domain Operations</a><br />
    1011<hr />
    1112Current group:
Note: See TracChangeset for help on using the changeset viewer.