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

banghart lon-capa-cvs@mail.lon-capa.org
Mon, 23 Oct 2006 20:53:46 -0000


banghart		Mon Oct 23 16:53:46 2006 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  	Present added fields to student in designated order.
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.183 loncom/interface/lonmeta.pm:1.184
--- loncom/interface/lonmeta.pm:1.183	Mon Oct 16 17:39:37 2006
+++ loncom/interface/lonmeta.pm	Mon Oct 23 16:53:46 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.183 2006/10/16 21:39:37 albertel Exp $
+# $Id: lonmeta.pm,v 1.184 2006/10/23 20:53:46 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1192,6 +1192,7 @@
 	my $output;
 	my @fields;
 	my $added_metadata_fields;
+	my @added_order;
 	if ($file_type eq 'portfolio' || $file_type eq 'groups') {
 	    if(exists ($env{$Apache::lonpublisher::metadatafields{'courserestricted'}.'.metadata.fieldlist'})) {
 	        # retrieve fieldnames (in order) from the course restricted list
@@ -1202,6 +1203,9 @@
 			    'notes','lowestgradelevel',
 	                    'highestgradelevel','standards');
 	        $added_metadata_fields = &Apache::lonparmset::get_added_meta_fieldnames();
+	        if ($env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}) {
+	            @added_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'};
+	        }
 	        $env{$Apache::lonpublisher::metadatafields{'courserestricted'}.'.metadata.fieldlist'} = join (",",@fields);
 	    }
 	} else {
@@ -1244,10 +1248,16 @@
 		$r->print("This resource is not associated with a course.<br />");
 	    }
 	}
-        foreach my $field_name(keys (%$added_metadata_fields)) {
-            
-            push (@fields,$field_name);
-            $lt{$field_name} = $$added_metadata_fields{$field_name};
+	if (@added_order) {
+	    foreach my $field_name(@added_order) {
+                push (@fields,$field_name);
+                $lt{$field_name} = $$added_metadata_fields{$field_name};
+	    }
+	} else {
+            foreach my $field_name(keys (%$added_metadata_fields)) {
+                push (@fields,$field_name);
+                $lt{$field_name} = $$added_metadata_fields{$field_name};
+            }
         }
         foreach my $field_name (@fields) {
             if (defined($env{'form.new_'.$field_name})) {