--- rat/lonuserstate.pm 2002/07/30 20:01:40 1.36 +++ rat/lonuserstate.pm 2002/08/17 17:40:06 1.37 @@ -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.36 2002/07/30 20:01:40 albertel Exp $ +# $Id: lonuserstate.pm,v 1.37 2002/08/17 17:40:06 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -79,7 +79,10 @@ sub loadmap { $hash{'map_pc_'.$uri}=$lpc; $hash{'map_id_'.$lpc}=$uri; - my $fn='/home/httpd/html'.$uri; +# Determine and check filename + my $fn=&Apache::lonnet::filelocation('',$uri); + + my $ispage=($fn=~/\.page$/); unless (($fn=~/\.sequence$/) || ($fn=~/\.page$/)) { @@ -87,32 +90,12 @@ sub loadmap { return OK; } - my $ispage=($fn=~/\.page$/); + my $instr=&Apache::lonnet::getfile($fn); - unless (-e $fn) { - my $returned=Apache::lonnet::repcopy($fn); - unless ($returned eq OK) { - $errtext.="Could not import: $fn - "; - if ($returned eq HTTP_SERVICE_UNAVAILABLE) { - $errtext.="Server unavailable\n"; - } - if ($returned eq HTTP_NOT_FOUND) { - $errtext.="File not found\n"; - } - if ($returned eq FORBIDDEN) { - $errtext.="Access forbidden\n"; - } - return OK; - } - } + unless ($instr == -1) { + +# Successfully got file, parse it - if (-e $fn) { - my @content; - { - my $fh=Apache::File->new($fn); - @content=<$fh>; - } - my $instr=join('',@content); my $parser = HTML::TokeParser->new(\$instr); my $token;