--- rat/lonuserstate.pm 2000/10/20 14:43:53 1.12 +++ rat/lonuserstate.pm 2000/10/30 15:12:49 1.13 @@ -11,7 +11,7 @@ # 7/1,7/3,7/4,7/7,7/8,7/10 Gerd Kortemeyer) # # 7/15,7/17,7/18,8/1,8/2,8/4,8/5,8/21,8/22,8/23,8/30, -# 9/2,9/4,9/29,9/30,10/2,10/11 Gerd Kortemeyer +# 9/2,9/4,9/29,9/30,10/2,10/11,10/30 Gerd Kortemeyer package Apache::lonuserstate; @@ -250,7 +250,7 @@ sub accinit { map { my $sub=$_; my $orig=$_; - $sub=~/\(\((\d+\&(:?\d+\&)*)(?:\d+\&*)+\)(?:\|\(\1(?:\d+\&*)+\))+\)/; + $sub=~/\(\((\d+\&(:?\d+\&)*)(?:\d+\&*)+\)(?:\|\(\1(?:\d+\&*)+\))+\)/; my $factor=$1; $sub=~s/$factor//g; $sub=~s/^\(/\($factor\(/; @@ -269,24 +269,34 @@ sub accinit { } keys %hash; map { if ($_=~/^ids/) { - my $resid=$hash{$_}; + map { + my $resid=$_; my $uri=$hash{'src_'.$resid}; my @uriparts=split(/\//,$uri); my $urifile=$uriparts[$#uriparts]; $#uriparts--; my $uripath=join('/',@uriparts); $uripath=~s/^\/res\///; + my $uricond='0'; if (defined($hash{'conditions_'.$resid})) { - $urifile.=':'.$captured{$hash{'conditions_'.$resid}}; - } else { - $urifile.=':0'; + $uricond=$captured{$hash{'conditions_'.$resid}}; } if (defined($acchash{'acc.res.'.$short.'.'.$uripath})) { - $acchash{'acc.res.'.$short.'.'.$uripath}.=$urifile.'&'; + if ($acchash{'acc.res.'.$short.'.'.$uripath}=~ + /(\&$urifile\:[^\&]*)/) { + my $replace=$1; + $acchash{'acc.res.'.$short.'.'.$uripath} + =~s/$replace/$replace\|$uricond/; + } else { + $acchash{'acc.res.'.$short.'.'.$uripath}.= + $urifile.':'.$uricond.'&'; + } } else { - $acchash{'acc.res.'.$short.'.'.$uripath}='&'.$urifile.'&'; - } - } + $acchash{'acc.res.'.$short.'.'.$uripath}= + '&'.$urifile.':'.$uricond.'&'; + } + } split(/\,/,$hash{$_}); + } } keys %hash; my $courseuri=$uri; $courseuri=~s/^\/res\///;