[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonprintout.pm

raeburn raeburn at source.lon-capa.org
Thu Mar 5 13:33:35 EST 2020


raeburn		Thu Mar  5 18:33:35 2020 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonprintout.pm 
  Log:
  - For 2.11
    Backport 1.670, 1.671, 1.672
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.627.2.29 loncom/interface/lonprintout.pm:1.627.2.30
--- loncom/interface/lonprintout.pm:1.627.2.29	Sat Aug 17 23:37:03 2019
+++ loncom/interface/lonprintout.pm	Thu Mar  5 18:33:35 2020
@@ -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 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 @@
 								      $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 @@
 
     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 @@
 	    $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 @@
 
 	    &Apache::lonenc::reset_enc();
 
-
 	    # Note due to document structure, not allowed to put \newpage
 	    # prior to the first resource
 
@@ -3457,8 +3460,9 @@
         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 @@
             if ($usehttp) {
                 $URLback .= (($URLback =~ /\?/) ? '&':'?').'usehttp=1';
             }
-            $URLback .= (($URLback =~ /\?/) ? '&':'?').'symb='.&escape($symb.$anchor);
+            unless ($plainurl =~ /\.page$/) {
+                $URLback .= (($URLback =~ /\?/) ? '&':'?').'symb='.&escape($symb.$anchor);
+            }
         }
     }
     #




More information about the LON-CAPA-cvs mailing list