version 1.112, 2004/12/23 22:53:41
|
version 1.117, 2005/04/01 18:08:14
|
Line 110 sub poprandomnumber {
|
Line 110 sub poprandomnumber {
|
&Apache::lonxml::error("Unable to restore random algorithm."); |
&Apache::lonxml::error("Unable to restore random algorithm."); |
} |
} |
} |
} |
|
|
sub setrandomnumber { |
sub setrandomnumber { |
my $rndseed; |
my $rndseed; |
$rndseed=&Apache::structuretags::setup_rndseed(); |
$rndseed=&Apache::structuretags::setup_rndseed(); |
Line 431 sub end_responseparam {
|
Line 432 sub end_responseparam {
|
} |
} |
|
|
sub start_parameter { |
sub start_parameter { |
my $result = &start_responseparam(@_); |
return &start_responseparam(@_); |
return $result; |
|
} |
} |
|
|
sub end_parameter { |
sub end_parameter { |
my $result = &end_responseparam(@_); |
return &end_responseparam(@_); |
return $result; |
|
} |
} |
|
|
sub reset_params { |
sub reset_params { |
Line 515 sub showallfoils {
|
Line 514 sub showallfoils {
|
if (defined($ENV{'form.showallfoils'})) { |
if (defined($ENV{'form.showallfoils'})) { |
my ($symb)=&Apache::lonxml::whichuser(); |
my ($symb)=&Apache::lonxml::whichuser(); |
if ($ENV{'request.state'} eq 'construct' || |
if ($ENV{'request.state'} eq 'construct' || |
($ENV{'user.adv'} && $symb eq '')) { |
$ENV{'user.adv'} ) { |
return 1; |
return 1; |
} |
} |
} |
} |
Line 715 sub get_response_param {
|
Line 714 sub get_response_param {
|
return $parameter; |
return $parameter; |
} |
} |
|
|
|
sub submitted { |
|
my ($who)=@_; |
|
|
|
# when scatron grading any submission is a submission |
|
if ($ENV{'form.submitted'} eq 'scantron') { return 1; } |
|
# if the caller only cared if this was a scantron submission |
|
if ($who eq 'scantron') { return 0; } |
|
# if the Submit Answer button for this particular part was pressed |
|
my $partid=$Apache::inputtags::part; |
|
if (defined($ENV{'form.submit_'.$partid})) { return 1; } |
|
# otherwise no submission occured |
|
return 0; |
|
} |
|
|
|
# basically undef and 0 (both false) mean that they still have work to do |
|
# and all true values mean that they can't do any more work |
|
# |
|
# a return of undef means it is unattempted |
|
# a return of 0 means it is attmpted and wrong but still has tries |
|
# a return of 1 means it is marked correct |
|
# a return of 2 means they have exceed maximum number of tries |
|
# a return of 3 means it after the answer date |
|
sub check_status { |
|
my ($id)=@_; |
|
if (!$id) { $id=$Apache::linputtags::part; } |
|
my $curtime=&Apache::lonnet::EXT('system.time'); |
|
my $opendate=&Apache::lonnet::EXT("resource.$id.opendate"); |
|
my $duedate=&Apache::lonnet::EXT("resource.$id.duedate"); |
|
my $answerdate=&Apache::lonnet::EXT("resource.$id.answerdate"); |
|
if ( $opendate && $curtime > $opendate && |
|
$duedate && $curtime > $duedate && |
|
$answerdate && $curtime > $answerdate) { |
|
return 3; |
|
} |
|
my $status=&Apache::lonnet::EXT("user.resource.resource.$id.solved"); |
|
if ($status =~ /^correct/) { return 1; } |
|
if (!$status) { return undef; } |
|
my $maxtries=&Apache::lonnet::EXT("resource.$id.maxtries"); |
|
if ($maxtries eq '') { $maxtries=2; } |
|
my $curtries=&Apache::lonnet::EXT("user.resource.resource.$id.tries"); |
|
if ($curtries < $maxtries) { return 0; } |
|
return 2; |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|