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

sakharuk lon-capa-cvs@mail.lon-capa.org
Fri, 03 Oct 2003 13:21:01 -0000


sakharuk		Fri Oct  3 09:21:01 2003 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Only answers can be printed for students' assignments - item "print assignment for selected students" allows to do this.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.249 loncom/interface/lonprintout.pm:1.250
--- loncom/interface/lonprintout.pm:1.249	Thu Oct  2 16:34:27 2003
+++ loncom/interface/lonprintout.pm	Fri Oct  3 09:21:01 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.249 2003/10/02 20:34:27 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.250 2003/10/03 13:21:01 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -938,17 +938,25 @@
 		    if (&Apache::lonnet::allowed('bre',$res_url)) {
 			my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,
                                                                         $ENV{'request.course.id'},'tex');
-			if ($flag_latex_header_remove eq 'YES') {
-			    $rendered = &latex_header_footer_remove($rendered);
-			} else {
-			    $rendered =~ s/\\end{document}//;
-			}
-			if($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
+			if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
+			   ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
 			    my %form;
 			    $form{'answer_output_mode'}='tex';
 			    $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
 			    my $ansrendered = &Apache::loncommon::get_student_answers($curresline,$username,$userdomain,$ENV{'request.course.id'},%form);
-			    $rendered=~s/(\\keephidden{ENDOFPROBLEM})/$ansrendered$1/;
+			    if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
+				$rendered=~s/(\\keephidden{ENDOFPROBLEM})/$ansrendered$1/;
+			    } 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.='\vskip 1 mm '.$ansrendered;
+			    }
+			}
+			if ($flag_latex_header_remove eq 'YES') {
+			    $rendered = &latex_header_footer_remove($rendered);
+			} else {
+			    $rendered =~ s/\\end{document}//;
 			}
 			$current_output .= $rendered;
 		    }