--- loncom/interface/lonprintout.pm 2009/07/14 11:08:00 1.557.2.2 +++ loncom/interface/lonprintout.pm 2009/07/23 10:53:03 1.559 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.557.2.2 2009/07/14 11:08:00 foxr Exp $ +# $Id: lonprintout.pm,v 1.559 2009/07/23 10:53:03 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -104,7 +104,7 @@ sub fetch_raw_resource { sub annotate { my ($symb) = @_; - my $annotation_text = &Apache::admannotations::get_annotation($symb, 1); + my $annotation_text = &Apache::loncommon::get_annotation($symb, 1); my $result = ""; @@ -230,6 +230,10 @@ sub include_pdf { sub ssi_with_retries { my ($resource, $retries, %form) = @_; + my $target = $form{'grade_target'}; + my $aom = $form{'answer_output_mode'}; + + my ($content, $response) = &Apache::loncommon::ssi_with_retries($resource, $retries, %form); if (!$response->is_success) { @@ -1344,10 +1348,11 @@ sub print_page_in_course { $currentURL=~s|^(/adm/wrapper/)?ext/|http://|; my $title=&Apache::lonnet::gettitle($symb); $title = &Apache::lonxml::latex_special_symbols($title); - $result.=' \strut \\\\ '.$title.' \strut \\\\ '.$currentURL.' '; } else { $result.=$currentURL; } + $result .= '\\\\'; + if ($helper->{'VARS'}->{'style_file'}=~/\w/) { &Apache::lonnet::appenv({'construct.style' => $helper->{'VARS'}->{'style_file'}}); @@ -1355,15 +1360,15 @@ sub print_page_in_course { &Apache::lonnet::delenv('construct.style'); } - # First is theo verall page description. This is then followed by the + # First is the overall page description. This is then followed by the # components of the page. Each of which must be printed independently. my $the_page = shift(@page_resources); - $result .= "URL: $currentURL " .'\\\\'; foreach my $resource (@page_resources) { my $resource_src = $resource->src(); # Essentially the URL of the resource. - + $result .= $resource->title() . '\\\\'; + # Recurse if a .page: if ($resource_src =~ /.page$/i) { @@ -1408,21 +1413,27 @@ sub print_page_in_course { my $texversion = &ssi_with_retries($urlp, $ssi_retry_count, %form); + # There seems to be an extraneous \vskip 1mm \\\\ : + + $texversion =~ s/^\\vskip 1mm \\\\\\\\//; + # current document with answers.. no need to encap in minipage # since there's only one answer. if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') || ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) { - $form{'problem_split'}=$parmhash{'problem_stream_switch'}; - $form{'grade_target'}='answer'; - $form{'answer_output_mode'}='tex'; - $form{'rndseed'}=$rndseed; + my %answerform = %form; + + + $answerform{'problem_split'}=$parmhash{'problem_stream_switch'}; + $answerform{'grade_target'}='answer'; + $answerform{'answer_output_mode'}='tex'; + $answerform{'rndseed'}=$rndseed; if ($helper->{'VARS'}->{'probstatus'} eq 'exam') { - $form{'problemtype'}='exam'; + $answerform{'problemtype'}='exam'; } - $resources_printed .= $currentURL.':'; - my $answer=&ssi_with_retries($currentURL,$ssi_retry_count, %form); - + $resources_printed .= $urlp.':'; + my $answer=&ssi_with_retries($urlp,$ssi_retry_count, %answerform); if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { $texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/; @@ -1717,8 +1728,16 @@ sub output_data { ENDPART - - my $start_page = &Apache::loncommon::start_page('Preparing Printout',$js); + # Breadcrumbs + #FIXME: Choose better/different breadcrumbs?!? Links? + my $brcrum = [{'href' => '', + 'text' => 'Helper'}, #FIXME: Different origin possible than print out helper? + {'href' => '', + 'text' => 'Preparing Printout'}]; + + my $start_page = &Apache::loncommon::start_page('Preparing Printout', + $js, + {'bread_crumbs' => $brcrum,}); my $msg = &mt('Please stand by while processing your print request, this may take some time ...'); $r->print($start_page."\n

\n$msg\n

\n"); @@ -1891,7 +1910,6 @@ ENDPART && $currentURL=~/\.(sequence|page)$/ && $helper->{'VARS'}->{'construction'} eq '1') { #printing content of sequence from the construction space - &Apache::lonnet::logthis("Printing sequence/page but construction space??"); $currentURL=~s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|; # $result .= &print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); @@ -1929,7 +1947,6 @@ ENDPART $result .= &include_pdf($cleanURL); $result .= '\end{document}'; } elsif ($cleanURL =~ /\.page$/i) { # Print page in non construction space contexts. - &Apache::lonnet::logthis("Printing .page $cleanURL at " . __LINE__); # Determine the set of resources in the map of the page: @@ -2007,12 +2024,10 @@ ENDPART my $texversion=''; if ($urlp!~m|^/adm/| && $urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { - &Apache::lonnet::logthis("At line 1834 printing $urlp"); $resources_printed .= $urlp.':'; &Apache::lonxml::remember_problem_counter(); $texversion.=&ssi_with_retries($urlp, $ssi_retry_count, %form); if ($urlp=~/\.page$/) { - &Apache::lonnet::logthis("Handling a .page at ". __LINE__); ($texversion,my $number_of_columns_page) = &page_cleanup($texversion); if ($number_of_columns_page > $number_of_columns) {$number_of_columns=$number_of_columns_page;} @@ -2602,7 +2617,6 @@ sub print_resources { if ($res_url!~m|^ext/| && $res_url=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { $printed .= $curresline.':'; - &Apache::lonnet::logthis("At line 2427 printing $curresline"); &Apache::lonxml::remember_problem_counter(); my $rendered = &get_student_view_with_retries($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);