[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm /homework/caparesponse caparesponse.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 12 Mar 2004 16:55:35 -0000


albertel		Fri Mar 12 11:55:35 2004 EDT

  Modified files:              
    /loncom/homework	default_homework.lcpm 
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  - BUG#2820, namescape the internal variables we use
  
  
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.69 loncom/homework/default_homework.lcpm:1.70
--- loncom/homework/default_homework.lcpm:1.69	Wed Feb 18 17:49:32 2004
+++ loncom/homework/default_homework.lcpm	Fri Mar 12 11:55:35 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
 #
-# $Id: default_homework.lcpm,v 1.69 2004/02/18 22:49:32 albertel Exp $
+# $Id: default_homework.lcpm,v 1.70 2004/03/12 16:55:35 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -44,7 +44,7 @@
   #not to be used: $ans_fmt
   my ($type,$tol,$sig,$ans_fmt,$unit,$calc,$samples) =
     eval $_[2].
-      ';return ($type,$tol,$sig,$ans_fmt,$unit,$calc,$samples);';
+      ';return ($__LC__type,$__LC__tol,$__LC__sig,$__LC__ans_fmt,$__LC__unit,$__LC__calc,$__LC__samples);';
 
   my $tol_type=''; # gets it's value from whether tol has a % or not done
   my $sig_lbound=''; #done
@@ -165,7 +165,8 @@
   my $answers=join(':',@list);
   $result.="Got response :$answers:\n";
   my @responselist;
-  my $type =eval $expr.';return $type;';
+  my $type =eval $expr.';return $__LC__type;';
+  $result.="Got type :$type:\n";
   if ($type ne '' && $#list > 0) {
     (@responselist)=split /,/,$response;
   } else {
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.138 loncom/homework/caparesponse/caparesponse.pm:1.139
--- loncom/homework/caparesponse/caparesponse.pm:1.138	Tue Mar  2 11:09:42 2004
+++ loncom/homework/caparesponse/caparesponse.pm	Fri Mar 12 11:55:35 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.138 2004/03/02 16:09:42 sakharuk Exp $
+# $Id: caparesponse.pm,v 1.139 2004/03/12 16:55:35 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -133,26 +133,26 @@
 		my $hideunit=&Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.turnoffunit');
 
 		foreach my $key (keys(%Apache::inputtags::params)) {
-		    $expression.= ';my $'. #'
+		    $expression.= ';my $__LC__'. #'
 			$key.'="'.$Apache::inputtags::params{$key}.'"';
 		}
 
 		#no way to enter units, with radio buttons
 		if ($Apache::lonhomework::type eq 'exam' ||
 		    lc($hideunit) eq "yes") {
-		    $expression.=';my $unit=undef;';
+		    $expression.=';my $__LC__unit=undef;';
 		}
 		#sig fig don't make much sense either
 		if (($Apache::lonhomework::type eq 'exam' ||
 		     $ENV{'form.submitted'} eq 'scantron') &&
 		    $tag eq 'numericalresponse') {
-		    $expression.=';my $sig=undef;';
+		    $expression.=';my $__LC__sig=undef;';
 		}
 
 		if ($tag eq 'formularesponse') {
-		    $expression.=';my $type="fml";';
+		    $expression.=';my $__LC__type="fml";';
 		} elsif ($tag eq 'numericalresponse') {
-		    $expression.=';my $type="float";';
+		    $expression.=';my $__LC__type="float";';
 		}
 		$expression.="');";
 		my @answer=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);