--- loncom/homework/inputtags.pm 2004/06/07 21:52:11 1.146
+++ loncom/homework/inputtags.pm 2004/11/06 01:15:59 1.149.2.1
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.146 2004/06/07 21:52:11 albertel Exp $
+# $Id: inputtags.pm,v 1.149.2.1 2004/11/06 01:15:59 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -330,6 +330,7 @@ sub decideoutput {
my $button=0;
my $previousmsg;
my $bgcolor='orange';
+ my $added_computer_text=0;
my %possiblecolors =
( 'correct' => '#aaffaa',
'charged_try' => '#ffaaaa',
@@ -347,7 +348,8 @@ sub decideoutput {
} else {
$message = "".&mt('You are correct.')."";
}
- $message.= " ".&mt(" Computer's answer now shown.");
+ $message.=" ".&mt("Computer's answer now shown above.");
+ $added_computer_text=1;
unless ($ENV{'course.'.
$ENV{'request.course.id'}.
'.disable_receipt_display'} eq 'yes') {
@@ -379,7 +381,8 @@ sub decideoutput {
} else {
$message = "".&mt('You are correct.')."";
}
- $message.= " ".&mt(" Computer's answer now shown.");
+ $message.=" ".&mt("Computer's answer now shown above.");
+ $added_computer_text=1;
unless ($ENV{'course.'.
$ENV{'request.course.id'}.
'.disable_receipt_display'} eq 'yes') {
@@ -487,8 +490,10 @@ sub decideoutput {
$bgcolor=$possiblecolors{'correct'};
$button=1;
}
- if ($Apache::inputtags::status[-1] eq 'SHOW_ANSWER') {
- $message.=" ".&mt("Computer's answer now shown.");
+ if ($Apache::inputtags::status[-1] eq 'SHOW_ANSWER' &&
+ !$added_computer_text) {
+ $message.=" ".&mt("Computer's answer now shown above.");
+ $added_computer_text=1;
}
return ($button,$bgcolor,$message,$previousmsg);
}
@@ -519,10 +524,15 @@ sub hidealldata {
sub setgradedata {
my ($award,$msg,$id,$previously_used) = @_;
- # if the student already has it correct, don't modify the status
- if ($Apache::lonhomework::scantronmode && defined($ENV{'form.CODE'})) {
+ if ($Apache::lonhomework::scantronmode &&
+ &Apache::lonnet::validCODE($ENV{'form.CODE'})) {
$Apache::lonhomework::results{"resource.CODE"}=$ENV{'form.CODE'};
+ } elsif ($Apache::lonhomework::scantronmode &&
+ $ENV{'form.CODE'} eq '' &&
+ $Apache::lonhomework::history{"resource.CODE"} ne '') {
+ $Apache::lonhomework::results{"resource.CODE"}='';
}
+
if (!$Apache::lonhomework::scantronmode &&
$Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
$Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') {
@@ -531,7 +541,10 @@ sub setgradedata {
} elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~
/^correct/ || $Apache::lonhomework::scantronmode ||
lc($Apache::lonhomework::problemstatus) eq 'no') {
- #handle assignment of tries and solved status
+ # the student doesn't already have it correct,
+ # or we are in a mode (scantron orno problem status) where a correct
+ # can become incorrect
+ # handle assignment of tries and solved status
my $solvemsg;
if ($Apache::lonhomework::scantronmode) {
$solvemsg='correct_by_scantron';
@@ -712,7 +725,7 @@ sub gradestatus {
if ( $Apache::lonhomework::type eq 'survey') { $tries_text=&mt('Submissions'); }
if ( $showbutton ) {
if ($target eq 'tex') {
- if ($ENV{'request.state'} ne "construct" && $Apache::lonhomework::type ne 'exam') {
+ if ($ENV{'request.state'} ne "construct" && $Apache::lonhomework::type ne 'exam' && $ENV{'form.suppress_tries'} ne 'yes') {
$trystr = ' {\vskip 1 mm \small \textit{'.$tries_text.'} '.$tries.'/'.$maxtries.'} \vskip 2 mm ';
} else {
$trystr = '\vskip 0 mm ';