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

foxr foxr@source.lon-capa.org
Tue, 06 Oct 2009 11:02:12 -0000


foxr		Tue Oct  6 11:02:12 2009 EDT

  Modified files:              (Branch: bz2851)
    /loncom/interface	lonprintout.pm 
  Log:
  BZ 2851 continued work...testing all of the print options after
  - Centralizing some helper production
  - Centralizing the print headers.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.560.2.3 loncom/interface/lonprintout.pm:1.560.2.4
--- loncom/interface/lonprintout.pm:1.560.2.3	Tue Sep  8 10:53:15 2009
+++ loncom/interface/lonprintout.pm	Tue Oct  6 11:02:12 2009
@@ -11,7 +11,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.560.2.3 2009/09/08 10:53:15 foxr Exp $
+# $Id: lonprintout.pm,v 1.560.2.4 2009/10/06 11:02:12 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -163,7 +163,7 @@
       <nextstate>$next_state</nextstate>
       <filterfunc>return $filter;</filterfunc>
 CHOOSE_RESOURCES
-    if ($value_func ne '') {
+    if ($choice_func ne '') {
 	$result .= "<choicefunc>return $choice_func;</choicefunc>";
     }
     if ($top_url ne '') {
@@ -2153,7 +2153,7 @@
 		$texversion.=&ssi_with_retries($urlp, $ssi_retry_count, %form);
 		&Apache::lonnet::logthis("texversion so far: $texversion");
 		if ($urlp=~/\.page$/) {
-		    &Apache::lonnet::("Special page actions");
+		    &Apache::lonnet::logthis("Special page actions");
 		    ($texversion,my $number_of_columns_page) = &page_cleanup($texversion);
 		    if ($number_of_columns_page > $number_of_columns) {$number_of_columns=$number_of_columns_page;} 
 		    $texversion =~ s/\\end{document}\d*/\\end{document}/;
@@ -2197,7 +2197,9 @@
 		}
 
 		if ($flag_latex_header_remove ne 'NO') {
+		    &Apache::lonnet::logthis("Removing header/footer 1");
 		    $texversion = &latex_header_footer_remove($texversion);
+		    &Apache::lonnet::logthis("With h/f removed we have: $texversion");
 		} else {
 		    $texversion =~ s/\\end{document}//;
 		}
@@ -2234,6 +2236,7 @@
 		}
 
 		if ($flag_latex_header_remove ne 'NO') {
+		    &Apache::lonnet::logthis("Removing header & footer 2");
 		    $texversion = &latex_header_footer_remove($texversion);
 		} else {	
 		    $texversion =~ s/\\end{document}/\\vskip 0\.5mm\\noindent\\makebox\[\\textwidth\/\$number_of_columns\]\[b\]\{\\hrulefill\}/;
@@ -2261,6 +2264,7 @@
 		$texversion=&unsupported($urlp,$helper->{'VARS'}->{'LATEX_TYPE'},
 					 $master_seq[$i]);
 		if ($flag_latex_header_remove ne 'NO') {
+		    &Apache::lonnet::logthis("Removing header/footer 3");
 		    $texversion = &latex_header_footer_remove($texversion);
 		} else {
 		    $texversion =~ s/\\end{document}//;
@@ -2322,9 +2326,11 @@
 	     $helper->{'VARS'}->{'NUMBER_TO_PRINT'} = $#students+1;
 	 }
 	 my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
+	 &Apache::lonnet::logthis("RESOURCES: ". $helper->{'VARS'}->{'RESOURCES'});
 
 	 #loop over students
-	 my $flag_latex_header_remove = 'NO';
+
+ 	 my $flag_latex_header_remove = 'NO';
 	 my %moreenv;
          $moreenv{'instructor_comments'}='hide';
 	 $moreenv{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
@@ -2523,6 +2529,7 @@
 		$newurlp=&path_to_problem($newurlp,$LaTeXwidth);
 		$texversion =~ s/(\\begin{minipage}{\\textwidth})/$1 $newurlp/;
 		if ($flag_latex_header_remove ne 'NO') {
+		    &Apache::lonnet::logthis("Removing header/footer: 4");
 		    $texversion = &latex_header_footer_remove($texversion);
 		} else {
 		    $texversion =~ s/\\end{document}//;
@@ -2727,9 +2734,10 @@
     #   so we will just rely on prntout.pl to strip  ENDOFSTUDENTSTAMP from the
     #   postscript.  Each ENDOFSTUDENTSTAMP will go on a line by itself.
     #
-
+    &Apache::lonnet::logthis("In print_resources");
 
     foreach my $curresline (@{$master_seq})  {
+	&Apache::lonnet::logthis("Res: $curresline");
 	if (defined $page_breaks{$curresline}) {
 	    if($i != 0) {
 		$current_output.= "\\newpage\n";
@@ -2747,7 +2755,7 @@
 		    &Apache::lonxml::remember_problem_counter();    
 
 		    my $rendered = &get_student_view_with_retries($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);
-
+		    &Apache::lonnet::logthis("student view: $rendered");
 		    if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
 		       ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
 			#   Use a copy of the hash so we don't pervert it on future loop passes.
@@ -2775,13 +2783,14 @@
 			    $rendered = $header.$body;
 			}
 		    }
-
+		    &Apache::lonnet::logthis("After preprending header: $rendered");
 		    if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') {
 			my $url = &Apache::lonnet::clutter($res_url);
 			my $annotation = &annotate($url);
 			$rendered =~  s/(\\keephidden{ENDOFPROBLEM})/$annotation$1/;
 		    }
 		    if ($remove_latex_header eq 'YES') {
+			&Apache::lonnet::logthis("Removing header/footer: 5");
 			$rendered = &latex_header_footer_remove($rendered);
 		    } else {
 			$rendered =~ s/\\end{document}//;
@@ -2796,6 +2805,7 @@
 			$annotation    =~ s/(\\end{document})/$annotation$1/;
 		    }
 		    if ($remove_latex_header eq 'YES') {
+			&Apache::lonnet::logthis("Removing header/footer: 6");
 			$rendered = &latex_header_footer_remove($rendered);
 		    } else {
 			$rendered =~ s/\\end{document}//;
@@ -2805,12 +2815,14 @@
 		    my $url = &Apache::lonnet::clutter($res_url);
 		    my $rendered  = &include_pdf($url);
 		    if ($remove_latex_header ne 'NO') {
+			&Apache::lonnet::logthis("Removing header/footer: 7");
 			$rendered = &latex_header_footer_remove($rendered);
 		    }
 		    $current_output .= $rendered;
 		} else {
 		    my $rendered = &unsupported($res_url,$helper->{'VARS'}->{'LATEX_TYPE'},$curresline);
 		    if ($remove_latex_header ne 'NO') {
+			&Apache::lonnet::logthis("Removing header/footer: 8");
 			$rendered = &latex_header_footer_remove($rendered);
 		    } else {
 			$rendered =~ s/\\end{document}//;
@@ -3151,7 +3163,7 @@
 	}
         my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS_PAGE',
 							'Select Problem(s) to print',
-							"multichoice='1' toponly='1', addstatus='1' closeallpages='1'",
+							"multichoice='1' toponly='1' addstatus='1' closeallpages='1'",
 							'RESOURCES',
 							'PAGESIZE',
 							$url,
@@ -3248,7 +3260,7 @@
 							      'RESOURCES',
 							      'PAGESIZE',
 							      '',
-							      $isNotMap,,$symbFilter,
+							      $isNotMap,'',$symbFilter,
 							      $start_new_option) .
 				   &generate_resource_chooser('ALL_PROBLEMS_STUDENTS',
 							      'Select Problem(s) to print',
@@ -3256,7 +3268,7 @@
 							      'RESOURCES',
 							      'STUDENTS1',
 							      '',
-							      $isProblemOrMap, , $symbFilter,
+							      $isProblemOrMap,'' , $symbFilter,
 							      $start_new_option) .
 				     $suffixXml
 				   );