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

banghart lon-capa-cvs@mail.lon-capa.org
Wed, 13 Sep 2006 22:08:08 -0000


banghart		Wed Sep 13 18:08:08 2006 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  	Permit users to store added metadata fields. 
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.175 loncom/interface/lonmeta.pm:1.176
--- loncom/interface/lonmeta.pm:1.175	Wed Sep 13 16:12:20 2006
+++ loncom/interface/lonmeta.pm	Wed Sep 13 18:08:07 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.175 2006/09/13 20:12:20 banghart Exp $
+# $Id: lonmeta.pm,v 1.176 2006/09/13 22:08:07 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -605,7 +605,7 @@
         if (($type eq 'keywords') || ($type eq 'subject')
              || ($type eq 'author')||($type eq  'notes')
              || ($type eq  'abstract')|| ($type eq  'title')|| ($type eq  'standards')
-             || (exists($env{'course.'.$env{'request.course.id'}.'metadata.'.$type.'.added'}))) {
+             || (exists($env{'course.'.$env{'request.course.id'}.'.metadata.'.$type.'.added'}))) {
             if ($values) {
                 if ($only_one) {
                     $output .= (&Apache::loncommon::select_form($cur_values_inst[0],'new_'.$type,%meta_options));
@@ -620,7 +620,7 @@
                       $relatedvalue); 
             }
             return ($output);
-        }
+        } 
         if (($type eq 'lowestgradelevel') ||
 	    ($type eq 'highestgradelevel')) {
 	    return &Apache::loncommon::select_level_form($value,$fieldname).
@@ -1195,6 +1195,7 @@
 			    'notes','lowestgradelevel',
 	                    'highestgradelevel','standards');
 	        $added_metadata_fields = &Apache::lonparmset::get_added_meta_fieldnames();
+	        
 	        $env{$Apache::lonpublisher::metadatafields{'courserestricted'}.'.metadata.fieldlist'} = join (",",@fields);
 	    }
 	} else {
@@ -1237,6 +1238,12 @@
 		$r->print("This resource is not associated with a course.<br />");
 	    }
 	}
+        foreach my $field_name(keys (%$added_metadata_fields)) {
+            push (@fields,$field_name);
+            $Apache::lonpublisher::metadatafields{$field_name} =
+                     $$added_metadata_fields{$field_name};
+            $lt{$field_name} = $$added_metadata_fields{$field_name};
+        }
         foreach my $field_name (@fields) {
             if (defined($env{'form.new_'.$field_name})) {
                 $Apache::lonpublisher::metadatafields{$field_name}=
@@ -1263,12 +1270,6 @@
                
             }
         }
-        foreach my $field_name (keys(%$added_metadata_fields)) {
-            my $course = $env{'request.course.id'};
-            $output.=('<p>'.$$added_metadata_fields{$field_name}.': '.
-                    &prettyinput($field_name,$env{'course.'.$env{'request.course.id'}.'metadata.'.$field_name.'.value'},
-                    'new_'.$field_name,'addedmeta').'</p>')
-        }
 	if ($env{'form.store'}) {
 	    my $mfh;
 	    my $formname='store';