--- loncom/interface/lonprintout.pm 2007/04/20 20:13:58 1.498 +++ loncom/interface/lonprintout.pm 2007/07/23 22:16:31 1.503 @@ -2,7 +2,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.498 2007/04/20 20:13:58 foxr Exp $ +# $Id: lonprintout.pm,v 1.503 2007/07/23 22:16:31 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -60,19 +60,13 @@ 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); + my $contents = &Apache::lonnet::getfile($filename); - if ($repcopy_result ne 'ok') { - return "File open failed for $filename"; # This will bomb the print. - } + if ($contents == -1) { + return "File open failed for $filename"; # This will bomb the print. } - my $contents = &Apache::lonnet::readfile($filename); - return $contents; + } @@ -873,7 +867,11 @@ sub page_format_transformation { my ($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin); if ($selectionmade eq '4') { - $assignment='Problems from the Whole Course'; + if ($choice eq 'all_problems') { + $assignment='Problems from the Whole Course'; + } else { + $assignment='Resources from the Whole Course'; + } } else { $assignment=&Apache::lonxml::latex_special_symbols($assignment,'header'); } @@ -1293,6 +1291,7 @@ sub output_data { my ($r,$helper,$rparmhash) = @_; my %parmhash = %$rparmhash; $resources_printed = ''; + my $do_postprocessing = 1; my $js = < var editbrowser; @@ -1397,9 +1396,6 @@ ENDPART $moreenv{'request.filename'}=$cleanURL; if ($helper->{'VARS'}->{'style_file'}=~/\w/) { $moreenv{'construct.style'}=$helper->{'VARS'}->{'style_file'}; - my $dom = $env{'user.domain'}; - my $user = $env{'user.name'}; - my $put_result = &Apache::lonnet::put('environment',{'construct.style'=>$helper->{'VARS'}->{'style_file'}},$dom,$user); } if ($helper->{'VARS'}->{'probstatus'} eq 'exam') {$form{'problemtype'}='exam';} $form{'problem_split'}=$parmhash{'problem_stream_switch'}; @@ -1489,6 +1485,7 @@ ENDPART # $result = &fetch_raw_resource($currentURL); + $do_postprocessing = 0; # Don't massage the result. } else { $result.=&unsupported($currentURL,$helper->{'VARS'}->{'LATEX_TYPE'}, @@ -1894,15 +1891,20 @@ ENDPART $result .= '\end{document}'; } #-------------------------------------------------------- corrections for the different page formats - $result = &page_format_transformation($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'},$helper->{'VARS'}->{'TABLE_CONTENTS'},$helper->{'VARS'}->{'TABLE_INDEX'},$selectionmade); - $result = &latex_corrections($number_of_columns,$result,$selectionmade, - $helper->{'VARS'}->{'ANSWER_TYPE'}); - #if ($numberofcolumns == 1) { + + # Only post process if that has not been turned off e.g. by a raw latex resource. + + if ($do_postprocessing) { + $result = &page_format_transformation($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'},$helper->{'VARS'}->{'TABLE_CONTENTS'},$helper->{'VARS'}->{'TABLE_INDEX'},$selectionmade); + $result = &latex_corrections($number_of_columns,$result,$selectionmade, + $helper->{'VARS'}->{'ANSWER_TYPE'}); + #if ($numberofcolumns == 1) { $result =~ s/\\textwidth\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /; $result =~ s/\\textheight\s*=?\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /; $result =~ s/\\evensidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /; $result =~ s/\\oddsidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /; - #} + #} + } #-- writing .tex file in prtspool my $temp_file; @@ -2600,7 +2602,7 @@ CHOOSE_STUDENTS - Names to store the CODEs under for later: + Names to save the CODEs under for later: @@ -2711,7 +2713,7 @@ CHOOSE_STUDENTS1 - Names to store the CODEs under for later: + Names to save the CODEs under for later: @@ -2941,17 +2943,15 @@ CHOOSE_FROM_ANY_SEQUENCE - : + : -   Select style file +   Select style file Show all foils? RNDSEED &Apache::lonxml::xmlparse($r, 'helper', $xmlfrag); - $helper->{'VARS'}->{'style_file'}=$env{'form.style_file_value'}; - } }