--- loncom/homework/structuretags.pm 2001/09/14 20:17:35 1.67 +++ loncom/homework/structuretags.pm 2001/09/18 02:21:13 1.68 @@ -152,7 +152,7 @@ sub start_problem { &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval); - if ($target eq 'web' || $target eq 'grade') { + if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') { #handle exam checkout if ($Apache::lonhomework::type eq 'exam') { my $token=$Apache::lonhomework::history{"resource.0.outtoken"}; @@ -252,17 +252,20 @@ sub end_problem { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $result=''; my $status=$Apache::inputtags::status['-1']; - if ($target eq 'grade' || $target eq 'web' ) { + if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ) { if ( $target eq 'grade' && $Apache::inputtags::part eq '0' && $status eq 'CAN_ANSWER') { # if part is zero, no s existed, so we need to the grading &Apache::inputtags::grade; - } elsif ($Apache::inputtags::part eq '0') { + } elsif ( $target eq 'web' && $Apache::inputtags::part eq '0') { # if part is zero, no s existed, so we need show the current # grading status $result.= &Apache::inputtags::gradestatus($Apache::inputtags::part); } - if ($target eq 'web') { + if ( + ($target eq 'web' && ($ENV{'request.state'} ne 'construct')) || + ($target eq 'answer') + ) { if ($status eq 'CAN_ANSWER') { $result.="\n"; } elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER') { @@ -321,7 +324,7 @@ sub end_library { sub start_block { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; - if ($target eq 'web' || $target eq 'grade') { + if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') { my $code = @$parstack[$#$parstack]; $code =~ s/\"//g; $code .=';return $condition;'; @@ -435,7 +438,7 @@ sub start_part { @Apache::inputtags::previous=(); if ($target eq 'meta') { return &Apache::response::mandatory_part_meta; - } elsif ($target eq 'web' || $target eq 'grade') { + } elsif ($target eq 'web' || $target eq 'grade' || $target eq 'answer') { my ($status,$accessmsg) = &Apache::lonhomework::check_access($id); push (@Apache::inputtags::status,$status); my $expression='$external::datestatus="'.$status.'";'; @@ -468,7 +471,7 @@ sub end_part { sub start_preduedate { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; - if ($target eq 'web' || $target eq 'grade') { + if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') { if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' && $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER' ) { &Apache::lonxml::get_all_text("/preduedate",$$parser[$#$parser]); @@ -497,7 +500,7 @@ sub end_postanswerdate { sub start_notsolved { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; - if ($target eq 'web' || $target eq 'grade') { + if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') { my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; &Apache::lonxml::debug("not solved has :$gradestatus:"); if ($gradestatus =~ /^correct/) { @@ -514,7 +517,7 @@ sub end_notsolved { sub start_solved { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; - if ($target eq 'web' || $target eq 'grade') { + if ($target eq 'web' || $target eq 'grade' || $target eq 'answer') { my $gradestatus=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; if ($gradestatus !~ /^correct/) { &Apache::lonxml::get_all_text("/solved",$$parser[$#$parser]);