version 1.101.8.4, 2010/08/26 08:15:59
|
version 1.101.8.7, 2011/09/27 20:18:45
|
Line 276 sub handler {
|
Line 276 sub handler {
|
my $tmpinfo=Apache::lonnet::reply('tmpget:'.$form{'logtoken'}, |
my $tmpinfo=Apache::lonnet::reply('tmpget:'.$form{'logtoken'}, |
$form{'serverid'}); |
$form{'serverid'}); |
|
|
if (($tmpinfo=~/^error/) || ($tmpinfo eq 'con_lost')) { |
if (($tmpinfo=~/^error/) || ($tmpinfo eq 'con_lost') || |
|
($tmpinfo eq 'no_such_host')) { |
&failed($r,'Information needed to verify your login information is missing, inaccessible or expired.',\%form); |
&failed($r,'Information needed to verify your login information is missing, inaccessible or expired.',\%form); |
return OK; |
return OK; |
} else { |
} else { |
Line 362 sub handler {
|
Line 363 sub handler {
|
&Apache::lonnet::get_dom('configuration',['usercreation'],$form{'udom'}); |
&Apache::lonnet::get_dom('configuration',['usercreation'],$form{'udom'}); |
if (grep(/^login$/,@cancreate)) { |
if (grep(/^login$/,@cancreate)) { |
my $domdesc = &Apache::lonnet::domain($form{'udom'},'description'); |
my $domdesc = &Apache::lonnet::domain($form{'udom'},'description'); |
&check_can_host($r,\%form,'no_account_on_host',$domdesc); |
unless (&check_can_host($r,\%form,'no_account_on_host',$domdesc)) { |
|
return OK; |
|
} |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Create a user account in LON-CAPA', |
&Apache::loncommon::start_page('Create a user account in LON-CAPA', |
'',{'no_inline_link' => 1,}); |
'',{'no_inline_link' => 1,}); |
Line 415 sub handler {
|
Line 418 sub handler {
|
} |
} |
} |
} |
|
|
&check_can_host($r,\%form,$authhost); |
|
|
|
if ($r->dir_config("lonBalancer") eq 'yes') { |
if ($r->dir_config("lonBalancer") eq 'yes') { |
&success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef, |
my $otherserver = &Apache::lonnet::spareserver(30000,undef,1,$form{'udom'}); |
\%form); |
if (!$otherserver) { |
my ($otherserver) = &Apache::lonnet::choose_server($form{'udom'}); |
($otherserver) = &Apache::lonnet::choose_server($form{'udom'}); |
$r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl); |
} |
|
if ($otherserver) { |
|
&success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef, |
|
\%form); |
|
$r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl); |
|
} else { |
|
$r->print(&noswitch()); |
|
} |
|
return OK; |
} else { |
} else { |
|
if (!&check_can_host($r,\%form,$authhost)) { |
|
my ($otherserver) = &Apache::lonnet::choose_server($form{'udom'}); |
|
if ($otherserver) { |
|
&success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef, |
|
\%form); |
|
$r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl); |
|
} else { |
|
$r->print(&noswitch()); |
|
} |
|
return OK; |
|
} |
# ------------------------------------------------------- Do the load balancing |
# ------------------------------------------------------- Do the load balancing |
|
|
# ---------------------------------------------------------- Determine own load |
# ---------------------------------------------------------- Determine own load |
Line 439 sub handler {
|
Line 459 sub handler {
|
# ---------------------------------------------------------- Are we overloaded? |
# ---------------------------------------------------------- Are we overloaded? |
if ((($userloadpercent>100.0)||($loadpercent>100.0))) { |
if ((($userloadpercent>100.0)||($loadpercent>100.0))) { |
my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent,1,$form{'udom'}); |
my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent,1,$form{'udom'}); |
|
if (!$unloaded) { |
|
($unloaded) = &Apache::lonnet::choose_server($form{'udom'}); |
|
} |
if ($unloaded) { |
if ($unloaded) { |
&success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect', |
&success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect', |
undef,\%form); |
undef,\%form); |
$r->internal_redirect('/adm/switchserver?otherserver='.$unloaded.'&origurl='.$firsturl); |
$r->internal_redirect('/adm/switchserver?otherserver='.$unloaded.'&origurl='.$firsturl); |
|
return OK; |
} |
} |
} |
} |
&success($r,$form{'uname'},$form{'udom'},$authhost,$firsturl,undef, |
&success($r,$form{'uname'},$form{'udom'},$authhost,$firsturl,undef, |
\%form); |
\%form); |
|
return OK; |
} |
} |
return OK; |
|
} |
} |
|
|
sub check_can_host { |
sub check_can_host { |
Line 483 sub check_can_host {
|
Line 507 sub check_can_host {
|
} |
} |
unless ($canhost) { |
unless ($canhost) { |
if ($authhost eq 'no_account_on_host') { |
if ($authhost eq 'no_account_on_host') { |
my ($login_host,$hostname) = &Apache::lonnet::choose_server($udom); |
my $checkloginvia = 1; |
|
my ($login_host,$hostname) = |
|
&Apache::lonnet::choose_server($udom,$checkloginvia); |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
if ($login_host ne '') { |
if ($login_host ne '') { |
Line 503 sub check_can_host {
|
Line 529 sub check_can_host {
|
'<p>'.&mt('Currently a LON-CAPA server is not available within the [_1] domain for you to log-in to, to create an account.',$domdesc).'</p>'. |
'<p>'.&mt('Currently a LON-CAPA server is not available within the [_1] domain for you to log-in to, to create an account.',$domdesc).'</p>'. |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
return OK; |
|
} else { |
} else { |
&success($r,$form->{'uname'},$udom,$authhost,'noredirect',undef, |
&success($r,$form->{'uname'},$udom,$authhost,'noredirect',undef, |
$form); |
$form); |
Line 511 sub check_can_host {
|
Line 536 sub check_can_host {
|
$r->internal_redirect('/adm/switchserver?otherserver='.$otherserver); |
$r->internal_redirect('/adm/switchserver?otherserver='.$otherserver); |
} |
} |
} |
} |
|
return $canhost; |
|
} |
|
|
|
sub noswitch { |
|
my $result = &Apache::loncommon::start_page('Access to LON-CAPA unavailable'). |
|
'<h3>'.&mt('Session unavailable').'</h3>'. |
|
&mt('This LON-CAPA server is unable to host your session.').'<br />'. |
|
'<p>'.&mt('Currently no other LON-CAPA server is available to host your session either.').'</p>'. |
|
&Apache::loncommon::end_page(); |
|
return $result; |
} |
} |
|
|
1; |
1; |