--- loncom/homework/lonhomework.pm 2004/02/13 21:21:30 1.163 +++ loncom/homework/lonhomework.pm 2004/02/16 19:19:31 1.167 @@ -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.167 2004/02/16 19:19:31 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -201,6 +201,17 @@ 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','is in this state by royal decree.'); + } + } else { + return ($ENV{'form.problemstate'}, + '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 +278,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/ &&