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

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


sakharuk		Fri Oct  3 09:38:21 2003 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Only answers for the set of problems from some subdirectory (no matter from the resource or construction space) can be printed.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.250 loncom/interface/lonprintout.pm:1.251
--- loncom/interface/lonprintout.pm:1.250	Fri Oct  3 09:21:01 2003
+++ loncom/interface/lonprintout.pm	Fri Oct  3 09:38:21 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.250 2003/10/03 13:21:01 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.251 2003/10/03 13:38:21 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1005,14 +1005,29 @@
 		    $urlp =~ s|^/home/httpd/html||;
 		}
 		my $texversion=&Apache::lonnet::ssi($urlp,%form);
-		if($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
+		if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') ||
+			   ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
 		    my %form;
 		    $form{'grade_target'}='answer';
 		    $form{'answer_output_mode'}='tex';
 		    $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
 		    $form{'rndseed'}=$rndseed;
 		    my $answer=&Apache::lonnet::ssi($urlp,%form);
-		    $texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/;
+		    if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
+			$texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/;
+		    } else {
+		    $texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
+		    if ($helper->{'VARS'}->{'construction'} ne '1') {
+			$texversion.='\vskip 0 mm \noindent ';
+			$texversion.=&path_to_problem ($urlp,$LaTeXwidth);
+		    } else {
+			$texversion.='\vskip 0 mm \noindent\textbf{Prints from construction space - there is no title.}\vskip 0 mm ';
+			my $URLpath=$urlp;
+			$URLpath=~s/~([^\/]+)/public_html\/$1\/$1/;
+			$texversion.=&path_to_problem ($URLpath,$LaTeXwidth);
+		    }
+		    $texversion.='\vskip 1 mm '.$answer.'\end{document}';
+		}
 		}
                 #this chunck is responsible for printing the path to problem
 		my $newurlp=&path_to_problem($urlp,$LaTeXwidth);