version 1.112, 2004/11/23 07:29:24
|
version 1.115, 2004/12/17 21:44:19
|
Line 84 sub handler {
|
Line 84 sub handler {
|
my $envkey; |
my $envkey; |
my %dcroles = (); |
my %dcroles = (); |
my $numdc = &check_fordc(\%dcroles,$then); |
my $numdc = &check_fordc(\%dcroles,$then); |
my %recentroles; |
|
if ($numdc > 0) { |
|
%recentroles = &Apache::lonnet::dump(&recent_filename('roles')); |
|
} |
|
|
|
# ================================================================== Roles Init |
# ================================================================== Roles Init |
if ($ENV{'form.selectrole'}) { |
if ($ENV{'form.selectrole'}) { |
Line 117 sub handler {
|
Line 113 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) { |
foreach $envkey (keys %ENV) { |
next if ($envkey!~/^user\.role\./); |
next if ($envkey!~/^user\.role\./); |
my ($where,$trolecode,$role,$tstatus,$tend,$tstart); |
my ($where,$trolecode,$role,$tstatus,$tend,$tstart); |
Line 276 ENDENTERKEY
|
Line 262 ENDENTERKEY
|
'.course.helper.not.run'}) { |
'.course.helper.not.run'}) { |
$furl = "/adm/helper/course.initialization.helper"; |
$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 |
# Send the user to the course they selected |
&redirect_user($r,&mt('Entering Course'), |
&redirect_user($r,&mt('Entering Course'), |
$furl,$msg, |
$furl,$msg, |
Line 363 ENDHEADER
|
Line 339 ENDHEADER
|
$r->print("<h1>LON-CAPA Access Control</h1>"); |
$r->print("<h1>LON-CAPA Access Control</h1>"); |
$r->print("<hr><pre>Access : ". |
$r->print("<hr><pre>Access : ". |
Apache::lonnet::plaintext($priv)."\n"); |
Apache::lonnet::plaintext($priv)."\n"); |
$r->print("Resource: $fn\n"); |
$r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n"); |
$r->print("Action : $msg\n</pre><hr>"); |
$r->print("Action : $msg\n</pre><hr>"); |
} else { |
} else { |
if ($ENV{'user.error.msg'}) { |
if ($ENV{'user.error.msg'}) { |
Line 618 ENDHEADER
|
Line 594 ENDHEADER
|
foreach (sort(keys(%recent_roles))) { |
foreach (sort(keys(%recent_roles))) { |
if (defined($roletext{'user.role.'.$_})) { |
if (defined($roletext{'user.role.'.$_})) { |
$output.=$roletext{'user.role.'.$_}; |
$output.=$roletext{'user.role.'.$_}; |
} |
} elsif ($numdc > 0) { |
|
unless ($_ =~/^error\:/) { |
|
$output.=&display_cc_role('user.role.'.$_); |
|
} |
|
} |
} |
} |
if ($output) { |
if ($output) { |
$r->print("<tr bgcolor='#BBffBB'><td align='center' colspan='7'>". |
$r->print("<tr bgcolor='#BBffBB'><td align='center' colspan='7'>". |
&mt('Recent Roles')."</td>"); |
&mt('Recent Roles')."</td>"); |
$r->print($output); |
$r->print($output); |
$r->print("</tr>"); |
$r->print("</tr>"); |
|
$doheaders ++; |
} |
} |
} |
} |
|
|
if ($numdc > 0) { |
if ($numdc > 0) { |
&display_recent_roles($r,\%roletext,\%recentroles); |
|
$r->print(&coursepick_jscript()); |
$r->print(&coursepick_jscript()); |
$r->print(&Apache::loncommon::coursebrowser_javascript()); |
$r->print(&Apache::loncommon::coursebrowser_javascript()); |
} |
} |
Line 869 function verifyCoursePick(caller) {
|
Line 849 function verifyCoursePick(caller) {
|
} |
} |
} |
} |
else { |
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 { |
else { |
Line 923 END
|
Line 903 END
|
return $process_pick; |
return $process_pick; |
} |
} |
|
|
sub display_recent_roles { |
sub display_cc_role { |
my ($r,$roletext,$recentroles)=@_; |
my $rolekey = shift; |
|
my $roletext; |
my $advanced = $ENV{'user.adv'}; |
my $advanced = $ENV{'user.adv'}; |
my $tryagain = $ENV{'form.tryagain'}; |
my $tryagain = $ENV{'form.tryagain'}; |
my $numrecent = 0; |
unless ($rolekey =~/^error\:/) { |
my $roledisplay = '<tr bgcolor="#BBffBB">'. |
if ($rolekey =~ m-^user\.role.cc\./(\w+)/(\w+)$-) { |
'<td align="center" colspan="7">'. |
my $tcourseid = $1.'_'.$2; |
&mt('Recent courses accessed by DC'). |
my $trolecode = 'cc./'.$1.'/'.$2; |
'</td></tr>'."\n"; |
my $trole = Apache::lonnet::plaintext('cc'); |
foreach my $rolekey (sort keys %{$recentroles}) { |
my $twhere; |
unless ($rolekey =~/^error\:/) { |
my $tbg='#77FF77'; |
unless ($$roletext{$rolekey}) { |
my $tfont='#003300'; |
if ($rolekey =~ m-^user\.role.cc\./(\w+)/(\w+)$-) { |
my %newhash=&Apache::lonnet::coursedescription($tcourseid); |
my $tcourseid = $1.'_'.$2; |
if (%newhash) { |
my $trolecode = 'cc./'.$1.'/'.$2; |
$twhere=$newhash{'description'}. |
my $trole = Apache::lonnet::plaintext('cc'); |
' <font size="-2">'. |
my $twhere; |
&Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$2,$1,$tfont). |
my $tbg='#77FF77'; |
'</font>'; |
my $tfont='#003300'; |
} else { |
my %newhash=&Apache::lonnet::coursedescription($tcourseid); |
$twhere=&mt('Currently not available'); |
if (%newhash) { |
$ENV{'course.'.$tcourseid.'.description'}=$twhere; |
$twhere=$newhash{'description'}. |
|
' <font size="-2">'. |
|
&Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$2,$1,$tfont). |
|
'</font>'; |
|
} else { |
|
$twhere=&mt('Currently not available'); |
|
$ENV{'course.'.$tcourseid.'.description'}=$twhere; |
|
} |
|
$twhere.="<br />".&mt('Domain').":".$1; |
|
$$roletext{$rolekey} = &build_roletext($trolecode,$1,$2,'is',$tryagain,$advanced,'',$tbg,$tfont,$trole,&mt('Course'),$twhere,'','','',1,''); |
|
} |
|
} |
} |
$roledisplay.=$$roletext{$rolekey}; |
$twhere.="<br />".&mt('Domain').":".$1; |
$numrecent ++; |
$roletext = &build_roletext($trolecode,$1,$2,'is',$tryagain,$advanced,'',$tbg,$tfont,$trole,&mt('Course'),$twhere,'','','',1,''); |
} |
} |
} |
} |
if ($numrecent > 0) { |
return $roletext; |
$r->print("$roledisplay\n"); |
|
} |
|
} |
} |
|
|
sub allcourses_row { |
sub allcourses_row { |