--- loncom/homework/lonhomework.pm 2004/02/13 21:21:30 1.163 +++ loncom/homework/lonhomework.pm 2004/03/02 20:59:25 1.170 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.163 2004/02/13 21:21:30 albertel Exp $ +# $Id: lonhomework.pm,v 1.170 2004/03/02 20:59:25 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -47,6 +47,7 @@ use Apache::externalresponse(); use Apache::rankresponse(); use Apache::matchresponse(); use Apache::chemresponse(); +use Apache::drawimage(); use Apache::Constants qw(:common); use HTML::Entities(); use Apache::loncommon(); @@ -201,6 +202,18 @@ sub check_access { my $passed; if ($ENV{'request.state'} eq "construct") { + if ($ENV{'form.problemstate'}) { + if ($ENV{'form.problemstate'} =~ /^CANNOT_ANSWER/) { + if ( ! ($ENV{'form.problemstate'} eq 'CANNOT_ANSWER_correct' && + lc($Apache::lonhomework::problemstatus) eq 'no')) { + return ('CANNOT_ANSWER', + &mt('is in this state by royal decree.')); + } + } else { + return ($ENV{'form.problemstate'}, + &mt('is in this state by royal decree.')); + } + } &Apache::lonxml::debug("in construction ignoring dates"); $status='CAN_ANSWER'; $datemsg=&mt('is in under construction'); @@ -267,8 +280,9 @@ sub check_access { my $tries = $Apache::lonhomework::history{"resource.$id.tries"}; my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); if ( $tries eq '' ) { $tries = '0'; } - if ( $maxtries eq '' ) { $maxtries = '2'; } - if ($tries >= $maxtries) { $status = 'CANNOT_ANSWER'; } + if ( $maxtries eq '' && + $ENV{'request.state'} ne 'construct') { $maxtries = '2'; } + if ($maxtries && $tries >= $maxtries) { $status = 'CANNOT_ANSWER'; } # if (correct and show prob status) or excused then CANNOT_ANSWER if(($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/ && @@ -539,12 +553,12 @@ sub editxmlmode {
- - + +
- - - + + +
' . $xml_help . '