--- loncom/auth/lonroles.pm 2000/10/02 21:34:58 1.9 +++ loncom/auth/lonroles.pm 2000/10/05 19:15:34 1.12 @@ -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 Gerd Kortemeyer +# 09/04,09/06,09/28,09/29,09/30,10/2,10/5 Gerd Kortemeyer # package Apache::lonroles; @@ -16,27 +16,14 @@ use Apache::Constants qw(:common); use Apache::File(); sub handler { - my $r = shift; - $r->content_type('text/html'); - $r->send_http_header; - return OK if $r->header_only; -# ---------------------------------------------------------------- Print Header - $r->print(< - -LON-CAPA User Roles -ENDHEADER - if ($ENV{'form.orgurl'}) { - $r->print(''); - } - $r->print(''); + my $r = shift; my $now=time; my $then=$ENV{'user.login.time'}; my $envkey; + # ================================================================== Roles Init if ($ENV{'form.selectrole'}) { @@ -62,24 +49,38 @@ ENDHEADER my ($cdom,$cnum)=split(/\//,$where); if ($cnum) { &Apache::lonuserstate::readmap($where); - $r->print('

Role initialized

'); - return OK; + if ($ENV{'form.orgurl'}) { + $r->internal_redirect($ENV{'form.orgurl'}); + return OK; + } } } } } } - - $r->print('

Role not active

'); - return OK; } + + # =============================================================== No Roles Init + $r->content_type('text/html'); + $r->send_http_header; + return OK if $r->header_only; + + $r->print(< + +LON-CAPA User Roles + +ENDHEADER + # ------------------------------------------ Get Error Message from Environment my ($fn,$priv,$nochoose,$error,$msg)=split(/:/,$ENV{'user.error.msg'}); - $r->log_reason( - "$msg for $ENV{'user.name'} domain $ENV{'user.domain'} access $priv",$fn); + if ($ENV{'user.error.msg'}) { + $r->log_reason( + "$msg for $ENV{'user.name'} domain $ENV{'user.domain'} access $priv",$fn); + } # ---------------------------------------------------------------- Who is this? @@ -126,7 +127,7 @@ ENDHEADER } else { $r->print("

Enter a Course

\n"); } - $r->print('
'); + $r->print(''); $r->print(''); $r->print(''); }