--- rat/lonuserstate.pm 2004/04/23 19:39:25 1.75 +++ rat/lonuserstate.pm 2004/05/11 06:28:23 1.78 @@ -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.75 2004/04/23 19:39:25 www Exp $ +# $Id: lonuserstate.pm,v 1.78 2004/05/11 06:28:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -160,12 +160,11 @@ sub loadmap { if ($token->[2]->{'external'} eq 'true') { # external $turi=~s/^http\:\/\//\/adm\/wrapper\/ext\//; } elsif ($turi=~/^\/*uploaded\//) { # uploaded - if (($embstyle eq 'img') || ($embstyle eq 'emb') - || ($embstyle eq 'ssi')) { - unless ($turi =~/\.page$/) { - $turi='/adm/wrapper'.$turi; - } - } elsif ($turi!~/\.(sequence|page)$/) { + if (($embstyle eq 'img') || ($embstyle eq 'emb')) { + $turi='/adm/wrapper'.$turi; + } 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 @@ -332,10 +331,16 @@ sub simplify { # -------------------------------------------------------- Build condition hash sub traceroute { - my ($sofar,$rid,$beenhere)=@_; + my ($sofar,$rid,$beenhere,$encflag,$hdnflag)=@_; $sofar=simplify($sofar); unless ($beenhere=~/\&$rid\&/) { $beenhere.=$rid.'&'; + if ($hdnflag) { + $hiddenurl{$rid}=1; + } + if ($encflag) { + $encurl{$rid}=1; + } if (($retfurl eq '') && ($hash{'src_'.$rid}) && ($hash{'src_'.$rid}!~/\.sequence$/)) { my ($mapid,$resid)=split(/\./,$rid); @@ -354,7 +359,9 @@ sub traceroute { } if (defined($hash{'is_map_'.$rid})) { if (defined($hash{'map_start_'.$hash{'src_'.$rid}})) { - &traceroute($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},'&'); + &traceroute($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},'&', + $encflag || $encurl{$rid}, + $hdnflag || $hiddenurl{$rid}); if (defined($hash{'map_finish_'.$hash{'src_'.$rid}})) { $sofar= $hash{'conditions_'.$hash{'map_finish_'.$hash{'src_'.$rid}}}; @@ -373,7 +380,7 @@ sub traceroute { .$hash{'undercond_'.$_}.'. '; } } - &traceroute($further,$hash{'goesto_'.$_},$beenhere); + &traceroute($further,$hash{'goesto_'.$_},$beenhere,$encflag,$hdnflag); } } } @@ -442,9 +449,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.'&';