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

sakharuk lon-capa-cvs@mail.lon-capa.org
Thu, 08 May 2003 18:33:03 -0000


sakharuk		Thu May  8 14:33:03 2003 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  I've restored single resource printing (either published or from the construction space). All printing was completely broken after last (yesterday) Jeremy's commitment - he used the same variables as me but with completely different content and meaning. Working on other items from printing menu. Note, that you can not print currently from data.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.157 loncom/interface/lonprintout.pm:1.158
--- loncom/interface/lonprintout.pm:1.157	Wed May  7 15:09:10 2003
+++ loncom/interface/lonprintout.pm	Thu May  8 14:33:03 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.157 2003/05/07 19:09:10 bowersj2 Exp $
+# $Id: lonprintout.pm,v 1.158 2003/05/08 18:33:03 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1363,28 +1363,29 @@
     if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'current_document') {
       #-- single document - problem, page, html, xml, ...
 	my $currentURL;
-	if (not defined $helper->{'VARS'}->{'construction'}) {
+	if ($helper->{'VARS'}->{'construction'} ne '1') {
+            #prins published resource
 	    $currentURL=$helper->{'VARS'}->{'postdata'};
 	} else {
-	    $currentURL=$helper->{'VARS'}->{'construction'};
+            #prins resource from the construction space
+	    $currentURL=$helper->{'VARS'}->{'filename'};
+	    $currentURL=~s/\/home\//\/~/;
+	    $currentURL=~s/public_html\///;
 	}
 	$selectionmade = 1;
 	if ($currentURL=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
-        my %moreenv;
-        $moreenv{'form.grade_target'}='tex';
-	if (&Apache::lonnet::allowed('bre',$currentURL)) {
-	    $currentURL=~s/http:\/\/[^\/]+//;
-	}
-        $moreenv{'request.filename'}=$currentURL;
-        $moreenv{'form.textwidth'}=$LaTeXwidth;
-        &Apache::lonnet::appenv(%moreenv);
-        my $texversion=&Apache::lonnet::ssi($currentURL);
-        &Apache::lonnet::delenv('form.grade_target','form.textwidth','form.counter');
-        $result .= $texversion;
-        if ($currentURL=~m/\.page\s*$/) {
-	  ($result,$number_of_columns) = &page_cleanup($result);
-        }
-      } else {
+	    my %moreenv;
+	    $moreenv{'form.grade_target'}='tex';
+	    $moreenv{'request.filename'}=$currentURL;
+	    $moreenv{'form.textwidth'}=$LaTeXwidth;
+	    &Apache::lonnet::appenv(%moreenv);
+	    my $texversion=&Apache::lonnet::ssi($currentURL);
+	    &Apache::lonnet::delenv('form.grade_target','form.textwidth','form.counter');
+	    $result .= $texversion;
+	    if ($currentURL=~m/\.page\s*$/) {
+		($result,$number_of_columns) = &page_cleanup($result);
+	    }
+	} else {
 #	  $result='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: ';
 #	  if ($ENV{'form.url'}=~/\/(aboutme|syllabus|bulletinboard|smppg)$/) {
 #	      $result.=$1;
@@ -1392,7 +1393,7 @@
 #	      $result.=$ENV{'form.url'};
 #	  }
 #	  $result.=' \end{document}'
-      }
+	}
 
 
     } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') or
@@ -1585,7 +1586,7 @@
 	
 #	my $key; 
 #	foreach $key (keys %{$helper->{'VARS'}}) {
-#	    $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<br />');
+#	    $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<-<br />');
 #	}
 #	return OK;