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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 13 Dec 2005 19:13:51 -0000


albertel		Tue Dec 13 14:13:51 2005 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  - BUG#4501, path splitting alogrithm was buggy
  - was printing out symbs instead of paths in one case
  - was print sequence url not resource url in one case
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.403 loncom/interface/lonprintout.pm:1.404
--- loncom/interface/lonprintout.pm:1.403	Tue Dec  6 11:23:26 2005
+++ loncom/interface/lonprintout.pm	Tue Dec 13 14:13:51 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.403 2005/12/06 16:23:26 albertel Exp $
+# $Id: lonprintout.pm,v 1.404 2005/12/13 19:13:51 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -844,16 +844,19 @@
 
 sub path_to_problem {
     my ($urlp,$colwidth)=@_;
+    $urlp=&Apache::lonnet::clutter($urlp);
+
     my $newurlp = '';
     $colwidth=~s/\s*mm\s*$//;
 #characters average about 2 mm in width
     if (length($urlp)*2 > $colwidth) {
-	my @elements = split '/',$urlp;
+	my @elements = split('/',$urlp);
 	my $curlength=0;
 	foreach my $element (@elements) {
+	    if ($element eq '') { next; }
 	    if ($curlength+(length($element)*2) > $colwidth) {
-		$newurlp .=  '|\vskip -1 mm \noindent \verb|';
-		$curlength=0;
+		$newurlp .=  '|\vskip -1 mm \verb|';
+		$curlength=length($element)*2;
 	    } else {
 		$curlength+=length($element)*2;
 	    }
@@ -1183,7 +1186,7 @@
 			} else {
 			    $texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
 			    $texversion.='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($helper->{'VARS'}->{'symb'}).'}\vskip 0 mm ';
-			    $texversion.=&path_to_problem ($currentURL,$LaTeXwidth);
+			    $texversion.=&path_to_problem($urlp,$LaTeXwidth);
 			    $texversion.='\vskip 1 mm '.$answer.'\end{document}';
 			}
 		    }
@@ -1750,7 +1753,7 @@
 			} else {
 			    $rendered=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
 			    $rendered.='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($curresline).'}\vskip 0 mm ';
-			    $rendered.=&path_to_problem ($curresline,$LaTeXwidth);
+			    $rendered.=&path_to_problem($res_url,$LaTeXwidth);
 			    $rendered.='\vskip 1 mm '.$ansrendered;
 			}
 		    }