--- loncom/lonmap.pm 2011/10/06 10:56:49 1.3 +++ loncom/lonmap.pm 2011/10/21 10:10:07 1.5 @@ -2,7 +2,7 @@ # # Read maps into a 'big hash'. # -# $Id: lonmap.pm,v 1.3 2011/10/06 10:56:49 foxr Exp $ +# $Id: lonmap.pm,v 1.5 2011/10/21 10:10:07 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -95,10 +95,7 @@ my %cenv; # Course environment. sub simplify { my $expression=shift; - my $prior = ''; # This is safe as a null expression is pretty optimal. - - while ($prior ne $expression) { - $prior = $expression; # Stop when the substitutions below do nothing. + # (0&1) = 1 $expression=~s/\(0\&([_\.\d]+)\)/$1/g; # (8)=8 @@ -115,7 +112,8 @@ sub simplify { # ((5&3)|(4&6))|(1&2)=(5&3)|(4&6)|(1&2) $expression=~ s/\((\([_\.\d]+(?:\&[_\.\d]+)*\))((?:\|\([_\.\d]+(?:\&[_\.\d]+)*\))+)\)\|(\([_\.\d]+(?:\&[_\.\d]+)*\))/\($1$2\|$3\)/g; - } + + return $expression; } @@ -405,7 +403,6 @@ sub hiddenurls { my (undef,$id)=split(/\./,$rid); if ($randompickseed{$rid}) { $id=$randompickseed{$rid}; } my $rndseed=&Apache::lonnet::rndseed($id, $courseid, $udom, $uname, \%cenv); # use id instead of symb - &Apache::lonnet::logthis("lonmap random seed: $rndseed"); &Apache::lonnet::setup_random_from_rndseed($rndseed); my @whichids=&Math::Random::random_permuted_index($#currentrids+1); for (my $i=1;$i<=$rndpick;$i++) { $currentrids[$whichids[$i]]=''; } @@ -1387,7 +1384,7 @@ sub loadmap { %encurl = (); %hiddenurl = (); %parmhash = (); - @cond = (); + @cond = ('true:normal'); # Initial value for cond 0. $retfrid = ''; $username = ''; $userdomain = ''; @@ -1417,7 +1414,6 @@ sub loadmap { &Apache::lonnet::logthis("lonmap::loadmap failed: $cnum/$cdom - did not get url"); return; } - &Apache::lonnet::logthis("Course environment: \n" . Dumper(\%cenv)); $course_id = $cdom . '_' . $cnum; # Long course id.