[LON-CAPA-cvs] cvs: loncom /homework response.pm structuretags.pm /interface lonnavmaps.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 29 Jun 2004 22:32:15 -0000


albertel		Tue Jun 29 18:32:15 2004 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
    /loncom/homework	structuretags.pm response.pm 
  Log:
  - BUG#3149, need to stroe the order of responses, so we can show them in the right order, all user of lonnavmaps are good to go now.
  
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.263 loncom/interface/lonnavmaps.pm:1.264
--- loncom/interface/lonnavmaps.pm:1.263	Mon Jun 28 11:09:13 2004
+++ loncom/interface/lonnavmaps.pm	Tue Jun 29 18:32:11 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.263 2004/06/28 15:09:13 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.264 2004/06/29 22:32:11 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3735,6 +3735,20 @@
                 }
             }
         }
+	my $resorder = &Apache::lonnet::metadata($self->src(),'responseorder');
+	if ($resorder) {
+	    my @resorder=split(/,/,$resorder);
+	    foreach my $part (keys(%responseIdHash)) {
+		my %resids = map { ($_,1) } @{ $responseIdHash{$part} };
+		my @neworder;
+		foreach my $possibleid (@resorder) {
+		    if (exists($resids{$possibleid})) {
+			push(@neworder,$possibleid);
+		    }
+		}
+		$responseIdHash{$part}=\@neworder;	
+	    }
+	}
         $self->{RESPONSE_IDS} = \%responseIdHash;
         $self->{RESPONSE_TYPES} = \%responseTypeHash;
     }
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.257 loncom/homework/structuretags.pm:1.258
--- loncom/homework/structuretags.pm:1.257	Wed Jun 23 13:43:31 2004
+++ loncom/homework/structuretags.pm	Tue Jun 29 18:32:12 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.257 2004/06/23 17:43:31 sakharuk Exp $
+# $Id: structuretags.pm,v 1.258 2004/06/29 22:32:12 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -673,6 +673,7 @@
 	    $result=&Apache::response::mandatory_part_meta;
 	}
 	$result.=&Apache::response::meta_part_order();
+	$result.=&Apache::response::meta_response_order();
     } elsif ($target eq 'edit') {
 	&Apache::lonxml::debug("in end_problem with $target, edit");
 	$result = &problem_edit_footer();
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.99 loncom/homework/response.pm:1.100
--- loncom/homework/response.pm:1.99	Thu May 27 00:25:13 2004
+++ loncom/homework/response.pm	Tue Jun 29 18:32:14 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.99 2004/05/27 04:25:13 albertel Exp $
+# $Id: response.pm,v 1.100 2004/06/29 22:32:14 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -220,9 +220,16 @@
     if (@Apache::inputtags::partlist) {
 	my @parts=@Apache::inputtags::partlist;
 	shift(@parts);
-	return '<partorder>'.join(',',@parts).'</partorder>';
+	return '<partorder>'.join(',',@parts).'</partorder>'."\n";
     } else {
-	return '<partorder>0</partorder>';
+	return '<partorder>0</partorder>'."\n";
+    }
+}
+
+sub meta_response_order {
+    if (@Apache::inputtags::responselist) {
+	return '<responseorder>'.join(',',@Apache::inputtags::responselist).
+	    '</responseorder>'."\n";
     }
 }