--- rat/lonuserstate.pm 2006/05/11 23:56:27 1.107.2.1 +++ rat/lonuserstate.pm 2006/04/27 23:36:10 1.108 @@ -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.107.2.1 2006/05/11 23:56:27 albertel Exp $ +# $Id: lonuserstate.pm,v 1.108 2006/04/27 23:36:10 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -413,18 +413,16 @@ sub accinit { foreach my $key (keys(%hash)) { if ($key=~/^conditions/) { my $expr=$hash{$key}; - # try to find and factor out common sub-expressions foreach my $sub ($expr=~m/(\(\([_\.\d]+(?:\&[_\.\d]+)+\)(?:\|\([_\.\d]+(?:\&[_\.\d]+)+\))+\))/g) { my $orig=$sub; - - my ($factor) = ($sub=~/\(\(([_\.\d]+\&(:?[_\.\d]+\&)*)(?:[_\.\d]+\&*)+\)(?:\|\(\1(?:[_\.\d]+\&*)+\))+\)/); - next if (!defined($factor)); - - $sub=~s/\Q$factor\E//g; + $sub=~/\(\(([_\.\d]+\&(:?[_\.\d]+\&)*)(?:[_\.\d]+\&*)+\)(?:\|\(\1(?:[_\.\d]+\&*)+\))+\)/; + my $factor=$1; + $sub=~s/$factor//g; $sub=~s/^\(/\($factor\(/; $sub.=')'; $sub=simplify($sub); - $expr=~s/\Q$orig\E/$sub/; + $orig=~s/(\W)/\\$1/g; + $expr=~s/$orig/$sub/; } $hash{$key}=$expr; unless (defined($captured{$expr})) { @@ -545,7 +543,7 @@ sub hiddenurls { sub readmap { my $short=shift; $short=~s/^\///; - my %cenv=&Apache::lonnet::coursedescription($short); + my %cenv=&Apache::lonnet::coursedescription($short,{'freshen_cache'=>1}); my $fn=$cenv{'fn'}; my $uri; $short=~s/\//\_/g; @@ -592,14 +590,8 @@ sub readmap { } # ------------------------------------------------------- Put versions into src foreach my $key (keys(%hash)) { - if ($key=~/^src_/) { + if ($key=~/^src\_/) { $hash{$key}=&putinversion($hash{$key}); - } elsif ($key =~ /^(map_(?:start|finish|pc)_)(.*)/) { - &Apache::lonnet::logthis($key); - my ($type, $url) = ($1,$2); - my $value = $hash{$key}; - delete($hash{$key}); - $hash{$type.&putinversion($url)}=$value; } } # ---------------------------------------------------------------- Encrypt URLs