[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface domainprefs.pm
raeburn
raeburn at source.lon-capa.org
Wed Jul 31 21:45:50 EDT 2019
raeburn Thu Aug 1 01:45:50 2019 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface domainprefs.pm
Log:
- For 2.11
Backport 1.342
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160.6.93 loncom/interface/domainprefs.pm:1.160.6.94
--- loncom/interface/domainprefs.pm:1.160.6.93 Tue Jul 30 11:14:53 2019
+++ loncom/interface/domainprefs.pm Thu Aug 1 01:45:48 2019
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.93 2019/07/30 11:14:53 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.94 2019/08/01 01:45:48 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4440,13 +4440,13 @@
my $numinrow = 1;
my $datatable;
my %servers = &Apache::lonnet::internet_dom_servers($dom);
- my (%currbalancer,%currtargets,%currrules,%existing);
+ my (%currbalancer,%currtargets,%currrules,%existing,%currcookies);
if (ref($settings) eq 'HASH') {
%existing = %{$settings};
}
if ((keys(%servers) > 1) || (keys(%existing) > 0)) {
&get_loadbalancers_config(\%servers,\%existing,\%currbalancer,
- \%currtargets,\%currrules);
+ \%currtargets,\%currrules,\%currcookies);
} else {
return;
}
@@ -4523,6 +4523,9 @@
my %hostherechecked = (
no => ' checked="checked"',
);
+ my %balcookiechecked = (
+ no => ' checked="checked"',
+ );
foreach my $sparetype (@sparestypes) {
my $targettable;
for (my $i=0; $i<$numspares; $i++) {
@@ -4578,6 +4581,11 @@
}
}
}
+ if ($currcookies{$lonhost}) {
+ %balcookiechecked = (
+ yes => ' checked="checked"',
+ );
+ }
$datatable .= &mt('Hosting on balancer itself').'<br />'.
'<label><input type="radio" name="loadbalancing_target_'.$balnum.'_hosthere" value="no"'.
$hostherechecked{'no'}.' />'.&mt('No').'</label><br />';
@@ -4586,7 +4594,12 @@
'value="'.$sparetype.'"'.$hostherechecked{$sparetype}.' /><i>'.$typetitles{$sparetype}.
'</i></label><br />';
}
- $datatable .= '</div></td></tr>'.
+ $datatable .= &mt('Use balancer cookie').'<br />'.
+ '<label><input type="radio" name="loadbalancing_cookie_'.$balnum.'" value="1"'.
+ $balcookiechecked{'yes'}.' />'.&mt('Yes').'</label><br />'.
+ '<label><input type="radio" name="loadbalancing_cookie_'.$balnum.'" value="0"'.
+ $balcookiechecked{'no'}.' />'.&mt('No').'</label><br />'.
+ '</div></td></tr>'.
&loadbalancing_rules($dom,$intdom,$currrules{$lonhost},
$othertitle,$usertypes,$types,\%servers,
\%currbalancer,$lonhost,
@@ -4600,10 +4613,11 @@
}
sub get_loadbalancers_config {
- my ($servers,$existing,$currbalancer,$currtargets,$currrules) = @_;
+ my ($servers,$existing,$currbalancer,$currtargets,$currrules,$currcookies) = @_;
return unless ((ref($servers) eq 'HASH') &&
(ref($existing) eq 'HASH') && (ref($currbalancer) eq 'HASH') &&
- (ref($currtargets) eq 'HASH') && (ref($currrules) eq 'HASH'));
+ (ref($currtargets) eq 'HASH') && (ref($currrules) eq 'HASH') &&
+ (ref($currcookies) eq 'HASH'));
if (keys(%{$existing}) > 0) {
my $oldlonhost;
foreach my $key (sort(keys(%{$existing}))) {
@@ -4622,6 +4636,9 @@
$currbalancer->{$key} = 1;
$currtargets->{$key} = $existing->{$key}{'targets'};
$currrules->{$key} = $existing->{$key}{'rules'};
+ if ($existing->{$key}{'cookie'}) {
+ $currcookies->{$key} = 1;
+ }
}
}
} else {
@@ -13238,12 +13255,12 @@
my @sparestypes = ('primary','default');
my %typetitles = &sparestype_titles();
my $resulttext;
- my (%currbalancer,%currtargets,%currrules,%existing);
+ my (%currbalancer,%currtargets,%currrules,%existing,%currcookies);
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
%existing = %{$domconfig{'loadbalancing'}};
}
&get_loadbalancers_config(\%servers,\%existing,\%currbalancer,
- \%currtargets,\%currrules);
+ \%currtargets,\%currrules,\%currcookies);
my ($saveloadbalancing,%defaultshash,%changes);
my ($alltypes,$othertypes,$titles) =
&loadbalancing_titles($dom,$intdom,$usertypes,$types);
@@ -13295,6 +13312,18 @@
}
$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype} = \@offloadto;
}
+ if ($env{'form.loadbalancing_cookie_'.$i}) {
+ $defaultshash{'loadbalancing'}{$balancer}{'cookie'} = 1;
+ if (exists($currbalancer{$balancer})) {
+ unless ($currcookies{$balancer}) {
+ $changes{'curr'}{$balancer}{'cookie'} = 1;
+ }
+ }
+ } elsif (exists($currbalancer{$balancer})) {
+ if ($currcookies{$balancer}) {
+ $changes{'curr'}{$balancer}{'cookie'} = 1;
+ }
+ }
if (ref($currtargets{$balancer}) eq 'HASH') {
foreach my $sparetype (@sparestypes) {
if (ref($currtargets{$balancer}{$sparetype}) eq 'ARRAY') {
@@ -13448,6 +13477,10 @@
}
}
}
+ if ($changes{'curr'}{$balancer}{'cookie'}) {
+ $resulttext .= '<li>'.&mt('Load Balancer: [_1] -- cookie use enabled',
+ $balancer).'</li>';
+ }
if (keys(%toupdate)) {
my %thismachine;
my $updatedhere;
@@ -13677,12 +13710,12 @@
}
push(@alltypes,'default','_LC_adv','_LC_author','_LC_internetdom','_LC_external');
$allinsttypes = join("','", at alltypes);
- my (%currbalancer,%currtargets,%currrules,%existing);
+ my (%currbalancer,%currtargets,%currrules,%existing,%currcookies);
if (ref($settings) eq 'HASH') {
%existing = %{$settings};
}
&get_loadbalancers_config($servers,\%existing,\%currbalancer,
- \%currtargets,\%currrules);
+ \%currtargets,\%currrules,\%currcookies);
my $balancers = join("','",sort(keys(%currbalancer)));
return <<"END";
More information about the LON-CAPA-cvs
mailing list