--- loncom/interface/lonprintout.pm 2007/04/17 15:45:03 1.497 +++ loncom/interface/lonprintout.pm 2007/04/20 20:13:58 1.498 @@ -2,7 +2,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.497 2007/04/17 15:45:03 www Exp $ +# $Id: lonprintout.pm,v 1.498 2007/04/20 20:13:58 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -48,6 +48,34 @@ my %perm; my %parmhash; my $resources_printed; +# Fetch the contents of a resource, uninterpreted. +# This is used here to fetch a latex file to be included +# verbatim into the printout< +# NOTE: Ask Guy if there is a lonnet function similar to this? +# +# Parameters: +# URL of the file +# +sub fetch_raw_resource { + my ($url) = @_; + + my $filename = &Apache::lonnet::filelocation("", $url); + # + # fetch if needed: + # + if (! -e $filename) { + my $repcopy_result = &Apache::lonnet::repcopy($filename); + + if ($repcopy_result ne 'ok') { + return "File open failed for $filename"; # This will bomb the print. + } + } + my $contents = &Apache::lonnet::readfile($filename); + + return $contents; + +} + # # printf_style_subst item format_string repl # @@ -1455,6 +1483,13 @@ ENDPART $resources_printed .= $currentURL.':'; my $texversion=&Apache::lonnet::ssi($currentURL,%form); $result .= $texversion; + } elsif ($cleanURL =~/.tex$/) { + # For this sort of print of a single LaTeX file, + # We can just print the LaTeX file as it is uninterpreted in any way: + # + + $result = &fetch_raw_resource($currentURL); + } else { $result.=&unsupported($currentURL,$helper->{'VARS'}->{'LATEX_TYPE'}, $helper->{'VARS'}->{'symb'});