--- loncom/auth/lonroles.pm 2003/02/04 16:25:37 1.51 +++ loncom/auth/lonroles.pm 2003/03/23 01:46:51 1.53 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.51 2003/02/04 16:25:37 www Exp $ +# $Id: lonroles.pm,v 1.53 2003/03/23 01:46:51 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -93,6 +93,41 @@ sub handler { if ($tstatus eq 'is') { $where=~s/^\///; my ($cdom,$cnum,$csec)=split(/\//,$where); +# check for keyed access + if (($role eq 'st') && + ($ENV{'course.'.$cdom.'_'.$cnum.'.keyaccess'} eq 'yes')) { + unless (&Apache::lonnet::validate_access_key( + $ENV{'environment.key.'.$cdom.'_'.$cnum}, + $cdom,$cnum)) { +# there is no valid key + if ($ENV{'form.newkey'}) { +# student attempts to register a new key + } else { +# print form to enter a new key + $r->content_type('text/html'); + &Apache::loncommon::no_cache($r); + $r->send_http_header; + my $swinfo=&Apache::lonmenu::rawconfig(); + my $bodytag=&Apache::loncommon::bodytag + ('Enter Access Key to Unlock this Course'); + $r->print(<Entering Course Access Key + + +$bodytag + +
+ + + +
+ +ENDENTERKEY + } + } + } &Apache::lonnet::appenv('request.role' => $trolecode, 'request.role.domain' => $cdom, 'request.course.sec' => $csec); @@ -115,7 +150,7 @@ sub handler { $r->content_type('text/html'); &Apache::loncommon::no_cache($r); $r->send_http_header; - my $swinfo=&Apache::lonmenu::rawconfig($r); + my $swinfo=&Apache::lonmenu::rawconfig(); my $bodytag=&Apache::loncommon::bodytag('Switching Role'); print (<Entering Course @@ -146,10 +181,10 @@ ENDREDIR $r->send_http_header; return OK if $r->header_only; - my $swinfo=&Apache::lonmenu::rawconfig($r); + my $swinfo=&Apache::lonmenu::rawconfig(); my $bodytag=&Apache::loncommon::bodytag('User Roles'); my $helptag=&Apache::loncommon::help_open_topic - ("General_Intro","CLICK HERE FOR HELP"); + ("General_Intro","Click here for help"); $r->print(<