--- rat/lonuserstate.pm 2011/08/09 09:15:50 1.140 +++ rat/lonuserstate.pm 2012/11/11 22:26:49 1.144 @@ -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.140 2011/08/09 09:15:50 foxr Exp $ +# $Id: lonuserstate.pm,v 1.144 2012/11/11 22:26:49 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -297,7 +297,7 @@ sub loadmap { # processing the randomorder parameter if it is set, not # randompick. - @map_ids=&math::Random::random_permutation(@map_ids); + @map_ids=&Math::Random::random_permutation(@map_ids); } @@ -801,7 +801,7 @@ sub simplify { # 8&8=8 $expression=~s/([^_\.\d])([_\.\d]+)\&\2([^_\.\d])/$1$2$3/g; # 8|8=8 - $expression=~s/([^_\.\d])([_\.\d]+)\|\2([^_\.\d])/$1$2$3/g; + $expression=~s/([^_\.\d])([_\.\d]+)(?:\|\2)+([^_\.\d])/$1$2$3/g; # (5&3)&4=5&3&4 $expression=~s/\(([_\.\d]+)((?:\&[_\.\d]+)+)\)\&([_\.\d]+[^_\.\d])/$1$2\&$3/g; # (((5&3)|(4&6)))=((5&3)|(4&6)) @@ -1108,9 +1108,8 @@ sub readmap { # # Most likely a permissions problem on the lockfile or its directory. # - $errtext.='
'.&mt('Map not loaded - Lock file could not be opened when reading map:').' '.$fn.'.'; $retfurl = ''; - return ($retfurl,$errtext); + return ($retfurl,'
'.&mt('Map not loaded - Lock file could not be opened when reading map:').' '.$fn.'.'); } my $lock=0; my $gotstate=0; @@ -1126,6 +1125,7 @@ sub readmap { undef %hiddenurl; undef %encurl; $retfrid=''; + $errtext=''; my ($untiedhash,$untiedparmhash,$tiedhash,$tiedparmhash); # More state flags. # if we got the lock, regenerate course regnerate empty files and tie them. @@ -1220,7 +1220,9 @@ sub readmap { # &Apache::lonnet::appenv({"request.course.id" => $short, "request.course.fn" => $fn, - "request.course.uri" => $uri}); + "request.course.uri" => $uri, + "request.course.tied" => time}); + $untiedhash = untie(%hash); $untiedparmhash = untie(%parmhash); $gotstate = 1; @@ -1265,6 +1267,7 @@ sub readmap { undef %randompick; undef %hiddenurl; undef %encurl; + $errtext=''; $retfrid=''; # # Once more through the routine of tying and loading and so on. @@ -1376,7 +1379,8 @@ sub build_tmp_hashes { if (defined($hash{'map_start_'.$uri})) { &Apache::lonnet::appenv({"request.course.id" => $short, "request.course.fn" => $fn, - "request.course.uri" => $uri}); + "request.course.uri" => $uri, + "request.course.tied" => time}); $env{'request.course.id'}=$short; &traceroute('0',$hash{'map_start_'.$uri},'&'); &accinit($uri,$short,$fn);