--- rat/lonuserstate.pm 2004/04/26 19:16:45 1.77 +++ rat/lonuserstate.pm 2004/10/26 15:10:42 1.79 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Construct and maintain state and binary representation of course for user # -# $Id: lonuserstate.pm,v 1.77 2004/04/26 19:16:45 www Exp $ +# $Id: lonuserstate.pm,v 1.79 2004/10/26 15:10:42 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -162,7 +162,9 @@ sub loadmap { } elsif ($turi=~/^\/*uploaded\//) { # uploaded if (($embstyle eq 'img') || ($embstyle eq 'emb')) { $turi='/adm/wrapper'.$turi; - } elsif ($turi!~/\.(sequence|page)$/) { + } elsif ($embstyle eq 'ssi') { + #do nothing with these + } elsif ($turi!~/\.(sequence|page)$/) { $turi='/adm/coursedocs/showdoc'.$turi; } } elsif ($turi=~/\S/) { # normal non-empty internal resource @@ -333,21 +335,16 @@ sub traceroute { $sofar=simplify($sofar); unless ($beenhere=~/\&$rid\&/) { $beenhere.=$rid.'&'; - if ($hdnflag) { - $hiddenurl{$rid}=1; - } - if ($encflag) { - $encurl{$rid}=1; - } + my ($mapid,$resid)=split(/\./,$rid); + my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},$resid,$hash{'src_'.$rid}); + my $encrypt=&Apache::lonnet::EXT('resource.0.hiddenresource',$symb); + if ($hdnflag || lc($encrypt) eq 'yes') { $hiddenurl{$rid}=1; } + my $encrypt=&Apache::lonnet::EXT('resource.0.encrypturl',$symb); + if ($encflag || lc($encrypt) eq 'yes') { $encurl{$rid}=1; } if (($retfurl eq '') && ($hash{'src_'.$rid}) - && ($hash{'src_'.$rid}!~/\.sequence$/)) { - my ($mapid,$resid)=split(/\./,$rid); - $retfurl=$hash{'src_'.$rid}. - (($hash{'src_'.$rid}=~/\?/)?'&':'?').'symb='. - &Apache::lonnet::symbclean( - &Apache::lonnet::declutter($hash{'map_id_'.$mapid}). - '___'.$resid.'___'. - &Apache::lonnet::declutter($hash{'src_'.$rid})); + && ($hash{'src_'.$rid}!~/\.sequence$/)) { + $retfurl=$hash{'src_'.$rid}.(($hash{'src_'.$rid}=~/\?/)?'&':'?'). + 'symb='.$symb; } if (defined($hash{'conditions_'.$rid})) { $hash{'conditions_'.$rid}=simplify( @@ -447,9 +444,9 @@ sub accinit { /(\&\Q$urifile\E\:[^\&]*)/) { my $replace=$1; my $regexp=$replace; - $regexp=~s/\|/\\\|/g; + #$regexp=~s/\|/\\\|/g; $acchash{'acc.res.'.$short.'.'.$uripath} - =~s/$regexp/$replace\|$uricond/; + =~s/\Q$regexp\E/$replace\|$uricond/; } else { $acchash{'acc.res.'.$short.'.'.$uripath}.= $urifile.':'.$uricond.'&'; @@ -466,10 +463,7 @@ sub accinit { my $courseuri=$uri; $courseuri=~s/^\/res\///; &Apache::lonnet::delenv('(acc\.|httpref\.)'); - &Apache::lonnet::appenv(%acchash, - "request.course.id" => $short, - "request.course.fn" => $fn, - "request.course.uri" => $courseuri); + &Apache::lonnet::appenv(%acchash); } # ---------------- Selectively delete from randompick maps and hidden url parms @@ -570,6 +564,9 @@ sub readmap { $hash{'is_map_0.0'}=1; loadmap($uri); if (defined($hash{'map_start_'.$uri})) { + &Apache::lonnet::appenv("request.course.id" => $short, + "request.course.fn" => $fn, + "request.course.uri" => $uri); &traceroute('0',$hash{'map_start_'.$uri},'&'); &accinit($uri,$short,$fn); &hiddenurls();