--- rat/lonuserstate.pm 2005/11/15 18:27:52 1.98 +++ rat/lonuserstate.pm 2006/02/22 22:36:34 1.102 @@ -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.98 2005/11/15 18:27:52 albertel Exp $ +# $Id: lonuserstate.pm,v 1.102 2006/02/22 22:36:34 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -166,8 +166,7 @@ sub loadmap { } elsif ($turi=~/^\/*uploaded\//) { # uploaded if (($embstyle eq 'img') || ($embstyle eq 'emb') - || ($embstyle eq 'ign') - || ($embstyle eq 'unk')) { + || ($embstyle eq 'wrp')) { $turi='/adm/wrapper'.$turi; } elsif ($embstyle eq 'ssi') { #do nothing with these @@ -178,7 +177,9 @@ sub loadmap { my $mapdir=$uri; $mapdir=~s/[^\/]+$//; $turi=&Apache::lonnet::hreflocation($mapdir,$turi); - if (($embstyle eq 'img') || ($embstyle eq 'emb')) { + if (($embstyle eq 'img') + || ($embstyle eq 'emb') + || ($embstyle eq 'wrp')) { $turi='/adm/wrapper'.$turi; } } @@ -317,6 +318,8 @@ sub loadmap { sub simplify { my $expression=shift; +# (0&1) = 1 + $expression=~s/\(0\&(\d+)\)/$1/g; # (8)=8 $expression=~s/\((\d+)\)/$1/g; # 8&8=8 @@ -326,8 +329,8 @@ sub simplify { # (5&3)&4=5&3&4 $expression=~s/\((\d+)((?:\&\d+)+)\)\&(\d+\D)/$1$2\&$3/g; # (((5&3)|(4&6)))=((5&3)|(4&6)) - $expression=~ - s/\((\(\(\d+(?:\&\d+)*\)(?:\|\(\d+(?:\&\d+)*\))+\))\)/$1/g; +# $expression=~ +# s/\((\(\(\d+(?:\&\d+)*\)(?:\|\(\d+(?:\&\d+)*\))+\))\)/$1/g; # ((5&3)|(4&6))|(1&2)=(5&3)|(4&6)|(1&2) $expression=~ s/\((\(\d+(?:\&\d+)*\))((?:\|\(\d+(?:\&\d+)*\))+)\)\|(\(\d+(?:\&\d+)*\))/\($1$2\|$3\)/g; @@ -361,11 +364,11 @@ sub traceroute { } if (defined($hash{'conditions_'.$rid})) { $hash{'conditions_'.$rid}=simplify( - '('.$hash{'conditions_'.$rid}.')|('.$sofar.')'); + '('.'conditions_'.$rid.')|('.$sofar.')'); } else { $hash{'conditions_'.$rid}=$sofar; } - $newsofar=$hash{'conditions_'.$rid}; + $newsofar='conditions_'.$rid; if (defined($hash{'is_map_'.$rid})) { if (defined($hash{'map_start_'.$hash{'src_'.$rid}})) { $sofar=$newsofar= @@ -442,12 +445,8 @@ sub accinit { foreach (split(/\,/,$hash{$_})) { my $resid=$_; my $uri=$hash{'src_'.$resid}; - $uri=~s/^\/adm\/wrapper//; - $uri=&Apache::lonnet::declutter($uri); - my @uriparts=split(/\//,$uri); - my $urifile=$uriparts[$#uriparts]; - $#uriparts--; - my $uripath=join('/',@uriparts); + my ($uripath,$urifile) = + &Apache::lonnet::split_uri_for_cond($uri); if ($uripath) { my $uricond='0'; if (defined($hash{'conditions_'.$resid})) {