Changeset 638
- Timestamp:
- 06/03/14 17:18:10 (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dns.cgi
r628 r638 1077 1077 fill_permissions($page, \%grpperms); 1078 1078 1079 } elsif ($webvar{page} eq 'bulkdomain' ) {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 1081 ##fixme: do we care about bulk operations on revzones? Move-to-group, activate, deactivate, 1082 1082 # and delete should all be much rarer for revzones than for domains. 1083 1083 1084 changepage(page => "domlist", errmsg => "You are not permitted to make bulk domainchanges")1084 changepage(page => "domlist", errmsg => "You are not permitted to make bulk zone changes") 1085 1085 unless ($permissions{admin} || $permissions{domain_edit} || $permissions{domain_create} || $permissions{domain_delete}); 1086 1086 1087 1087 fill_grouplist("grouplist"); 1088 1088 1089 my $count = $dnsdb->getZoneCount(revrec => 'n', curgroup => $curgroup); 1089 $page->param(fwdzone => $webvar{page} eq 'bulkdomain'); 1090 1091 my $count = $dnsdb->getZoneCount(revrec => ($webvar{page} eq 'bulkdomain' ? 'n' : 'y'), 1092 curgroup => $curgroup); 1090 1093 1091 1094 $page->param(curpage => $webvar{page}); … … 1094 1097 $page->param(perpage => $perpage); 1095 1098 1096 my $domlist = $dnsdb->getZoneList(revrec => 'n', curgroup => $curgroup, offset => $offset); 1099 my $domlist = $dnsdb->getZoneList(revrec => ($webvar{page} eq 'bulkdomain' ? 'n' : 'y'), 1100 curgroup => $curgroup, offset => $offset); 1097 1101 my $rownum = 0; 1098 1102 foreach my $dom (@{$domlist}) { 1099 1103 delete $dom->{status}; 1100 1104 delete $dom->{group}; 1101 $dom->{newrow} = (++$rownum) % 5 == 0 ;1105 $dom->{newrow} = (++$rownum) % 5 == 0 && $rownum != $perpage; 1102 1106 } 1103 1107 … … 1140 1144 # order here, and since we don't have the domain names until we go around this 1141 1145 # loop, we can't alpha-sort them here. :( 1142 foreach (keys %webvar) {1146 foreach my $input (keys %webvar) { 1143 1147 my %row; 1144 next unless $_ =~ /^dom_\d+$/; 1148 next unless $input =~ /^(dom|rev)_\d+$/; 1149 my $fr = $1; 1145 1150 # second security check - does the user have permission to meddle with this domain? 1146 if (!check_scope(id => $webvar{$ _}, type => 'domain')) {1147 $row{domerr} = "You are not permitted to make changes to the requested domain";1148 $row{domain} = $webvar{$ _};1151 if (!check_scope(id => $webvar{$input}, type => ($fr eq 'dom' ? 'domain' : 'revzone'))) { 1152 $row{domerr} = "You are not permitted to make changes to the requested zone"; 1153 $row{domain} = $webvar{$input}; 1149 1154 push @bulkresults, \%row; 1150 1155 next; 1151 1156 } 1152 $row{domain} = $dnsdb->domainName($webvar{$_});1157 $row{domain} = ($fr eq 'dom' ? $dnsdb->domainName($webvar{$input}) : $dnsdb->revName($webvar{$input})); 1153 1158 1154 1159 # Do the $webvar{bulkaction} 1155 1160 my ($code, $msg); 1156 ($code, $msg) = $dnsdb->changeGroup( 'domain', $webvar{$_}, $webvar{destgroup})1161 ($code, $msg) = $dnsdb->changeGroup(($fr eq 'dom' ? 'domain' : 'revzone'), $webvar{$input}, $webvar{destgroup}) 1157 1162 if $webvar{bulkaction} eq 'move'; 1158 1163 if ($webvar{bulkaction} eq 'deactivate' || $webvar{bulkaction} eq 'activate') { 1159 my $stat = $dnsdb->zoneStatus($webvar{$_}, 'n', ($webvar{bulkaction} eq 'activate' ? 'domon' : 'domoff')); 1164 my $stat = $dnsdb->zoneStatus($webvar{$input}, ($fr eq 'dom' ? 'n' : 'y'), 1165 ($webvar{bulkaction} eq 'activate' ? 'domon' : 'domoff')); 1160 1166 $code = (defined($stat) ? 'OK' : 'FAIL'); 1161 1167 $msg = (defined($stat) ? $DNSDB::resultstr : $DNSDB::errstr); 1162 1168 } 1163 ($code, $msg) = $dnsdb->delZone($webvar{$ _}, 'n')1169 ($code, $msg) = $dnsdb->delZone($webvar{$input}, ($fr eq 'dom' ? 'n' : 'y')) 1164 1170 if $webvar{bulkaction} eq 'delete'; 1165 1171 -
trunk/templates/bulkdomain.tmpl
r590 r638 17 17 <tr><td> 18 18 <table border="0" cellspacing="2" cellpadding="2" width="100%"> 19 <tr class="darkrowheader"><td colspan="2" align="center">Bulk DomainChanges</td></tr>19 <tr class="darkrowheader"><td colspan="2" align="center">Bulk Zone Changes</td></tr> 20 20 21 21 <tr class="datalinelight"> … … 32 32 </tr> 33 33 <tr class="darkrowheader"> 34 <td colspan="2" align="center"> Domains to change:</td>34 <td colspan="2" align="center">Zones to change:</td> 35 35 </tr> 36 36 <tr class="datalinelight"> … … 38 38 <div class="center"><TMPL_INCLUDE NAME="pgcount.tmpl"></div> 39 39 <div class="center"><TMPL_INCLUDE NAME="fpnla.tmpl"></div> 40 <div class="center hidden" id="selall"><input type="checkbox" name="selall" id="master" onclick="bulk_selall();" /> Select all domains on this page</div> 40 <div class="center hidden" id="selall"><input type="checkbox" name="selall" id="master" onclick="bulk_selall();" 41 /> Select all zones on this page</div> 41 42 42 43 <table> 43 44 <tr> 44 <TMPL_LOOP NAME=domtable><td><input type="checkbox" name=" dom_<TMPL_VAR NAME=zoneid>" value="<TMPL_VAR NAME=zoneid>" /> <TMPL_VAR NAME=zone></td>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> 45 46 <TMPL_IF newrow></tr> 46 47 <tr> -
trunk/templates/menu.tmpl
r493 r638 12 12 <TMPL_IF mayimport><a href="<TMPL_VAR NAME=script_self>&page=axfr">AXFR Import</a><br /></TMPL_IF> 13 13 <TMPL_IF maybulk><a href="<TMPL_VAR NAME=script_self>&page=bulkdomain">Bulk Domain Operations</a><br /></TMPL_IF> 14 <TMPL_IF maybulk><a href="<TMPL_VAR NAME=script_self>&page=bulkrev">Bulk Reverse Zone Operations</a><br /></TMPL_IF> 14 15 <br /> 15 16 <a href="<TMPL_VAR NAME=script_self>&page=grpman"><TMPL_IF chggrps>Manage<TMPL_ELSE>View</TMPL_IF> groups</a><br /> -
trunk/templates/widgets.js
r590 r638 14 14 var newstate = document.getElementById("master").checked; 15 15 for (var i=0; i<y.length; i++) { 16 // only monkey with the dom _nnnn checkboxes17 if (y[i].name.substring(0,4) == 'dom_' ) {16 // only monkey with the dom/rev_nnnn checkboxes 17 if (y[i].name.substring(0,4) == 'dom_' || y[i].name.substring(0,4) == 'rev_') { 18 18 if (newstate == true) { 19 19 // if the master gets checkmarked, save the original state of 20 // the dom _nnn checkbox, and force it to "true"20 // the dom/rev_nnn checkbox, and force it to "true" 21 21 bulk_selstate[i] = y[i].checked; 22 22 y[i].checked = true;
Note:
See TracChangeset
for help on using the changeset viewer.