--- loncom/interface/domainprefs.pm 2016/10/05 13:59:46 1.282 +++ loncom/interface/domainprefs.pm 2016/12/05 00:51:53 1.284 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.282 2016/10/05 13:59:46 raeburn Exp $ +# $Id: domainprefs.pm,v 1.284 2016/12/05 00:51:53 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -4690,6 +4690,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++) { @@ -4735,6 +4738,23 @@ sub print_loadbalancing { $datatable .= ''.$typetitles{$sparetype}.'
'. ''.$targettable.'

'; } + $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}, @@ -11853,13 +11873,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).'
  • '; } } } @@ -13192,8 +13214,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) {