--- loncom/auth/lonroles.pm 2004/11/12 23:29:55 1.109
+++ loncom/auth/lonroles.pm 2004/11/23 07:29:24 1.112
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.109 2004/11/12 23:29:55 raeburn Exp $
+# $Id: lonroles.pm,v 1.112 2004/11/23 07:29:24 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -84,6 +84,10 @@ sub handler {
my $envkey;
my %dcroles = ();
my $numdc = &check_fordc(\%dcroles,$then);
+ my %recentroles;
+ if ($numdc > 0) {
+ %recentroles = &Apache::lonnet::dump(&recent_filename('roles'));
+ }
# ================================================================== Roles Init
if ($ENV{'form.selectrole'}) {
@@ -100,27 +104,29 @@ sub handler {
"request.role.adv" => $ENV{'user.adv'},
"request.role.domain" => $ENV{'user.domain'});
-# Check to see if the user is a DC trying to enter a course and needs privs to be created
+# 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;
- if ($ENV{$cckey}) {
- my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus,$tpstart,$tpend,$tfont);
- &role_status($cckey,$then,$now,\$role,\$where,\$trolecode,\$tstatus,\$tstart,\$tend);
- unless (($tstatus eq 'is') || ($tstatus eq 'will_not')) {
- &set_privileges($1,$2);
- }
- } else {
- &set_privileges($1,$2);
- }
+ &check_privs($cckey,$then,$now);
}
last;
}
}
}
+# Check if user is a DC with courses in the recent list which need privs.
+# if ($numdc > 0) {
+# %recentroles = &Apache::lonnet::dump(&recent_filename('recent_roles'));
+# foreach my $rolekey (keys %recentroles) {
+# if ($rolekey =~ m-^user\.role.cc\./\w+/\w+$-) {
+# &check_privs($rolekey,$then,$now);
+# }
+# }
+# }
+
foreach $envkey (keys %ENV) {
next if ($envkey!~/^user\.role\./);
my ($where,$trolecode,$role,$tstatus,$tend,$tstart);
@@ -129,6 +135,13 @@ sub handler {
if ($tstatus eq 'is') {
$where=~s/^\///;
my ($cdom,$cnum,$csec)=split(/\//,$where);
+# store role if recent_role list being kept
+ if ($ENV{'environment.recentroles'}) {
+ &Apache::lonhtmlcommon::store_recent('roles',
+ $trolecode,' ');
+ }
+
+
# check for keyed access
if (($role eq 'st') &&
($ENV{'course.'.$cdom.'_'.$cnum.'.keyaccess'} eq 'yes')) {
@@ -268,8 +281,8 @@ ENDENTERKEY
my $formaction = '/adm/roles/';
my ($dcdom,$pickedcourse) = split/_/,$courseid;
if ($ENV{'user.role.dc./'.$dcdom.'/'}) {
- &Apache::lonhtmlcommon::store_recent('recent_roles',
- $courseid,$formaction);
+ &Apache::lonhtmlcommon::store_recent('roles',
+ $envkey,$formaction);
}
}
#
@@ -550,41 +563,7 @@ ENDHEADER
$sortkey=$role.$twhere;
}
- $roletext.='
';
- unless ($nochoose) {
- if (!$button) {
- if ($switchserver) {
- $roletext.='