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

raeburn raeburn@source.lon-capa.org
Sun, 19 Dec 2010 21:12:21 -0000


raeburn		Sun Dec 19 21:12:21 2010 EDT

  Modified files:              
    /loncom/homework	inputtags.pm structuretags.pm 
  Log:
  - New Question Type - randomizetry
    - Store rndseed used if questiontype is randomizetry for both display in
      Construction Space and use in course.
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.274 loncom/homework/inputtags.pm:1.275
--- loncom/homework/inputtags.pm:1.274	Sun Dec 19 02:58:16 2010
+++ loncom/homework/inputtags.pm	Sun Dec 19 21:12:20 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.274 2010/12/19 02:58:16 raeburn Exp $
+# $Id: inputtags.pm,v 1.275 2010/12/19 21:12:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1279,6 +1279,9 @@
         ($Apache::lonhomework::type eq 'randomizetry')) {
         $Apache::lonhomework::results{"resource.$id.type"} = $Apache::lonhomework::type;
     }
+    if ($Apache::lonhomework::type eq 'randomizetry') {
+        $Apache::lonhomework::results{"resource.$id.rndseed"} = $env{'form.'.$id.'.rndseed'};
+    }
 }
 
 sub find_which_previous {
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.479 loncom/homework/structuretags.pm:1.480
--- loncom/homework/structuretags.pm:1.479	Sat Dec 18 22:49:33 2010
+++ loncom/homework/structuretags.pm	Sun Dec 19 21:12:20 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.479 2010/12/18 22:49:33 raeburn Exp $
+# $Id: structuretags.pm,v 1.480 2010/12/19 21:12:20 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -393,6 +393,7 @@
             if ($tries) {
                 $rndseed += $tries;
             }
+            $env{'form.'.$Apache::inputtags::part.'.rndseed'}=$rndseed;
         }
 	if ( ($env{'form.resetdata'} eq &mt('New Problem Variation')
 	      && $env{'form.submitted'} eq 'yes')  ||
@@ -717,13 +718,6 @@
 					      $namespace,'',$domain,$name);
 	    &Apache::lonxml::debug('Construct Store return message:'.$result);
 	} else {
-            if ($Apache::lonhomework::type eq 'randomizetry') {
-                foreach my $key (keys(%Apache::lonhomework::results)) {
-                    if ($key =~ /^resource\.([^\.]+)\.tries/) {
-                        $Apache::lonhomework::results{'resource.'.$1.'.rndseed'}=$env{'form.'.$1.'.rndseed'};
-                    }
-                }
-            }
 	    $result=&Apache::lonnet::cstore(\%Apache::lonhomework::results,
 					    $symb,$courseid,$domain,$name);
 	    &Apache::lonxml::debug('Store return message:'.$result);