version 1.14, 2000/10/31 19:31:42
|
version 1.17, 2000/11/02 17:46:43
|
Line 11
|
Line 11
|
# 7/1,7/3,7/4,7/7,7/8,7/10 Gerd Kortemeyer) |
# 7/1,7/3,7/4,7/7,7/8,7/10 Gerd Kortemeyer) |
# |
# |
# 7/15,7/17,7/18,8/1,8/2,8/4,8/5,8/21,8/22,8/23,8/30, |
# 7/15,7/17,7/18,8/1,8/2,8/4,8/5,8/21,8/22,8/23,8/30, |
# 9/2,9/4,9/29,9/30,10/2,10/11,10/30,10/31 Gerd Kortemeyer |
# 9/2,9/4,9/29,9/30,10/2,10/11,10/30,10/31,11/1,11/2 Gerd Kortemeyer |
|
|
package Apache::lonuserstate; |
package Apache::lonuserstate; |
|
|
Line 22 use HTML::TokeParser;
|
Line 22 use HTML::TokeParser;
|
use Apache::lonnet(); |
use Apache::lonnet(); |
use GDBM_File; |
use GDBM_File; |
use Apache::lonmsg; |
use Apache::lonmsg; |
|
use Safe; |
|
use Opcode; |
|
|
# ---------------------------------------------------- Globals for this package |
# ---------------------------------------------------- Globals for this package |
|
|
Line 354 sub readmap {
|
Line 356 sub readmap {
|
&Apache::lonmsg::author_res_msg($ENV{'request.course.uri'},$errtext); |
&Apache::lonmsg::author_res_msg($ENV{'request.course.uri'},$errtext); |
return $errtext; |
return $errtext; |
} |
} |
|
|
|
# ------------------------------------------------------- Evaluate state string |
|
|
|
sub evalstate { |
|
my $safeeval = new Safe; |
|
my $fn=$ENV{'request.course.fn'}.'.state'; |
|
my $state='2'; |
|
if (-e $fn) { |
|
my @conditions=(); |
|
{ |
|
my $fh=Apache::File->new($fn); |
|
@conditions=<$fh>; |
|
} |
|
$safeeval->permit("entereval"); |
|
$safeeval->permit(":base_math"); |
|
$safeeval->deny(":base_io"); |
|
$safeeval->share_from('Apache::lonnet',['&EXT']); |
|
map { |
|
my $line=$_; |
|
chomp($line); |
|
my ($condition,$weight)=split(/\:/,$_); |
|
if ($safeeval->reval($condition)) { |
|
if ($weight eq 'force') { |
|
$state.='3'; |
|
} else { |
|
$state.='2'; |
|
} |
|
} else { |
|
if ($weight eq 'stop') { |
|
$state.='0'; |
|
} else { |
|
$state.='1'; |
|
} |
|
} |
|
} @conditions; |
|
} |
|
&Apache::lonnet::appenv('user.state.'.$ENV{'request.course.id'} => $state); |
|
return $state; |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|