--- rat/lonuserstate.pm 2003/10/29 21:50:41 1.65 +++ rat/lonuserstate.pm 2004/02/02 00:46:51 1.71 @@ -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.65 2003/10/29 21:50:41 www Exp $ +# $Id: lonuserstate.pm,v 1.71 2004/02/02 00:46:51 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -74,6 +74,9 @@ sub putinversion { if ($hash{'version_'.$uri}) { my $version=$hash{'version_'.$uri}; if ($version eq 'mostrecent') { return $uri; } + if ($version eq &Apache::lonnet::getversion( + &Apache::lonnet::filelocation('',$uri))) + { return $uri; } $uri=~s/\.(\w+)$/\.$version\.$1/; } return $uri; @@ -160,17 +163,22 @@ sub loadmap { } elsif ($turi!~/\.(sequence|page)$/) { $turi='/adm/coursedocs/showdoc'.$turi; } - } else { # normal internal resource - if (($embstyle eq 'img') || ($embstyle eq 'emb')) { - $turi='/adm/wrapper'.$turi; - } + } elsif ($turi=~/\S/) { # normal non-empty internal resource + my $mapdir=$uri; + $mapdir=~s/[^\/]+$//; + $turi=&Apache::lonnet::hreflocation($mapdir,$turi); + if (($embstyle eq 'img') || ($embstyle eq 'emb')) { + $turi='/adm/wrapper'.$turi; + } } } - - if (defined($hash{'ids_'.$turi})) { - $hash{'ids_'.$turi}.=','.$rid; +# Store reverse lookup, remove query string + my $idsuri=$turi; + $idsuri=~s/\?.+$//; + if (defined($hash{'ids_'.$idsuri})) { + $hash{'ids_'.$idsuri}.=','.$rid; } else { - $hash{'ids_'.$turi}=''.$rid; + $hash{'ids_'.$idsuri}=''.$rid; } if