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

banghart lon-capa-cvs@mail.lon-capa.org
Fri, 30 Sep 2005 00:27:21 -0000


banghart		Thu Sep 29 20:27:21 2005 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  	Re-name Instructor Defined Metadata as Portfolio Metadata.
  	Seems like a better than previous (as per Guy), but I expect yet 
  	better ones exist.
  
  	Now get fieldnames from lonmeta, and loop returns for display.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.254 loncom/interface/lonparmset.pm:1.255
--- loncom/interface/lonparmset.pm:1.254	Thu Sep 29 17:10:32 2005
+++ loncom/interface/lonparmset.pm	Thu Sep 29 20:27:20 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.254 2005/09/29 21:10:32 banghart Exp $
+# $Id: lonparmset.pm,v 1.255 2005/09/30 00:27:20 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2702,7 +2702,7 @@
 	    action => 'crsenv',
             permission => $parm_permission,
             },
-          { text => 'Set Instructor Defined Metadata',
+          { text => 'Set Portfolio Metadata',
 	    action => 'setinstmeta',
             permission => $parm_permission,
             },
@@ -2749,9 +2749,9 @@
     $r->print($menu_html);
     return;
 }
-### Set instructor defined metadata
+### Set portfolio metadata
 sub output_row {
-    my ($r, $field_name) = @_;
+    my ($r, $field_name, $field_text) = @_;
     my $output;
     my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'};
     my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'};
@@ -2760,7 +2760,7 @@
         $options = 'active,stuadd';
         $values = 'Type a list of values separated by commas.';
     }
-    $output.='<tr><td><strong>'.$field_name.'</strong></td>';
+    $output.='<tr><td><strong>'.$field_text.'</strong></td>';
     $output.='<td><input name="'.$field_name.'_values" type="text" value="'.$values.'" /></td>';
     if ($options =~ m/onlyone/) {
         $checked = ' CHECKED ';
@@ -2786,11 +2786,11 @@
     my $put_result;
     $r->print(&Apache::lonxml::xmlbegin());
     $r->print('<head>
-            <title>LON-CAPA Set Instructor Metadata</title>
+            <title>LON-CAPA Set Portfolio Metadata</title>
             </head>');
-    $r->print(&Apache::loncommon::bodytag('Set Instructor Metadata'));
+    $r->print(&Apache::loncommon::bodytag('Set Portfolio Metadata'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs(undef,
-						    'Set Instructor Metadata'));
+						    'Set Portfolio Metadata'));
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
     my $key_base = $env{'course.'.$env{'request.course.id'}.'.metadata.'};
@@ -2823,9 +2823,14 @@
         
     }
     &Apache::lonnet::coursedescription($env{'request.course.id'});
-    $output.= &output_row($r, "Title");
-    $output.= &output_row($r, "Subject");
-    $output.= &output_row($r, "Keywords");     
+    my %metadata_fields = &Apache::lonmeta::fieldnames();
+   
+    foreach my $field (sort(keys (%metadata_fields))) {
+        
+        if ($field =~ m/metadata/) {
+            $output.= &output_row($r, $field, $metadata_fields{$field});
+        }
+    }
     $r->print(<<ENDenv);       
         <form method="post" action="/adm/parmset?action=setinstmeta" name="form">
         
@@ -2834,7 +2839,7 @@
         <tr><th>Metadata Item</th><th>Values</th><th>Only One Choice</th><th>Student Can Add Choices</th></tr>
         $output
         </table>
-        <input type="submit" name="instmeta" value="Update Instructor Metadata">
+        <input type="submit" name="instmeta" value="Update Portfolio Metadata">
         </form>
 
 ENDenv
@@ -3078,7 +3083,7 @@
 	    &overview($r);
         } elsif ($env{'form.action'} eq 'setinstmeta' && $parm_permission) {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setinstmeta',
-						    text=>"Instructor Metadata"});
+						    text=>"Portfolio Metadata"});
 	    &setinstmeta($r);
         } elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',