--- loncom/auth/lonroles.pm 2004/11/23 07:29:24 1.112
+++ loncom/auth/lonroles.pm 2004/12/17 21:44:19 1.115
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.112 2004/11/23 07:29:24 raeburn Exp $
+# $Id: lonroles.pm,v 1.115 2004/12/17 21:44:19 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -84,10 +84,6 @@ 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'}) {
@@ -117,16 +113,6 @@ sub handler {
}
}
-# 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);
@@ -276,16 +262,6 @@ ENDENTERKEY
'.course.helper.not.run'}) {
$furl = "/adm/helper/course.initialization.helper";
}
- # Check to see if the user is a DC selecting a course
- if (($numdc > 0) && ($role eq 'cc')) {
- my $formaction = '/adm/roles/';
- my ($dcdom,$pickedcourse) = split/_/,$courseid;
- if ($ENV{'user.role.dc./'.$dcdom.'/'}) {
- &Apache::lonhtmlcommon::store_recent('roles',
- $envkey,$formaction);
- }
- }
- #
# Send the user to the course they selected
&redirect_user($r,&mt('Entering Course'),
$furl,$msg,
@@ -363,7 +339,7 @@ ENDHEADER
$r->print("
LON-CAPA Access Control
");
$r->print("
Access : ".
Apache::lonnet::plaintext($priv)."\n");
- $r->print("Resource: $fn\n");
+ $r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n");
$r->print("Action : $msg\n
");
} else {
if ($ENV{'user.error.msg'}) {
@@ -618,18 +594,22 @@ ENDHEADER
foreach (sort(keys(%recent_roles))) {
if (defined($roletext{'user.role.'.$_})) {
$output.=$roletext{'user.role.'.$_};
- }
+ } elsif ($numdc > 0) {
+ unless ($_ =~/^error\:/) {
+ $output.=&display_cc_role('user.role.'.$_);
+ }
+ }
}
if ($output) {
$r->print("".
&mt('Recent Roles')." | ");
$r->print($output);
$r->print("
");
+ $doheaders ++;
}
}
if ($numdc > 0) {
- &display_recent_roles($r,\%roletext,\%recentroles);
$r->print(&coursepick_jscript());
$r->print(&Apache::loncommon::coursebrowser_javascript());
}
@@ -869,7 +849,7 @@ function verifyCoursePick(caller) {
}
}
else {
- alert("You must use the 'Select Course' link to open a separate pick course window which you can use to select the course you wish to enter");
+ alert("Please use the 'Select Course' link to open a separate pick course window where you may select the course you wish to enter.");
}
}
else {
@@ -923,46 +903,34 @@ END
return $process_pick;
}
-sub display_recent_roles {
- my ($r,$roletext,$recentroles)=@_;
+sub display_cc_role {
+ my $rolekey = shift;
+ my $roletext;
my $advanced = $ENV{'user.adv'};
my $tryagain = $ENV{'form.tryagain'};
- my $numrecent = 0;
- my $roledisplay = ''.
- ''.
- &mt('Recent courses accessed by DC').
- ' |
'."\n";
- foreach my $rolekey (sort keys %{$recentroles}) {
- unless ($rolekey =~/^error\:/) {
- unless ($$roletext{$rolekey}) {
- if ($rolekey =~ m-^user\.role.cc\./(\w+)/(\w+)$-) {
- my $tcourseid = $1.'_'.$2;
- my $trolecode = 'cc./'.$1.'/'.$2;
- my $trole = Apache::lonnet::plaintext('cc');
- my $twhere;
- my $tbg='#77FF77';
- my $tfont='#003300';
- my %newhash=&Apache::lonnet::coursedescription($tcourseid);
- if (%newhash) {
- $twhere=$newhash{'description'}.
- ' '.
- &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$2,$1,$tfont).
- '';
- } else {
- $twhere=&mt('Currently not available');
- $ENV{'course.'.$tcourseid.'.description'}=$twhere;
- }
- $twhere.="
".&mt('Domain').":".$1;
- $$roletext{$rolekey} = &build_roletext($trolecode,$1,$2,'is',$tryagain,$advanced,'',$tbg,$tfont,$trole,&mt('Course'),$twhere,'','','',1,'');
- }
+ unless ($rolekey =~/^error\:/) {
+ if ($rolekey =~ m-^user\.role.cc\./(\w+)/(\w+)$-) {
+ my $tcourseid = $1.'_'.$2;
+ my $trolecode = 'cc./'.$1.'/'.$2;
+ my $trole = Apache::lonnet::plaintext('cc');
+ my $twhere;
+ my $tbg='#77FF77';
+ my $tfont='#003300';
+ my %newhash=&Apache::lonnet::coursedescription($tcourseid);
+ if (%newhash) {
+ $twhere=$newhash{'description'}.
+ ' '.
+ &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$2,$1,$tfont).
+ '';
+ } else {
+ $twhere=&mt('Currently not available');
+ $ENV{'course.'.$tcourseid.'.description'}=$twhere;
}
- $roledisplay.=$$roletext{$rolekey};
- $numrecent ++;
+ $twhere.="
".&mt('Domain').":".$1;
+ $roletext = &build_roletext($trolecode,$1,$2,'is',$tryagain,$advanced,'',$tbg,$tfont,$trole,&mt('Course'),$twhere,'','','',1,'');
}
}
- if ($numrecent > 0) {
- $r->print("$roledisplay\n");
- }
+ return $roletext;
}
sub allcourses_row {