--- loncom/auth/lonroles.pm 2005/06/05 07:10:32 1.120 +++ loncom/auth/lonroles.pm 2006/03/16 19:19:59 1.146 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.120 2005/06/05 07:10:32 albertel Exp $ +# $Id: lonroles.pm,v 1.146 2006/03/16 19:19:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,7 +50,8 @@ sub redirect_user { my $swinfo=&Apache::lonmenu::rawconfig(); my $navwindow; if ($launch_nav eq 'on') { - $navwindow.=&Apache::lonnavmaps::launch_win('now'); + $navwindow.=&Apache::lonnavmaps::launch_win('now',undef,undef, + ($url =~ m-^/adm/whatsnew-)); } else { $navwindow.=&Apache::lonnavmaps::close(); } @@ -88,6 +89,9 @@ sub handler { # ================================================================== Roles Init if ($env{'form.selectrole'}) { + if ($env{'form.newrole'}) { + $env{'form.'.$env{'form.newrole'}}=1; + } if ($env{'request.course.id'}) { my %temp=('logout_'.$env{'request.course.id'} => time); &Apache::lonnet::put('email_status',\%temp); @@ -104,10 +108,10 @@ sub handler { # Check if user is a DC trying to enter a course and needs privs to be created if ($numdc > 0) { foreach my $envkey (keys %env) { - if ($envkey =~ m-^form\.cc\./(\w+)/(\w+)$-) { - if ($dcroles{$1}) { - my $cckey = 'user.role.cc./'.$1.'/'.$2; - &check_privs($cckey,$then,$now); + if (my ($domain,$coursenum) = + ($envkey =~ m-^form\.cc\./(\w+)/(\w+)$-)) { + if ($dcroles{$domain}) { + &check_privs($domain,$coursenum,$then,$now); } last; } @@ -122,6 +126,11 @@ sub handler { if ($tstatus eq 'is') { $where=~s/^\///; my ($cdom,$cnum,$csec)=split(/\//,$where); +# check for course groups + my %coursegroups = &Apache::lonnet::get_active_groups( + $env{'user.domain'},$env{'user.name'},$cdom, $cnum); + my $cgrps = join(':',keys(%coursegroups)); + # store role if recent_role list being kept if ($env{'environment.recentroles'}) { &Apache::lonhtmlcommon::store_recent('roles', @@ -223,11 +232,12 @@ ENDENTERKEY &Apache::lonnet::appenv( 'request.role' => $trolecode, 'request.role.domain' => $cdom, - 'request.course.sec' => $csec); + 'request.course.sec' => $csec, + 'request.course.groups' => $cgrps); my $tadv=0; my $msg=&mt('Entering course ...'); - if (($cnum) && ($role ne 'ca')) { + if (($cnum) && ($role ne 'ca') && ($role ne 'aa')) { my ($furl,$ferr)= &Apache::lonuserstate::readmap($cdom.'/'.$cnum); if (($env{'form.orgurl'}) && @@ -243,7 +253,7 @@ ENDENTERKEY "request.course.id" => $cdom.'_'.$cnum); $furl='/adm/roles?tryagain=1'; $msg= - '
'.&Apache::loncommon::help_open_menu('','General Intro','General_Intro','User Roles',1,undef,undef,undef,undef,,&mt("Click here for help")).' |
Access : ". + $r->print("Access : ". Apache::lonnet::plaintext($priv)."\n"); $r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n"); $r->print("Action : $msg\n
"); @@ -354,7 +396,7 @@ ENDHEADER } else { if ($env{'user.error.msg'}) { $r->print( - ''. + '
'. &mt('You need to choose another user role or enter a specific course for this function').'
'); } } @@ -380,7 +422,7 @@ ENDHEADER ($env{'user.name'},$env{'user.domain'})}. "
\n"); $r->print(&mt( - "Author and Co-Author roles may not be available on servers other than your home server.")); + "Author and Co-Author roles are not available on servers other than their respective home servers.")); } if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) { $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'}; @@ -388,6 +430,7 @@ ENDHEADER $r->print('