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

sakharuk lon-capa-cvs@mail.lon-capa.org
Mon, 13 Jan 2003 21:20:51 -0000


sakharuk		Mon Jan 13 16:20:51 2003 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Fixed bug which does not allow you to change the width of one-column page using additional printout menu.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.103 loncom/interface/lonprintout.pm:1.104
--- loncom/interface/lonprintout.pm:1.103	Fri Jan 10 10:41:26 2003
+++ loncom/interface/lonprintout.pm	Mon Jan 13 16:20:51 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.103 2003/01/10 15:41:26 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.104 2003/01/13 21:20:51 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -445,8 +445,11 @@
     my $number_of_columns = 1; #used only for pages to determine the width of the cell
     my $selectionmade = '';
     my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format($papersize,$layout,$numberofcolumns);
-    my $LaTeXwidth;
- 
+    if ($numberofcolumns == 1) {
+	$textwidth=$ENV{'form.width'};
+	$textheight=$ENV{'form.height'};
+    }
+    my $LaTeXwidth; 
     if ($textwidth=~/(\d+\s*cm)/) {
 	$LaTeXwidth = $1*10;
     } elsif ($textwidth=~/(\d+\s*mm)/) {
@@ -1189,9 +1192,14 @@
 
 
 sub page_format_transformation {
-	my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment) = @_; 
+    my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment) = @_; 
+    my ($textwidth,$textheight,$oddoffset,$evenoffset);
 	$assignment=~s/_/ /g;
-	my ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format($papersize,$layout,$numberofcolumns);
+        if ($numberofcolumns != 1) {
+          ($textwidth,$textheight,$oddoffset,$evenoffset) = &page_format($papersize,$layout,$numberofcolumns);
+	} else {
+	  ($textwidth,$textheight,$oddoffset,$evenoffset) = ($ENV{'form.width'},$ENV{'form.height'},$ENV{'form.leftmargin'},$ENV{'form.leftmargin'});
+	}
 	my $courseidinfo = $ENV{'course.'.$ENV{'request.course.id'}.'.description'};	
 	if ($layout eq 'CBI') {
 	    $text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm} \\begin{document}\\setcounter{page}{1}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$ENV{'environment.firstname'} $ENV{'environment.lastname'}}} \\hfill  $courseidinfo} \\vskip 5 mm /;