[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
sakharuk
lon-capa-cvs@mail.lon-capa.org
Thu, 21 Mar 2002 18:46:15 -0000
sakharuk Thu Mar 21 13:46:15 2002 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
now works with nested sequences correctly for the whole course output
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.18 loncom/interface/lonprintout.pm:1.19
--- loncom/interface/lonprintout.pm:1.18 Thu Mar 21 11:15:34 2002
+++ loncom/interface/lonprintout.pm Thu Mar 21 13:46:15 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.18 2002/03/21 16:15:34 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.19 2002/03/21 18:46:15 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -70,8 +70,8 @@
<input type="hidden" name="url" value="$ENV{'form.postdata'}">
<input type="radio" name="choice" value="Standard LaTeX output for current document"> Current document
(you will print what you see on the screen)<br />
-<input type="radio" name="choice" value="Standard LaTeX output for the primary sequence"> Standard LaTeX output for the primary sequence<br />
-<input type="radio" name="choice" value="Standard LaTeX output for the top level sequence"> All documents from the top level sequence<br />
+<input type="radio" name="choice" value="Standard LaTeX output for the primary sequence"> All problems from the primary sequence<br />
+<input type="radio" name="choice" value="Standard LaTeX output for the top level sequence"> All problems from the top level sequence<br />
<br /><hr /><br />
<h1>And what page format do you prefer?</h1>
<input type="radio" name="layout" value="CBI" checked> CBI <br />
@@ -155,45 +155,27 @@
}
} elsif ($choice eq 'Standard LaTeX output for the top level sequence') {
my @master_seq = ();
- my $keyword = 0;
- my $output_seq = '';
+ my @add_file_seq = ();
#-- where is the main sequence of the course?
my $main_seq = '/res/'.$ENV{'request.course.uri'};
my $file=&Apache::lonnet::filelocation("",$main_seq);
my $filecontents=&Apache::lonnet::getfile($file);
my @file_seq = &content_map($filecontents);
-#-- temporary solution (without sequence inside sequence) - have to be generalized
-
-
-
-
-# if (defined @master_seq) {
-# my $old_value = $#master_seq;
-# my $total_value = $#master_seq + $#file_seq +2;
-# for (my $j=0; $j<=$old_value-$keyword+1; $j++) {
-# $master_seq[$total_value-$j] = $master_seq[$old_value-$j];
-# }
-# for (my $j=0; $j<=$#file_seq; $j++){
-# $master_seq[$keyword+$j] = $file_seq[$j];
-# }
-# @file_seq = ();
-# $keyword = 0;
-# } else {
- @master_seq = @file_seq;
-# @file_seq = ();
-# }
-
-#-- checking wether .sequence file is among the set of files
-# my $current_file = '';
-# for (my $i=0; $i<=$#file_seq; $i++) {
-# $_ = $file_seq[$i];
-# if (m/(.*)\.sequence/) {
-# $current_file = $_;
-# $keyword = $i;
-# last;
-# }
-# }
-
+#-- do we have any other sequence inside?
+ my $i=0;
+ while ($i<=$#file_seq) {
+ $_ = $file_seq[$i];
+ if (/\.sequence$/) {
+ $file = &Apache::lonnet::filelocation("",$file_seq[$i]);
+ $filecontents=&Apache::lonnet::getfile($file);
+ @add_file_seq = &content_map($filecontents);
+ splice(@file_seq,$i,1,@add_file_seq);
+ @add_file_seq = ();
+ $i = -1;
+ }
+ $i++;
+ }
+ @master_seq = @file_seq;
#-- produce an output string
for (my $i=0;$i<=$#master_seq;$i++) {
$_ = $master_seq[$i];