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

foxr lon-capa-cvs@mail.lon-capa.org
Wed, 02 Feb 2005 11:13:34 -0000


foxr		Wed Feb  2 06:13:34 2005 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Start some refactoring...
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.354 loncom/interface/lonprintout.pm:1.355
--- loncom/interface/lonprintout.pm:1.354	Mon Jan 31 07:03:08 2005
+++ loncom/interface/lonprintout.pm	Wed Feb  2 06:13:34 2005
@@ -1,7 +1,7 @@
 #  The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.354 2005/01/31 12:03:08 foxr Exp $
+# $Id: lonprintout.pm,v 1.355 2005/02/02 11:13:34 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -789,6 +789,9 @@
     my %parmhash = %$rparmhash;
     my $bodytag=&Apache::loncommon::bodytag('Preparing Printout');
     $r->print(<<ENDPART);
+
+
+
 <html>
 <script type="text/javascript" language="Javascript" >
     var editbrowser;
@@ -821,6 +824,10 @@
 Please stand by while processing your print request, this may take some time ...
 ENDPART
 
+    #  Common settings for the %form has:
+
+    my %form;
+
     my $format_from_helper = $helper->{'VARS'}->{'FORMAT'};
     my ($result,$selectionmade) = ('','');
     my $number_of_columns = 1; #used only for pages to determine the width of the cell
@@ -863,7 +870,6 @@
 		    my $user = $ENV{'user.name'};
 		    my $put_result = &Apache::lonnet::put('environment',{'construct.style'=>$helper->{'VARS'}->{'style_file'}},$dom,$user);
 		}
-		my %form;
                 if ($helper->{'VARS'}->{'probstatus'} eq 'exam') {$form{'problemtype'}='exam';}
 		$form{'grade_target'}='tex';
 		$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
@@ -885,7 +891,6 @@
 	    }
 	    if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
 	       ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
-		my %form;
 		$form{'problem_split'}=$parmhash{'problem_stream_switch'};
 		$form{'grade_target'}='answer';
 		$form{'answer_output_mode'}='tex';
@@ -933,7 +938,6 @@
 		if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) {
 		    my $texversion='';
 		    if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') {
-			my %form;
 			$form{'grade_target'}='tex';
 			$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
 			$form{'problem_split'}=$parmhash{'problem_stream_switch'};
@@ -945,7 +949,6 @@
 		    if((($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
 		       ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) && 
 		       ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page)$/)) {
-			my %form;
 			$form{'grade_target'}='answer';
 			$form{'answer_output_mode'}='tex';
 			$form{'rndseed'}=$rndseed;
@@ -981,7 +984,6 @@
 	    if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\begin{document})/$1 \\fbox\{RANDOM SEED IS $rndseed\} /;}
 	    $result .= '\end{document}';   
 	} elsif ($cleanURL=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { 
-		my %form;
 		$form{'grade_target'}='tex';
 		$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
 		$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
@@ -1008,7 +1010,6 @@
 	} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'select_sequences') {
 	    $selectionmade = 7;
 	}
-	my %form=();	   
 	$form{'grade_target'}='tex';
 	$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
 	$form{'problem_split'}=$parmhash{'problem_stream_switch'};
@@ -1060,7 +1061,6 @@
 		my $current_counter=$ENV{'form.counter'};
 		if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
 		   ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
-		    my %form;
 		    $form{'grade_target'}='answer';
 		    $form{'answer_output_mode'}='tex';
 		    my $answer=&Apache::lonnet::ssi($urlp,%form);
@@ -1096,7 +1096,6 @@
 		$result .= $texversion;
 		$flag_latex_header_remove = 'YES';   
 	    } elsif ($urlp=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { 
-		my %form;
 		$form{'grade_target'}='tex';
 		$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
 		$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
@@ -1253,7 +1252,6 @@
 	    my $urlp = $list_of_files[$i];
 	    $urlp=~s|//|/|;
 	    if ($urlp=~/\//) {
-		my %form;
 		$form{'problem_split'}=$parmhash{'problem_stream_switch'};
 		$form{'grade_target'}='tex';
 		$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
@@ -1266,7 +1264,6 @@
 		my $texversion=&Apache::lonnet::ssi($urlp,%form);
 		if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
 		   ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
-		    my %form;
 		    $form{'grade_target'}='answer';
 		    $form{'answer_output_mode'}='tex';
 		    $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};