[LON-CAPA-cvs] cvs: loncom /homework hint.pm structuretags.pm /homework/caparesponse caparesponse.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Wed, 13 Nov 2002 23:37:56 -0000
albertel Wed Nov 13 18:37:56 2002 EDT
Modified files:
/loncom/homework hint.pm structuretags.pm
/loncom/homework/caparesponse caparesponse.pm
Log:
- added more checks to make sure default homework is loaded in cases where people would care.
- Fixes BUG#957
Index: loncom/homework/hint.pm
diff -u loncom/homework/hint.pm:1.31 loncom/homework/hint.pm:1.32
--- loncom/homework/hint.pm:1.31 Tue Oct 29 01:02:20 2002
+++ loncom/homework/hint.pm Wed Nov 13 18:37:56 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# implements the tags that control the hints
#
-# $Id: hint.pm,v 1.31 2002/10/29 06:02:20 albertel Exp $
+# $Id: hint.pm,v 1.32 2002/11/13 23:37:56 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -131,6 +131,9 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result;
if ($target eq 'web') {
+ if (!$Apache::lonxml::default_homework_loaded) {
+ &Apache::lonxml::default_homework_load($safeeval);
+ }
$safeeval->share_from('capa',['&caparesponse_capa_check_answer']);
my $name= &Apache::lonxml::get_param('name',$parstack,$safeeval);
&Apache::response::setup_params('numericalhint');
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.136 loncom/homework/structuretags.pm:1.137
--- loncom/homework/structuretags.pm:1.136 Tue Nov 12 00:05:27 2002
+++ loncom/homework/structuretags.pm Wed Nov 13 18:37:56 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.136 2002/11/12 05:05:27 albertel Exp $
+# $Id: structuretags.pm,v 1.137 2002/11/13 23:37:56 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -502,6 +502,9 @@
if ($code) {
$code =~ s/\"//g;
$code .=';return $condition;';
+ if (!$Apache::lonxml::default_homework_loaded) {
+ &Apache::lonxml::default_homework_load($safeeval);
+ }
$result = &Apache::run::run($code,$safeeval);
&Apache::lonxml::debug("block :$code: returned :$result:");
} else {
@@ -537,6 +540,9 @@
$code .=';return $condition;';
push( @Apache::structuretags::whileconds, $code);
+ if (!$Apache::lonxml::default_homework_loaded) {
+ &Apache::lonxml::default_homework_load($safeeval);
+ }
my $result = &Apache::run::run($code,$safeeval);
my $bodytext=$$parser[$#$parser]->get_text("/while");
push( @Apache::structuretags::whilebody, $bodytext);
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.71 loncom/homework/caparesponse/caparesponse.pm:1.72
--- loncom/homework/caparesponse/caparesponse.pm:1.71 Fri Nov 8 15:36:27 2002
+++ loncom/homework/caparesponse/caparesponse.pm Wed Nov 13 18:37:56 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# caparesponse definition
#
-# $Id: caparesponse.pm,v 1.71 2002/11/08 20:36:27 sakharuk Exp $
+# $Id: caparesponse.pm,v 1.72 2002/11/13 23:37:56 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -128,6 +128,9 @@
my $id = $Apache::inputtags::response['-1'];
my $response = $ENV{'form.HWVAL'.$id};
if ( $response =~ /[^\s]/) {
+ if (!$Apache::lonxml::default_homework_loaded) {
+ &Apache::lonxml::default_homework_load($safeeval);
+ }
my %previous = &Apache::response::check_for_previous($response,$partid,$id);
$Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response;
&Apache::lonxml::debug("submitted a $response<br>\n");