--- loncom/auth/lonroles.pm 2004/11/23 07:29:24 1.112 +++ loncom/auth/lonroles.pm 2004/12/03 05:15:30 1.113 @@ -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.113 2004/12/03 05:15:30 raeburn 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, @@ -618,7 +594,11 @@ 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("". @@ -629,7 +609,6 @@ ENDHEADER } if ($numdc > 0) { - &display_recent_roles($r,\%roletext,\%recentroles); $r->print(&coursepick_jscript()); $r->print(&Apache::loncommon::coursebrowser_javascript()); } @@ -923,46 +902,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 {