--- loncom/homework/inputtags.pm 2005/05/20 18:53:53 1.167 +++ loncom/homework/inputtags.pm 2005/07/11 19:41:53 1.171 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.167 2005/05/20 18:53:53 albertel Exp $ +# $Id: inputtags.pm,v 1.171 2005/07/11 19:41:53 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -235,7 +235,7 @@ sub start_textline { } } else { #right or wrong don't show what was last typed in. - $result=''.$Apache::inputtags::answertxt{$id}.''; + $result=''.$Apache::inputtags::answertxt{$id}.''; #$result=''; } } elsif ($target eq 'edit') { @@ -401,7 +401,7 @@ sub finalizeawards { } sub decideoutput { - my ($award,$awardmsg,$solved,$previous,$target)=@_; + my ($award,$awarded,$awardmsg,$solved,$previous,$target)=@_; my $message=''; my $button=0; my $previousmsg; @@ -413,19 +413,32 @@ sub decideoutput { 'not_charged_try' => '#ffffaa', 'no_message' => '#fffff', ); + if ($previous) { $previousmsg=&mt('You have entered that answer before'); } if ($solved =~ /^correct/) { - if ($award eq 'ASSIGNED_SCORE') { - $message = &mt("A score has been assigned."); + $bgcolor=$possiblecolors{'correct'}; + $message=&mt('You are correct.'); + if ($awarded < 1 && $awarded > 0) { + $message=&mt('You are partially correct.'); + $bgcolor=$possiblecolors{'not_charged_try'}; + } elsif ($awarded < 1) { + $message=&mt('Incorrect.'); + $bgcolor=$possiblecolors{'charged_try'}; + } + + if ($target eq 'tex') { + $message = '\textbf{'.$message.'}'; } else { - if ($target eq 'tex') { - $message = '\textbf{'.&mt('You are correct.').'}'; - } else { - $message = "".&mt('You are correct.').""; + $message = "".$message.""; + } + $added_computer_text=1; + + if ($env{'request.filename'} !~ + m|/res/lib/templates/examupload.problem$|) { + if ($target ne 'tex') { $message.=" ".&mt("Computer's answer now shown above."); } - $added_computer_text=1; unless ($env{'course.'. $env{'request.course.id'}. '.disable_receipt_display'} eq 'yes') { @@ -434,7 +447,6 @@ sub decideoutput { (($target eq 'web')?&Apache::loncommon::help_open_topic('Receipt'):''); } } - $bgcolor=$possiblecolors{'correct'}; $button=0; $previousmsg=''; } elsif ($solved =~ /^excused/) { @@ -787,6 +799,7 @@ sub gradestatus { if ( $status ne 'CLOSED' && $status ne 'UNAVAILABLE' && $status ne 'INVALID_ACCESS') { my $award = $Apache::lonhomework::history{"resource.$id.award"}; + my $awarded = $Apache::lonhomework::history{"resource.$id.awarded"}; my $solved = $Apache::lonhomework::history{"resource.$id.solved"}; my $previous = $Apache::lonhomework::history{"resource.$id.previous"}; my $awardmsg = $Apache::lonhomework::history{"resource.$id.awardmsg"}; @@ -794,7 +807,8 @@ sub gradestatus { if ( $award ne '' || $solved ne '' || $status eq 'SHOW_ANSWER') { &Apache::lonxml::debug('Getting message'); ($showbutton,$bgcolor,$message,$previousmsg) = - &decideoutput($award,$awardmsg,$solved,$previous,$target); + &decideoutput($award,$awarded,$awardmsg,$solved,$previous, + $target); if ($target eq 'tex') { $message='\vskip 2 mm '.$message.' '; } else {