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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 10 Feb 2005 21:05:04 -0000


albertel		Thu Feb 10 16:05:04 2005 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  - removing the global LaTeXwidth it was annoying and masking some value scoping issues
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.359 loncom/interface/lonprintout.pm:1.360
--- loncom/interface/lonprintout.pm:1.359	Wed Feb  9 10:56:45 2005
+++ loncom/interface/lonprintout.pm	Thu Feb 10 16:05:03 2005
@@ -1,7 +1,7 @@
 #  The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.359 2005/02/09 15:56:45 www Exp $
+# $Id: lonprintout.pm,v 1.360 2005/02/10 21:05:03 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -42,9 +42,6 @@
 use POSIX qw(strftime);
 use Apache::lonlocal;
 
-my $LaTeXwidth = 0;
-
-
 #   Compare two students by name.  The students are in the form
 #   returned by the helper:
 #      user:domain:section:last,   first:status
@@ -726,7 +723,7 @@
     my $newurlp = '';
     $colwidth=~s/\s*mm\s*$//;
 #characters average about 2 mm in width
-    if (length($urlp)*2 > $LaTeXwidth) {
+    if (length($urlp)*2 > $colwidth) {
 	my @elements = split '/',$urlp;
 	my $curlength=0;
 	foreach my $element (@elements) {
@@ -824,15 +821,6 @@
 Please stand by while processing your print request, this may take some time ...
 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;
-    $form{'grade_target'} = 'tex';
-    $form{'textwidth'}    = &get_textwidth($helper, $LaTeXwidth);
-
     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
@@ -848,6 +836,15 @@
     my $LaTeXwidth=&recalcto_mm($textwidth); 
     my @print_array=();
     my @student_names=();
+
+    #  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;
+    $form{'grade_target'} = 'tex';
+    $form{'textwidth'}    = &get_textwidth($helper, $LaTeXwidth);
     
     if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') {
       #-- single document - problem, page, html, xml, ...
@@ -1172,7 +1169,8 @@
 	     my ($output,$fullname)=&print_resources($r,$helper,
 						     $person,$type,
 						     \%moreenv,\@master_seq,
-						     $flag_latex_header_remove);
+						     $flag_latex_header_remove,
+						     $LaTeXwidth);
 	     $print_array[$i].=$output;
 	     $student_names[$i].=$person.':'.$fullname.'_END_';
 	     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,&mt('last student').' '.$fullname);
@@ -1223,7 +1221,8 @@
 	     $moreenv{'CODE'}=&num_to_letters($code);
 	     my ($output,$fullname)=
 		 &print_resources($r,$helper,'anonymous',$type,\%moreenv,
-				  \@master_seq,$flag_latex_header_remove);
+				  \@master_seq,$flag_latex_header_remove,
+				  $LaTeXwidth);
 	     $print_array[$file_num].=$output;
 	     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
 				       &mt('last assignment').' '.$fullname);
@@ -1420,7 +1419,8 @@
 }
 
 sub print_resources {
-    my ($r,$helper,$person,$type,$moreenv,$master_seq,$remove_latex_header)=@_;
+    my ($r,$helper,$person,$type,$moreenv,$master_seq,$remove_latex_header,
+	$LaTeXwidth)=@_;
     my $current_output = ''; 
     my ($username,$userdomain,$usersection) = split /:/,$person;
     my $fullname = &get_name($username,$userdomain);