version 1.140, 2011/08/09 09:15:50
|
version 1.145, 2013/05/06 18:08:39
|
Line 297 sub loadmap {
|
Line 297 sub loadmap {
|
# processing the randomorder parameter if it is set, not |
# processing the randomorder parameter if it is set, not |
# randompick. |
# randompick. |
|
|
@map_ids=&math::Random::random_permutation(@map_ids); |
@map_ids=&Math::Random::random_permutation(@map_ids); |
} |
} |
|
|
|
|
Line 801 sub simplify {
|
Line 801 sub simplify {
|
# 8&8=8 |
# 8&8=8 |
$expression=~s/([^_\.\d])([_\.\d]+)\&\2([^_\.\d])/$1$2$3/g; |
$expression=~s/([^_\.\d])([_\.\d]+)\&\2([^_\.\d])/$1$2$3/g; |
# 8|8=8 |
# 8|8=8 |
$expression=~s/([^_\.\d])([_\.\d]+)\|\2([^_\.\d])/$1$2$3/g; |
$expression=~s/([^_\.\d])([_\.\d]+)(?:\|\2)+([^_\.\d])/$1$2$3/g; |
# (5&3)&4=5&3&4 |
# (5&3)&4=5&3&4 |
$expression=~s/\(([_\.\d]+)((?:\&[_\.\d]+)+)\)\&([_\.\d]+[^_\.\d])/$1$2\&$3/g; |
$expression=~s/\(([_\.\d]+)((?:\&[_\.\d]+)+)\)\&([_\.\d]+[^_\.\d])/$1$2\&$3/g; |
# (((5&3)|(4&6)))=((5&3)|(4&6)) |
# (((5&3)|(4&6)))=((5&3)|(4&6)) |
Line 1108 sub readmap {
|
Line 1108 sub readmap {
|
# |
# |
# Most likely a permissions problem on the lockfile or its directory. |
# Most likely a permissions problem on the lockfile or its directory. |
# |
# |
$errtext.='<br />'.&mt('Map not loaded - Lock file could not be opened when reading map:').' <tt>'.$fn.'</tt>.'; |
|
$retfurl = ''; |
$retfurl = ''; |
return ($retfurl,$errtext); |
return ($retfurl,'<br />'.&mt('Map not loaded - Lock file could not be opened when reading map:').' <tt>'.$fn.'</tt>.'); |
} |
} |
my $lock=0; |
my $lock=0; |
my $gotstate=0; |
my $gotstate=0; |
Line 1126 sub readmap {
|
Line 1125 sub readmap {
|
undef %hiddenurl; |
undef %hiddenurl; |
undef %encurl; |
undef %encurl; |
$retfrid=''; |
$retfrid=''; |
|
$errtext=''; |
my ($untiedhash,$untiedparmhash,$tiedhash,$tiedparmhash); # More state flags. |
my ($untiedhash,$untiedparmhash,$tiedhash,$tiedparmhash); # More state flags. |
|
|
# if we got the lock, regenerate course regnerate empty files and tie them. |
# if we got the lock, regenerate course regnerate empty files and tie them. |
Line 1220 sub readmap {
|
Line 1220 sub readmap {
|
# |
# |
&Apache::lonnet::appenv({"request.course.id" => $short, |
&Apache::lonnet::appenv({"request.course.id" => $short, |
"request.course.fn" => $fn, |
"request.course.fn" => $fn, |
"request.course.uri" => $uri}); |
"request.course.uri" => $uri, |
|
"request.course.tied" => time}); |
|
|
$untiedhash = untie(%hash); |
$untiedhash = untie(%hash); |
$untiedparmhash = untie(%parmhash); |
$untiedparmhash = untie(%parmhash); |
$gotstate = 1; |
$gotstate = 1; |
Line 1265 sub readmap {
|
Line 1267 sub readmap {
|
undef %randompick; |
undef %randompick; |
undef %hiddenurl; |
undef %hiddenurl; |
undef %encurl; |
undef %encurl; |
|
$errtext=''; |
$retfrid=''; |
$retfrid=''; |
# |
# |
# Once more through the routine of tying and loading and so on. |
# Once more through the routine of tying and loading and so on. |
Line 1376 sub build_tmp_hashes {
|
Line 1379 sub build_tmp_hashes {
|
if (defined($hash{'map_start_'.$uri})) { |
if (defined($hash{'map_start_'.$uri})) { |
&Apache::lonnet::appenv({"request.course.id" => $short, |
&Apache::lonnet::appenv({"request.course.id" => $short, |
"request.course.fn" => $fn, |
"request.course.fn" => $fn, |
"request.course.uri" => $uri}); |
"request.course.uri" => $uri, |
|
"request.course.tied" => time}); |
$env{'request.course.id'}=$short; |
$env{'request.course.id'}=$short; |
&traceroute('0',$hash{'map_start_'.$uri},'&'); |
&traceroute('0',$hash{'map_start_'.$uri},'&'); |
&accinit($uri,$short,$fn); |
&accinit($uri,$short,$fn); |
Line 1427 sub unlink_tmpfiles {
|
Line 1431 sub unlink_tmpfiles {
|
my ($fn) = @_; |
my ($fn) = @_; |
my $file_dir = dirname($fn); |
my $file_dir = dirname($fn); |
|
|
if ($fn eq LONCAPA::tempdir()) { |
if ("$file_dir/" eq LONCAPA::tempdir()) { |
my @files = qw (.db _symb.db .state _parms.db); |
my @files = qw (.db _symb.db .state _parms.db); |
foreach my $file (@files) { |
foreach my $file (@files) { |
if (-e $fn.$file) { |
if (-e $fn.$file) { |