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

sakharuk lon-capa-cvs@mail.lon-capa.org
Thu, 03 Jun 2004 18:46:34 -0000


sakharuk		Thu Jun  3 14:46:34 2004 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Fixed bug 2947 (/adm/wrapper documents don't print) but changes are more global - you can print simple pages, pages "about me", bullutin boards and syllabas. The only problem I have to solve - to print syllabas during printing resources for selected students. I do not know why but surrently I print message 
  <H1>Service Temporarily Unavailable</H1>
  The server is temporarily unable to service your
  request due to maintenance downtime or capacity
  problems. Please try again later.
  <HR>
  <ADDRESS>Apache/1.3.27 Server at bistromath.lite.msu.edu Port 80</ADDRESS>
  instead syllabus itself. Continue to work.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.304 loncom/interface/lonprintout.pm:1.305
--- loncom/interface/lonprintout.pm:1.304	Thu May 27 13:30:48 2004
+++ loncom/interface/lonprintout.pm	Thu Jun  3 14:46:34 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.304 2004/05/27 17:30:48 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.305 2004/06/03 18:46:34 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1286,35 +1286,59 @@
 	       ($curresline!~ m/\.(problem|exam|quiz|assess|survey|form|library)$/)) ) {
 	    my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);
 	    if (&Apache::lonnet::allowed('bre',$res_url)) {
-		my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$ENV{'request.course.id'},'tex',$moreenv);
-		my $lonidsdir=$r->dir_config('lonIDsDir');
-		my $envfile=$ENV{'user.environment'};
-		$envfile=~/\/([^\/]+)\.id$/;
-		$envfile=$1;
-		&Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);
-		my $current_counter=$ENV{'form.counter'};
-		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);
-		    &Apache::lonnet::appenv(('form.counter' => $current_counter));
-		    if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
-			$rendered=~s/(\\keephidden{ENDOFPROBLEM})/$ansrendered$1/;
+		if ($res_url=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
+		    my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$ENV{'request.course.id'},'tex',$moreenv);
+		    my $lonidsdir=$r->dir_config('lonIDsDir');
+		    my $envfile=$ENV{'user.environment'};
+		    $envfile=~/\/([^\/]+)\.id$/;
+		    $envfile=$1;
+		    &Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);
+		    my $current_counter=$ENV{'form.counter'};
+		    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);
+			&Apache::lonnet::appenv(('form.counter' => $current_counter));
+			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 ($remove_latex_header eq 'YES') {
+			$rendered = &latex_header_footer_remove($rendered);
 		    } 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;
+			$rendered =~ s/\\end{document}//;
 		    }
-		}
-		if ($remove_latex_header eq 'YES') {
-		    $rendered = &latex_header_footer_remove($rendered);
+		    $current_output .= $rendered;		    
+		} elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
+		    my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$ENV{'request.course.id'},'tex',$moreenv);
+		    my $lonidsdir=$r->dir_config('lonIDsDir');
+		    my $envfile=$ENV{'user.environment'};
+		    $envfile=~/\/([^\/]+)\.id$/;
+		    $envfile=$1;
+		    &Apache::lonnet::transfer_profile_to_env($lonidsdir,$envfile);
+		    my $current_counter=$ENV{'form.counter'};
+		    if ($remove_latex_header eq 'YES') {
+			$rendered = &latex_header_footer_remove($rendered);
+		    } else {
+			$rendered =~ s/\\end{document}//;
+		    }
+		    $current_output .= $rendered.'\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\strut \vskip 0 mm \strut ';
 		} else {
-		    $rendered =~ s/\\end{document}//;
+		    my $rendered = &unsupported($res_url);
+		    if ($remove_latex_header ne 'NO') {
+			$rendered = &latex_header_footer_remove($rendered);
+		    } else {
+			$rendered =~ s/\\end{document}//;
+		    }
+		    $current_output .= $rendered;
 		}
-		$current_output .= $rendered;
 	    }
 	    $remove_latex_header = 'YES';
 	}