--- loncom/lonnet/perl/lonnet.pm 2000/10/07 10:09:53 1.39 +++ loncom/lonnet/perl/lonnet.pm 2000/10/09 20:26:17 1.40 @@ -36,6 +36,8 @@ # coursedescription(id) : returns and caches course description for id # repcopy(filename) : replicate file # dirlist(url) : gets a directory listing +# directcondval(index) : reading condition value of single condition from +# state string # condval(index) : value of condition index based on state # varval(name) : value of a variable # refreshstate() : refresh the state information string @@ -60,7 +62,7 @@ # 08/22,08/28,08/31,09/01,09/02,09/04,09/05,09/25,09/28,09/30 Gerd Kortemeyer # 10/04 Gerd Kortemeyer # 10/04 Guy Albertelli -# 10/06 Gerd Kortemeyer +# 10/06,10/09 Gerd Kortemeyer package Apache::lonnet; @@ -940,6 +942,15 @@ sub dirlist { # -------------------------------------------------------- Value of a Condition +sub directcondval { + my $number=shift; + if ($ENV{'user.state.'.$ENV{'request.course.id'}}) { + return substr($ENV{'user.state.'.$ENV{'request.course.id'}},$number,1); + } else { + return 2; + } +} + sub condval { my $condidx=shift; my $result=0; @@ -960,8 +971,7 @@ sub condval { } elsif (($_ eq '&') || ($_ eq '|')) { $operand=$_; } else { - my $new= - substr($ENV{'user.state.'.$ENV{'request.course.id'}},$_,1); + my $new=directcondval($_); if ($operand eq '&') { $result=$result>$new?$new:$result; } else {