--- loncom/interface/lonprintout.pm 2005/12/06 16:23:26 1.403 +++ loncom/interface/lonprintout.pm 2005/12/15 18:36:23 1.406 @@ -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.406 2005/12/15 18:36:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -844,16 +844,19 @@ sub print_latex_header { 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 @@ ENDPART } 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 @@ sub print_resources { } 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; } } @@ -2169,16 +2172,16 @@ CHOOSE_STUDENTS my %all_codes = &Apache::lonnet::get('CODEs', \@names, $cdom,$cnum); my %code_values; - my @all_code_array; - foreach my $key (keys %all_codes) { + my %codes_to_print; + foreach my $key (keys(%all_codes)) { %code_values = &Apache::grades::get_codes($key, $cdom, $cnum); - foreach my $key (keys %code_values) { - push (@all_code_array, "$key"); + foreach my $key (keys(%code_values)) { + $codes_to_print{$key} = 1; } } my $code_selection = "\n"; - foreach my $code (sort {uc($a) cmp uc($b)} @all_code_array) { + foreach my $code (sort {uc($a) cmp uc($b)} (keys(%codes_to_print))) { my $choice = $code; if ($code =~ /^[A-Z]+$/) { # Alpha code $choice = &letters_to_num($code); @@ -2394,7 +2397,6 @@ CHOOSE_FROM_SUBDIR return $urlValue; return \$res->hasResource(\$res,sub { return !\$_[0]->is_sequence() },0,0); -