[LON-CAPA-cvs] cvs: loncom /interface printout.pl

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 20 Apr 2007 20:54:25 -0000


albertel		Fri Apr 20 16:54:25 2007 EDT

  Modified files:              
    /loncom/interface	printout.pl 
  Log:
  - style
  
  
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.122 loncom/interface/printout.pl:1.123
--- loncom/interface/printout.pl:1.122	Thu Feb 22 19:39:31 2007
+++ loncom/interface/printout.pl	Fri Apr 20 16:54:24 2007
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc.
 #
-# $Id: printout.pl,v 1.122 2007/02/23 00:39:31 albertel Exp $
+# $Id: printout.pl,v 1.123 2007/04/20 20:54:24 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -39,6 +39,7 @@
 use Apache::lonlocal;
 use Apache::lonmsg();
 use LONCAPA::Enrollment;
+use LONCAPA::Configuration;
 
 use strict;
 
@@ -161,6 +162,8 @@
 END
     return;
 }
+
+my %perlvar=%{&LONCAPA::Configuration::read_conf('loncapa.conf')};
  &Apache::lonlocal::get_language_handle();
  &Apache::loncommon::content_type(undef,'text/html');
 
@@ -214,13 +217,13 @@
 	      # $eps_f =~ s/\.[^.]*$/\.eps/i;
 	      if ($eps_f=~/\/home\/([^\/]+)\/public_html\//) {
                   $eps_f=~s/\/home\/([^\/]+)\/public_html/$1/;
-		  $eps_f = '/home/httpd/prtspool/'.$eps_f;
-	      } elsif ($eps_f=~/$Apache::lonnet::perlvar{'lonDocRoot'}\/res\//) {
-		  $eps_f=~m/$Apache::lonnet::perlvar{'lonDocRoot'}\/res\/(.+)/;
-		  $eps_f = '/home/httpd/prtspool/'.$1;
-	      } elsif ($eps_f=~/$Apache::lonnet::perlvar{'lonUsersDir'}\//) {
-		  $eps_f=~/$Apache::lonnet::perlvar{'lonUsersDir'}\/([^\/]+)\/\w\/\w\/\w\/(.+)/;
-		  $eps_f = '/home/httpd/prtspool/'.$1.'/'.$2;
+		  $eps_f = $perlvar{'lonPrtDir'}.$eps_f;
+	      } elsif ($eps_f=~/$perlvar{'lonDocRoot'}\/res\//) {
+		  $eps_f=~m/$perlvar{'lonDocRoot'}\/res\/(.+)/;
+		  $eps_f = $perlvar{'lonPrtDir'}.$1;
+	      } elsif ($eps_f=~/$perlvar{'lonUsersDir'}\//) {
+		  $eps_f=~/$perlvar{'lonUsersDir'}\/([^\/]+)\/\w\/\w\/\w\/(.+)/;
+		  $eps_f = $perlvar{'lonPrtDir'}.$1.'/'.$2;
 	      }
 	      $eps_f  =~ s/ /\_/g; # Spaces are problematic for system commands and LaTeX.
 	      # 
@@ -253,7 +256,7 @@
 		  if ($advanced_role) {
 		      my $prettyname=$not_eps;
 		      $prettyname=~s|/home/([^/]+)/public_html|/priv/$1|;
-		      $prettyname=~s|$Apache::lonnet::perlvar{'lonDocRoot'}/|/|;
+		      $prettyname=~s|$perlvar{'lonDocRoot'}/|/|;
 		      &Apache::lonhtmlcommon::Update_PrgWin('',\%prog_state,
 							    'Converting to EPS '.$prettyname);
 		  }
@@ -441,7 +444,7 @@
 	      print "</pre>\n";
 	      # print "<br /> Advanced role <br />";
               print "<b><big>The link to ";
-              $logfilename=~s/\/home\/httpd//;
+              $logfilename=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool};
 	      print "<a href=\"$logfilename\">Your log file </a></big></b>";
 	      print "\n";
               #link tooriginal LaTeX file (included according Michael Hamlin desire)
@@ -454,7 +457,7 @@
 	      print $tex_temporary_file '<html><head><title>LOGFILE</title></head><body><pre>'.$body_tex_file.'</pre></body></html>'."\n";
 	      print "<br /><br />";
 	      print "<b><big>The link to ";
-	      $texfile=~s/\/home\/httpd//;
+              $texfile=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool};
 	      print "<a href=\"$texfile\">Your original LaTeX file </a></big></b>";
 	      print "\n";
 	      my $help_text = &Apache::loncommon::help_open_topic("Print_Resource", "Help on printing");
@@ -612,7 +615,7 @@
 	  if ($advanced_role) {  
 	      print "<br /><br />";
 	      print "<b><big>The link to ";
-	      $logfilename=~s/\/home\/httpd//;
+              $logfilename=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool};
 	      print "<a href=\"$logfilename\">Your log file </a></big></b>";
 	      print "\n";
 	      #link tooriginal LaTeX file (included according Michael Hamlin desire)
@@ -625,7 +628,7 @@
 	      print $tex_temporary_file '<html><head><title>LOGFILE</title></head><body><pre>'.$body_tex_file.'</pre></body></html>'."\n";
 	      print "<br /><br />";
 	      print "<b><big>The link to ";
-	      $texfile=~s/\/home\/httpd//;
+              $texfile=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool};
 	      print "<a href=\"$texfile\">Your original LaTeX file </a></big></b>";
 	      print "\n";
 	  }
@@ -780,7 +783,7 @@
     print("<pre>Zip Output:\n");
     system($statement);
     print("</pre>");
-    $zipfile=~s/\/home\/httpd//;
+    $zipfile=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool};
     print "<br /> A <a href=\"$zipfile\">ZIP file</a> of all the PDFs.";
 }
 if ($advanced_role) { &Apache::lonhtmlcommon::Close_PrgWin('',\%prog_state); }