version 1.22, 2014/10/05 13:49:11
|
version 1.23, 2014/10/06 00:48:44
|
Line 114 sub ip_changed {
|
Line 114 sub ip_changed {
|
my $url; |
my $url; |
my $lonhost= $r->dir_config('lonHostID'); |
my $lonhost= $r->dir_config('lonHostID'); |
my $switchto = $lonhost; |
my $switchto = $lonhost; |
if ($rule_in_effect eq 'balancer') { |
if ($rule_in_effect ne 'offloadedto') { |
my $hosthere; |
my $hosthere; |
if ($dataref->{'role'}) { |
my @ids=&Apache::lonnet::current_machine_ids(); |
my ($adom,$aname); |
unless ($rule_in_effect eq 'balancer') { |
if ($dataref->{'role'} =~ m{^au\./($match_domain)/$}) { |
if (grep(/^\Q$rule_in_effect\E$/,@ids)) { |
$adom = $1; |
$hosthere = 1; |
$aname = $dataref->{'username'}; |
|
} elsif ($dataref->{'role'} =~ m{^(?:ca|aa)\./($match_domain)/($match_username)$}) { |
|
$adom = $1; |
|
$aname = $2; |
|
} |
} |
if ($adom ne '' && $aname ne '') { |
} |
my $ahome = &Apache::lonnet::homeserver($aname,$adom); |
unless ($hosthere) { |
unless ($ahome eq 'no_host') { |
if ($dataref->{'role'}) { |
my @ids=&Apache::lonnet::current_machine_ids(); |
my ($adom,$aname); |
if ($ahome && grep(/^\Q$ahome\E$/,@ids)) { |
if ($dataref->{'role'} =~ m{^au\./($match_domain)/$}) { |
$hosthere = 1; |
$adom = $1; |
|
$aname = $dataref->{'username'}; |
|
} elsif ($dataref->{'role'} =~ m{^(?:ca|aa)\./($match_domain)/($match_username)$}) { |
|
$adom = $1; |
|
$aname = $2; |
|
} |
|
if ($adom ne '' && $aname ne '') { |
|
my $ahome = &Apache::lonnet::homeserver($aname,$adom); |
|
unless ($ahome eq 'no_host') { |
|
if ($ahome && grep(/^\Q$ahome\E$/,@ids)) { |
|
$hosthere = 1; |
|
} |
} |
} |
} |
} |
} |
} |
} |
} |
unless ($hosthere) { |
unless ($hosthere) { |
my $hostname = &Apache::lonnet::hostname($dataref->{'server'}); |
my $hostname; |
|
if ($rule_in_effect eq 'balancer') { |
|
$hostname = &Apache::lonnet::hostname($dataref->{'server'}); |
|
if ($hostname) { |
|
$switchto = $dataref->{'server'}; |
|
} |
|
} else { |
|
$hostname = &Apache::lonnet::hostname($rule_in_effect); |
|
if ($hostname) { |
|
$switchto = $rule_in_effect; |
|
} |
|
} |
if ($hostname) { |
if ($hostname) { |
$switchto = $dataref->{'server'}; |
|
my $protocol = $Apache::lonnet::protocol{$switchto}; |
my $protocol = $Apache::lonnet::protocol{$switchto}; |
$protocol = 'http' if ($protocol ne 'https'); |
$protocol = 'http' if ($protocol ne 'https'); |
$url = $protocol.'://'.$hostname; |
$url = $protocol.'://'.$hostname; |
$message .= '<br />'. |
if ($rule_in_effect eq 'balancer') { |
&mt('As a result, your LON-CAPA session is being redirected to the server where you originally logged in.'); |
$message .= '<br />'. |
|
&mt('As a result, your LON-CAPA session is being redirected to the server where you originally logged in.'); |
|
} else { |
|
$message .= '<br />'. |
|
&mt('As a result, your LON-CAPA session is being redirected.'); |
|
} |
} |
} |
} |
} |
} |
} |