--- loncom/auth/lonlogin.pm 2010/03/17 14:37:43 1.135 +++ loncom/auth/lonlogin.pm 2011/03/03 06:37:30 1.147 @@ -1,7 +1,7 @@ # The LearningOnline Network # Login Screen # -# $Id: lonlogin.pm,v 1.135 2010/03/17 14:37:43 raeburn Exp $ +# $Id: lonlogin.pm,v 1.147 2011/03/03 06:37:30 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -69,6 +69,7 @@ sub handler { return OK; } + $env{'form.firsturl'} =~ s/(`)/'/g; # -------------------------------- Prevent users from attempting to login twice my $handle = &Apache::lonnet::check_for_valid_session($r); @@ -130,6 +131,7 @@ sub handler { } my $role = $r->dir_config('lonRole'); my $loadlim = $r->dir_config('lonLoadLim'); + my $uloadlim= $r->dir_config('lonUserLoadLim'); my $servadm = $r->dir_config('lonAdmEMail'); my $tabdir = $r->dir_config('lonTabDir'); my $include = $r->dir_config('lonIncludes'); @@ -149,18 +151,17 @@ sub handler { $loadavg=<$loadfile>; } $loadavg =~ s/\s.*//g; - my $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim); - my $userloadpercent=&Apache::lonnet::userload(); -# ------------------------------------------------------- Do the load balancing - my $otherserver= &Apache::lonnet::absolute_url($host_name); + my ($loadpercent,$userloadpercent); + if ($loadlim) { + $loadpercent=sprintf("%.1f",100*$loadavg/$loadlim); + } + if ($uloadlim) { + $userloadpercent=&Apache::lonnet::userload(); + } + my $firsturl= ($env{'request.firsturl'}?$env{'request.firsturl'}:$env{'form.firsturl'}); -# ---------------------------------------------------------- Are we overloaded? - if ((($userloadpercent>100.0)||($loadpercent>100.0))) { - my $unloaded=Apache::lonnet::spareserver($loadpercent,$userloadpercent); - if ($unloaded) { $otherserver=$unloaded; } - } # ----------------------------------------------------------- Get announcements my $announcements=&Apache::lonnet::getannounce(); @@ -264,13 +265,12 @@ my $link=&Apache::loncommon::designparm( my $vlink=&Apache::loncommon::designparm('login.vlink',$domain); my $alink=&Apache::loncommon::designparm('login.alink',$domain); my $mainbg=&Apache::loncommon::designparm('login.mainbg',$domain); +my $loginbox_bg=&Apache::loncommon::designparm('login.sidebg',$domain); +my $loginbox_header_bgcol=&Apache::loncommon::designparm('login.bgcol',$domain); +my $loginbox_header_textcol=&Apache::loncommon::designparm('login.textcol',$domain); my $logo=&Apache::loncommon::designparm('login.logo',$domain); my $img=&Apache::loncommon::designparm('login.img',$domain); -my $domainlogo='
'.&Apache::loncommon::domainlogo($domain).'
'; -my $login=&Apache::loncommon::designparm('login.login',$domain); -if ($login eq '') { -$login = $iconpath.'/'.&mt('userauthentication.gif'); -} +my $domainlogo=&Apache::loncommon::domainlogo($domain); my $showbanner = 1; my $showmainlogo = 1; if (defined(&Apache::loncommon::designparm('login.showlogo_img',$domain))) { @@ -282,7 +282,6 @@ if (defined(&Apache::loncommon::designpa my $showadminmail=&Apache::loncommon::designparm('login.adminmail',$domain); my $showcoursecat = &Apache::loncommon::designparm('login.coursecatalog',$domain); -my $loginheader =&Apache::loncommon::designparm('login.loginheader',$domain); my $shownewuserlink = &Apache::loncommon::designparm('login.newuser',$domain); my $now=time; @@ -315,6 +314,14 @@ this.document.client.elements.upass$now. this.document.server.submit(); return false; } + +function enableInput() { + this.document.client.elements.upass$now.removeAttribute("readOnly"); + this.document.client.elements.uname.removeAttribute("readOnly"); + this.document.client.elements.udom.removeAttribute("readOnly"); + return; +} + // ]]> @@ -327,7 +334,8 @@ my %add_entries = ( text => "$font", link => "$link", vlink => "$vlink", - alink => "$alink",); + alink => "$alink", + onload => 'javascript:enableInput();',); $r->print(&Apache::loncommon::start_page('The LearningOnline Network with CAPA Login',$js, { 'redirect' => [$expire,'/adm/roles'], @@ -367,7 +375,9 @@ $r->print(<$jsh>); # ---------------------------------------------------------- Serve rest of page $r->print( - '
'); + '
' +); # # If the loadbalancing yielded just http:// because perhaps there's no loadbalancing? @@ -375,7 +385,7 @@ $r->print( # $r->print(< +
@@ -395,13 +405,12 @@ my $newuserlink; if ($shownewuserlink) { $newuserlink = &newuser_link($lt{'newuser'}).'
'; } -my $logintitle; -if ($loginheader eq 'text') { - $logintitle ='

'.$lt{'log'}.'

'; -} else { - $logintitle = ''.
-                  &mt('User Authentication').''; -} +my $logintitle = + '

' + .$lt{'log'} + .'

'; my $noscript_warning='
-
-
+
+
$logintitle - - - - -
- $loginform -
- $noscript_warning + $loginform + $noscript_warning
-
+
$loginhelp $forgotpw $contactblock @@ -455,18 +457,19 @@ HEADER $coursecatalog
+ +
ENDTOP if ($showmainlogo) { $r->print(' '."\n"); } $r->print(< 
+
+
ENDTOP - -$r->print(< + my ($domainrow,$serverrow,$loadrow,$userloadrow,$versionrow); + $domainrow = <<"END"; $lt{'dom'}:  @@ -475,6 +478,8 @@ $r->print(< $domain +END + $serverrow = <<"END"; $lt{'serv'}:  @@ -483,6 +488,9 @@ $r->print(< $lonhost ($role) +END + if ($loadlim) { + $loadrow = <<"END"; $lt{'load'}:  @@ -491,6 +499,10 @@ $r->print(< $loadpercent $lt{'perc'} +END + } + if ($uloadlim) { + $userloadrow = <<"END"; $lt{'userload'}:  @@ -499,12 +511,32 @@ $r->print(< $userloadpercent $lt{'perc'} +END + } + if (($version ne '') && ($version ne '')) { + $versionrow = <<"END"; $version +END + } + +$r->print(< + +$domainrow +$serverrow +$loadrow +$userloadrow +$versionrow
+
+
+ $domainlogo +
+