[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 05 Sep 2003 02:25:30 -0000


albertel		Thu Sep  4 22:25:30 2003 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  - my first bit of helper code, neat!, anyway should be the other part of #988
  
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.225 loncom/interface/lonprintout.pm:1.226
--- loncom/interface/lonprintout.pm:1.225	Tue Sep  2 16:58:31 2003
+++ loncom/interface/lonprintout.pm	Thu Sep  4 22:25:30 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.225 2003/09/02 20:58:31 bowersj2 Exp $
+# $Id: lonprintout.pm,v 1.226 2003/09/05 02:25:30 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -669,6 +669,9 @@
 	    $form{'problem_split'}=$parmhash{'problem_stream_switch'};
 	    $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
 	    my $rndseed=time;
+	    if ($helper->{'VARS'}->{'curseed'}) {
+		$rndseed=$helper->{'VARS'}->{'curseed'};
+	    }
 	    $form{'rndseed'}=$rndseed;
 	    &Apache::lonnet::appenv(%moreenv);
 	    &Apache::lonnet::delenv('form.counter');
@@ -840,6 +843,9 @@
 	@list_of_files=sort @list_of_files;
 	my $flag_latex_header_remove = 'NO'; 
 	my $rndseed=time;
+	if ($helper->{'VARS'}->{'curseed'}) {
+	    $rndseed=$helper->{'VARS'}->{'curseed'};
+	}
 	for (my $i=0;$i<=$#list_of_files;$i++) {
 	    my $urlp = $list_of_files[$i];
 	    if ($urlp=~/\//) {
@@ -1015,6 +1021,7 @@
     my $helper = Apache::lonhelper::helper->new("Printing Helper");
     $helper->declareVar('symb');
     $helper->declareVar('postdata');    
+    $helper->declareVar('curseed');    
     $helper->declareVar('filename');
     $helper->declareVar('construction');
     $helper->declareVar('assignment');
@@ -1070,6 +1077,9 @@
         }
         $subdir = &Apache::lonnet::filelocation("", $url);
     }
+    if (!$helper->{VARS}->{'curseed'} && $ENV{'form.curseed'}) {
+	$helper->{VARS}->{'curseed'}=$ENV{'form.curseed'};
+    }
 
     my $userCanSeeHidden = Apache::lonnavmaps::advancedUser();
 
@@ -1286,6 +1296,18 @@
 				     ['Yes', 'yes'] ];
 	    Apache::lonhelper::dropdown->new();
 	    addMessage("</td></tr>");
+	}
+	if ($helper->{'VARS'}->{'construction'}) { 
+	    my $xmlfrag .= <<'RNDSEED';
+	    <message><tr><td align='right'>Use random seed: </td><td></message>
+	    <string variable="curseed" size="15" maxlength="15">
+		<defaultvalue>
+	            return $helper->{VARS}->{'curseed'};
+	        </defaultvalue>
+	     </string>
+             <message></td></tr></message>
+RNDSEED
+            &Apache::lonxml::xmlparse($r, 'helper', $xmlfrag);
 	}
     }