--- loncom/auth/lonroles.pm 2000/10/28 19:23:21 1.16 +++ loncom/auth/lonroles.pm 2001/01/17 17:26:01 1.21 @@ -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,10/28 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 @@ -79,6 +97,7 @@ sub handler { LON-CAPA User Roles + ENDHEADER # ------------------------------------------ Get Error Message from Environment @@ -130,6 +149,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(''); @@ -137,12 +159,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\./) { @@ -163,7 +181,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) { @@ -183,7 +201,7 @@ ENDHEADER $tbg='#AAFF77'; $tremark.='Expired after logout. '; } elsif ($tstatus eq 'selected') { - $tbg='#33FF33'; + $tbg='#11CC55'; $tremark.='Currently selected. '; } my $trole; @@ -240,7 +258,7 @@ ENDHEADER } my $tremark=''; if ($ENV{'request.role'} eq 'cm') { - $r->print(''); + $r->print(''); $tremark='Currently selected.'; } else { $r->print(''); @@ -307,15 +325,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