--- loncom/auth/lonlogin.pm 2003/01/31 21:51:36 1.29 +++ loncom/auth/lonlogin.pm 2003/04/03 21:53:51 1.40 @@ -1,7 +1,7 @@ # The LearningOnline Network # Login Screen # -# $Id: lonlogin.pm,v 1.29 2003/01/31 21:51:36 www Exp $ +# $Id: lonlogin.pm,v 1.40 2003/04/03 21:53:51 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,13 +50,27 @@ sub handler { &Apache::loncommon::get_unprocessed_cgi - ($ENV{'QUERY_STRING'},['interface']); - + ($ENV{'QUERY_STRING'}.'&'.$ENV{'request.querystring'}, + ['interface','username','domain','firsturl']); + +# ----------------------------------------------------------- Process Interface $ENV{'form.interface'}=~s/\W//g; - my $fullgraph=($ENV{'form.interface'} ne 'textual'); + my $textbrowsers=$r->dir_config('lonTextBrowsers'); + my $httpbrowser=$ENV{"HTTP_USER_AGENT"}; + + foreach (split(/\:/,$textbrowsers)) { + if ($httpbrowser=~/$_/i) { + $ENV{'form.interface'}='textual'; + } + } - my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':8080'. + my $fullgraph=($ENV{'form.interface'} ne 'textual'); + my $port_to_use=$r->dir_config('lonhttpdPort'); + if (!defined($port_to_use)) { + $port_to_use='8080'; + } + my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':'.$port_to_use. $r->dir_config('lonIconsURL'); my $domain = $r->dir_config('lonDefDomain'); my $role = $r->dir_config('lonRole'); @@ -66,7 +80,14 @@ sub handler { my $lonhost = $r->dir_config('lonHostID'); my $tabdir = $r->dir_config('lonTabDir'); my $include = $r->dir_config('lonIncludes'); + my $expire = $r->dir_config('lonExpire'); + +# --------------------------------------------- Default values for login fields + my $authusername=($ENV{'form.username'}?$ENV{'form.username'}:''); + my $authdomain=($ENV{'form.domain'}?$ENV{'form.domain'}:$domain); + +# ---------------------------------------------------------- Determine own load my $loadavg; { my $loadfile=Apache::File->new('/proc/loadavg'); @@ -75,8 +96,10 @@ sub handler { $loadavg =~ s/\s.*//g; my $loadpercent=100*$loadavg/$loadlim; +# ------------------------------------------------------- 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); @@ -102,14 +125,50 @@ sub handler { 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.='
'. + $Apache::lonnet::hostname{$_}.''; + if ($Apache::lonnet::spareid{$_}) { + $spares.=' (preferred)'; + } + } + } + $r->print(< +The LearningOnline Network with CAPA + + +

This LON-CAPA server is temporarily not available for login

+

Please attempt to login to one of the following servers:

$spares +

If the problem persists, please contact $servadm.

+ + +ENDTROUBLE + return OK; + } + +# ----------------------------------------------- Apparently we are in business + my $domainlogo=&Apache::loncommon::domainlogo(); + $servadm=~s/\,/\
/g; + $sysadm=~s/\,/\
/g; + # --------------------------------------------------- Print login screen header $r->print(< + The LearningOnline Network with CAPA Login ENDHEADER @@ -120,13 +179,19 @@ ENDHEADER } # ----------------------------------------------------------- Front page design - my $pgbg=&Apache::loncommon::designparm('login.pgbg'); - my $font=&Apache::loncommon::designparm('login.font'); - my $link=&Apache::loncommon::designparm('login.link'); - my $vlink=&Apache::loncommon::designparm('login.vlink'); + my $pgbg= + ($fullgraph?&Apache::loncommon::designparm('login.pgbg'):'#FFFFFF'); + my $font= + ($fullgraph?&Apache::loncommon::designparm('login.font'):'#000000'); + my $link= + ($fullgraph?&Apache::loncommon::designparm('login.link'):'#0000FF'); + my $vlink= + ($fullgraph?&Apache::loncommon::designparm('login.vlink'):'#0000FF'); my $alink=&Apache::loncommon::designparm('login.alink'); - my $mainbg=&Apache::loncommon::designparm('login.mainbg'); - my $sidebg=&Apache::loncommon::designparm('login.sidebg'); + my $mainbg= + ($fullgraph?&Apache::loncommon::designparm('login.mainbg'):'#FFFFFF'); + my $sidebg= + ($fullgraph?&Apache::loncommon::designparm('login.sidebg'):'#FFFFFF'); my $logo=&Apache::loncommon::designparm('login.logo'); my $img=&Apache::loncommon::designparm('login.img'); @@ -146,6 +211,24 @@ ENDHEADER this.document.server.elements.udom.value =this.document.client.elements.udom.value; + this.document.server.elements.imagesuppress.value + =this.document.client.elements.imagesuppress.checked; + + this.document.server.elements.embedsuppress.value + =this.document.client.elements.embedsuppress.checked; + + this.document.server.elements.appletsuppress.value + =this.document.client.elements.appletsuppress.checked; + + this.document.server.elements.fontenhance.value + =this.document.client.elements.fontenhance.checked; + + this.document.server.elements.blackwhite.value + =this.document.client.elements.blackwhite.checked; + + this.document.server.elements.remember.value + =this.document.client.elements.remember.checked; + uextkey=this.document.client.elements.uextkey.value; lextkey=this.document.client.elements.lextkey.value; initkeys(); @@ -166,12 +249,18 @@ ENDSCRIPT $r->print(< - - - - - - + + + + + + + + + + + + ENDSERVERFORM if ($fullgraph) { $r->print(< ENDTOP +} else { + $r->print('

The LearningOnline Network with CAPA

Text-based Interface Login

'); +} + $r->print('
'); + unless ($fullgraph) { + $r->print(<Select Accessibility Options + Suppress rendering of images
+ Suppress Java applets
+ Suppress rendering of embedded multimedia
+ Increase font size
+ Switch to black and white mode
+

If you have accessibility needs that are not addressed by this interface, +please +contact the system administrator at $sysadm.


+ Remember these settings for next login
+ENDACCESSOPTIONS +} else { + $r->print(< + + + + + +ENDNOOPT } $r->print(< @@ -239,7 +353,7 @@ ENDTOP User Authentication
   User Name: -
+
   Password: @@ -247,7 +361,7 @@ ENDTOP    Domain: - +    Help