--- loncom/auth/lonroles.pm 2008/05/19 17:55:38 1.193 +++ loncom/auth/lonroles.pm 2008/07/05 23:27:34 1.199 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.193 2008/05/19 17:55:38 raeburn Exp $ +# $Id: lonroles.pm,v 1.199 2008/07/05 23:27:34 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -137,18 +137,6 @@ sub handler { # Is this an ad-hoc CC-role? if (my ($domain,$coursenum) = ($envkey =~ m-^form\.cc\./($match_domain)/($match_courseid)$-)) { - # See if that is even allowed - my %crsenv=&Apache::lonnet::get('environment',['internal.courseowner'],$domain,$coursenum); - # First find course owner - my ($owneruser,$ownerdomain)=split(/\:/,$crsenv{'internal.courseowner'}); - # Check if course owner blocked cc-access - if (($owneruser) && ($ownerdomain)) { - my %blocked=&Apache::lonnet::get('environment',['domcoord.cc'],$ownerdomain,$owneruser); - if ($blocked{'domcoord.cc'} eq 'blocked') { - $env{'user.error.msg'}=':::1:Course owner '.$owneruser.' in domain '.$ownerdomain.' blocked domain coordinator access'; - last; - } - } if ($dcroles{$domain}) { &check_privs($domain,$coursenum,$then,$now,'cc'); } @@ -513,13 +501,6 @@ ENDHEADER $r->print(''); $r->print(''); } - if ($env{'user.adv'}) { - $r->print( - '
'); - } - my (%roletext,%sortrole,%roleclass); my $countactive=0; my $countfuture=0; @@ -686,6 +667,18 @@ ENDHEADER } } } + if ($env{'user.adv'}) { + $r->print( + '
'); + } else { + if ($countactive > 0) { + my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); + $r->print('

'.&mt('[_1]Visit the [_2]Course Catalog[_3] to view all [_4] LON-CAPA courses.','','','',$domdesc).'
'.&mt('If a course is [_1]not[_2] in your list of current courses below, you may be able to enroll if self-enrollment is permitted.','','').'

'); + } + } + # No active roles if ($countactive==0) { if ($inrole) { @@ -798,9 +791,12 @@ ENDHEADER } $r->print(&Apache::lonnet::getannounce()); if ($advanced) { - $r->print('

This is LON-CAPA '. - $r->dir_config('lonVersion').'
'. - ''.&mt('Logout').'

'); + $r->print('

' + .&mt('This is LON-CAPA [_1]',$r->dir_config('lonVersion')) + .'
' + .''.&mt('Logout').'  ' + .''.&mt('Course Catalog') + .'

'); } $r->print(&Apache::loncommon::end_page()); return OK; @@ -1077,22 +1073,22 @@ sub adhoc_course_role { my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; if (&check_forcc($cdom,$cnum,$then)) { my $setprivs; - if (!defined($env{'user.role.'.$env{'form.selectrole'}})) { + if (!defined($env{'user.role.'.$env{'form.switchrole'}})) { $setprivs = 1; } else { - my ($start,$end) = split(/\./,$env{'user.role.'.$env{'form.selectrole'}}); + my ($start,$end) = split(/\./,$env{'user.role.'.$env{'form.switchrole'}}); if (($start && ($start>$then || $start == -1)) || ($end && $end<$then)) { $setprivs = 1; } } if ($setprivs) { - if ($env{'form.switchrole'} =~ m-^(in|ta|ep|ad|st|cr)([\w/]*)\./\Q$cdom\E/\Q$cnum\E(/?\w*)$-) { + if ($env{'form.switchrole'} =~ m-^(in|ta|ep|ad|st|cr)([\w/]*)\./\Q$cdom\E/\Q$cnum\E/?(\w*)$-) { my $role = $1; my $custom_role = $2; my $usec = $3; if ($role eq 'cr') { - if ($custom_role =~ m-^$match_domain/$match_courseid/\w+$-) { + if ($custom_role =~ m-^/$match_domain/$match_username/\w+$-) { $role .= $custom_role; } else { return;