--- loncom/homework/inputtags.pm 2000/12/12 20:38:22 1.16 +++ loncom/homework/inputtags.pm 2000/12/21 18:13:33 1.19 @@ -16,6 +16,7 @@ sub initialize_inputtags { @Apache::inputtags::responselist=(); @Apache::inputtags::answergroup=(); $Apache::inputtags::part=''; + @Apache::inputtags::status=(); %Apache::inputtags::params=(); } @@ -249,25 +250,31 @@ sub gradestatus { my ($id) = @_; my $showbutton = 1; my $message = ''; - my $award = $Apache::lonhomework::history{"resource.$id.award"}; - &Apache::lonxml::debug("Found Award |$award|"); - if ( $award ne '' ) { - &Apache::lonxml::debug('Getting message'); - ($showbutton,$message) = &decideoutput($award); - } - my $button=''; - my $tries = $Apache::lonhomework::history{"resource.$id.tries"}; - my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); - &Apache::lonxml::debug("goit maxtries of :$maxtries:"); - if ( $tries eq '' ) { $tries = '0'; } - if ( $maxtries eq '' ) { $maxtries = '2'; } my $trystr=''; - if ( $showbutton ) { - $trystr = "

Tries $tries/$maxtries"; - } - if ( $tries >= $maxtries ) { $showbutton = 0; } - if ( $showbutton ) { - $button = '

'; + my $button=''; + + my $status = $Apache::inputtags::status['-1']; + &Apache::lonxml::debug("gradestatus has :$status:"); + if ( $status eq 'CAN_ANSWER' || $status eq 'SHOW_ANSWER' ) { + my $award = $Apache::lonhomework::history{"resource.$id.award"}; + &Apache::lonxml::debug("Found Award |$award|"); + if ( $award ne '' ) { + &Apache::lonxml::debug('Getting message'); + ($showbutton,$message) = &decideoutput($award); + } + my $tries = $Apache::lonhomework::history{"resource.$id.tries"}; + my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); + &Apache::lonxml::debug("got maxtries of :$maxtries:"); + if ( $tries eq '' ) { $tries = '0'; } + if ( $maxtries eq '' ) { $maxtries = '2'; } + if ( $showbutton ) { + $trystr = "

Tries $tries/$maxtries"; + } + if ( $tries >= $maxtries ) { $showbutton = 0; } + if ( $status eq 'SHOW_ANSWER' ) { $showbutton = 0; } + if ( $showbutton ) { + $button = '

'; + } } return $button.$message.$trystr; }