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

foxr lon-capa-cvs@mail.lon-capa.org
Mon, 07 Feb 2005 12:00:14 -0000


foxr		Mon Feb  7 07:00:14 2005 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Factor some page format defaults out of the individual branches of code.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.355 loncom/interface/lonprintout.pm:1.356
--- loncom/interface/lonprintout.pm:1.355	Wed Feb  2 06:13:34 2005
+++ loncom/interface/lonprintout.pm	Mon Feb  7 07:00:13 2005
@@ -1,7 +1,7 @@
 #  The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.355 2005/02/02 11:13:34 foxr Exp $
+# $Id: lonprintout.pm,v 1.356 2005/02/07 12:00:13 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -825,8 +825,13 @@
 ENDPART
 
     #  Common settings for the %form has:
-
+    # In some cases these settings get overriddent by specific cases, but the
+    # settings are common enough to make it worthwhile factoring them out
+    # here.
+    #
     my %form;
+    my $form{'grade_target'} = 'tex';
+    my $form{'textwidth'}    = &tget_textwidth($helper, $LaTeXwidth);
 
     my $format_from_helper = $helper->{'VARS'}->{'FORMAT'};
     my ($result,$selectionmade) = ('','');
@@ -871,8 +876,6 @@
 		    my $put_result = &Apache::lonnet::put('environment',{'construct.style'=>$helper->{'VARS'}->{'style_file'}},$dom,$user);
 		}
                 if ($helper->{'VARS'}->{'probstatus'} eq 'exam') {$form{'problemtype'}='exam';}
-		$form{'grade_target'}='tex';
-		$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
 		$form{'problem_split'}=$parmhash{'problem_stream_switch'};
 		$form{'suppress_tries'}=$parmhash{'suppress_tries'};
 		$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
@@ -938,8 +941,6 @@
 		if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) {
 		    my $texversion='';
 		    if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') {
-			$form{'grade_target'}='tex';
-			$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
 			$form{'problem_split'}=$parmhash{'problem_stream_switch'};
 			$form{'suppress_tries'}=$parmhash{'suppress_tries'};
 			$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
@@ -984,8 +985,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)$/) { 
-		$form{'grade_target'}='tex';
-		$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
 		$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
 		if ($currentURL=~/\/syllabus$/) {$currentURL=~s/\/res//;}
 		my $texversion=&Apache::lonnet::ssi($currentURL,%form);
@@ -1010,8 +1009,6 @@
 	} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'select_sequences') {
 	    $selectionmade = 7;
 	}
-	$form{'grade_target'}='tex';
-	$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
 	$form{'problem_split'}=$parmhash{'problem_stream_switch'};
 	$form{'suppress_tries'}=$parmhash{'suppress_tries'};
 	$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
@@ -1096,8 +1093,6 @@
 		$result .= $texversion;
 		$flag_latex_header_remove = 'YES';   
 	    } elsif ($urlp=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { 
-		$form{'grade_target'}='tex';
-		$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
 		$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
 		if ($urlp=~/\/syllabus$/) {$urlp=~s/\/res//;}
 		my $texversion=&Apache::lonnet::ssi($urlp,%form);
@@ -1253,8 +1248,6 @@
 	    $urlp=~s|//|/|;
 	    if ($urlp=~/\//) {
 		$form{'problem_split'}=$parmhash{'problem_stream_switch'};
-		$form{'grade_target'}='tex';
-		$form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
 		$form{'rndseed'}=$rndseed;
 		if ($urlp =~ m|/home/([^/]+)/public_html|) {
 		    $urlp =~ s|/home/([^/]*)/public_html|/~$1|;