Diff for /loncom/interface/lonparmset.pm between versions 1.345 and 1.346

version 1.345, 2006/11/15 20:13:43 version 1.346, 2006/11/15 22:33:13
Line 3188  ENDMAINFORMHEAD Line 3188  ENDMAINFORMHEAD
 }  }
 ### Set portfolio metadata  ### Set portfolio metadata
 sub output_row {  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;      my $output;
     $output = "<tr>";      $output = "<tr $row_class>";
     my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'};      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 $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'};
     if (!defined($options)) {      if (!defined($options)) {
Line 3198  sub output_row { Line 3204  sub output_row {
         $values = '';          $values = '';
     }      }
     if (!($options =~ /deleted/)) {      if (!($options =~ /deleted/)) {
         $output = "<tr>";          $output = "<tr $row_class>";
         $output .= '<td><span class="LC_metadata"><strong>'.$field_text.':</strong></td>';          $output .= '<td><span class="LC_metadata"><strong>'.$field_text.':</strong></span></td>';
         $output .= '<td><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>';          $output .= '<td><span class="LC_metadata"><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>';
         $output .= "</tr>\n";          $output .= "</tr>\n";
         my @options= ( ['active', 'Show to student'],          my @options= ( ['active', 'Show to student'],
    ['onlyone','Student may select only one choice'],     ['onlyone','Student may select only one choice'],
Line 3210  sub output_row { Line 3216  sub output_row {
         }          }
         foreach my $opt (@options) {          foreach my $opt (@options) {
     my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ;      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.' />'.          $field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'.
         &mt($opt->[1]).'</label></span> </td></tr>'."\n";          &mt($opt->[1]).'</label></span> </td></tr>'."\n";
  }   }
Line 3395  sub setrestrictmeta { Line 3401  sub setrestrictmeta {
     my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio');      my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio');
     # Now get possible added metadata fields      # Now get possible added metadata fields
     my $added_metadata_fields = &get_added_meta_fieldnames(\%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))) {      foreach my $field (sort(keys(%metadata_fields))) {
         if ($field ne 'courserestricted') {          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;      my $added_flag = 1;
     foreach my $field (sort(keys(%$added_metadata_fields))) {      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>";      $output .= "</table>";
     $r->print(<<ENDenv);             $r->print(<<ENDenv);       
         <form method="post" action="/adm/parmset?action=setrestrictmeta" name="form">          <form method="post" action="/adm/parmset?action=setrestrictmeta" name="form">
         <p>  
         $output          $output
         <input type="submit" name="restrictmeta" value="Update Metadata Restrictions">          <input type="submit" name="restrictmeta" value="Update Metadata Restrictions" />
         </form><br />          </form><br />
         <form method="post" action="/adm/parmset?action=addmetadata" name="form">          <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="Add a Metadata Field" />
         </form>          </form>
         </form><br />          <br />
         <form method="post" action="/adm/parmset?action=ordermetadata" name="form">          <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="Order Metadata Fields" />
         </form>          </form>
 ENDenv  ENDenv
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());

Removed from v.1.345  
changed lines
  Added in v.1.346


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>