[LON-CAPA-cvs] cvs: loncom /homework chemresponse.pm externalresponse.pm response.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Wed, 18 Apr 2007 00:19:38 -0000
albertel Tue Apr 17 20:19:38 2007 EDT
Modified files:
/loncom/homework response.pm chemresponse.pm externalresponse.pm
Log:
- 2622 for math, external, custom
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.162 loncom/homework/response.pm:1.163
--- loncom/homework/response.pm:1.162 Tue Apr 17 19:25:09 2007
+++ loncom/homework/response.pm Tue Apr 17 20:19:37 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.162 2007/04/17 23:25:09 albertel Exp $
+# $Id: response.pm,v 1.163 2007/04/18 00:19:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -447,6 +447,9 @@
$result .= &Apache::response::answer_part('customresponse',$answer);
$result .= &Apache::response::answer_footer('customresponse');
}
+ if ($target eq 'web') {
+ &setup_prior_tries_hash(\&format_prior_response_math);
+ }
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex' || $target eq 'analyze') {
&Apache::lonxml::increment_counter(&Apache::response::repetition());
@@ -459,6 +462,11 @@
return $result;
}
+sub format_prior_response_custom {
+ my ($mode,$answer) =@_;
+ return '<span class="LC_prior_custom">'.
+ &HTML::Entities::encode($answer,'"<>&').'</span>';
+}
sub start_mathresponse {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
@@ -536,6 +544,10 @@
}
}
}
+ if ($target eq 'web') {
+ &setup_prior_tries_hash(\&format_prior_response_math);
+ }
+
pop(@Apache::lonxml::namespace);
pop(@Apache::response::custom_answer);
pop(@Apache::response::custom_answer_type);
@@ -544,6 +556,12 @@
return $result;
}
+sub format_prior_response_math {
+ my ($mode,$answer) =@_;
+ return '<span class="LC_prior_math">'.
+ &HTML::Entities::encode($answer,'"<>&').'</span>';
+}
+
sub implicit_multiplication {
my ($expression)=@_;
# Escape scientific notation, so 3e8 does not become 3*e*8
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.71 loncom/homework/chemresponse.pm:1.72
--- loncom/homework/chemresponse.pm:1.71 Mon Dec 4 16:23:01 2006
+++ loncom/homework/chemresponse.pm Tue Apr 17 20:19:37 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# chemical equation style response
#
-# $Id: chemresponse.pm,v 1.71 2006/12/04 21:23:01 albertel Exp $
+# $Id: chemresponse.pm,v 1.72 2007/04/18 00:19:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -542,6 +542,9 @@
}
$result.=&Apache::response::answer_footer('reactionresponse');
}
+ if ($target eq 'web') {
+ &Apache::response::setup_prior_tries_hash(\&format_prior_response_reaction);
+ }
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex' || $target eq 'analyze') {
@@ -551,6 +554,12 @@
return $result;
}
+sub format_prior_response_reaction {
+ my ($mode,$answer) =@_;
+ return '<span class="LC_prior_reaction">'.
+ &HTML::Entities::encode($answer,'"<>&').'</span>';
+}
+
sub start_chem {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style) = @_;
my $result = '';
Index: loncom/homework/externalresponse.pm
diff -u loncom/homework/externalresponse.pm:1.6 loncom/homework/externalresponse.pm:1.7
--- loncom/homework/externalresponse.pm:1.6 Tue Oct 18 11:33:55 2005
+++ loncom/homework/externalresponse.pm Tue Apr 17 20:19:37 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# external style responses
#
-# $Id: externalresponse.pm,v 1.6 2005/10/18 15:33:55 albertel Exp $
+# $Id: externalresponse.pm,v 1.7 2007/04/18 00:19:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -97,6 +97,10 @@
}
}
}
+ if ($target eq 'web') {
+ &Apache::response::setup_prior_tries_hash(\&format_prior_response);
+ }
+
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
$target eq 'tex' || $target eq 'analyze') {
&Apache::lonxml::increment_counter($increment);
@@ -105,6 +109,12 @@
return $result;
}
+sub format_prior_response {
+ my ($mode,$answer) =@_;
+ return '<span class="LC_prior_external">'.
+ &HTML::Entities::encode($answer,'"<>&').'</span>';
+}
+
1;
__END__