--- modules/gci/lonlogin.pm 2009/09/17 01:55:01 1.1 +++ modules/gci/lonlogin.pm 2024/04/15 23:57:21 1.17 @@ -1,7 +1,7 @@ # The LearningOnline Network # Login Screen # -# $Id: lonlogin.pm,v 1.1 2009/09/17 01:55:01 gci Exp $ +# $Id: lonlogin.pm,v 1.17 2024/04/15 23:57:21 gci Exp $ # # Copyright Michigan State University Board of Trustees # @@ -30,7 +30,7 @@ package Apache::lonlogin; use strict; use Apache::Constants qw(:common); -use Apache::File (); +use Apache::File(); use Apache::lonnet; use Apache::loncommon(); use Apache::lonauth(); @@ -38,6 +38,7 @@ use Apache::lonlocal; use Apache::migrateuser(); use lib '/home/httpd/lib/perl/'; use LONCAPA; +use HTML::Entities(); sub handler { my $r = shift; @@ -46,7 +47,7 @@ sub handler { (join('&',$ENV{'QUERY_STRING'},$env{'request.querystring'}, $ENV{'REDIRECT_QUERY_STRING'}), ['interface','username','domain','firsturl','localpath','localres', - 'token']); + 'token','role','symb']); if (!defined($env{'form.firsturl'})) { &Apache::lonacc::get_posted_cgi($r,['firsturl']); } @@ -62,7 +63,6 @@ sub handler { $r->send_http_header; return OK if $r->header_only; - # Are we re-routing? if (-e '/home/httpd/html/lon-status/reroute.txt') { &Apache::lonauth::reroute($r); @@ -81,11 +81,22 @@ sub handler { &Apache::loncommon::start_page('Already logged in'); my $end_page = &Apache::loncommon::end_page(); + my $dest = '/adm/roles'; + if ($env{'form.role'}) { + $dest .= '?selectrole=1&'.$env{'form.role'}.'=1'; + } + if ($env{'form.symb'}) { + $dest .= ($dest =~ /\?/) ? '&' : '?'; + $dest .= 'destinationurl='.&HTML::Entities::encode($env{'form.symb'},'"&<>'); + } + if ($env{'form.firsturl'} ne '') { + $dest = $env{'form.firsturl'}; + } $r->print( $start_page .'

'.&mt('You are already logged in!').'

' - .'

'.&mt('Please either [_1]continue the current session[_2] or [_3]logout[_4].', - '','','','').'

' + .'

'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].', + '','','','').'

' .'

'.&mt('Login problems?').'

' .$end_page ); @@ -104,7 +115,7 @@ sub handler { my $textbrowsers=$r->dir_config('lonTextBrowsers'); my $httpbrowser=$ENV{"HTTP_USER_AGENT"}; - + foreach (split(/\:/,$textbrowsers)) { if ($httpbrowser=~/$_/i) { $env{'form.interface'}='textual'; @@ -121,6 +132,24 @@ sub handler { (&Apache::lonnet::domain($env{'form.domain'},'description'))) { $domain=$env{'form.domain'}; } + my %longname = ( + GCI => 'Geoscience Concept Inventory', + SLCI => 'Science Literacy Concept Inventory', + ); + my %allnums = &Apache::loncommon::get_faculty_cnums(); + my ($inventory,$uc_inventory,$testdom); + if ($domain =~ /^(\w+ci)test$/) { + $inventory = $1; + $testdom = $domain; + } else { + $inventory = $domain; + $testdom = $domain.'test'; + } + $uc_inventory = uc($inventory); + my $sitename; = $uc_inventory.' WebCenter'; + my $shortsitename = 'WebCenter'; + my $existing = 'Existing WebCenter user?'; + my $sitedesc = &mt('The [_1]WebCenter[_2] is a place to comment on existing concept questions, or submit new ones, and is also a place to build and manage Concept Tests which your students will complete via the [_3]Testing Center[_2].',$longname{$inventory}.' ('.$uc_inventory.') ','',''); my $role = $r->dir_config('lonRole'); my $loadlim = $r->dir_config('lonLoadLim'); my $servadm = $r->dir_config('lonAdmEMail'); @@ -130,6 +159,14 @@ sub handler { my $expire = $r->dir_config('lonExpire'); my $version = $r->dir_config('lonVersion'); my $host_name = &Apache::lonnet::hostname($lonhost); + if ($domain =~ /^(\w+ci)test$/) { + $lonhost = $domain.'l1'; + $host_name = $domain.'.lite.msu.edu'; + $sitename = $inventory.' Testing Center'; + $shortsitename = 'Testing Center'; + $existing = 'Student with Testing Center account?'; + $sitedesc = &mt('The [_1] Testing Center is used by [_2]students[_3] to complete online concept tests created by their instructors using questions available in the [_4].',$inventory,'','',$longname{$inventory}); + } # --------------------------------------------- Default values for login fields @@ -179,8 +216,23 @@ sub handler { if ($uextkey>2147483647) { $uextkey-=4294967296; } # -------------------------------------------------------- Store away log token + my $tokenextras; + if ($env{'form.role'}) { + $tokenextras = '&role='.&escape($env{'form.role'}); + } + if ($domain !~ /^\w+citest$/) { + unless ($env{'form.symb'} eq '/adm/statistics') { + $env{'form.symb'} = '/adm/ci_info'; + } + } + if ($env{'form.symb'}) { + if (!$tokenextras) { + $tokenextras = '&'; + } + $tokenextras .= '&symb='.&escape($env{'form.symb'}); + } my $logtoken=Apache::lonnet::reply( - 'tmpput:'.$ukey.$lkey.'&'.$firsturl, + 'tmpput:'.$ukey.$lkey.'&'.$firsturl.$tokenextras, $lonhost); # ------------------- If we cannot talk to ourselves, we are in serious trouble @@ -229,7 +281,7 @@ sub handler { .'' .'

