--- rat/lonuserstate.pm 2003/10/23 21:01:54 1.63 +++ rat/lonuserstate.pm 2004/04/05 18:25:08 1.72 @@ -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.63 2003/10/23 21:01:54 albertel Exp $ +# $Id: lonuserstate.pm,v 1.72 2004/04/05 18:25:08 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -25,22 +25,6 @@ # # http://www.lon-capa.org/ # -# (Server for RAT Maps -# -# (Edit Handler for RAT Maps -# (TeX Content Handler -# -# YEAR=2000 -# 05/29/00,05/30 Gerd Kortemeyer) -# 7/1 Gerd Kortemeyer) -# 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,10/30,10/31, -# 11/1,11/2,11/14,11/16,11/22,12/28, -# YEAR=2001 -# 07/05/01,08/30,08/31 Gerd Kortemeyer -# ### package Apache::lonuserstate; @@ -89,7 +73,10 @@ sub putinversion { my $uri=shift; if ($hash{'version_'.$uri}) { my $version=$hash{'version_'.$uri}; - if ($version eq 'current') { return $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; @@ -98,7 +85,7 @@ sub putinversion { # ----------------------------------------- Processing versions file for course sub processversionfile { - my %cenv=shift; + my %cenv=@_; my %versions=&Apache::lonnet::dump('resourceversions', $cenv{'domain'}, $cenv{'num'}); @@ -172,21 +159,28 @@ sub loadmap { } elsif ($turi=~/^\/*uploaded\//) { # uploaded if (($embstyle eq 'img') || ($embstyle eq 'emb') || ($embstyle eq 'ssi')) { - $turi='/adm/wrapper'.$turi; + unless ($turi =~/\.page$/) { + $turi='/adm/wrapper'.$turi; + } } 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