--- rat/lonuserstate.pm 2007/08/28 01:09:14 1.121 +++ rat/lonuserstate.pm 2007/08/28 16:45:20 1.123 @@ -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.121 2007/08/28 01:09:14 albertel Exp $ +# $Id: lonuserstate.pm,v 1.123 2007/08/28 16:45:20 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -236,7 +236,9 @@ sub loadmap { my $rid=$lpc.'.'.$token->[2]->{'id'}; $hash{'kind_'.$rid}='cond'; - $cond[$#cond+1]=$token->[2]->{'value'}; + my $condition = $token->[2]->{'value'}; + $condition =~ s/[\n\r]+/ /gs; + push(@cond, $condition); $hash{'condid_'.$rid}=$#cond; if ($token->[2]->{'type'}) { $cond[$#cond].=':'.$token->[2]->{'type'}; @@ -336,6 +338,7 @@ sub parse_mapalias_param { return if (!exists($hash{'src_'.$referid})); if ($token->[2]->{'name'}=~/^parameter_(0_)*mapalias$/) { + &count_mapalias($token->[2]->{'value'},$referid); $hash{'mapalias_'.$token->[2]->{'value'}}=$referid; } } @@ -599,6 +602,7 @@ sub readmap { %parmhash=(); $errtext=''; $pc=0; + &clear_mapalias_count(); &processversionfile(%cenv); my $furi=&Apache::lonnet::clutter($uri); $hash{'src_0.0'}=&versiontrack($furi); @@ -615,6 +619,7 @@ sub readmap { &accinit($uri,$short,$fn); &hiddenurls(); } + $errtext .= &get_mapalias_errors(); # ------------------------------------------------------- Put versions into src foreach my $key (keys(%hash)) { if ($key=~/^src_/) { @@ -746,6 +751,43 @@ sub evalstate { return $state; } +{ + my %mapalias_cache; + sub count_mapalias { + my ($value,$resid) = @_; + push(@{ $mapalias_cache{$value} }, $resid); + } + + sub get_mapalias_errors { + my $error_text; + foreach my $mapalias (sort(keys(%mapalias_cache))) { + next if (scalar(@{ $mapalias_cache{$mapalias} } ) == 1); + my $count; + my $which = + join('