--- loncom/interface/lonprintout.pm 2016/08/09 23:43:48 1.649 +++ loncom/interface/lonprintout.pm 2017/12/30 19:51:30 1.660 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.649 2016/08/09 23:43:48 raeburn Exp $ +# $Id: lonprintout.pm,v 1.660 2017/12/30 19:51:30 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -889,7 +889,7 @@ sub include_pdf { my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; $file =~ s{(.*)/res/}{$londocroot/res/}; - open(FILE,">>$Apache::lonnet::perlvar{'lonPrtDir'}/$env{'user.name'}_$env{'user.domain'}_printout.dat"); + open(FILE,">>","$Apache::lonnet::perlvar{'lonPrtDir'}/$env{'user.name'}_$env{'user.domain'}_printout.dat"); print FILE ("$file\n"); close (FILE); @@ -1976,8 +1976,8 @@ sub latex_corrections { if ($result =~ m/&(\w+|#\d+);/) { $result = &character_chart($result); } - $result =~ s/(\\end{tabular})\s*\\vskip 0 mm/$1/g; - $result =~ s/(\\begin{enumerate})\s*\\noindent/$1/g; + $result =~ s/(\\end\{tabular})\s*\\vskip 0 mm/$1/g; + $result =~ s/(\\begin\{enumerate})\s*\\noindent/$1/g; return $result; } @@ -2586,7 +2586,7 @@ sub print_construction_sequence { $result .= $texversion; } } - if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\begin{document})/$1 \\fbox\{RANDOM SEED IS $rndseed\} /;} + if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\begin\{document})/$1 \\fbox\{RANDOM SEED IS $rndseed\} /;} return $result; } @@ -2743,7 +2743,7 @@ ENDPART $cleanURL=$currentURL; } $selectionmade = 1; - + if ($cleanURL!~m|^/adm/| && $cleanURL=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) { my $rndseed=time; @@ -2847,9 +2847,10 @@ ENDPART $result = &print_latex_header() . $result; } # End construction space sequence. - } elsif ($cleanURL=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { + } elsif ($cleanURL=~/\/(smppg|syllabus|aboutme|bulletinboard|ext\.tool)$/) { $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; if ($currentURL=~/\/syllabus$/) {$currentURL=~s/\/res//;} + if ($currentURL=~/\/ext\.tool$/) {$currentURL=~s/^\/adm\/wrapper//;} $resources_printed .= $currentURL.':'; my $texversion = &ssi_with_retries($currentURL, $ssi_retry_count, %form); if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') { @@ -2956,6 +2957,7 @@ ENDPART my $texversion=''; if ($urlp!~m|^/adm/| && $urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { + my $extension = $1; $resources_printed .= $urlp.':'; &Apache::lonxml::remember_problem_counter(); if ($flag_latex_header_remove eq 'NO') { @@ -2964,7 +2966,7 @@ ENDPART (($i==0) && (($urlp=~/\.page$/) || ($print_type eq 'map_problems_in_page') || - ($print_type eq 'map_resources_in_page')))) { + (($print_type eq 'map_resources_in_page') && ($extension !~ /^x?html?$/))))) { $flag_latex_header_remove = 'YES'; } } @@ -3045,9 +3047,10 @@ ENDPART } $result .= $texversion; $flag_latex_header_remove = 'YES'; - } elsif ($urlp=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { + } elsif ($urlp=~/\/(smppg|syllabus|aboutme|bulletinboard|ext\.tool)$/) { $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; if ($urlp=~/\/syllabus$/) {$urlp=~s/\/res//;} + if ($urlp=~/\/ext\.tool$/) {$urlp=~s/^\/adm\/wrapper//;} $resources_printed .= $urlp.':'; my $texversion = &ssi_with_retries($urlp, $ssi_retry_count, %form); if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') { @@ -3447,7 +3450,13 @@ ENDPART $URLback=$helper->{'VARS'}->{'filename'}; } elsif ($helper->{VARS}{'symb'}) { my ($map, $id, $url) = &Apache::lonnet::decode_symb($helper->{VARS}{'symb'}); - $URLback = &Apache::lonnet::clutter($url); + $url = &Apache::lonnet::clutter($url); + if ($env{'request.enc'}) { + $url = &Apache::lonenc::encrypted($url); + } + if ($url ne '') { + $URLback = $url.(($url =~ /\?/) ? '&':'?').'symb='.$helper->{VARS}{'symb'}; + } } # # Final adjustment of the font size: @@ -3531,7 +3540,7 @@ ENDPART 'cgi.'.$identifier.'.role' => $perm{'pav'}, 'cgi.'.$identifier.'.numberoffiles' => $#print_array, 'cgi.'.$identifier.'.studentnames' => $student_names, - 'cgi.'.$identifier.'.backref' => $URLback,}); + 'cgi.'.$identifier.'.backref' => &escape($URLback),}); &Apache::lonnet::appenv({"cgi.$identifier.user" => $env{'user.name'}, "cgi.$identifier.domain" => $env{'user.domain'}, "cgi.$identifier.courseid" => $cnum, @@ -3714,7 +3723,7 @@ sub print_resources { $rendered =~ s/\\end\{document}//; } $current_output .= $rendered; - } elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { + } elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard|ext\.tool)$/) { if ($i == 1) { $syllabus_first = 1; }