--- loncom/homework/lonhomework.pm 2001/08/17 15:51:00 1.54 +++ loncom/homework/lonhomework.pm 2001/08/29 10:18:10 1.59 @@ -1,7 +1,7 @@ # The LON-CAPA Homework handler # Guy Albertelli # 11/30 Gerd Kortemeyer -# 6/1,8/17 Gerd Kortemeyer +# 6/1,8/17,8/18 Gerd Kortemeyer package Apache::lonhomework; use strict; @@ -10,6 +10,7 @@ use Apache::lonxml; use Apache::lonnet; use Apache::inputtags; use Apache::structuretags; +use Apache::randomlabel; use Apache::response; use Apache::hint; use Apache::outputtags; @@ -132,7 +133,8 @@ sub check_access { if ($tries >= $maxtries) { $status = 'CANNOT_ANSWER'; } } - if (($status ne 'CLOSED') && (&Apache::lonhomework::type eq 'exam')) { + if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') && + (!$Apache::lonhomework::history{"resource.0.outtoken"})) { return ('UNCHECKEDOUT','needs to be checked out'); } @@ -224,11 +226,6 @@ sub renderpage { my $result = ''; &Apache::inputtags::initialize_inputtags; &Apache::edit::initialize_edit; - %Apache::lonhomework::results=(); - %Apache::lonhomework::history=&Apache::lonnet::restore(); - #ignore error conditions - my ($temp)=keys %Apache::lonhomework::history ; - if ($temp =~ m/^error:.*/) { %Apache::lonhomework::history=(); } if ($target eq 'web') { if (&Apache::lonnet::symbread() eq '') { if ($ENV{'request.state'} eq "construct") { @@ -261,14 +258,6 @@ sub renderpage { $request->print($result); } #$request->print(":Result ends"); - if ($target eq 'grade') { &showhash(%Apache::lonhomework::results); } - - #store new values - my ($temp) = keys %Apache::lonhomework::results; - if ( $temp ne '' ) { - &Apache::lonxml::debug("Store return message:". - &Apache::lonnet::cstore(\%Apache::lonhomework::results)); - } #my $td=&tv_interval($t0); } }