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

sakharuk lon-capa-cvs@mail.lon-capa.org
Fri, 02 May 2003 13:39:04 -0000


sakharuk		Fri May  2 09:39:04 2003 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Second step is done - primary sequence can be printed (for both courses created in RAT and in DOCS). Jeremy has to correct his lonhelper and show only the content of primary sequence for the item #2 from the main printing menu. Note, that I still have to do some additional work with printing of single resource - currently you can not printing the resource from the construction space.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.140 loncom/interface/lonprintout.pm:1.141
--- loncom/interface/lonprintout.pm:1.140	Thu May  1 16:37:32 2003
+++ loncom/interface/lonprintout.pm	Fri May  2 09:39:04 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.140 2003/05/01 20:37:32 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.141 2003/05/02 13:39:04 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1417,50 +1417,49 @@
       }
 
 
-#    } elsif ($choice eq 'Standard LaTeX output for the primary sequence' or 
-#             $choice eq 'Standard LaTeX output for whole primary sequence') {
-#      #-- minimal sequence to which the current document belongs
-#        #-- where is the primary sequence containing file?
-#        my @master_seq = ();
-#	for (my $i=0; $i<$ENV{'form.numberoffiles'};$i++) {
-#	    if ($ENV{'form.whatfile'.$i}=~/\S/) {
-#		push @master_seq,$ENV{'form.whatfile'.$i};
-#	    }
+    } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') { 
+        #-- produce an output string
+	my $flag_latex_header_remove = 'NO';
+	my $flag_page_in_sequence = 'NO';
+	my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
+
+#	foreach  my $key (@master_seq) {
+#	    $r->print(' '.$key.'<br />');
 #	}
-#        #-- produce an output string
-#	my $flag_latex_header_remove = 'NO';
-#	my $flag_page_in_sequence = 'NO';
-#	for (my $i=0;$i<=$#master_seq;$i++) {
-#           my ($urlp,$symb) = split /&&/, $master_seq[$i];
-#	    if ($choice eq 'Standard LaTeX output for the primary sequence') {
-#              $selectionmade = 2;
+#	return OK;
+
+	for (my $i=0;$i<=$#master_seq;$i++) {
+	    $master_seq[$i]=~/___\d+___(.*)$/;
+	    my $urlp='/res/'.$1;
+	    if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') {
+              $selectionmade = 2;
 #	    } elsif ($choice eq 'Standard LaTeX output for whole primary sequence') {
 #              $selectionmade = 3;
-#	    }
-#	   my %moreenv;
-#	   $moreenv{'form.grade_target'}='tex';
-#	   $moreenv{'form.textwidth'}=$LaTeXwidth;
-#	   &Apache::lonnet::appenv(%moreenv);
-#	   #&Apache::lonnet::logthis("Trying to get $urlp with symb $symb");
-#	   my $texversion=&Apache::lonnet::ssi($urlp,('symb'=>$symb));
-#	   &Apache::lonnet::delenv('form.grade_target','form.textwidth');
-#	   if ($urlp =~ m/\.page/) {
-#	     ($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}/;
-#	     $flag_page_in_sequence = 'YES';
-#	   } 
-#	   if ($flag_latex_header_remove ne 'NO') {
-#	     $texversion = &latex_header_footer_remove($texversion);
-#	   } else {
-#	     $texversion =~ s/\\end{document}//;
-#	   }
-#	   $result .= $texversion;         
-#	   $flag_latex_header_remove = 'YES';   
-#	}
-#	&Apache::lonnet::delenv('form.counter');
-#	if ($flag_page_in_sequence eq 'YES') {$result =~ s/\\usepackage{calc}/\\usepackage{calc}\\usepackage{longtable}/;}	
-#	$result .= '\end{document}';
+	    }
+	    my %moreenv;
+	    $moreenv{'form.grade_target'}='tex';
+	    $moreenv{'form.textwidth'}=$LaTeXwidth;
+	    &Apache::lonnet::appenv(%moreenv);
+	    #&Apache::lonnet::logthis("Trying to get $urlp with symb $master_seq[$i]");
+	    my $texversion=&Apache::lonnet::ssi($urlp,('symb'=>$master_seq[$i]));
+	    &Apache::lonnet::delenv('form.grade_target','form.textwidth');
+	    if ($urlp=~/\.page$/) {
+		($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}/;
+		$flag_page_in_sequence = 'YES';
+	    } 
+	    if ($flag_latex_header_remove ne 'NO') {
+		$texversion = &latex_header_footer_remove($texversion);
+	    } else {
+		$texversion =~ s/\\end{document}//;
+	    }
+	    $result .= $texversion;         
+	    $flag_latex_header_remove = 'YES';   
+	}
+	&Apache::lonnet::delenv('form.counter');
+	if ($flag_page_in_sequence eq 'YES') {$result =~ s/\\usepackage{calc}/\\usepackage{calc}\\usepackage{longtable}/;}	
+	$result .= '\end{document}';
 #    }  elsif ($choice eq 'Standard LaTeX output for the top level sequence') {
 #        # where is the main sequence of the course?
 #	$selectionmade = 4;
@@ -1660,12 +1659,13 @@
         $helper = $result;
     
 
-#    my $key; 
+    my $key; 
 #    foreach $key (keys %{$helper->{'VARS'}}) {
 #	$r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<br />');
 #    }
+#	return OK;
+	
 	
-
 	&output_data_new($r,$helper);