[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 20 Jan 2005 20:46:04 -0000
albertel Thu Jan 20 15:46:04 2005 EDT
Modified files:
/loncom/homework inputtags.pm
Log:
- BUG#3835 printing with a unit failure caused tEx some problems.
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.154 loncom/homework/inputtags.pm:1.155
--- loncom/homework/inputtags.pm:1.154 Fri Nov 5 20:11:38 2004
+++ loncom/homework/inputtags.pm Thu Jan 20 15:46:03 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.154 2004/11/06 01:11:38 albertel Exp $
+# $Id: inputtags.pm,v 1.155 2005/01/20 20:46:03 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -439,17 +439,17 @@
$bgcolor=$possiblecolors{'not_charged_try'};
$button=1;
} elsif ($award eq 'UNIT_INVALID_STUDENT') {
- $message = &mt('Unable to interpret units. Computer reads units as "[_1]".','<tt>'.$awardmsg.'</tt>');
+ $message = &mt('Unable to interpret units. Computer reads units as "[_1]".',&markup_unit($awardmsg,$target));
if ($target ne 'tex') {$message.=&Apache::loncommon::help_open_topic('Physical_Units');}
$bgcolor=$possiblecolors{'not_charged_try'};
$button=1;
} elsif ($award eq 'UNIT_FAIL' || $award eq 'UNIT_IRRECONCIBLE') {
- $message = &mt('Incompatible units. No conversion found between "[_1]" and the required units.','<tt>'.$awardmsg.'</tt>');
+ $message = &mt('Incompatible units. No conversion found between "[_1]" and the required units.',&markup_unit($awardmsg,$target));
if ($target ne 'tex') {$message.=&Apache::loncommon::help_open_topic('Physical_Units');}
$bgcolor=$possiblecolors{'not_charged_try'};
$button=1;
} elsif ($award eq 'UNIT_NOTNEEDED') {
- $message = &mt('Only a number required. Computer reads units of "[_1]".','<tt>'.$awardmsg.'</tt>');
+ $message = &mt('Only a number required. Computer reads units of "[_1]".',&markup_unit($awardmsg,$target));
$bgcolor=$possiblecolors{'not_charged_try'};
$button=1;
} elsif ($award eq 'NO_UNIT') {
@@ -502,6 +502,15 @@
return ($button,$bgcolor,$message,$previousmsg);
}
+sub markup_unit {
+ my ($unit,$target)=@_;
+ if ($target eq 'tex') {
+ return '\texttt{'.&Apache::lonxml::latex_special_symbols($unit).'}';
+ } else {
+ return "<tt>".$unit."</tt>";
+ }
+}
+
sub removealldata {
my ($id)=@_;
foreach my $key (keys(%Apache::lonhomework::results)) {