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

sakharuk lon-capa-cvs@mail.lon-capa.org
Thu, 27 Feb 2003 21:20:33 -0000


sakharuk		Thu Feb 27 16:20:33 2003 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
   Atomated the printing of "Leave blank on scoring form" message (it's number)
  for the bubble exam. 
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.78 loncom/homework/caparesponse/caparesponse.pm:1.79
--- loncom/homework/caparesponse/caparesponse.pm:1.78	Thu Feb 27 15:31:34 2003
+++ loncom/homework/caparesponse/caparesponse.pm	Thu Feb 27 16:20:33 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.78 2003/02/27 20:31:34 www Exp $
+# $Id: caparesponse.pm,v 1.79 2003/02/27 21:20:33 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -223,7 +223,7 @@
 	my $powers_number = 8; #default values for number of powers
 	my $symb;
 	if ($ENV{'form.symb'}=~/___\d+___/) {$symb=$ENV{'form.symb'};} else {$symb=$ENV{'request.symb'};}
-	my $randomseed = srand(&Apache::lonnet::rndseed($symb,$ENV{'request.course.id'},
+	srand(&Apache::lonnet::rndseed($symb,$ENV{'request.course.id'},
                                                               $ENV{'user.domain'},$ENV{'user.name'}));
 	my $ind=1+int(rand()*($factors_number-1));
 	my $factor = $factors[$ind];
@@ -329,9 +329,17 @@
 	     &Apache::lonxml::increment_counter();
          } else {
 	     $result.='\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}';
-	     $result.= '\begin{enumerate}\item[\textbf{'.$Apache::lonxml::counter.'}.]\textit{Live blank on scoring form}\vskip 0 mm \end{enumerate}';
-	     &Apache::lonxml::increment_counter();
-	 }
+	    my $id = $Apache::inputtags::part;
+	    my $weight = &Apache::lonnet::EXT("resource.$id.weight");
+            my $repetition = int $weight/9;
+	    if ($weight % 9 != 0) {$repetition++;} 
+	      $result.='\begin{enumerate}';
+	      for (my $i=0;$i<$repetition;$i++) {
+		 $result.='\item[\textbf{'.$Apache::lonxml::counter.'}.]\textit{Leave blank on scoring form}\vskip 0 mm';
+		 &Apache::lonxml::increment_counter();
+	      }
+	      $result.= '\end{enumerate}';
+	    }
 	}
     }
   } elsif ($target eq 'edit') {