[LON-CAPA-cvs] cvs: loncom /auth lonlogin.pm
www
lon-capa-cvs@mail.lon-capa.org
Tue, 04 Feb 2003 16:03:25 -0000
www Tue Feb 4 11:03:25 2003 EDT
Modified files:
/loncom/auth lonlogin.pm
Log:
Give people some options if lonc/lond is down on current server.
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.30 loncom/auth/lonlogin.pm:1.31
--- loncom/auth/lonlogin.pm:1.30 Tue Feb 4 10:11:44 2003
+++ loncom/auth/lonlogin.pm Tue Feb 4 11:03:25 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Login Screen
#
-# $Id: lonlogin.pm,v 1.30 2003/02/04 15:11:44 www Exp $
+# $Id: lonlogin.pm,v 1.31 2003/02/04 16:03:25 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -50,7 +50,7 @@
&Apache::loncommon::get_unprocessed_cgi
- ($ENV{'QUERY_STRING'},['interface','username','domain']);
+ ($ENV{'QUERY_STRING'},['interface','username','domain','firsturl']);
$ENV{'form.interface'}=~s/\W//g;
@@ -83,7 +83,8 @@
# ------------------------------------------------------- Do the load balancing
my $otherserver='http://'.$ENV{'SERVER_NAME'};
- my $firsturl=$ENV{'request.firsturl'};
+ my $firsturl=
+ ($ENV{'request.firsturl'}?$ENV{'request.firsturl'}:$ENV{'form.firsturl'});
# ---------------------------------------- Are we access server and overloaded?
if (($role eq 'access') && ($loadpercent>100.0)) {
$otherserver=Apache::lonnet::spareserver($loadpercent);
@@ -109,9 +110,41 @@
my $uextkey=hex($ukey);
if ($uextkey>2147483647) { $uextkey-=4294967296; }
+# -------------------------------------------------------- Store away log token
my $logtoken=Apache::lonnet::reply(
'tmpput:'.$ukey.$lkey.'&'.$firsturl,
$lonhost);
+
+# ------------------- If we cannot talk to ourselves, we are in serious trouble
+
+ if ($logtoken eq 'con_lost') {
+ my $spares='';
+ foreach (keys %Apache::lonnet::hostname) {
+ if ($_ ne $lonhost) {
+ $spares.='<br /><a href="http://'.$Apache::lonnet::hostname{$_}.
+ '/adm/login?domain='.$authdomain.'">'.
+ $Apache::lonnet::hostname{$_}.'</a>';
+ if ($Apache::lonnet::spareid{$_}) {
+ $spares.=' (preferred)';
+ }
+ }
+ }
+ $r->print(<<ENDTROUBLE);
+<html>
+<head><title>The LearningOnline Network with CAPA</title></head>
+<body bgcolor="#FFFFFF">
+<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" />
+<h3>This LON-CAPA server is temporarily not available for login</h3>
+<p>Please attempt to login to one of the following servers:</p>$spares
+<p>If the problem persists, please contact <tt>$servadm</tt>.</p>
+</body>
+</html>
+ENDTROUBLE
+ return OK;
+ }
+
+# ----------------------------------------------- Apparently we are in business
+
my $domainlogo=&Apache::loncommon::domainlogo();
# --------------------------------------------------- Print login screen header
$r->print(<<ENDHEADER);