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

www www@source.lon-capa.org
Mon, 06 Jun 2011 21:01:06 -0000


www		Mon Jun  6 21:01:06 2011 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  Backward compatible also to old construction space random seeds
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.488 loncom/homework/structuretags.pm:1.489
--- loncom/homework/structuretags.pm:1.488	Mon Jun  6 17:43:51 2011
+++ loncom/homework/structuretags.pm	Mon Jun  6 21:01:06 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.488 2011/06/06 17:43:51 www Exp $
+# $Id: structuretags.pm,v 1.489 2011/06/06 21:01:06 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -413,8 +413,12 @@
 	}
         $rndseed=~s/\,/\:/g;
         $rndseed=~s/[^\w\d\:\-]//g;
-	if ((defined($rndseed)) && ($rndseed!~/^[\d\-]+\:[\d\-]+/)) {
-	    $rndseed=join(':',&Apache::lonnet::digest($rndseed));
+	if (defined($rndseed)) {
+            my ($c1,$c2)=split(/\:/,$rndseed);
+            unless ($c2) { $c2=0; }
+            unless (($c1==int($c1)) && ($c2==int($c2))) {
+	       $rndseed=join(':',&Apache::lonnet::digest($rndseed));
+            }
         }
         if ($Apache::lonhomework::history{'resource.CODE'}) {
 	   $rndseed=&Apache::lonnet::rndseed();