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

sakharuk lon-capa-cvs@mail.lon-capa.org
Thu, 23 Jan 2003 20:19:38 -0000


sakharuk		Thu Jan 23 15:19:38 2003 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  1. Restored the natural order in printing the content of primary sequence. All problems now are printing in the same order as they appear in the sequence (not ion alphabetical order). I had a conversation with Ed and he agreed with me that it is absolutely unresonable to sort problems fron the sequence in alphabetical order (I don't remember who's desire was to sort problems in sequence).
  2. Item four from the primary printing menu now works for the courses constructed using docs. It was tested by me on three courses - everything looks fine. Nevertheless, I would be really glad to receive any critical notes or just notes that other courses can be printed eather. 
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.104 loncom/interface/lonprintout.pm:1.105
--- loncom/interface/lonprintout.pm:1.104	Mon Jan 13 16:20:51 2003
+++ loncom/interface/lonprintout.pm	Thu Jan 23 15:19:38 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.104 2003/01/13 21:20:51 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.105 2003/01/23 20:19:38 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -159,8 +159,8 @@
     if ($sequence[0]=~/^uploaded/) {$primary_sequence = '/'.$sequence[0];} 
       else {$primary_sequence = '/res/'.$sequence[0];} 
     my @master_seq = &coming_from_hash($primary_sequence,$sequence[0]);
-    my @master_seq_view = sort @master_seq;
-    @master_seq = sort @master_seq;
+    my @master_seq_view = @master_seq;
+    @master_seq = @master_seq;
     for (my $i=0;$i<=$#master_seq_view;$i++) {
 	$master_seq_view[$i]=~/\/([^\/]+)$/;
 	$master_seq_view[$i]=$1;
@@ -496,7 +496,7 @@
 	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];		
+           my ($urlp,$symb) = split /&&/, $master_seq[$i];
 	    if ($choice eq 'Standard LaTeX output for the primary sequence') {
               $selectionmade = 2;
 	    } elsif ($choice eq 'Standard LaTeX output for whole primary sequence') {
@@ -529,14 +529,20 @@
     }  elsif ($choice eq 'Standard LaTeX output for the top level sequence') {
         # where is the main sequence of the course?
 	$selectionmade = 4;
-	my $main_seq = '/res/'.$ENV{'request.course.uri'};
+	my $main_seq;
+	if ($ENV{'request.course.uri'}=~/\/?uploaded\//) {
+	    $main_seq = $ENV{'request.course.uri'};
+	} else {
+	    $main_seq = '/res/'.$ENV{'request.course.uri'};
+	}
 	my @file_seq = &coming_from_hash_whole($main_seq);
 	my $flag_latex_header_remove = 'NO';
         #-- produce an output string
 	for (my $i=0;$i<=$#file_seq;$i++) {
-            my ($urlp,$symb) = split /&&/, $file_seq[$i];
-	    $urlp=~s/\/home\/httpd\/html//;	    
-            if ($urlp=~m/\.(problem|exam|quiz|assess|survey|form|library)/) {
+	   if (not $file_seq[$i]=~/^&&/) {
+	     my ($urlp,$symb) = split /&&/, $file_seq[$i];
+	     $urlp=~s/\/home\/httpd\/html//;	    
+	     if ($urlp=~m/\.(problem|exam|quiz|assess|survey|form|library)/) {
 		my %moreenv;
 		$moreenv{'form.grade_target'}='tex';
 		$moreenv{'form.textwidth'}=$LaTeXwidth;
@@ -550,7 +556,8 @@
 		}
 		$result .= $texversion;  
 		$flag_latex_header_remove = 'YES';
-	    }		
+	     }		
+	   }
 	}	    
 	$result .= '\end{document}';
     } elsif ($choice eq 'All class print') { 
@@ -701,10 +708,11 @@
 	if ($hash{'src_'.$current_resource}=~/\.sequence$/) {
 	    push @resourcelist,&coming_from_hash_whole($hash{'src_'.$current_resource});
 	} else {
-            $mainsequence =~ /\/res\/(.*)$/;
-	    my $presymb = $1;
+	    my $presymb; 
+	    if ($mainsequence =~ /\/res\/(.*)$/) {$presymb = $1;} 
+              elsif ($mainsequence =~ /\/?(uploaded\/(.*))$/) {$presymb = $1;} 
 	    my $rid = $hash{'ids_'.$hash{'src_'.$current_resource}};
-            if ($rid=~/,/) {
+	    if ($rid=~/,/) {
 		my @rid = split /,/, $rid;
 		foreach my $rid_element (@rid) {
 		    if ($rid_element =~ m/^$mapid\.(\d*)/) {
@@ -713,7 +721,7 @@
 		    }
 		}
 	    } else {
-		$rid =~ m/^$mapid\.(\d*)/;
+	        $rid =~ m/^$mapid\.(\d*)/;
                 $rid = $1;  
 	    }
 	    $hash{'src_'.$current_resource} =~ m/\/res\/(.*)$/;