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

banghart lon-capa-cvs@mail.lon-capa.org
Wed, 15 Nov 2006 22:33:14 -0000


banghart		Wed Nov 15 17:33:14 2006 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  	Improve appearance of restrict metadata.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.345 loncom/interface/lonparmset.pm:1.346
--- loncom/interface/lonparmset.pm:1.345	Wed Nov 15 15:13:43 2006
+++ loncom/interface/lonparmset.pm	Wed Nov 15 17:33:13 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.345 2006/11/15 20:13:43 banghart Exp $
+# $Id: lonparmset.pm,v 1.346 2006/11/15 22:33:13 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3188,9 +3188,15 @@
 }
 ### Set portfolio metadata
 sub output_row {
-    my ($r, $field_name, $field_text, $added_flag) = @_;
+    my ($r, $field_name, $field_text, $added_flag, $alt_row) = @_;
+    my $row_class;
+    if ($alt_row) {
+        $row_class = ' class="LC_metadata_light" ';
+    } else {
+        $row_class = ' class="LC_metadata_dark" ';
+    }
     my $output;
-    $output = "<tr>";
+    $output = "<tr $row_class>";
     my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'};
     my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'};
     if (!defined($options)) {
@@ -3198,9 +3204,9 @@
         $values = '';
     }
     if (!($options =~ /deleted/)) {
-        $output = "<tr>";
-        $output .= '<td><span class="LC_metadata"><strong>'.$field_text.':</strong></td>';
-        $output .= '<td><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>';
+        $output = "<tr $row_class>";
+        $output .= '<td><span class="LC_metadata"><strong>'.$field_text.':</strong></span></td>';
+        $output .= '<td><span class="LC_metadata"><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>';
         $output .= "</tr>\n";
         my @options= ( ['active', 'Show to student'],
 		   ['onlyone','Student may select only one choice'],
@@ -3210,7 +3216,7 @@
         }
         foreach my $opt (@options) {
 	    my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ;
-	    $output .= '<tr><td colspan="2">'.('&nbsp;' x 5).'<span class="LC_metadata"><label><input type="checkbox" name="'.
+	    $output .= '<tr '.$row_class.'><td colspan="2">'.('&nbsp;' x 5).'<span class="LC_metadata"><label><input type="checkbox" name="'.
 	        $field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'.
 	        &mt($opt->[1]).'</label></span> </td></tr>'."\n";
 	}
@@ -3395,29 +3401,31 @@
     my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio');
     # Now get possible added metadata fields
     my $added_metadata_fields = &get_added_meta_fieldnames(\%metadata_fields);
-    $output .= "<table>";
+    my $row_alt = 1;
+    $output .= '<table class="LC_metadata_table" cellspacing="0">';
     foreach my $field (sort(keys(%metadata_fields))) {
         if ($field ne 'courserestricted') {
-	    $output.= &output_row($r, $field, $metadata_fields{$field});
+            $row_alt = $row_alt ? 0 : 1;
+	    $output.= &output_row($r, $field, $metadata_fields{$field}, undef, $row_alt);
 	}
     }
     my $added_flag = 1;
     foreach my $field (sort(keys(%$added_metadata_fields))) {
-        $output.= &output_row($r, $field, $$added_metadata_fields{$field},$added_flag);
+        $row_alt = $row_alt ? 0 : 1;
+        $output.= &output_row($r, $field, $$added_metadata_fields{$field},$added_flag, $row_alt);
     }
     $output .= "</table>";
     $r->print(<<ENDenv);       
         <form method="post" action="/adm/parmset?action=setrestrictmeta" name="form">
-        <p>
         $output
-        <input type="submit" name="restrictmeta" value="Update Metadata Restrictions">
+        <input type="submit" name="restrictmeta" value="Update Metadata Restrictions" />
         </form><br />
-        <form method="post" action="/adm/parmset?action=addmetadata" name="form">
-        <input type="submit" name="restrictmeta" value="Add a Metadata Field">
+        <form method="post" action="/adm/parmset?action=addmetadata" name="form1">
+        <input type="submit" name="restrictmeta" value="Add a Metadata Field" />
         </form>
-        </form><br />
-        <form method="post" action="/adm/parmset?action=ordermetadata" name="form">
-        <input type="submit" name="restrictmeta" value="Order Metadata Fields">
+        <br />
+        <form method="post" action="/adm/parmset?action=ordermetadata" name="form2">
+        <input type="submit" name="restrictmeta" value="Order Metadata Fields" />
         </form>
 ENDenv
     $r->print(&Apache::loncommon::end_page());