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

www www@source.lon-capa.org
Mon, 06 Jun 2011 17:43:52 -0000


www		Mon Jun  6 17:43:52 2011 EDT

  Modified files:              
    /loncom/homework	response.pm structuretags.pm 
  Log:
  Interestingly, one needs the pre-processed random seed to reconstruct
  the problem in construction space. Now stored as rawrndseed.
  
  
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.223 loncom/homework/response.pm:1.224
--- loncom/homework/response.pm:1.223	Mon Jun  6 17:17:38 2011
+++ loncom/homework/response.pm	Mon Jun  6 17:43:51 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.223 2011/06/06 17:17:38 www Exp $
+# $Id: response.pm,v 1.224 2011/06/06 17:43:51 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -179,7 +179,7 @@
     } else {
 	($rndmod,$rndmod2)=&Apache::lonnet::digest("$id1,$id2");
     }
-
+    $Apache::lonhomework::results{'resource.'.$id1.'.rawrndseed'}=$rndseed;
     if ($rndseed =~/([,:])/) {
 	my $char=$1;
 	use integer;
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.487 loncom/homework/structuretags.pm:1.488
--- loncom/homework/structuretags.pm:1.487	Sun Feb  6 18:43:10 2011
+++ loncom/homework/structuretags.pm	Mon Jun  6 17:43:51 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.487 2011/02/06 18:43:10 www Exp $
+# $Id: structuretags.pm,v 1.488 2011/06/06 17:43:51 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -411,7 +411,9 @@
 	    delete($env{'form.resetdata'});
 	    delete($env{'form.newrandomization'});
 	}
-	if (defined($rndseed) && $rndseed ne int($rndseed)) {
+        $rndseed=~s/\,/\:/g;
+        $rndseed=~s/[^\w\d\:\-]//g;
+	if ((defined($rndseed)) && ($rndseed!~/^[\d\-]+\:[\d\-]+/)) {
 	    $rndseed=join(':',&Apache::lonnet::digest($rndseed));
         }
         if ($Apache::lonhomework::history{'resource.CODE'}) {
@@ -642,7 +644,7 @@
    <div class="LC_edit_problem_header_randomize_row">
      <input type="submit" name="newrandomization" accesskey="a" value="'.&mt('New Randomization').'" />
      <input type="submit" name="changerandseed" value="'.&mt('Change Random Seed To:').'" />
-     <input type="text" name="rndseed" size="10" value="'.
+     <input type="text" name="rndseed" size="24" value="'.
 	       $rndseed.'"
              onchange="javascript:document.lonhomework.changerandseed.click()" />';