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

sakharuk lon-capa-cvs@mail.lon-capa.org
Wed, 11 Sep 2002 20:18:08 -0000


sakharuk		Wed Sep 11 16:18:08 2002 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Primary sequence is printed using lonnavmap.pm Gerd's hash. 
  Working on the other options.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.60 loncom/interface/lonprintout.pm:1.61
--- loncom/interface/lonprintout.pm:1.60	Wed Sep 11 14:07:35 2002
+++ loncom/interface/lonprintout.pm	Wed Sep 11 16:18:08 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.60 2002/09/11 18:07:35 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.61 2002/09/11 20:18:08 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -366,16 +366,13 @@
         #-- open and analyses the primary sequence
 	my $sequence_file=&Apache::lonnet::filelocation("",$primary_sequence);
 	my $sequencefilecontents=&Apache::lonnet::getfile($sequence_file);
-	my @master_seq = &content_map($sequencefilecontents);
+	my @master_seq = &coming_from_hash($primary_sequence); 
         #-- produce an output string
 	for (my $i=0;$i<=$#master_seq;$i++) {
-	    $_ = $master_seq[$i];
-	    m/\"(.*)\"/;
-            $_ = $1;
-            my $urlp = $1;		
+            my $urlp = $master_seq[$i];		
 	    if ($choice eq 'Standard LaTeX output for the primary sequence') {
 		$selectionmade = 2;
-		if ($urlp =~ m/\.(problem|exam|quiz|assess|survey|form|library)/) {
+ 		if ($urlp =~ m/\.(problem|exam|quiz|assess|survey|form|library)/) {
 		    my %moreenv;
 		    $moreenv{'form.grade_target'}='tex';
 		    &Apache::lonnet::appenv(%moreenv);
@@ -474,7 +471,7 @@
 	my $sequence_file=&Apache::lonnet::filelocation("",$primary_sequence);
 	my $sequencefilecontents=&Apache::lonnet::getfile($sequence_file);
 	my @master_seq = &content_map($sequencefilecontents);
-        #loop over students
+       #loop over students
 	foreach my $person (@students) {
 	    my $current_output = ''; 
 	    my ($usersection,$username,$userdomain) = split /:/,$person;
@@ -594,6 +591,26 @@
 </html>
 FINALEND
 }
+
+
+sub coming_from_hash {
+
+    my $mainsequence = shift;
+    my @resourcelist = ();
+    my $mapstart = $hash{'map_start_'.$mainsequence};
+    my $mapfinish = $hash{'map_finish_'.$mainsequence};
+    my $current_resource = $mapstart;
+    while ($current_resource ne $mapfinish) {
+	if (not $hash{'src_'.$current_resource}=~/\.sequence$/) {
+	    push @resourcelist,$hash{'src_'.$current_resource};
+	} else {
+	    push @resourcelist,&coming_from_hash($hash{'src_'.$current_resource});
+	}
+	$current_resource = $hash{'goesto_'.$hash{'to_'.$current_resource}};
+    }
+    return @resourcelist;
+}
+
 
 sub character_chart {
     my $result = shift;