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

raeburn raeburn at source.lon-capa.org
Fri Sep 14 14:27:50 EDT 2018


raeburn		Fri Sep 14 18:27:50 2018 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  - Portfolio Metadata settings in course.
    - Add &mt()
    - Remove scalar ($row_alt) unused due to changes in rev. 1.347
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.585 loncom/interface/lonparmset.pm:1.586
--- loncom/interface/lonparmset.pm:1.585	Mon Sep  3 16:43:47 2018
+++ loncom/interface/lonparmset.pm	Fri Sep 14 18:27:49 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.585 2018/09/03 16:43:47 raeburn Exp $
+# $Id: lonparmset.pm,v 1.586 2018/09/14 18:27:49 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5975,7 +5975,7 @@
     my $output;
     $output .= '<form action="" method="post">';
     $output .= '<input type="hidden" name="action" value="setrestrictmeta" />';
-    $output .= '<input type="submit" value="Continue" />';
+    $output .= '<input type="submit" value="'.&mt('Continue').'" />';
     return ($output);
 }
 
@@ -6003,7 +6003,10 @@
             my $put_result = &Apache::lonnet::put('environment',
                                         {'metadata.'.$meta_field.'.options'=>$options},$dom,$crs);
 
-            $r->print('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />');
+            $r->print(&mt('Undeleted Metadata Field [_1] with result [_2]',
+                          '<strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}.
+                          '</strong>',$put_result).
+                      '<br />');
         }
         $r->print(&continue());
     } elsif (exists($env{'form.fieldname'})) {
@@ -6015,23 +6018,30 @@
                             {'metadata.'.$meta_field.'.values'=>"",
                              'metadata.'.$meta_field.'.added'=>"$display_field",
                              'metadata.'.$meta_field.'.options'=>""},$dom,$crs);
-        $r->print('Added new Metadata Field <strong>'.$env{'form.fieldname'}."</strong> with result ".$put_result.'<br />');
+        $r->print(&mt('Added new Metadata Field [_1] with result [_2]',
+                      '<strong>'.$env{'form.fieldname'}.'</strong>',$put_result).
+                  '<br />');
         $r->print(&continue());
     } else {
         my $fields = &get_deleted_meta_fieldnames($env{'request.course.id'});
         if ($fields) {
-            $r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />');
+            $r->print(&mt('You may undelete previously deleted fields.').
+                      '<br />'.
+                      &mt('Check those you wish to undelete and click Undelete.').
+                      '<br />');
             $r->print('<form method="post" action="">');
             foreach my $key(keys(%$fields)) {
                 $r->print('<label><input type="checkbox" name="undeletefield" value="'.$key.'" />'.$$fields{$key}.'</label><br /');
             }
-            $r->print('<input type="submit" name="undelete" value="Undelete" />');
+            $r->print('<input type="submit" name="undelete" value="'.&mt('Undelete').'" />');
             $r->print('</form>');
         }
-        $r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.'.
+        $r->print('<hr />'.
+                  &mt('[_1]Or[_2] you may enter a new metadata field name.',
+                      '<strong>','</strong>').
                   '<form method="post" action="/adm/parmset?action=addmetadata">');
         $r->print('<input type="text" name="fieldname" /><br />');
-        $r->print('<input type="submit" value="Add Metadata Field" />');
+        $r->print('<input type="submit" value="'.&mt('Add Metadata Field').'" />');
         $r->print('</form>');
     }
     &endSettingsScreen($r);
@@ -6058,6 +6068,11 @@
     &startSettingsScreen($r,'parmset',$crstype);
     my $key_base = $env{'course.'.$env{'request.course.id'}.'.'};
     my $save_field = '';
+    my %lt = &Apache::lonlocal::texthash(
+                                           addm => 'Add Metadata Field',
+                                           ordm => 'Order Metadata Fields',
+                                           save => 'Save',
+                                        );
     if ($env{'form.restrictmeta'}) {
         foreach my $field (sort(keys(%env))) {
             if ($field=~m/^form.(.+)_(.+)$/) {
@@ -6096,28 +6111,25 @@
     my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio');
     # Now get possible added metadata fields
     my $added_metadata_fields = &get_added_meta_fieldnames($env{'request.course.id'});
-    my $row_alt = 1;
     $output .= &Apache::loncommon::start_data_table();
     foreach my $field (sort(keys(%metadata_fields))) {
         if ($field ne 'courserestricted') {
-            $row_alt = $row_alt ? 0 : 1;
-            $output.= &output_row($r, $field, $metadata_fields{$field});
+            $output.= &output_row($r,$field,$metadata_fields{$field});
         }
     }
     my $buttons = (<<ENDButtons);
-        <input type="submit" name="restrictmeta" value="Save" />
+        <input type="submit" name="restrictmeta" value="$lt{'save'}" />
         </form><br />
         <form method="post" action="/adm/parmset?action=addmetadata" name="form1">
-        <input type="submit" name="restrictmeta" value="Add a Metadata Field" />
+        <input type="submit" name="restrictmeta" value="$lt{'addm'}" />
         </form>
         <br />
         <form method="post" action="/adm/parmset?action=ordermetadata" name="form2">
-        <input type="submit" name="restrictmeta" value="Order Metadata Fields" />
+        <input type="submit" name="restrictmeta" value="$lt{'ordm'}" />
 ENDButtons
     my $added_flag = 1;
     foreach my $field (sort(keys(%$added_metadata_fields))) {
-        $row_alt = $row_alt ? 0 : 1;
-        $output.= &output_row($r, $field, $$added_metadata_fields{$field},$added_flag, $row_alt); # FIXME: wrong parameters
+        $output.= &output_row($r,$field,$$added_metadata_fields{$field},$added_flag);
     }
     $output .= &Apache::loncommon::end_data_table();
     $r->print(<<ENDenv);




More information about the LON-CAPA-cvs mailing list