version 1.179, 2005/11/10 22:19:27
|
version 1.181, 2005/11/16 22:52:22
|
Line 403 sub valid_award {
|
Line 403 sub valid_award {
|
} |
} |
|
|
sub finalizeawards { |
sub finalizeawards { |
my ($awardref,$msgref)=@_; |
my ($awardref,$msgref,$nameref,$reverse)=@_; |
my $result=undef; |
my $result=undef; |
my $award; |
my $award; |
my $msg; |
my $msg; |
Line 419 sub finalizeawards {
|
Line 419 sub finalizeawards {
|
if ($blankcount == ($#$awardref + 1)) { $result = 'NO_RESPONSE'; } |
if ($blankcount == ($#$awardref + 1)) { $result = 'NO_RESPONSE'; } |
} |
} |
if (defined($result)) { return ($result,$msg); } |
if (defined($result)) { return ($result,$msg); } |
foreach my $possibleaward ('MISSING_ANSWER', 'ERROR', 'NO_RESPONSE', |
|
'TOO_LONG', 'UNIT_INVALID_INSTRUCTOR', |
# these awards are ordered from most important error through best correct |
'UNIT_INVALID_STUDENT', 'UNIT_IRRECONCIBLE', |
|
'UNIT_FAIL', 'NO_UNIT', |
my @awards = ('MISSING_ANSWER', 'ERROR', 'NO_RESPONSE', 'TOO_LONG', |
'UNIT_NOTNEEDED', 'WANTED_NUMERIC', |
'UNIT_INVALID_INSTRUCTOR', 'UNIT_INVALID_STUDENT', |
'BAD_FORMULA', 'SIG_FAIL', 'INCORRECT', |
'UNIT_IRRECONCIBLE', 'UNIT_FAIL', 'NO_UNIT', |
'MISORDERED_RANK', 'INVALID_FILETYPE', |
'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA', |
'DRAFT', 'SUBMITTED', 'ASSIGNED_SCORE', |
'COMMA_FAIL', 'SIG_FAIL', 'INCORRECT', 'MISORDERED_RANK', |
'APPROX_ANS', 'EXACT_ANS','COMMA_FAIL') { |
'INVALID_FILETYPE', 'DRAFT', 'SUBMITTED', 'ASSIGNED_SCORE', |
|
'APPROX_ANS', 'EXACT_ANS'); |
|
if ($reverse) { @awards=reverse(@awards); } |
|
foreach my $possibleaward (@awards) { |
($result,$msg)=&checkstatus($possibleaward,$awardref,$msgref); |
($result,$msg)=&checkstatus($possibleaward,$awardref,$msgref); |
if (defined($result)) { return ($result,$msg); } |
if (defined($result)) { return ($result,$msg); } |
} |
} |
Line 448 sub decideoutput {
|
Line 451 sub decideoutput {
|
'no_message' => '#fffff', |
'no_message' => '#fffff', |
); |
); |
|
|
|
my $part = $Apache::inputtags::part; |
|
my $handgrade = |
|
('yes' eq lc(&Apache::lonnet::EXT("resource.$part.handgrade"))); |
|
|
|
my $computer = ($handgrade)? '' |
|
: " ".&mt("Computer's answer now shown above."); |
|
&Apache::lonxml::debug("handgrade has :$handgrade:"); |
|
|
if ($previous) { $previousmsg=&mt('You have entered that answer before'); } |
if ($previous) { $previousmsg=&mt('You have entered that answer before'); } |
|
|
if ($solved =~ /^correct/) { |
if ($solved =~ /^correct/) { |
Line 469 sub decideoutput {
|
Line 480 sub decideoutput {
|
$message = '\textbf{'.$message.'}'; |
$message = '\textbf{'.$message.'}'; |
} else { |
} else { |
$message = "<b>".$message."</b>"; |
$message = "<b>".$message."</b>"; |
$message.=" ".&mt("Computer's answer now shown above."); |
$message.= $computer; |
} |
} |
$added_computer_text=1; |
$added_computer_text=1; |
unless ($env{'course.'. |
unless ($env{'course.'. |
Line 501 sub decideoutput {
|
Line 512 sub decideoutput {
|
$message = '\textbf{'.&mt('You are correct.').'}'; |
$message = '\textbf{'.&mt('You are correct.').'}'; |
} else { |
} else { |
$message = "<b>".&mt('You are correct.')."</b>"; |
$message = "<b>".&mt('You are correct.')."</b>"; |
$message.=" ".&mt("Computer's answer now shown above."); |
$message.= $computer; |
} |
} |
$added_computer_text=1; |
$added_computer_text=1; |
unless ($env{'course.'. |
unless ($env{'course.'. |
Line 617 sub decideoutput {
|
Line 628 sub decideoutput {
|
} |
} |
if ($Apache::inputtags::status[-1] eq 'SHOW_ANSWER' && |
if ($Apache::inputtags::status[-1] eq 'SHOW_ANSWER' && |
!$added_computer_text && $target ne 'tex') { |
!$added_computer_text && $target ne 'tex') { |
$message.=" ".&mt("Computer's answer now shown above."); |
$message.= $computer; |
$added_computer_text=1; |
$added_computer_text=1; |
} |
} |
return ($button,$bgcolor,$message,$previousmsg); |
return ($button,$bgcolor,$message,$previousmsg); |