version 1.19, 2002/07/10 17:47:01
|
version 1.37, 2003/03/02 02:16:53
|
Line 50 sub handler {
|
Line 50 sub handler {
|
|
|
|
|
&Apache::loncommon::get_unprocessed_cgi |
&Apache::loncommon::get_unprocessed_cgi |
($ENV{'QUERY_STRING'},['interface']); |
($ENV{'QUERY_STRING'},['interface','username','domain','firsturl']); |
|
|
|
# ----------------------------------------------------------- Process Interface |
$ENV{'form.interface'}=~s/\W//g; |
$ENV{'form.interface'}=~s/\W//g; |
|
|
|
my $textbrowsers=$r->dir_config('lonTextBrowsers'); |
|
my $httpbrowser=$ENV{"HTTP_USER_AGENT"}; |
|
|
|
foreach (split(/\:/,$textbrowsers)) { |
|
if ($httpbrowser=~/$_/i) { |
|
$ENV{'form.interface'}='textual'; |
|
} |
|
} |
|
|
my $fullgraph=($ENV{'form.interface'} ne 'textual'); |
my $fullgraph=($ENV{'form.interface'} ne 'textual'); |
|
|
my $iconpath= $r->dir_config('lonIconsURL'); |
my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':8080'. |
|
$r->dir_config('lonIconsURL'); |
my $domain = $r->dir_config('lonDefDomain'); |
my $domain = $r->dir_config('lonDefDomain'); |
my $role = $r->dir_config('lonRole'); |
my $role = $r->dir_config('lonRole'); |
my $loadlim = $r->dir_config('lonLoadLim'); |
my $loadlim = $r->dir_config('lonLoadLim'); |
Line 65 sub handler {
|
Line 76 sub handler {
|
my $lonhost = $r->dir_config('lonHostID'); |
my $lonhost = $r->dir_config('lonHostID'); |
my $tabdir = $r->dir_config('lonTabDir'); |
my $tabdir = $r->dir_config('lonTabDir'); |
my $include = $r->dir_config('lonIncludes'); |
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 $loadavg; |
{ |
{ |
my $loadfile=Apache::File->new('/proc/loadavg'); |
my $loadfile=Apache::File->new('/proc/loadavg'); |
Line 74 sub handler {
|
Line 92 sub handler {
|
$loadavg =~ s/\s.*//g; |
$loadavg =~ s/\s.*//g; |
my $loadpercent=100*$loadavg/$loadlim; |
my $loadpercent=100*$loadavg/$loadlim; |
|
|
|
# ------------------------------------------------------- Do the load balancing |
my $otherserver='http://'.$ENV{'SERVER_NAME'}; |
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? |
# ---------------------------------------- Are we access server and overloaded? |
if (($role eq 'access') && ($loadpercent>100.0)) { |
if (($role eq 'access') && ($loadpercent>100.0)) { |
$otherserver=Apache::lonnet::spareserver(); |
$otherserver=Apache::lonnet::spareserver($loadpercent); |
} |
} |
|
|
# -------------------------------------------------------- Set login parameters |
# -------------------------------------------------------- Set login parameters |
Line 101 sub handler {
|
Line 121 sub handler {
|
my $uextkey=hex($ukey); |
my $uextkey=hex($ukey); |
if ($uextkey>2147483647) { $uextkey-=4294967296; } |
if ($uextkey>2147483647) { $uextkey-=4294967296; } |
|
|
|
# -------------------------------------------------------- Store away log token |
my $logtoken=Apache::lonnet::reply( |
my $logtoken=Apache::lonnet::reply( |
'tmpput:'.$ukey.$lkey.'&'.$firsturl, |
'tmpput:'.$ukey.$lkey.'&'.$firsturl, |
$lonhost); |
$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 |
# --------------------------------------------------- Print login screen header |
$r->print(<<ENDHEADER); |
$r->print(<<ENDHEADER); |
<html> |
<html> |
<head> |
<head> |
|
<meta HTTP-EQUIV="Refresh" CONTENT="$expire; url=/adm/roles" /> |
<title>The LearningOnline Network with CAPA Login</title> |
<title>The LearningOnline Network with CAPA Login</title> |
</head> |
</head> |
ENDHEADER |
ENDHEADER |
Line 117 ENDHEADER
|
Line 170 ENDHEADER
|
my $jsh=Apache::File->new($include."/londes.js"); |
my $jsh=Apache::File->new($include."/londes.js"); |
$r->print(<$jsh>); |
$r->print(<$jsh>); |
} |
} |
|
|
|
# ----------------------------------------------------------- Front page design |
|
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= |
|
($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'); |
|
|
|
|
# ---------------------------------------------------------- Serve rest of page |
# ---------------------------------------------------------- Serve rest of page |
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
|
|
<body bgcolor="#006600" text="#000000" link="#999999" vlink="#999999" |
<body bgcolor="$pgbg" text="$font" link="$link" vlink="$vlink" alink="$alink" |
onLoad="init();" topmargin=0 leftmargin=0 marginwidth=0 marginheight=0> |
topmargin=0 leftmargin=0 marginwidth=0 marginheight=0> |
|
|
<script language="JavaScript"> |
<script language="JavaScript"> |
function send() |
function send() |
Line 132 ENDHEADER
|
Line 204 ENDHEADER
|
this.document.server.elements.udom.value |
this.document.server.elements.udom.value |
=this.document.client.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; |
uextkey=this.document.client.elements.uextkey.value; |
lextkey=this.document.client.elements.lextkey.value; |
lextkey=this.document.client.elements.lextkey.value; |
initkeys(); |
initkeys(); |
Line 152 ENDSCRIPT
|
Line 242 ENDSCRIPT
|
|
|
$r->print(<<ENDSERVERFORM); |
$r->print(<<ENDSERVERFORM); |
<form name="server" action="$otherserver/adm/authenticate" method="post" target="_top"> |
<form name="server" action="$otherserver/adm/authenticate" method="post" target="_top"> |
<input type=hidden name=logtoken value="$logtoken"> |
<input type="hidden" name="logtoken" value="$logtoken" /> |
<input type=hidden name=serverid value="$lonhost"> |
<input type="hidden" name="serverid" value="$lonhost" /> |
<input type=hidden name=interface value="$ENV{'form.interface'}"> |
<input type="hidden" name="interface" value="$ENV{'form.interface'}" /> |
<input type=hidden name=uname value=""> |
<input type="hidden" name="uname" value="" /> |
<input type=hidden name=upass value=""> |
<input type="hidden" name="upass" value="" /> |
<input type=hidden name=udom value=""> |
<input type="hidden" name="udom" value="" /> |
|
<input type="hidden" name="imagesuppress" value="" /> |
|
<input type="hidden" name="appletsuppress" value="" /> |
|
<input type="hidden" name="embedsuppress" value="" /> |
|
<input type="hidden" name="fontenhance" value="" /> |
|
<input type="hidden" name="blackwhite" value="" /> |
|
<input type="hidden" name="remember" value="" /> |
</form> |
</form> |
ENDSERVERFORM |
ENDSERVERFORM |
if ($fullgraph) { $r->print(<<ENDTOP); |
if ($fullgraph) { $r->print(<<ENDTOP); |
Line 165 ENDSERVERFORM
|
Line 261 ENDSERVERFORM
|
<tr> |
<tr> |
|
|
<!-- Row 1 Columns 2-4 --> |
<!-- Row 1 Columns 2-4 --> |
<td width="100%" height=75 colspan=4 align="left" valign="top" bgcolor="#006600"><img src="$iconpath/header.gif" border=0 alt="The Learning Online Network with CAPA" /></td> |
<td width="100%" height=75 colspan=4 align="left" valign="top" bgcolor="$pgbg"><img src="$img" border=0 alt="The Learning Online Network with CAPA" /></td> |
</tr> |
</tr> |
|
|
<!-- The gray bar that starts the two table frames --> |
<!-- The gray bar that starts the two table frames --> |
<tr> |
<tr> |
|
|
<!-- Row 2 Column 1 --> |
<!-- Row 2 Column 1 --> |
<td width=182 height=27 bgcolor="#cccccc"> </td> |
<td width=182 height=27 bgcolor="$sidebg"> </td> |
|
|
<!-- Row 2 Column 2 --> |
<!-- Row 2 Column 2 --> |
<td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td> |
<td width=27 height=27 align="left" background="$iconpath/filltop.gif"><img src="$iconpath/upperleft.gif" border=0 alt="" /></td> |
Line 187 ENDSERVERFORM
|
Line 283 ENDSERVERFORM
|
|
|
<!-- A cell that will hold the 'access' and 'about' buttons --> |
<!-- A cell that will hold the 'access' and 'about' buttons --> |
<!-- Row 3 Column 1 --> |
<!-- Row 3 Column 1 --> |
<td valign="top" height=60 align="center" bgcolor="#cccccc"> |
<td valign="top" height=60 align="center" bgcolor="$sidebg"> |
<a href="/adm/login?interface=textual"><img src="$iconpath/accessbutton.gif" border=0 alt="Accessibility Options" /></a> |
<a href="/adm/login?interface=textual"><img src="$iconpath/accessbutton.gif" border=0 alt="Accessibility Options" /></a> |
<br /> |
<br /> |
<a href="/adm/about.html"><img src="$iconpath/aboutlon.gif" border=0 alt="About LON-CAPA" /></a> |
<a href="/adm/about.html"><img src="$iconpath/aboutlon.gif" border=0 alt="About LON-CAPA" /></a> |
Line 199 ENDSERVERFORM
|
Line 295 ENDSERVERFORM
|
|
|
<!-- The right main column holding the large LON-CAPA logo--> |
<!-- The right main column holding the large LON-CAPA logo--> |
<!-- Rows 3-4 Column 3 --> |
<!-- Rows 3-4 Column 3 --> |
<td align="center" valign="top" width="100%" height="100%" rowspan=2 bgcolor="#ffffff"> |
<td align="center" valign="top" width="100%" height="100%" rowspan=2 bgcolor="$mainbg"> |
<center> |
<center> |
<img src="$iconpath/loncapalogo.gif" alt="" /> |
<img src="$logo" alt="" /> |
</center> |
</center> |
</td> |
</td> |
|
|
Line 212 ENDSERVERFORM
|
Line 308 ENDSERVERFORM
|
|
|
<!-- The entry form --> |
<!-- The entry form --> |
<!-- Row 4 Column 1 --> |
<!-- Row 4 Column 1 --> |
<td align="center" valign="middle" bgcolor="#cccccc"> |
<td align="center" valign="middle" bgcolor="$sidebg"> |
ENDTOP |
ENDTOP |
|
} else { |
|
$r->print('<h1>The Learning<i>Online</i> Network with CAPA</h1><h2>Text-based Interface Login</h2>'); |
|
} |
|
$r->print('<form name="client" onsubmit="return(send())">'); |
|
unless ($fullgraph) { |
|
$r->print(<<ENDACCESSOPTIONS); |
|
<h3>Select Accessibility Options</h3> |
|
<input type="checkbox" name="imagesuppress" /> Suppress rendering of images<br /> |
|
<input type="checkbox" name="appletsuppress" /> Suppress Java applets<br /> |
|
<input type="checkbox" name="embedsuppress" /> Suppress rendering of embedded multimedia<br /> |
|
<input type="checkbox" name="fontenhance" /> Increase font size<br /> |
|
<input type="checkbox" name="blackwhite" /> Switch to black and white mode<br /> |
|
<p>If you have accessibility needs that are not addressed by this interface, |
|
please |
|
contact the system administrator at <tt>$sysadm</tt>.</p><br /> |
|
<input type="checkbox" name="remember" /> Remember these settings for next login<hr /> |
|
ENDACCESSOPTIONS |
|
} else { |
|
$r->print(<<ENDNOOPT); |
|
<input type="hidden" name="imagesuppress" value="" /> |
|
<input type="hidden" name="embedsuppress" value="" /> |
|
<input type="hidden" name="appletsuppress" value="" /> |
|
<input type="hidden" name="fontenhance" value="" /> |
|
<input type="hidden" name="blackwhite" value="" /> |
|
<input type="hidden" name="remember" value="" /> |
|
ENDNOOPT |
} |
} |
$r->print(<<ENDLOGIN); |
$r->print(<<ENDLOGIN); |
<form name="client" onsubmit="return(send())"> |
|
<input type="hidden" name="lextkey" value="$lextkey"> |
<input type="hidden" name="lextkey" value="$lextkey"> |
<input type="hidden" name="uextkey" value="$uextkey"> |
<input type="hidden" name="uextkey" value="$uextkey"> |
|
|
<!-- Start the sub-table for text and input alignment --> |
<!-- Start the sub-table for text and input alignment --> |
<table border=0 cellspacing=0 cellpadding=0> |
<table border=0 cellspacing=0 cellpadding=0> |
<tr><td bgcolor="#cccccc" colspan=2><img src="$iconpath/userauthentication.gif" alt="User Authentication" /></td></tr> |
<tr><td bgcolor="$sidebg" colspan=2><img src="$iconpath/userauthentication.gif" alt="User Authentication" /></td></tr> |
<tr> |
<tr> |
<td bgcolor="#ffffff"><br /><font size=-1><b> User Name:</b></font></td> |
<td bgcolor="$mainbg"><br /><font size=-1><b> User Name:</b></font></td> |
<td bgcolor="#ffffff"><br /><input type="text" name="uname" size="10" /></td> |
<td bgcolor="$mainbg"><br /><input type="text" name="uname" size="10" value="$authusername" /></td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td bgcolor="#ffffff"><font size=-1><b> Password:</b></font></td> |
<td bgcolor="$mainbg"><font size=-1><b> Password:</b></font></td> |
<td bgcolor="#ffffff"><input type="password" name="upass" size="10" /></td> |
<td bgcolor="$mainbg"><input type="password" name="upass" size="10" /></td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td bgcolor="#ffffff"><font size=-1><b> Domain:</b></font></td> |
<td bgcolor="$mainbg"><font size=-1><b> Domain:</b></font></td> |
<td bgcolor="#ffffff"><input type="text" name="udom" size="10" value=$domain /></td> |
<td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td bgcolor="#ffffff" valign="bottom" align="center" colspan=2> |
<td bgcolor="$mainbg"> <a href="/adm/loginproblems.html">Help</a></td> |
|
<td bgcolor="$mainbg" valign="bottom" align="center"> |
<br /> |
<br /> |
<input type="submit" value="Log In" /> |
<input type="submit" value="Log In" /> |
</td> |
</td> |
Line 258 ENDLOGIN
|
Line 380 ENDLOGIN
|
<tr> |
<tr> |
|
|
<!-- Row 5 Column 1 --> |
<!-- Row 5 Column 1 --> |
<td bgcolor="#cccccc" valign="middle" align="left"> |
<td bgcolor="$sidebg" valign="middle" align="left"> |
<br /> |
<br /> |
<table border=0 cellspacing=0 cellpadding=0> |
<table border=0 cellspacing=0 cellpadding=0> |
<tr> |
<tr> |
<td bgcolor="#cccccc" align="left" valign="top"> |
<td bgcolor="$sidebg" align="left" valign="top"> |
<small><b> Domain: </b></small> |
<small><b> Domain: </b></small> |
</td> |
</td> |
<td bgcolor="#cccccc" align="left" valign="top"> |
<td bgcolor="$sidebg" align="left" valign="top"> |
<small><tt> $domain</tt></small> |
<small><tt> $domain</tt></small> |
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td bgcolor="#cccccc" align="left" valign="top"> |
<td bgcolor="$sidebg" align="left" valign="top"> |
<small><b> Server: </b></small> |
<small><b> Server: </b></small> |
</td> |
</td> |
<td bgcolor="#cccccc" align="left" valign="top"> |
<td bgcolor="$sidebg" align="left" valign="top"> |
<small><tt> $lonhost ($role)</tt></small> |
<small><tt> $lonhost ($role)</tt></small> |
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td bgcolor="#cccccc" align="left" valign="top"> |
<td bgcolor="$sidebg" align="left" valign="top"> |
<small><b> Load: </b></small> |
<small><b> Load: </b></small> |
</td> |
</td> |
<td bgcolor="#cccccc" align="left" valign="top"> |
<td bgcolor="$sidebg" align="left" valign="top"> |
<small><tt> $loadpercent percent</tt></small> |
<small><tt> $loadpercent percent</tt></small> |
</td> |
</td> |
</tr> |
</tr> |
Line 299 ENDLOGIN
|
Line 421 ENDLOGIN
|
<td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td> |
<td width=27 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td> |
|
|
<!-- Row 5 Column 3 --> |
<!-- Row 5 Column 3 --> |
<td width="100%" valign="bottom" bgcolor="#ffffff"><img src="$iconpath/litetext.gif" alt="Laboratory for Instructional Technology in Education" /><img src="$iconpath/lite.gif" alt="" /></td> |
<td width="100%" valign="bottom" bgcolor="$mainbg"> |
|
$domainlogo |
|
</td> |
|
|
<!-- Row 5 Column 4 --> |
<!-- Row 5 Column 4 --> |
<td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td> |
<td width=27 background="$iconpath/fillright.gif"><img src="$iconpath/fillright.gif" alt="" /></td> |
Line 307 ENDLOGIN
|
Line 431 ENDLOGIN
|
<tr> |
<tr> |
|
|
<!-- Row 6 Column 1 --> |
<!-- Row 6 Column 1 --> |
<td bgcolor="#cccccc"> </td> |
<td bgcolor="$sidebg"> </td> |
|
|
<!-- Row 6 Column 2 --> |
<!-- Row 6 Column 2 --> |
<td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td> |
<td align="left" background="$iconpath/fillbottom.gif"><img src="$iconpath/lowerleft.gif" alt="" /></td> |
Line 320 ENDLOGIN
|
Line 444 ENDLOGIN
|
</tr> |
</tr> |
</table> |
</table> |
|
|
|
<script> |
|
// the if prevents the script error if the browser can't handle this |
|
if ( document.client.uname ) { document.client.uname.focus(); } |
|
</script> |
|
|
ENDDOCUMENT |
ENDDOCUMENT |
} |
} |
$r->print('</body></html>'); |
$r->print('</body></html>'); |