--- rat/lonuserstate.pm 2006/05/11 23:54:06 1.110
+++ rat/lonuserstate.pm 2006/05/30 17:15:10 1.114
@@ -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.110 2006/05/11 23:54:06 albertel Exp $
+# $Id: lonuserstate.pm,v 1.114 2006/05/30 17:15:10 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,6 +33,7 @@ package Apache::lonuserstate;
use strict;
use HTML::TokeParser;
use Apache::lonnet;
+use Apache::lonlocal;
use Apache::loncommon();
use GDBM_File;
use Apache::lonmsg;
@@ -41,6 +42,9 @@ use Safe::Hole;
use Opcode;
use Apache::lonenc;
use Fcntl qw(:flock);
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
+
# ---------------------------------------------------- Globals for this package
@@ -103,8 +107,10 @@ sub processversionfile {
sub loadmap {
my $uri=shift;
- if ($hash{'map_pc_'.$uri}) { return; }
-
+ if ($hash{'map_pc_'.$uri}) {
+ $errtext.=&mt('
Multiple use of sequence/page [_1]! The course will not function properly.',$uri);
+ return;
+ }
$pc++;
my $lpc=$pc;
$hash{'map_pc_'.$uri}=$lpc;
@@ -117,7 +123,7 @@ sub loadmap {
unless (($fn=~/\.sequence$/) ||
($fn=~/\.page$/)) {
- $errtext.="Invalid map: $fn\n";
+ $errtext.=&mt("
Invalid map: [_1]",$fn);
return;
}
@@ -277,9 +283,9 @@ sub loadmap {
}
$name=~s/^.*_([^_]*)$/$1/;
my $newparam=
- &Apache::lonnet::escape($token->[2]->{'type'}).':'.
- &Apache::lonnet::escape($part.'.'.$name).'='.
- &Apache::lonnet::escape($token->[2]->{'value'});
+ &escape($token->[2]->{'type'}).':'.
+ &escape($part.'.'.$name).'='.
+ &escape($token->[2]->{'value'});
if (defined($hash{'param_'.$referid})) {
$hash{'param_'.$referid}.='&'.$newparam;
} else {
@@ -310,7 +316,7 @@ sub loadmap {
}
} else {
- $errtext.='Map not loaded: The file ('.$fn.') does not exist. ';
+ $errtext.=&mt('
Map not loaded: The file [_1] does not exist.',$fn);
}
}
@@ -390,8 +396,7 @@ sub traceroute {
$further=simplify('('.'_'.$rid.')&('.
$hash{'condid_'.$hash{'undercond_'.$id}}.')');
} else {
- $errtext.='Undefined condition ID: '
- .$hash{'undercond_'.$id}.'. ';
+ $errtext.=&mt('
Undefined condition ID: [_1]',$hash{'undercond_'.$id});
}
}
$newsofar=&traceroute($further,$hash{'goesto_'.$id},$beenhere,
@@ -438,10 +443,10 @@ sub accinit {
foreach my $param (split(/\&/,$hash{$key})) {
my ($typename,$value)=split(/\=/,$param);
my ($type,$name)=split(/\:/,$typename);
- $parmhash{$prefix.'.'.&Apache::lonnet::unescape($name)}=
- &Apache::lonnet::unescape($value);
- $parmhash{$prefix.'.'.&Apache::lonnet::unescape($name).'.type'}=
- &Apache::lonnet::unescape($type);
+ $parmhash{$prefix.'.'.&unescape($name)}=
+ &unescape($value);
+ $parmhash{$prefix.'.'.&unescape($name).'.type'}=
+ &unescape($type);
}
}
}
@@ -552,7 +557,7 @@ sub readmap {
unless ($uri=$cenv{'url'}) {
&Apache::lonnet::logthis("WARNING: ".
"Could not load course $short.");
- return 'No course data available.';
+ return ('',&mt('No course data available.'));;
}
@cond=('true:normal');
@@ -595,10 +600,8 @@ sub readmap {
if ($key=~/^src_/) {
$hash{$key}=&putinversion($hash{$key});
} elsif ($key =~ /^(map_(?:start|finish|pc)_)(.*)/) {
- &Apache::lonnet::logthis($key);
my ($type, $url) = ($1,$2);
my $value = $hash{$key};
- delete($hash{$key});
$hash{$type.&putinversion($url)}=$value;
}
}
@@ -683,7 +686,7 @@ sub evalstate {
if (-e $fn) {
my @conditions=();
{
- my $fh=Apache::File->new($fn);
+ open(my $fh,$fn);
@conditions=<$fh>;
}
my $safeeval = new Safe;