--- loncom/homework/structuretags.pm 2004/02/13 23:59:24 1.235 +++ loncom/homework/structuretags.pm 2004/02/16 19:50:10 1.239 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.235 2004/02/13 23:59:24 albertel Exp $ +# $Id: structuretags.pm,v 1.239 2004/02/16 19:50:10 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -158,8 +158,8 @@ sub setup_rndseed { $rndseed=$Apache::lonhomework::history{'rndseed'}; if (!$rndseed) { $rndseed=time; - $ENV{'form.rndseed'}=$rndseed; } + $ENV{'form.rndseed'}=$rndseed; } if ($ENV{'form.resetdata'} eq &mt('New Problem Variation') || $ENV{'form.newrandomization'} eq &mt('New Randomization')) { @@ -395,7 +395,16 @@ sub start_problem { if ($target eq 'web') { &Apache::lonhomework::showhash(%Apache::lonhomework::history); } + if ($ENV{'request.state'} eq 'construct' && + $ENV{'form.problemstate'} eq 'CANNOT_ANSWER_correct' ) { + $Apache::lonhomework::history{'resource.0.solved'}= + 'correct_by_student'; + } $Apache::lonhomework::type=&Apache::lonnet::EXT('resource.0.type'); + if (($ENV{'request.state'} eq 'construct') && + defined($ENV{'form.problemtype'})) { + $Apache::lonhomework::type=$ENV{'form.problemtype'}; + } &Apache::lonxml::debug("Found this to be of type :$Apache::lonhomework::type:"); } if ($Apache::lonhomework::type eq '' ) { @@ -1086,9 +1095,10 @@ sub end_part { sub start_preduedate { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { + &Apache::lonxml::debug("State in preduedate is ". $Apache::inputtags::status['-1']); if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' && - $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER' && - $Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') { + $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') { + &Apache::lonxml::debug("Wha? ". ($Apache::inputtags::status['-1'] ne 'SHOW_ANSWER')); &Apache::lonxml::get_all_text("/preduedate",$parser); } } @@ -1121,7 +1131,8 @@ sub start_notsolved { $target eq 'tex') { my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; &Apache::lonxml::debug("not solved has :$gradestatus:"); - if ($gradestatus =~ /^correct/) { + if ($gradestatus =~ /^correct/ && + &Apache::response::show_answer()) { &Apache::lonxml::debug("skipping"); &Apache::lonxml::get_all_text("/notsolved",$parser); } @@ -1138,7 +1149,8 @@ sub start_solved { if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; - if ($gradestatus !~ /^correct/) { + if ($gradestatus !~ /^correct/ || + !&Apache::response::show_answer()) { &Apache::lonxml::get_all_text("/solved",$parser); } }