[LON-CAPA-cvs] cvs: loncom /homework chemresponse.pm hint.pm response.pm /homework/caparesponse caparesponse.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 12 Mar 2004 18:41:44 -0000


albertel		Fri Mar 12 13:41:44 2004 EDT

  Modified files:              
    /loncom/homework	chemresponse.pm hint.pm response.pm 
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  BUG#2758, $var in <responseparam> worked but didn't show that they worked in Answer mode
  
  
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.30 loncom/homework/chemresponse.pm:1.31
--- loncom/homework/chemresponse.pm:1.30	Mon Mar  8 12:31:37 2004
+++ loncom/homework/chemresponse.pm	Fri Mar 12 13:41:43 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # chemical equation style response
 #
-# $Id: chemresponse.pm,v 1.30 2004/03/08 17:31:37 www Exp $
+# $Id: chemresponse.pm,v 1.31 2004/03/12 18:41:43 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -165,7 +165,7 @@
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result;
     if ($target eq 'grade' && defined($ENV{'form.submitted'})) {
-	&Apache::response::setup_params($$tagstack[-1]);
+	&Apache::response::setup_params($$tagstack[-1],$safeeval);
 	my $response = &Apache::response::getresponse();
 	if ( $response =~ /[^\s]/) {
 	    my $partid = $Apache::inputtags::part;
@@ -326,7 +326,7 @@
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result;
     if ($target eq 'grade' && defined($ENV{'form.submitted'})) {
-	&Apache::response::setup_params($$tagstack[-1]);
+	&Apache::response::setup_params($$tagstack[-1],$safeeval);
 	my $response = &Apache::response::getresponse();
 	if ( $response =~ /[^\s]/) {
 	    my $partid = $Apache::inputtags::part;
Index: loncom/homework/hint.pm
diff -u loncom/homework/hint.pm:1.47 loncom/homework/hint.pm:1.48
--- loncom/homework/hint.pm:1.47	Thu Mar  4 16:21:55 2004
+++ loncom/homework/hint.pm	Fri Mar 12 13:41:43 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # implements the tags that control the hints
 #
-# $Id: hint.pm,v 1.47 2004/03/04 21:21:55 albertel Exp $
+# $Id: hint.pm,v 1.48 2004/03/12 18:41:43 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -150,7 +150,7 @@
 	}
 	$safeeval->share_from('capa',['&caparesponse_capa_check_answer']);
 	my $name= &Apache::lonxml::get_param('name',$parstack,$safeeval);
-	&Apache::response::setup_params('numericalhint');
+	&Apache::response::setup_params('numericalhint',$safeeval);
 	my $partid=$Apache::inputtags::part;
 	my $id=$Apache::inputtags::response['-1'];
 	#id submissions occured under
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.93 loncom/homework/response.pm:1.94
--- loncom/homework/response.pm:1.93	Mon Mar  8 17:59:12 2004
+++ loncom/homework/response.pm	Fri Mar 12 13:41:43 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.93 2004/03/08 22:59:12 albertel Exp $
+# $Id: response.pm,v 1.94 2004/03/12 18:41:43 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -273,7 +273,7 @@
 	    my ($symb,$courseid,$domain,$name)=&Apache::lonxml::whichuser();
 	    my $allowed=&Apache::lonnet::allowed('mgr',$courseid);
 	    if ($allowed) {
-		&Apache::response::setup_params('dataresponse');
+		&Apache::response::setup_params('dataresponse',$safeeval);
 		my $partid = $Apache::inputtags::part;
 		my $id = $Apache::inputtags::response['-1'];
 		my $response = $ENV{'form.HWVAL_'.$id};
@@ -393,7 +393,7 @@
 }
 
 sub setup_params {
-    my ($tag) = @_;
+    my ($tag,$safeeval) = @_;
 
     if ($ENV{'request.state'} eq 'construct') { return; }
     my %paramlist=();
@@ -416,7 +416,9 @@
 	    &Apache::lonxml::debug("using nothing");
 	    $Apache::inputtags::params{$key}='';
 	} else {
-	    &Apache::lonxml::debug("using value");
+	    my $string="{return qq\0".$value."\0}";
+	    my $newvalue=&Apache::run::run($string,$safeeval,1);
+	    if (defined($newvalue)) { $value=$newvalue; }
 	    $Apache::inputtags::params{$key}=$value;
 	}
     }
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.139 loncom/homework/caparesponse/caparesponse.pm:1.140
--- loncom/homework/caparesponse/caparesponse.pm:1.139	Fri Mar 12 11:55:35 2004
+++ loncom/homework/caparesponse/caparesponse.pm	Fri Mar 12 13:41:43 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.139 2004/03/12 16:55:35 albertel Exp $
+# $Id: caparesponse.pm,v 1.140 2004/03/12 18:41:43 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -99,7 +99,7 @@
     my $tag;
     if (scalar(@$tagstack)) { $tag=$$tagstack[-1]; }
     if ( $target eq 'grade' && defined($ENV{'form.submitted'})) {
-	&Apache::response::setup_params($tag);
+	&Apache::response::setup_params($tag,$safeeval);
 	$safeeval->share_from('capa',['&caparesponse_capa_check_answer']);
 	my $partid = $Apache::inputtags::part;
 	my $id = $Apache::inputtags::response['-1'];
@@ -298,7 +298,7 @@
 	    push (@{ $Apache::lonhomework::analyze{"$part_id.incorrect"} }, @incorrect);
 	}
 	if (scalar(@$tagstack)) {
-	    &Apache::response::setup_params($tag);
+	    &Apache::response::setup_params($tag,$safeeval);
 	}
 	my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);
 	my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,$safeeval);
@@ -582,7 +582,7 @@
 	&Apache::lonxml::default_homework_load($safeeval);
     }
     if ( $target eq 'grade' && defined($ENV{'form.submitted'})) {
-	&Apache::response::setup_params('stringresponse');
+	&Apache::response::setup_params('stringresponse',$safeeval);
 	$safeeval->share_from('capa',['&caparesponse_capa_check_answer']);
 	if ($Apache::lonhomework::type eq 'exam' ||
 	    $ENV{'form.submitted'} eq 'scantron') {
@@ -659,7 +659,7 @@
 	    push (@{ $Apache::lonhomework::analyze{"parts"} },"$part.$id");
 	    $Apache::lonhomework::analyze{"$part.$id.type"} = 'stringresponse';
 	}
-	&Apache::response::setup_params('stringresponse');
+	&Apache::response::setup_params('stringresponse',$safeeval);
 	if ($target eq 'answer') {
 	    $result.=&Apache::response::answer_header('stringresponse');
 	}