version 1.76, 2006/07/24 17:25:48
|
version 1.88, 2007/03/02 23:17:48
|
Line 40 use Apache::migrateuser();
|
Line 40 use Apache::migrateuser();
|
use lib '/home/httpd/lib/perl/'; |
use lib '/home/httpd/lib/perl/'; |
use LONCAPA; |
use LONCAPA; |
|
|
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
|
|
&Apache::loncommon::get_unprocessed_cgi |
&Apache::loncommon::get_unprocessed_cgi |
($ENV{'QUERY_STRING'}.'&'.$env{'request.querystring'}, |
(join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'}, |
|
$ENV{'REDIRECT_QUERY_STRING'}), |
['interface','username','domain','firsturl','localpath','localres', |
['interface','username','domain','firsturl','localpath','localres', |
'token']); |
'token']); |
|
|
Line 73 sub handler {
|
Line 73 sub handler {
|
my $lonid=$cookies{'lonID'}; |
my $lonid=$cookies{'lonID'}; |
my $cookie; |
my $cookie; |
if ($lonid) { |
if ($lonid) { |
my $handle=$lonid->value; |
my $handle=&LONCAPA::clean_handle($lonid->value); |
$handle=~s/\W//g; |
|
my $lonidsdir=$r->dir_config('lonIDsDir'); |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
if (-e "$lonidsdir/$handle.id") { |
if (-e "$lonidsdir/$handle.id") { |
# Is there an existing token file? |
# Is there an existing token file? |
Line 127 ENDFAILED
|
Line 126 ENDFAILED
|
} |
} |
my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':'.$port_to_use. |
my $iconpath= 'http://'.$ENV{'HTTP_HOST'}.':'.$port_to_use. |
$r->dir_config('lonIconsURL'); |
$r->dir_config('lonIconsURL'); |
my $domain = $r->dir_config('lonDefDomain'); |
my $domain = &Apache::lonnet::default_login_domain(); |
my $testdomain=(split(/\./,$ENV{'HTTP_HOST'}))[0]; |
|
foreach my $posdom (&Apache::lonnet::current_machine_domains()) { |
|
if (lc($posdom) eq lc($testdomain)) { $domain=$posdom; } |
|
} |
|
if (($env{'form.domain'}) && |
if (($env{'form.domain'}) && |
($Apache::lonnet::domaindescription{$env{'form.domain'}})) { |
($Apache::lonnet::domaindescription{$env{'form.domain'}})) { |
$domain=$env{'form.domain'}; |
$domain=$env{'form.domain'}; |
} |
} |
my $role = $r->dir_config('lonRole'); |
my $role = $r->dir_config('lonRole'); |
my $loadlim = $r->dir_config('lonLoadLim'); |
my $loadlim = $r->dir_config('lonLoadLim'); |
my $servadm = $r->dir_config('lonAdmEMail'); |
|
my $sysadm = $r->dir_config('lonSysEMail'); |
|
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'); |
my $expire = $r->dir_config('lonExpire'); |
my $version = $r->dir_config('lonVersion'); |
my $version = $r->dir_config('lonVersion'); |
my $host_name = $Apache::lonnet::hostname{$lonhost}; |
my $host_name = &Apache::lonnet::hostname($lonhost); |
|
|
# --------------------------------------------- Default values for login fields |
# --------------------------------------------- Default values for login fields |
|
|
Line 163 ENDFAILED
|
Line 156 ENDFAILED
|
my $userloadpercent=&Apache::lonnet::userload(); |
my $userloadpercent=&Apache::lonnet::userload(); |
|
|
# ------------------------------------------------------- Do the load balancing |
# ------------------------------------------------------- Do the load balancing |
my $otherserver='http://'.$host_name; |
my $otherserver= &Apache::lonnet::absolute_url($host_name); |
my $firsturl= |
my $firsturl= |
($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'}); |
($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'}); |
# ---------------------------------------- Are we access server and overloaded? |
# ---------------------------------------- Are we access server and overloaded? |
Line 207 ENDFAILED
|
Line 200 ENDFAILED
|
my $last; |
my $last; |
foreach my $hostid (sort |
foreach my $hostid (sort |
{ |
{ |
$Apache::lonnet::hostname{$a} cmp |
&Apache::lonnet::hostname($a) cmp |
$Apache::lonnet::hostname{$b}; |
&Apache::lonnet::hostname($b); |
} |
} |
keys(%Apache::lonnet::spareid)) { |
keys(%Apache::lonnet::spareid)) { |
next if ($hostid eq $lonhost); |
next if ($hostid eq $lonhost); |
next if ($last eq $Apache::lonnet::hostname{$hostid}); |
my $hostname = &Apache::lonnet::hostname($hostid); |
|
next if ($last eq $hostname); |
$spares.='<br /><font size="+1"><a href="http://'. |
$spares.='<br /><font size="+1"><a href="http://'. |
$Apache::lonnet::hostname{$hostid}. |
$hostname. |
'/adm/login?domain='.$authdomain.'">'. |
'/adm/login?domain='.$authdomain.'">'. |
$Apache::lonnet::hostname{$hostid}.'</a>'. |
$hostname.'</a>'. |
' (preferred)</font>'.$/; |
' (preferred)</font>'.$/; |
$last=$Apache::lonnet::hostname{$hostid}; |
$last=$hostname; |
} |
} |
$spares.= '<br />'; |
$spares.= '<br />'; |
|
my %all_hostnames = &Apache::lonnet::all_hostnames(); |
foreach my $hostid (sort |
foreach my $hostid (sort |
{ |
{ |
$Apache::lonnet::hostname{$a} cmp |
&Apache::lonnet::hostname($a) cmp |
$Apache::lonnet::hostname{$b}; |
&Apache::lonnet::hostname($b); |
} |
} |
keys(%Apache::lonnet::hostname)) { |
keys(%all_hostnames)) { |
next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid}); |
next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid}); |
next if ($last eq $Apache::lonnet::hostname{$hostid}); |
my $hostname = &Apache::lonnet::hostname($hostid); |
|
next if ($last eq $hostname); |
$spares.='<br /><a href="http://'. |
$spares.='<br /><a href="http://'. |
$Apache::lonnet::hostname{$hostid}. |
$hostname. |
'/adm/login?domain='.$authdomain.'">'. |
'/adm/login?domain='.$authdomain.'">'. |
$Apache::lonnet::hostname{$hostid}.'</a>'; |
$hostname.'</a>'; |
$last=$Apache::lonnet::hostname{$hostid}; |
$last=$hostname; |
} |
} |
$r->print(<<ENDTROUBLE); |
$r->print(<<ENDTROUBLE); |
<html> |
<html> |
Line 242 ENDFAILED
|
Line 238 ENDFAILED
|
<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" /> |
<img src="/adm/lonKaputt/lonlogo_broken.gif" align="right" /> |
<h3>This LON-CAPA server is temporarily not available for login</h3> |
<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>Please attempt to login to one of the following servers:</p>$spares |
<p>If the problem persists, please contact <tt>$servadm</tt>.</p> |
|
</body> |
</body> |
</html> |
</html> |
ENDTROUBLE |
ENDTROUBLE |
Line 252 ENDTROUBLE
|
Line 247 ENDTROUBLE
|
# ----------------------------------------------- Apparently we are in business |
# ----------------------------------------------- Apparently we are in business |
|
|
my $domainlogo=&Apache::loncommon::domainlogo($domain); |
my $domainlogo=&Apache::loncommon::domainlogo($domain); |
$servadm=~s/\,/\<br \/\>/g; |
|
$sysadm=~s/\,/\<br \/\>/g; |
|
|
|
# --------------------------------------------------- Print login screen header |
# --------------------------------------------------- Print login screen header |
$r->print(<<ENDHEADER); |
$r->print(<<ENDHEADER); |
Line 295 my %lt=&Apache::lonlocal::texthash(
|
Line 288 my %lt=&Apache::lonlocal::texthash(
|
'perc' => 'percent', |
'perc' => 'percent', |
'load' => 'Load', |
'load' => 'Load', |
'userload' => 'User Load', |
'userload' => 'User Load', |
'about' => 'aboutlon.gif', |
'about' => 'About LON-CAPA', |
'access' => 'accessbutton.gif', |
'access' => 'Accessibility Options', |
|
'catalog' => 'Course Catalog', |
'auth' => 'userauthentication.gif', |
'auth' => 'userauthentication.gif', |
'log' => 'Log in', |
'log' => 'Log in', |
'help' => 'Help', |
'help' => 'Log-in Help', |
'serv' => 'Server', |
'serv' => 'Server', |
'servadm' => 'Server Administration', |
'helpdesk' => 'Contact Helpdesk', |
'sysadm' => 'System Administration', |
'forgotpw' => 'Forgot password?'); |
'helpdesk' => 'Contact Helpdesk'); |
|
# -------------------------------------------------- Change password field name |
# -------------------------------------------------- Change password field name |
my $now=time; |
my $now=time; |
|
my $forgotpw = &forgotpwdisplay(%lt); |
|
my $loginhelp = &loginhelpdisplay(%lt); |
# ---------------------------------------------------------- Serve rest of page |
# ---------------------------------------------------------- Serve rest of page |
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
|
|
Line 409 ENDSERVERFORM
|
Line 404 ENDSERVERFORM
|
</tr> |
</tr> |
<tr> |
<tr> |
|
|
<!-- A cell that will hold the 'access' and 'about' buttons --> |
<!-- A cell that will hold the 'access', 'about', and 'catalog' links --> |
<!-- Row 3 Column 1 --> |
<!-- Row 3 Column 1 --> |
<td valign="top" height=60 align="center" bgcolor="$sidebg"> |
<td valign="top" height="60" align="left" bgcolor="$sidebg"> |
<a href="/adm/login?interface=textual"><img src="$iconpath/$lt{'access'}" border=0 alt="Accessibility Options" /></a> |
<table cellpadding="0" cellspacing="2" border="0"> |
<br /> |
<tr> |
<a href="/adm/about.html"><img src="$iconpath/$lt{'about'}" border=0 alt="About LON-CAPA" /></a> |
<td> </td> |
|
<td><a href="/adm/login?interface=textual"><b>$lt{'access'}</b></a></td> |
|
</tr> |
|
<tr> |
|
<td> </td> |
|
<td><a href="/adm/about.html"><b>$lt{'about'}</b></a></td> |
|
</tr> |
|
<tr> |
|
<td> </td> |
|
<td><a href="/adm/coursecatalog"><b>$lt{'catalog'}</b></a></td> |
|
</tr> |
|
<tr> |
|
<td colspan="2"> </td> |
|
</tr> |
|
</table> |
</td> |
</td> |
|
|
<!-- The shaded space between the two main columns --> |
<!-- The shaded space between the two main columns --> |
<!-- Row 3 Column 2 --> |
<!-- Row 3 Column 2 --> |
<td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td> |
<td width=27 height=60 background="$iconpath/fillleft.gif"><img src="$iconpath/fillleft.gif" alt="" /></td> |
Line 450 ENDTOP
|
Line 458 ENDTOP
|
<label><input type="checkbox" name="embedsuppress" /> Suppress rendering of embedded multimedia</label><br /> |
<label><input type="checkbox" name="embedsuppress" /> Suppress rendering of embedded multimedia</label><br /> |
<label><input type="checkbox" name="fontenhance" /> Increase font size</label><br /> |
<label><input type="checkbox" name="fontenhance" /> Increase font size</label><br /> |
<label><input type="checkbox" name="blackwhite" /> Switch to black and white mode</label><br /> |
<label><input type="checkbox" name="blackwhite" /> Switch to black and white mode</label><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 /> |
<input type="checkbox" name="remember" /> Remember these settings for next login<hr /> |
ENDACCESSOPTIONS |
ENDACCESSOPTIONS |
} else { |
} else { |
Line 485 ENDNOOPT
|
Line 490 ENDNOOPT
|
<td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td> |
<td bgcolor="$mainbg"><input type="text" name="udom" size="10" value="$authdomain" /></td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td bgcolor="$mainbg"> <a href="/adm/loginproblems.html">$lt{'help'}</a></td> |
<td bgcolor="$mainbg"> </td> |
<td bgcolor="$mainbg" valign="bottom" align="center"> |
<td bgcolor="$mainbg" valign="bottom" align="center"> |
<br /> |
<br /> |
<input type="submit" value="$lt{'log'}" /> |
<input type="submit" value="$lt{'log'}" /> |
</td> |
</td> |
</tr> |
</tr> |
|
<tr> |
|
<td bgcolor="$mainbg" valign="bottom" align="left" colspan="2"> |
|
$loginhelp |
|
$forgotpw |
|
</td> |
|
</tr> |
</table> |
</table> |
<!-- End sub-table --> |
<!-- End sub-table --> |
</form> |
</form> |
ENDLOGIN |
ENDLOGIN |
if ($fullgraph) { |
if ($fullgraph) { |
my $helpdeskscript; |
my $helpdeskscript; |
my $contactblock = &contactdisplay(\%lt,$sysadm,$servadm,$version,$authdomain,\$helpdeskscript); |
my $contactblock = &contactdisplay(\%lt,$version,$authdomain,\$helpdeskscript); |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
</td> |
</td> |
|
|
Line 593 ENDDOCUMENT
|
Line 604 ENDDOCUMENT
|
} |
} |
|
|
sub contactdisplay { |
sub contactdisplay { |
my ($lt,$sysadm,$servadm,$version,$authdomain,$helpdeskscript) = @_; |
my ($lt,$version,$authdomain,$helpdeskscript) = @_; |
my $contactblock; |
my $contactblock; |
my $showsysadm = 1; |
|
my $showservadm = 1; |
|
my $showhelpdesk = 0; |
my $showhelpdesk = 0; |
my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'}; |
my $requestmail = $Apache::lonnet::perlvar{'lonSupportEMail'}; |
if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) { |
if ($requestmail =~ m/^[^\@]+\@[^\@]+$/) { |
$showhelpdesk = 1; |
$showhelpdesk = 1; |
} |
} |
if ($showsysadm) { |
|
$contactblock .= '<b> '.$$lt{'sysadm'}.':</b><br />'. |
|
'<tt> '.$sysadm.'</tt><br />'; |
|
} |
|
if ($showservadm) { |
|
$contactblock .= '<b> '.$$lt{'servadm'}.':</b><br />'. |
|
'<tt> '.$servadm.'</tt><br /> <br />'; |
|
} |
|
if ($showhelpdesk) { |
if ($showhelpdesk) { |
$contactblock .= '<b> <a href="javascript:helpdesk()">'.$$lt{'helpdesk'}.'</a></b><br />'; |
$contactblock .= '<b> <a href="javascript:helpdesk()"><font size="+1">'.$lt->{'helpdesk'}.'</font></a></b><br />'; |
my $thisurl = &escape('/adm/login'); |
my $thisurl = &escape('/adm/login'); |
$$helpdeskscript = <<"ENDSCRIPT"; |
$$helpdeskscript = <<"ENDSCRIPT"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 632 ENDSCRIPT
|
Line 633 ENDSCRIPT
|
ENDBLOCK |
ENDBLOCK |
return $contactblock; |
return $contactblock; |
} |
} |
|
|
|
sub forgotpwdisplay { |
|
my (%lt) = @_; |
|
my $prompt_for_resetpw = 1; |
|
if ($prompt_for_resetpw) { |
|
return '<br /> <a href="/adm/resetpw">'.$lt{'forgotpw'}.'</a></b><br /><br />'; |
|
} |
|
return; |
|
} |
|
|
|
sub loginhelpdisplay { |
|
my (%lt) = @_; |
|
my $login_help = 1; |
|
if ($login_help) { |
|
return ' <a href="/adm/loginproblems.html">'.$lt{'help'}.'</a></b>'; |
|
} |
|
return; |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |