--- loncom/interface/domainprefs.pm 2016/10/24 22:37:24 1.160.6.74
+++ loncom/interface/domainprefs.pm 2017/01/21 21:51:56 1.160.6.76
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.74 2016/10/24 22:37:24 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.76 2017/01/21 21:51:56 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4019,6 +4019,9 @@ sub print_loadbalancing {
my ($numspares,@spares) = &count_servers($lonhost,%servers);
my @sparestypes = ('primary','default');
my %typetitles = &sparestype_titles();
+ my %hostherechecked = (
+ no => ' checked="checked"',
+ );
foreach my $sparetype (@sparestypes) {
my $targettable;
for (my $i=0; $i<$numspares; $i++) {
@@ -4064,6 +4067,23 @@ sub print_loadbalancing {
$datatable .= ''.$typetitles{$sparetype}.'
'.
'
';
}
+ $hostherechecked{$sparetype} = '';
+ if (ref($currtargets{$lonhost}) eq 'HASH') {
+ if (ref($currtargets{$lonhost}{$sparetype}) eq 'ARRAY') {
+ if (grep(/^\Q$lonhost\E$/,@{$currtargets{$lonhost}{$sparetype}})) {
+ $hostherechecked{$sparetype} = ' checked="checked"';
+ $hostherechecked{'no'} = '';
+ }
+ }
+ }
+ }
+ $datatable .= &mt('Hosting on balancer itself').'
'.
+ '
';
+ foreach my $sparetype (@sparestypes) {
+ $datatable .= '
';
}
$datatable .= ''.
&loadbalancing_rules($dom,$intdom,$currrules{$lonhost},
@@ -10590,13 +10610,15 @@ sub modify_helpsettings {
$rolename=~s/[^A-Za-z0-9]//gs;
if ($rolename ne '') {
unless(exists($existing{'rolesdef_'.$rolename})) {
- my $errmsg;
- my $result = &Apache::lonuserutils::store_custom_role($rolename,$prefix,
- $confname,$dom);
+ my %newprivs = &Apache::lonuserutils::custom_role_update($rolename,$prefix);
+ my $result = &Apache::lonnet::definerole($rolename,$newprivs{'s'},$newprivs{'d'},
+ $newprivs{'c'},$confname,$dom);
if ($result eq 'ok') {
$changes{'newcustomrole'} = $rolename;
} else {
- $errmsg = ': '.$result;
+ $errors .= ''.
+ &mt('An error occurred storing the new custom role: [_1]',
+ $result).'';
}
}
}
@@ -11630,8 +11652,13 @@ sub modify_loadbalancing {
push(@offloadto,$target);
}
}
- $defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype} = \@offloadto;
}
+ if ($env{'form.loadbalancing_target_'.$i.'_hosthere'} eq $sparetype) {
+ unless(grep(/^\Q$balancer\E$/,@offloadto)) {
+ push(@offloadto,$balancer);
+ }
+ }
+ $defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype} = \@offloadto;
}
if (ref($currtargets{$balancer}) eq 'HASH') {
foreach my $sparetype (@sparestypes) {