--- loncom/lonnet/perl/lonnet.pm 2000/10/28 17:26:35 1.52 +++ loncom/lonnet/perl/lonnet.pm 2000/10/28 19:26:07 1.53 @@ -499,7 +499,7 @@ sub coursedescription { if ($chome ne 'no_host') { my $rep=reply("dump:$cdomain:$cnum:environment",$chome); if ($rep ne 'con_lost') { - my %cachehash=(); + my %envhash=(); my %returnhash=('home' => $chome, 'domain' => $cdomain, 'num' => $cnum); @@ -508,14 +508,14 @@ sub coursedescription { $name=&unescape($name); $value=&unescape($value); $returnhash{$name}=$value; - if ($name eq 'description') { - $cachehash{$courseid}=$value; - } + my $normalid=$courseid; + $normalid=~s/\//\_/g; + $envhash{'course.'.$normalid.'.'.$name}=$value; } split(/\&/,$rep); $returnhash{'url'}='/res/'.declutter($returnhash{'url'}); $returnhash{'fn'}=$perlvar{'lonDaemons'}.'/tmp/'. $ENV{'user.name'}.'_'.$cdomain.'_'.$cnum; - put ('nohist_coursedescriptions',%cachehash); + &appenv(%envhash); return %returnhash; } } @@ -785,17 +785,23 @@ sub allowed { } } if (($ENV{'HTTP_REFERER'}) && ($checkreferer)) { - my @uriparts=split(/\//,&declutter($ENV{'HTTP_REFERER'})); + my $refuri=&declutter($ENV{'HTTP_REFERER'}); + my @uriparts=split(/\//,$refuri); my $filename=$uriparts[$#uriparts]; - my $pathname=$uri; + my $pathname=$refuri; $pathname=~s/\/$filename$//; - if ($ENV{'acc.res.'.$ENV{'request.course.id'}.'.'.$pathname}=~ + my @filenameparts=split(/\./,$filename); + if (&fileembstyle($filenameparts[$#filenameparts]) ne 'ssi') { + if ($ENV{'acc.res.'.$ENV{'request.course.id'}.'.'.$pathname}=~ /\&$filename\:(\d+)\&/) { - $statecond=$1; + my $refstatecond=$1; if ($ENV{'user.priv.'.$ENV{'request.role'}.'./'.$courseprivid} =~/$priv\&([^\:]*)/) { $thisallowed.=$1; + $uri=$refuri; + $statecond=$refstatecond; } + } } } } @@ -874,6 +880,23 @@ sub allowed { # Now user is definitely in a course # + +# Course preferences + + if ($thisallowed=~/C/) { +# +# Registered course preferences from environment +# + } + +# Resource preferences + + if ($thisallowed=~/R/) { +# +# Resource Metadata +# + } + # Restricted by state? if ($thisallowed=~/X/) {