--- loncom/auth/lonroles.pm 2000/10/26 21:43:18 1.15 +++ loncom/auth/lonroles.pm 2001/01/15 15:59:52 1.20 @@ -5,7 +5,9 @@ # 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,10/26 Gerd Kortemeyer +# 09/04,09/06,09/28,09/29,09/30,10/2,10/5,10/26,10/28, +# 12/08,12/28, +# 01/15/01 Gerd Kortemeyer # package Apache::lonroles; @@ -47,7 +49,7 @@ sub handler { } if ($tend) { if ($tend<$then) { $tstatus='expired'; } - if ($tend>$now) { $tstatus='will_not'; } + if ($tend<$now) { $tstatus='will_not'; } } if ($tstatus eq 'is') { $where=~s/^\///; @@ -55,17 +57,33 @@ sub handler { &Apache::lonnet::appenv('request.role' => $trolecode, 'request.course.sec' => $csec); if ($cnum) { - &Apache::lonuserstate::readmap($cdom.'/'.$cnum); - if ($ENV{'form.orgurl'}) { + my ($furl,$ferr)= + &Apache::lonuserstate::readmap($cdom.'/'.$cnum); + if (($ENV{'form.orgurl'}) && + ($ENV{'form.orgurl'}!~/^\/adm\/flip/)) { $r->internal_redirect($ENV{'form.orgurl'}); return OK; - } + } else { + $r->content_type('text/html'); + $r->send_http_header; + print (<Entering Course + + + + +Entering course ... + + +ENDREDIR + return OK; + } } } } } } - } + } # =============================================================== No Roles Init @@ -99,10 +117,6 @@ ENDHEADER } } -# ---------------------------------------------- Get cached course descriptions - - my %cdes=Apache::lonnet::dump('nohist_coursedescriptions'); - # -------------------------------------------------------- Generate Page Output # --------------------------------------------------------------- Error Header? if ($error) { @@ -134,6 +148,9 @@ ENDHEADER } else { $r->print("

Enter a Course

\n"); } + if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) { + $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'}; + } $r->print('
'); $r->print(''); $r->print(''); @@ -141,12 +158,8 @@ ENDHEADER # ----------------------------------------------------------------------- Table $r->print(''); unless ($nochoose) { $r->print(''); } - if ($advanced) { $r->print(''. ''."\n"); - } else { - $r->print(''."\n"); - } foreach $envkey (sort keys %ENV) { if ($envkey=~/^user\.role\./) { @@ -167,7 +180,7 @@ ENDHEADER } if ($tend) { if ($tend<$then) { $tstatus='expired'; } - if ($tend>$now) { $tstatus='will_not'; } + if ($tend<$now) { $tstatus='will_not'; } $tpend=localtime($tend); } if ($ENV{'request.role'} eq $trolecode) { @@ -187,7 +200,7 @@ ENDHEADER $tbg='#AAFF77'; $tremark.='Expired after logout. '; } elsif ($tstatus eq 'selected') { - $tbg='#33FF33'; + $tbg='#11CC55'; $tremark.='Currently selected. '; } my $trole; @@ -207,17 +220,17 @@ ENDHEADER if ($tsection) { $ttype.='
Section/Group: '.$tsection; } - my $tcourseid=$tdom.'/'.$trest; - if ($cdes{$tcourseid}) { - $twhere=$cdes{$tcourseid}; + my $tcourseid=$tdom.'_'.$trest; + if ($ENV{'course.'.$tcourseid.'.description'}) { + $twhere=$ENV{'course.'.$tcourseid.'.description'}; } else { my %newhash=Apache::lonnet::coursedescription($tcourseid); if (%newhash) { $twhere=$newhash{'description'}; } else { $twhere='Currently not available'; + $ENV{'course.'.$tcourseid.'.description'}=$twhere; } - $cdes{$tcourseid}=$twhere; } } elsif ($tdom) { $ttype='Domain'; @@ -244,7 +257,7 @@ ENDHEADER } my $tremark=''; if ($ENV{'request.role'} eq 'cm') { - $r->print(''); + $r->print(''); $tremark='Currently selected.'; } else { $r->print(''); @@ -277,7 +290,7 @@ ENDHEADER split(/\//,Apache::lonnet::declutter($where)); if ($trest) { $ttype='Course'; - $twhere=$cdes{$tdom.'/'.$trest}; + $twhere=$ENV{'course.'.$tdom.'_'.$trest.'.description'}; if ($tsec) { $twhere.=' (Section/Group: '.$tsec.')'; } @@ -311,15 +324,6 @@ ENDHEADER } } } -# -------------------------------------------------------------- Debug - remove - - $->print("

Debugging


\n"); - - foreach $envkey (sort keys %ENV) { - $r->print("$envkey ---- $ENV{$envkey}
"); - } - -# ------------------------------------------------------------------- End Debug $r->print("\n"); return OK;
 User RoleExtentStartEndRemark
Course