Changeset 640
- Timestamp:
- 06/05/14 14:00:13 (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r638 r640 1079 1079 } elsif ($webvar{page} eq 'bulkdomain' || $webvar{page} eq 'bulkrev') { 1080 1080 # Bulk operations on domains. Note all but group move are available on the domain list. 1081 ##fixme: do we care about bulk operations on revzones? Move-to-group, activate, deactivate,1082 # and delete should all be much rarer for revzones than for domains.1083 1081 1084 1082 changepage(page => "domlist", errmsg => "You are not permitted to make bulk zone changes") … … 1112 1110 $page->param(maydelete => $permissions{admin} || $permissions{domain_delete}); 1113 1111 1112 #} elsif ($webvar{page} eq 'confirmbulkdom' || $webvar{page} eq 'confirmbulkrev') { 1113 } elsif ($webvar{page} eq 'confirmbulk') { 1114 1115 changepage(page => "domlist", errmsg => "You are not permitted to make bulk zone changes") 1116 unless ($permissions{admin} || $permissions{domain_edit} || $permissions{domain_create} || $permissions{domain_delete}); 1117 1118 $page->param(bulkaction => $webvar{bulkaction}); 1119 $page->param(destgroup => $webvar{destgroup}); 1120 my @zlist; 1121 my $rownum = 0; 1122 1123 ##fixme: this could probably be made more efficient, since this looks up 2 zone names for 1124 # each comparison during sort rather than slurping them in bulk once before doing the sort 1125 # sort zones by zone name, not ID 1126 sub zsort { 1127 my $tmpa = ($a =~ /^dom/ ? $dnsdb->domainName($webvar{$a}) : $dnsdb->revName($webvar{$a}) ); 1128 my $tmpb = ($b =~ /^dom/ ? $dnsdb->domainName($webvar{$b}) : $dnsdb->revName($webvar{$b}) ); 1129 return $tmpa cmp $tmpb; 1130 } 1131 # eugh. can't see a handy way to sort this mess by zone name the way it is on the submitting page. :( 1132 foreach my $input (sort zsort grep(/^(?:dom|rev)_/, keys %webvar) ) { 1133 next unless $input =~ /^(dom|rev)_\d+$/; 1134 my $fr = $1; 1135 my %row = (zoneid => $webvar{$input}, 1136 zone => ($fr eq 'dom' ? $dnsdb->domainName($webvar{$input}) : $dnsdb->revName($webvar{$input}) ), 1137 zvarname => $input, 1138 newrow => ( (++$rownum) % 5 == 0 && $rownum != $perpage), 1139 ); 1140 push @zlist, \%row; 1141 } 1142 $page->param(domtable => \@zlist); 1143 1114 1144 } elsif ($webvar{page} eq 'bulkchange') { 1115 1145 … … 1120 1150 } 1121 1151 1152 # skip the changes if user did not confirm 1153 my $wasrev = grep /^rev_/, keys %webvar; 1154 changepage(page => ($wasrev ? "bulkrev" : "bulkdomain")) unless $webvar{okdel} eq 'y'; 1155 1156 changepage(page => "domlist", errmsg => "You are not permitted to make bulk zone changes") 1157 unless ($permissions{admin} || $permissions{domain_edit} || $permissions{domain_create} || $permissions{domain_delete}); 1158 1122 1159 # per-action scope checks 1123 1160 if ($webvar{bulkaction} eq 'move') { 1124 changepage(page => "domlist", errmsg => "You are not permitted to bulk-move domains")1161 changepage(page => "domlist", errmsg => "You are not permitted to bulk-move zones") 1125 1162 unless ($permissions{admin} || ($permissions{domain_edit} && $permissions{domain_create} && $permissions{domain_delete})); 1126 1163 my $newgname = $dnsdb->groupName($webvar{destgroup}); 1127 1164 $page->param(action => "Move to group $newgname"); 1128 1165 } elsif ($webvar{bulkaction} eq 'deactivate' || $webvar{bulkaction} eq 'activate') { 1129 changepage(page => "domlist", errmsg => "You are not permitted to bulk-$webvar{bulkaction} domains")1166 changepage(page => "domlist", errmsg => "You are not permitted to bulk-$webvar{bulkaction} zones") 1130 1167 unless ($permissions{admin} || $permissions{domain_edit}); 1131 $page->param(action => "$webvar{bulkaction} domains");1168 $page->param(action => "$webvar{bulkaction} zones"); 1132 1169 } elsif ($webvar{bulkaction} eq 'delete') { 1133 changepage(page => "domlist", errmsg => "You are not permitted to bulk-delete domains")1170 changepage(page => "domlist", errmsg => "You are not permitted to bulk-delete zones") 1134 1171 unless ($permissions{admin} || $permissions{domain_delete}); 1135 $page->param(action => "$webvar{bulkaction} domains");1172 $page->param(action => "$webvar{bulkaction} zones"); 1136 1173 } else { 1137 1174 # unknown action, bypass actually doing anything. it should not be possible in -
trunk/templates/bulkdomain.tmpl
r638 r640 10 10 <fieldset> 11 11 12 <input type="hidden" name="page" value=" bulkchange" />12 <input type="hidden" name="page" value="confirmbulk" /> 13 13 <input type="hidden" name="offset" value="<TMPL_VAR NAME=offset>" /> 14 14 <input type="hidden" name="perpage" value="<TMPL_VAR NAME=perpage>" /> … … 44 44 <tr> 45 45 <TMPL_LOOP NAME=domtable><td><input type="checkbox" name="<TMPL_IF fwdzone>dom<TMPL_ELSE>rev</TMPL_IF>_<TMPL_VAR NAME=zoneid>" value="<TMPL_VAR NAME=zoneid>" /> <TMPL_VAR NAME=zone></td> 46 <TMPL_IF newrow>< /tr>46 <TMPL_IF newrow><TMPL_UNLESS __last__></tr> 47 47 <tr> 48 </TMPL_ IF></TMPL_LOOP>48 </TMPL_UNLESS></TMPL_IF></TMPL_LOOP> 49 49 </tr> 50 50 </table>
Note:
See TracChangeset
for help on using the changeset viewer.