--- loncom/auth/lonlogin.pm 2011/03/03 06:37:30 1.147 +++ loncom/auth/lonlogin.pm 2011/06/11 18:21:07 1.148 @@ -1,7 +1,7 @@ # The LearningOnline Network # Login Screen # -# $Id: lonlogin.pm,v 1.147 2011/03/03 06:37:30 raeburn Exp $ +# $Id: lonlogin.pm,v 1.148 2011/06/11 18:21:07 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -200,9 +200,13 @@ sub handler { 'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras, $lonhost); -# ------------------- If we cannot talk to ourselves, we are in serious trouble +# -- If we cannot talk to ourselves, or hostID does not map to a hostname +# we are in serious trouble - if ($logtoken eq 'con_lost') { + if (($logtoken eq 'con_lost') || ($logtoken eq 'no_such_host')) { + if ($logtoken eq 'no_such_host') { + &Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab'); + } my $spares=''; my $last; foreach my $hostid (sort @@ -213,7 +217,7 @@ sub handler { keys(%Apache::lonnet::spareid)) { next if ($hostid eq $lonhost); my $hostname = &Apache::lonnet::hostname($hostid); - next if ($last eq $hostname); + next if (($last eq $hostname) || ($hostname eq '')); $spares.='
'. @@ -221,7 +225,9 @@ sub handler { ' '.&mt('(preferred)').''.$/; $last=$hostname; } -$spares.= '
'; + if ($spares) { + $spares.= '
'; + } my %all_hostnames = &Apache::lonnet::all_hostnames(); foreach my $hostid (sort { @@ -231,7 +237,7 @@ foreach my $hostid (sort keys(%all_hostnames)) { next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid}); my $hostname = &Apache::lonnet::hostname($hostid); - next if ($last eq $hostname); + next if (($last eq $hostname) || ($hostname eq '')); $spares.='
'. @@ -246,12 +252,15 @@ $r->print( .'' .'

'.&mt('The LearningOnline Network with CAPA').'

' .'' - .'

'.&mt('This LON-CAPA server is temporarily not available for login.').'

' - .'

'.&mt('Please attempt to login to one of the following servers:').'

' - .$spares - .'' + .'

'.&mt('This LON-CAPA server is temporarily not available for login.').'

'); + if ($spares) { + $r->print('

'.&mt('Please attempt to login to one of the following servers:') + .'

' + .$spares); + } + $r->print('' .'' -); + ); return OK; }