--- loncom/interface/lonprintout.pm	2003/09/05 02:25:30	1.226
+++ loncom/interface/lonprintout.pm	2003/09/06 17:21:16	1.230
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.226 2003/09/05 02:25:30 albertel Exp $
+# $Id: lonprintout.pm,v 1.230 2003/09/06 17:21:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -49,6 +49,7 @@ use Apache::grades;
 use Apache::edit;
 use Apache::File();
 use Apache::lonnavmaps;
+use Apache::lonratedt;
 use POSIX qw(strftime);
 use GDBM_File;
 
@@ -698,8 +699,51 @@ ENDPART
 	    if ($currentURL=~m/\.page\s*$/) {
 		($result,$number_of_columns) = &page_cleanup($result);
 	    }
+        } elsif ($currentURL=~/\.sequence$/ && $helper->{'VARS'}->{'construction'} eq '1') {
+            #printing content of sequence from the construction space	
+	    my $flag_latex_header_remove = 'NO'; 
+	    my $rndseed=time;
+	    $currentURL=~s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|;
+	    my $errtext=&Apache::lonratedt::mapread($currentURL);
+	    for (my $member=0;$member<=$#Apache::lonratedt::order;$member++) {
+		$Apache::lonratedt::resources[$Apache::lonratedt::order[$member]]=~/^([^:]*):([^:]*):/;
+		my $urlp=$2;
+		if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) {
+		    my %form;
+		    $form{'grade_target'}='tex';
+		    $form{'textwidth'}=$LaTeXwidth;
+		    $form{'rndseed'}=$rndseed;
+		    my $texversion=&Apache::lonnet::ssi($urlp,%form);
+		    if($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') {
+			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 ($flag_latex_header_remove ne 'NO') {
+			$texversion = &latex_header_footer_remove($texversion);
+		    } else {
+			$texversion =~ s/\\end{document}//;
+		    }
+		    if ($helper->{'VARS'}->{'TABLE_INDEX'} eq 'yes') {
+			$texversion=&IndexCreation($texversion,$urlp);
+		    }
+		    if ($helper->{'VARS'}->{'CONSTR_RESOURSE_URL'} eq 'yes') {
+			$texversion=~s/(\\addcontentsline\{toc\}\{subsection\}\{[^\}]*\})/$1 URL: \\verb|$urlp| \\strut\\\\\\strut /;
+		    }
+		    $result.=$texversion;
+		    $flag_latex_header_remove = 'YES';
+		} elsif ($urlp=~/\.(sequence|page)$/) {
+		    $result.='\strut\newline\noindent Sequence/page '.$urlp.'\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent ';
+		}  
+	    }
+	    if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\begin{document})/$1 \\fbox\{RANDOM SEED IS $rndseed\} /;}
+	    $result .= '\end{document}';   
 	} else {
-	  $result='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: ';
+	  $result.='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: ';
 	  if ($currentURL=~/\/(aboutme|syllabus|bulletinboard|smppg)$/) {
 	      $result.=$1;
 	  } elsif ($currentURL=~/\/ext\//) {
@@ -1236,8 +1280,8 @@ CHOOSE_FROM_SUBDIR
 	$paramHash->{'variable'} = 'ANSWER_TYPE';   
 	$helper->declareVar('ANSWER_TYPE');         
         $paramHash->{CHOICES} = [
-                                   ['Yes', 'yes'],
-                                   ['No', 'no'] ];
+                                   ['No', 'yes'],
+                                   ['Yes', 'no'] ];
         Apache::lonhelper::dropdown->new();
 	addMessage("</td></tr>");
 	$startedTable = 1;