--- loncom/interface/lonprintout.pm 2019/08/17 23:37:03 1.627.2.29 +++ loncom/interface/lonprintout.pm 2020/03/05 18:33:35 1.627.2.30 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.627.2.29 2019/08/17 23:37:03 raeburn Exp $ +# $Id: lonprintout.pm,v 1.627.2.30 2020/03/05 18:33:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2076,16 +2076,28 @@ sub get_textwidth { sub unsupported { my ($currentURL,$mode,$symb)=@_; + my $cleanURL=&Apache::lonenc::check_decrypt($currentURL); + my $shown = $currentURL; + if (($cleanURL ne $currentURL) || ($symb =~ m{/^enc/})) { + $shown = &mt('URL not shown (encrypted)'); + } if ($mode ne '') {$mode='\\'.$mode} - my $result.= &print_latex_header($mode); - if ($currentURL=~m|^(/adm/wrapper/)?ext/|) { - $currentURL=~s|^(/adm/wrapper/)?ext/|http://|; - $currentURL=~s|^http://https://|https://|; - my $title=&Apache::lonnet::gettitle($symb); - $title = &Apache::lonxml::latex_special_symbols($title); - $result.=' \strut \\\\ '.$title.' \strut \\\\ '.$currentURL.' '; + my $result = &print_latex_header($mode); + if ($cleanURL=~m|^(/adm/wrapper/)?ext/|) { + $cleanURL=~s|^(/adm/wrapper/)?ext/|http://|; + $cleanURL=~s|^http://https://|https://|; + if ($shown eq $currentURL) { + $shown = &Apache::lonxml::latex_special_symbols($cleanURL); + } + my $title=&Apache::lonnet::gettitle($symb); + $title = &Apache::lonxml::latex_special_symbols($title); + $result.=' \strut \\\\ \textit{'.$title.'} \strut \\\\ '.$shown.' '; } else { - $result.=$currentURL; + if ($shown eq $currentURL) { + $result.=&Apache::lonxml::latex_special_symbols($currentURL); + } else { + $result.=$shown; + } } $result.= '\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill} \end{document}'; return $result; @@ -2123,19 +2135,12 @@ sub print_page_in_course { $numberofcolumns); my $LaTeXwidth=&recalcto_mm($textwidth); - if ($mode ne '') {$mode='\\'.$mode} my $result = &print_latex_header($mode); - if ($currentURL=~m|^(/adm/wrapper/)?ext/|) { - $currentURL=~s|^(/adm/wrapper/)?ext/|http://|; - my $title=&Apache::lonnet::gettitle($symb); - $title = &Apache::lonxml::latex_special_symbols($title); - } else { - my $esc_currentURL= $currentURL; - $esc_currentURL =~ s/_/\\_/g; - $result.=$esc_currentURL; - } - $result .= '\\\\'; + + my $title=&Apache::lonnet::gettitle($currentURL); + $title = &Apache::lonxml::latex_special_symbols($title); + $result .= '\noindent\textit{'.$title.'}\\\\'; if ($helper->{'VARS'}->{'style_file'}=~/\w/) { &Apache::lonnet::appenv({'construct.style' => @@ -2151,7 +2156,7 @@ sub print_page_in_course { foreach my $resource (@page_resources) { my $resource_src = $resource->src(); # Essentially the URL of the resource. - $result .= $resource->title() . '\\\\'; + my $current_url = $resource->link(); # Recurse if a .page: @@ -2161,11 +2166,10 @@ sub print_page_in_course { $result .= &print_page_in_course($helper, $rparmhash, $resource_src, \@page_resources); } elsif ($resource->ext()) { - $result .= &unsupported($currentURL,$mode,$symb); - } - # these resources go through the XML transformer: - - elsif ($resource_src =~ /\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) { + $result.=&latex_header_footer_remove(&unsupported($current_url,$mode,$resource->symb)); + } elsif ($resource_src =~ /\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) { + # these resources go through the XML transformer: + $result .= &Apache::lonxml::latex_special_symbols($resource->title()) . '\\\\'; my $urlp = &Apache::lonnet::clutter($resource_src); @@ -2941,7 +2945,6 @@ ENDPART &Apache::lonenc::reset_enc(); - # Note due to document structure, not allowed to put \newpage # prior to the first resource @@ -3457,8 +3460,9 @@ ENDPART my ($map, $id, $url) = &Apache::lonnet::decode_symb($helper->{VARS}{'symb'}); my $cdom =$env{'course.'.$env{'request.course.id'}.'.domain'}; my $cnum =$env{'course.'.$env{'request.course.id'}.'.num'}; - my ($anchor,$usehttp); + my ($anchor,$usehttp,$plainurl); $url = &Apache::lonnet::clutter($url); + $plainurl = $url; if (($ENV{'SERVER_PORT'} == 443) && ($env{'request.course.id'}) && (($url =~ m{^\Q/public/$cdom/$cnum/syllabus\E($|\?)}) || ($url =~ m{^\Q/adm/wrapper/ext/\E(?!https:)}))) { @@ -3483,7 +3487,9 @@ ENDPART if ($usehttp) { $URLback .= (($URLback =~ /\?/) ? '&':'?').'usehttp=1'; } - $URLback .= (($URLback =~ /\?/) ? '&':'?').'symb='.&escape($symb.$anchor); + unless ($plainurl =~ /\.page$/) { + $URLback .= (($URLback =~ /\?/) ? '&':'?').'symb='.&escape($symb.$anchor); + } } } #