[LON-CAPA-cvs] cvs: rat / lonuserstate.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 26 Oct 2004 23:00:14 -0000
albertel Tue Oct 26 19:00:14 2004 EDT
Modified files:
/rat lonuserstate.pm
Log:
- conditions weren't properly cascading along,
- code asumed a empty finish state, and thus could grab the condition that
was needed to get into the finish state as the starting point for the condition
for the resource after a nested map, need to instead pass the end condition up
the recursion chain
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.80 rat/lonuserstate.pm:1.81
--- rat/lonuserstate.pm:1.80 Tue Oct 26 11:15:20 2004
+++ rat/lonuserstate.pm Tue Oct 26 19:00:11 2004
@@ -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.80 2004/10/26 15:15:20 albertel Exp $
+# $Id: lonuserstate.pm,v 1.81 2004/10/26 23:00:11 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -332,13 +332,13 @@
sub traceroute {
my ($sofar,$rid,$beenhere,$encflag,$hdnflag)=@_;
- $sofar=simplify($sofar);
+ my $newsofar=$sofar=simplify($sofar);
unless ($beenhere=~/\&$rid\&/) {
$beenhere.=$rid.'&';
my ($mapid,$resid)=split(/\./,$rid);
my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},$resid,$hash{'src_'.$rid});
- my $encrypt=&Apache::lonnet::EXT('resource.0.hiddenresource',$symb);
- if ($hdnflag || lc($encrypt) eq 'yes') { $hiddenurl{$rid}=1; }
+ my $hidden=&Apache::lonnet::EXT('resource.0.hiddenresource',$symb);
+ if ($hdnflag || lc($hidden) eq 'yes') { $hiddenurl{$rid}=1; }
my $encrypt=&Apache::lonnet::EXT('resource.0.encrypturl',$symb);
if ($encflag || lc($encrypt) eq 'yes') { $encurl{$rid}=1; }
if (($retfurl eq '') && ($hash{'src_'.$rid})
@@ -352,15 +352,14 @@
} else {
$hash{'conditions_'.$rid}=$sofar;
}
+ $newsofar=$hash{'conditions_'.$rid};
if (defined($hash{'is_map_'.$rid})) {
if (defined($hash{'map_start_'.$hash{'src_'.$rid}})) {
- &traceroute($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},'&',
- $encflag || $encurl{$rid},
- $hdnflag || $hiddenurl{$rid});
- if (defined($hash{'map_finish_'.$hash{'src_'.$rid}})) {
- $sofar=
- $hash{'conditions_'.$hash{'map_finish_'.$hash{'src_'.$rid}}};
- }
+ $sofar=$newsofar=
+ &traceroute($sofar,
+ $hash{'map_start_'.$hash{'src_'.$rid}},'&',
+ $encflag || $encurl{$rid},
+ $hdnflag || $hiddenurl{$rid});
}
}
if (defined($hash{'to_'.$rid})) {
@@ -375,10 +374,12 @@
.$hash{'undercond_'.$_}.'. ';
}
}
- &traceroute($further,$hash{'goesto_'.$_},$beenhere,$encflag,$hdnflag);
+ $newsofar=&traceroute($further,$hash{'goesto_'.$_},$beenhere,
+ $encflag,$hdnflag);
}
}
}
+ return $newsofar;
}
# ------------------------------ Cascading conditions, quick access, parameters