Changeset 313


Ignore:
Timestamp:
04/23/12 23:34:37 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Convert SQL for bulk change choice page to existing calls to
DNSDB.pm. See #1.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r311 r313  
    984984} elsif ($webvar{page} eq 'bulkdomain') {
    985985  # Bulk operations on domains.  Note all but group move are available on the domain list.
     986##fixme:  do we care about bulk operations on revzones?  Move-to-group, activate, deactivate,
     987# and delete should all be much rarer for revzones than for domains.
    986988
    987989  changepage(page => "domlist", errmsg => "You are not permitted to make bulk domain changes")
     
    990992  fill_grouplist("grouplist");
    991993
    992 ##fixme
    993 ##fixme  push the SQL and direct database fiddling off into a sub in DNSDB.pm
    994 ##fixme
    995 
    996   my $sth = $dbh->prepare("SELECT count(*) FROM domains WHERE group_id=?");
    997   $sth->execute($curgroup);
    998   my ($count) = ($sth->fetchrow_array);
     994  my $count = getZoneCount($dbh, (revrec => 'n', curgroup => $curgroup) );
    999995
    1000996  $page->param(curpage => $webvar{page});
     
    1003999  $page->param(perpage => $perpage);
    10041000
    1005   my @domlist;
    1006   my $sql = "SELECT domain_id,domain FROM domains".
    1007         " WHERE group_id=?".
    1008         " ORDER BY domain".
    1009         ($offset eq 'all' ? '' : " LIMIT $perpage OFFSET ".$offset*$perpage);
    1010   $sth = $dbh->prepare($sql);
    1011   $sth->execute($curgroup);
     1001  my $domlist = getZoneList($dbh, (revrec => 'n', curgroup => $curgroup) );
    10121002  my $rownum = 0;
    1013   while (my @data = $sth->fetchrow_array) {
    1014     my %row;
    1015     $row{domid} = $data[0];
    1016     $row{domain} = $data[1];
    1017     $rownum++;  # putting this in the expression below causes failures.  *eyeroll*
    1018     $row{newrow} = $rownum % 5 == 0;
    1019     push @domlist, \%row;
    1020   }
    1021   $page->param(domtable => \@domlist);
     1003  foreach my $dom (@{$domlist}) {
     1004    delete $dom->{status};
     1005    delete $dom->{group};
     1006    $dom->{newrow} = (++$rownum) % 5 == 0;
     1007  }
     1008
     1009  $page->param(domtable => $domlist);
    10221010  # ACLs
    10231011  $page->param(maymove => ($permissions{admin} || ($permissions{domain_edit} && $permissions{domain_create} && $permissions{domain_delete})));
  • trunk/templates/bulkdomain.tmpl

    r207 r313  
    4040<table>
    4141<tr>
    42 <TMPL_LOOP NAME=domtable><td><input type="checkbox" name="dom_<TMPL_VAR NAME=domid>" value="<TMPL_VAR NAME=domid>" /> <TMPL_VAR NAME=domain></td>
     42<TMPL_LOOP NAME=domtable><td><input type="checkbox" name="dom_<TMPL_VAR NAME=domainid>" value="<TMPL_VAR NAME=domainid>" /> <TMPL_VAR NAME=domain></td>
    4343<TMPL_IF newrow></tr>
    4444<tr>
Note: See TracChangeset for help on using the changeset viewer.