--- loncom/homework/inputtags.pm 2007/11/17 02:03:46 1.235
+++ loncom/homework/inputtags.pm 2008/05/22 22:04:31 1.243
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.235 2007/11/17 02:03:46 albertel Exp $
+# $Id: inputtags.pm,v 1.243 2008/05/22 22:04:31 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -306,7 +306,9 @@ sub start_textline {
$oldresponse = $oldresponse->[$#Apache::inputtags::inputlist];
}
$oldresponse = &HTML::Entities::encode($oldresponse,'<>&"');
-
+ $oldresponse =~ s/^\s+//;
+ $oldresponse =~ s/\s+$//;
+ $oldresponse =~ s/\s+/ /g;
if ($Apache::lonhomework::type ne 'exam') {
my $addchars=&Apache::lonxml::get_param('addchars',$parstack,$safeeval);
$result='';
@@ -636,8 +638,8 @@ sub decideoutput {
);
my $part = $Apache::inputtags::part;
- my $handgrade =
- ('yes' eq lc(&Apache::lonnet::EXT("resource.$part.handgrade")));
+ my $tohandgrade = &Apache::lonnet::EXT("resource.$part.handgrade");
+ my $handgrade = ('yes' eq lc($tohandgrade));
my $computer = ($handgrade)? ''
: " ".&mt("Computer's answer now shown above.");
@@ -672,7 +674,8 @@ sub decideoutput {
if (($symb ne '')
&&
($env{'course.'.$env{'request.course.id'}.
- '.disable_receipt_display'} ne 'yes')) {
+ '.disable_receipt_display'} ne 'yes') &&
+ ($Apache::lonhomework::type ne 'practice')) {
$message.=(($target eq 'web')?'
':' ').
&mt('Your receipt is [_1]',
(&Apache::lonnet::receipt($Apache::inputtags::part).
@@ -726,7 +729,7 @@ sub decideoutput {
$css_class=$possible_class{'not_charged_try'};
$button = 1;
} elsif ($award eq 'MISSING_ANSWER') {
- $message = &mt('Some items were not submitted.');
+ $message = &mt('Some items were not submitted.').&Apache::loncommon::help_open_topic('Some_Items_Were_Not_Submitted');
$css_class=$possible_class{'not_charged_try'};
$button = 1;
} elsif ($award eq 'ERROR') {
@@ -742,10 +745,10 @@ sub decideoutput {
$css_class=$possible_class{'not_charged_try'};
$button=1;
} elsif ($award eq 'MISORDERED_RANK') {
- $message = &mt('You have provided an invalid ranking');
- if ($target ne 'tex') {
- $message.=', '.&mt('please refer to').' '.&Apache::loncommon::help_open_topic('Ranking_Problems','help on ranking problems');
- }
+ $message = &mt('You have provided an invalid ranking.');
+ if ($target ne 'tex') {
+ $message.=' '.&mt('Please refer to [_1]',&Apache::loncommon::help_open_topic('Ranking_Problems',&mt('help on ranking problems')));
+ }
$css_class=$possible_class{'not_charged_try'};
$button=1;
} elsif ($award eq 'INVALID_FILETYPE') {
@@ -787,7 +790,8 @@ sub decideoutput {
$css_class=$possible_class{'not_charged_try'};
$button=1;
} elsif ($award eq 'BAD_FORMULA') {
- $message = &mt("Unable to understand formula");
+ $message = &mt("Unable to understand formula").'.';
+ if ($target ne 'tex') {$message.=&Apache::loncommon::help_open_topic('Formula_Answers')};
$css_class=$possible_class{'not_charged_try'};
$button=1;
} elsif ($award eq 'INCORRECT') {
@@ -844,6 +848,10 @@ sub decideoutput {
$message.= $computer;
$added_computer_text=1;
}
+ if ($Apache::lonhomework::type eq 'practice') {
+ $message.='
'.&mt('Submissions to practice problems are not permanently recorded.');
+ }
+
return ($button,$css_class,$message,$previousmsg);
}
@@ -1251,11 +1259,11 @@ sub previous_tries {
&& $Apache::lonhomework::history{"$prefix.solved"} =~/^correct/
) {
+ my $txt_correct = &mt('Correct');
$message =~ s{(