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

banghart lon-capa-cvs@mail.lon-capa.org
Fri, 14 Oct 2005 04:25:56 -0000


banghart		Fri Oct 14 00:25:56 2005 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  	Change name of subroutine, and remove 'metadata' from field names.
  	Confirm change of values, options of restricted metadata env keys.`
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.258 loncom/interface/lonparmset.pm:1.259
--- loncom/interface/lonparmset.pm:1.258	Thu Oct  6 18:05:56 2005
+++ loncom/interface/lonparmset.pm	Fri Oct 14 00:25:56 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.258 2005/10/06 22:05:56 albertel Exp $
+# $Id: lonparmset.pm,v 1.259 2005/10/14 04:25:56 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2703,7 +2703,7 @@
             permission => $parm_permission,
             },
           { text => 'Set Portfolio Metadata',
-	    action => 'setinstmeta',
+	    action => 'setrestrictmeta',
             permission => $parm_permission,
             },
           { text => 'Set/Modify Resource Parameters - Helper Mode',
@@ -2753,8 +2753,8 @@
 sub output_row {
     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'};
+    my $options=$env{'course.'.$env{'request.course.id'}.'.'.$field_name.'.options'};
+    my $values=$env{'course.'.$env{'request.course.id'}.'.'.$field_name.'.values'};
     my $checked;
     unless (defined($options)) {
         $options = 'active,stuadd';
@@ -2784,7 +2784,8 @@
     $output.='</tr>';
     return ($output);
 }
-sub setinstmeta {
+
+sub setrestrictmeta {
     my ($r)=@_;
     my $next_meta;
     my $output;
@@ -2799,9 +2800,9 @@
 						    '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.'};
+    my $key_base = $env{'course.'.$env{'request.course.id'}.'.'};
     my $save_field = '';
-    if ($env{'form.instmeta'}) {
+    if ($env{'form.restrictmeta'}) {
         foreach my $field (sort(keys(%env))) {
             if ($field=~m/^form.(.+)_(.+)$/) {
                 my $options;
@@ -2818,10 +2819,10 @@
             	    if ($env{'form.'.$meta_field.'_active'}) {
             	        $options.='active,';
             	    }
-                    my $name = 'metadata.'.$save_field;
+                    my $name = $save_field;
                      $put_result = &Apache::lonnet::put('environment',
-                                                  {'metadata.'.$meta_field.'.options'=>$options,
-                                                   'metadata.'.$meta_field.'.values'=>$env{'form.'.$meta_field.'_values'},
+                                                  {$meta_field.'.options'=>$options,
+                                                   $meta_field.'.values'=>$env{'form.'.$meta_field.'_values'},
                                                    },$dom,$crs);
                 }
             }
@@ -2835,14 +2836,14 @@
 	$output.= &output_row($r, $field, $metadata_fields{$field});
     }
     $r->print(<<ENDenv);       
-        <form method="post" action="/adm/parmset?action=setinstmeta" name="form">
+        <form method="post" action="/adm/parmset?action=setrestrictmeta" name="form">
         
         <p>
         <table border=2>
         <tr><th>Active</th><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 Portfolio Metadata">
+        <input type="submit" name="restrictmeta" value="Update Metadata Restrictions">
         </form>
 
 ENDenv
@@ -3024,6 +3025,7 @@
 ##################################################
 #    use Data::Dumper;
 
+
 sub handler {
     my $r=shift;
 
@@ -3084,10 +3086,10 @@
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
 						    text=>"Overview Mode"});
 	    &overview($r);
-        } elsif ($env{'form.action'} eq 'setinstmeta' && $parm_permission) {
-            &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setinstmeta',
-						    text=>"Portfolio Metadata"});
-	    &setinstmeta($r);
+        } elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) {
+            &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta',
+						    text=>"Restrict Metadata"});
+	    &setrestrictmeta($r);
         } elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
 						    text=>"Overview Mode"});