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

sakharuk lon-capa-cvs@mail.lon-capa.org
Mon, 16 Sep 2002 14:20:33 -0000


sakharuk		Mon Sep 16 10:20:33 2002 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Can print pages: 1. with problems;
                   2. with html documents;
                   3. with another pages;
                   4. with mixture if 1.,2., and 3.  
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.64 loncom/interface/lonprintout.pm:1.65
--- loncom/interface/lonprintout.pm:1.64	Thu Sep 12 14:28:45 2002
+++ loncom/interface/lonprintout.pm	Mon Sep 16 10:20:33 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.64 2002/09/12 18:28:45 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.65 2002/09/16 14:20:33 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -87,7 +87,7 @@
 <input type="hidden" name="phase" value="two">
 <input type="hidden" name="url" value="$ENV{'form.postdata'}">
 <input type="radio" name="choice" value="Standard LaTeX output for current document" checked>  Current document <b>$title_for_single_resource</b>
-(you will print what you saw on the screen)<br />
+(prints what you just saw on the screen)<br />
 ENDMENUOUT1
     if ((not $ENV{'request.role'}=~m/^au\./) and (not $ENV{'request.role'}=~m/^ca\./)) {
 	$r->print(<<ENDMENUOUT2);
@@ -358,11 +358,13 @@
       $moreenv{'request.filename'}=$ENV{'form.url'};
       &Apache::lonnet::appenv(%moreenv);
       my $texversion=&Apache::lonnet::ssi($ENV{'form.url'});
+      &Apache::lonnet::logthis(" Got $result");
       &Apache::lonnet::delenv('form.grade_target');
       $result .= $texversion;
-      $result = &additional_cleanup($result);
       if ($ENV{'form.url'}=~m/\.page\s*$/) {
 	  ($result,$number_of_columns) = &page_cleanup($result);
+      } else {
+	  $result = &additional_cleanup($result);
       }
     } elsif ($choice eq 'Standard LaTeX output for the primary sequence' or 
              $choice eq 'Standard LaTeX output for whole primary sequence') {
@@ -566,6 +568,12 @@
 	}
 	$current_resource = $hash{'goesto_'.$hash{'to_'.$current_resource}};
     }
+    #needs if final resource in the map (type=finish) contains something
+    if (not $hash{'src_'.$current_resource}=~/\.sequence$/) {
+	push @resourcelist,$hash{'src_'.$current_resource};
+    } else {
+	push @resourcelist,&coming_from_hash($hash{'src_'.$current_resource});
+    }
     return @resourcelist;
 }
 
@@ -911,17 +919,14 @@
 }
 sub page_cleanup {
     my $result = shift;	
-    $_ = $result;
-    m/\\end{document}(\d*)$/;
+ 
+    $result =~ m/\\end{document}(\d*)$/;
     my $number_of_columns = $1;
     my $insert = '{';
     for (my $id=1;$id<=$number_of_columns;$id++) { $insert .='l'; }
     $insert .= '}';
-    $result =~ s/(\\begin{longtable})INSERTTHEHEADOFLONGTABLE/$1$insert/g;
+    $result =~ s/(\\begin{longtable})INSERTTHEHEADOFLONGTABLE\\endfirsthead\\endhead/$1$insert/g;
     $result =~ s/&\s*REMOVETHEHEADOFLONGTABLE\\\\/\\\\/g;
-    $result =~ s/(\\vskip\s*\d+\s*mm)/}\\\\\\parbox{\\minipagewidth}{/g;
-    $result =~ s/\\parbox{\\minipagewidth}{}\s*\\\\\s*(\\parbox{\\minipagewidth})/$1/g;
-    $result =~ s/\\parbox{\\minipagewidth}{\s*\\\\\\\\/\\parbox{\\minipagewidth}{/g;
     return $result,$number_of_columns;
 }