'.&mt('The LearningOnline Network with CAPA').'

' .'' - .'

'.&mt('The GCI WebCenter server is temporarily not available for login.').'

' + .'

'.&mt("The $sitename server is temporarily not available for login.").'

' .'' .'' ); @@ -281,7 +333,9 @@ sub handler { my $now=time; my $js = (< + ENDSCRIPT @@ -357,8 +412,9 @@ ENDSCRIPT onload => "if ( document.client.uname ) { document.client.uname.focus(); }", marginheight => "0",); - $js .= "\n".''."\n"; - $r->print(&Apache::loncommon::start_page('GCI WebCenter Login',$js, + my $css_url = "/css/$domain/login.css"; + $js .= "\n".''."\n"; + $r->print(&Apache::loncommon::start_page($uc_inventory.' WebCenter Login',$js, { 'redirect' => [$expire,'/adm/roles'], 'add_entries' => \%add_entries, 'only_body' => 1,})); @@ -409,23 +465,23 @@ my %lt=&Apache::lonlocal::texthash( $newuserlink = &newuser_link($lt{'newuser'}); } if ($fullgraph) { - $r->print(<<"END_OF_BLOCK2"); + $r->print(<<"END_OF_BLOCK1");
- - + - + @@ -481,9 +553,9 @@ my %lt=&Apache::lonlocal::texthash( @@ -495,7 +567,7 @@ my %lt=&Apache::lonlocal::texthash( - + @@ -508,7 +580,7 @@ my %lt=&Apache::lonlocal::texthash( - + - +
- + + - + @@ -438,26 +494,42 @@ my %lt=&Apache::lonlocal::texthash(


$uc_inventory
-
+
  -
New to the WebCenter?

- The Geoscience Concept Inventory (GCI) WebCenter is a place to comment on existing concept questions and submit new ones.

The WebCenter runs on LON-CAPA - an open source freeware distributed learning content management and assessment system.


- Create a GCI WebCenter ID – use your ID to submit comments or new content. If you are already a GCI WebCenter user, please log-in.


-
+
New to the $sitename?

+ $sitedesc

The $shortsitename runs on LON-CAPA - an open source freeware distributed learning content management and assessment system.


+END_OF_BLOCK1 + if ($domain !~ /^\w+citest$/) { + my $review; + if (ref($allnums{$domain}) eq 'HASH') { + $review = $domain.'_'.$allnums{$domain}{'review'}; + } + $r->print(<<"END_OF_BLOCK2"); + Create a $uc_inventory WebCenter ID – use your ID to submit comments or new content, or to create a new test. If you are already a $uc_inventory WebCenter user, please log-in.


+ - + - + - + + + - + - +
+END_OF_BLOCK2 + } else { + $r->print(''. + &mt("If you are already a $sitename user, please log-in.").' '.&mt('If not, contact your instructor to request a username and password.'). + '


'); + } + $r->print(<<"END_OF_BLOCK3");
@@ -470,9 +542,9 @@ my %lt=&Apache::lonlocal::texthash(
 
 
 

- Existing WebCenter user? + $existing
Please log-in.
-


+

:
 



-
+
Forgot your password?

@@ -519,36 +591,38 @@ my %lt=&Apache::lonlocal::texthash(
 
 
 
- + +
  - Note:
+ Note:
If log-in fails, it may be because your browser is not accepting session cookies, or javascript is disabled. Learn more.
 
+
- +   - +
@@ -557,19 +631,19 @@ my %lt=&Apache::lonlocal::texthash( Javascript must be enabled in your web browser in order to use this web site.

 

- - - - - - -END_OF_BLOCK2 + + + + + + +END_OF_BLOCK3 } else { $r->print(<The LearningOnline Network with CAPA

$lt{'tbli'}

$announcements

$lt{'options_headline'}

-
+


@@ -580,8 +654,8 @@ END_OF_BLOCK2 ENDACCESSOPTIONS } $r->print(' - - + + '); unless ($fullgraph) { my $logintitle; @@ -597,7 +671,7 @@ ENDACCESSOPTIONS .''; $r->print(< - +
$logintitle$noscript_warning @@ -613,7 +687,7 @@ ENDACCESSOPTIONS @@ -639,12 +713,12 @@ ENDTEXTUAL - - - - - - + + + + + + @@ -676,6 +750,7 @@ sub contactdisplay { my $thisurl = &escape('/adm/login'); $$helpdeskscript = <<"ENDSCRIPT"; ENDSCRIPT } $contactblock .= <<"ENDBLOCK"; -    $version +    $version ENDBLOCK return $contactblock; } sub forgotpwdisplay { my (%lt) = @_; - my $prompt_for_resetpw = 1; + my $prompt_for_resetpw = 1; if ($prompt_for_resetpw) { return '
   '.$lt{'forgotpw'}.'
'; }

- +