--- loncom/auth/lonroles.pm 2000/10/05 19:15:34 1.12 +++ loncom/auth/lonroles.pm 2000/12/08 21:57:25 1.18 @@ -5,7 +5,7 @@ # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14 Gerd Kortemeyer) # 11/23 Gerd Kortemeyer) # 1/14,03/06,06/01,07/22,07/24,07/25, -# 09/04,09/06,09/28,09/29,09/30,10/2,10/5 Gerd Kortemeyer +# 09/04,09/06,09/28,09/29,09/30,10/2,10/5,10/26,10/28,12/08 Gerd Kortemeyer # package Apache::lonroles; @@ -27,8 +27,13 @@ sub handler { # ================================================================== Roles Init if ($ENV{'form.selectrole'}) { - foreach $envkey (keys %ENV) { - if ($envkey=~/^user\.role\./) { + &Apache::lonnet::appenv("request.course.id" => '', + "request.course.fn" => '', + "request.course.uri" => '', + "request.course.sec" => '', + "request.role" => 'cm'); + foreach $envkey (keys %ENV) { + if ($envkey=~/^user\.role\./) { my ($dum1,$dum2,$role,@pwhere)=split(/\./,$envkey); my $where=join('.',@pwhere); my $trolecode=$role.'.'.$where; @@ -45,10 +50,12 @@ sub handler { if ($tend>$now) { $tstatus='will_not'; } } if ($tstatus eq 'is') { - &Apache::lonnet::appenv('request.role' => $trolecode); - my ($cdom,$cnum)=split(/\//,$where); + $where=~s/^\///; + my ($cdom,$cnum,$csec)=split(/\//,$where); + &Apache::lonnet::appenv('request.role' => $trolecode, + 'request.course.sec' => $csec); if ($cnum) { - &Apache::lonuserstate::readmap($where); + &Apache::lonuserstate::readmap($cdom.'/'.$cnum); if ($ENV{'form.orgurl'}) { $r->internal_redirect($ENV{'form.orgurl'}); return OK; @@ -92,10 +99,6 @@ ENDHEADER } } -# ---------------------------------------------- Get cached course descriptions - - my %cdes=Apache::lonnet::dump('coursedescriptions'); - # -------------------------------------------------------- Generate Page Output # --------------------------------------------------------------- Error Header? if ($error) { @@ -127,6 +130,9 @@ ENDHEADER } else { $r->print("