Diff for /loncom/interface/lonmeta.pm between versions 1.129 and 1.133

version 1.129, 2005/11/19 00:00:38 version 1.133, 2005/11/22 23:20:40
Line 243  sub fieldnames { Line 243  sub fieldnames {
          'authorspace' => 'Author Space',           'authorspace' => 'Author Space',
          'modifyinguser' => 'Last Modifying User',           'modifyinguser' => 'Last Modifying User',
          'subject' => 'Subject',           'subject' => 'Subject',
            'standards' => 'Standards',
          'keywords' => 'Keyword(s)',           'keywords' => 'Keyword(s)',
          'notes' => 'Notes',           'notes' => 'Notes',
          'abstract' => 'Abstract',           'abstract' => 'Abstract',
Line 254  sub fieldnames { Line 255  sub fieldnames {
         %fields =           %fields = 
         (%fields,          (%fields,
          'domain' => 'Domain',           'domain' => 'Domain',
          'standards' => 'Standards',  
          'mime' => 'MIME Type',           'mime' => 'MIME Type',
          'language' => 'Language',           'language' => 'Language',
          'creationdate' => 'Creation Date',           'creationdate' => 'Creation Date',
Line 284  sub fieldnames { Line 284  sub fieldnames {
          'stdno'      => 'Total number of students who have worked on this problem',           'stdno'      => 'Total number of students who have worked on this problem',
          'difficulty' => 'Degree of difficulty',           'difficulty' => 'Degree of difficulty',
          'disc'       => 'Degree of discrimination',           'disc'       => 'Degree of discrimination',
  'dependencies' => 'Resources used by this resource',       'dependencies' => 'Resources used by this resource',
          );           );
     }      }
     return &Apache::lonlocal::texthash(%fields);      return &Apache::lonlocal::texthash(%fields);
Line 490  sub prettyinput { Line 490  sub prettyinput {
         my %meta_options;          my %meta_options;
         my @cur_values_inst;          my @cur_values_inst;
         my $cur_values_stu;          my $cur_values_stu;
         my $values = $env{$course_key.'.metadata.'.$_.'.values'};          my $values = $env{$course_key.'.metadata.'.$type.'.values'};
         if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/stuadd/) {          if ($env{$course_key.'.metadata.'.$type.'.options'} =~ m/stuadd/) {
             $stu_add = 'true';              $stu_add = 'true';
         }          }
         if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/onlyone/) {          if ($env{$course_key.'.metadata.'.$type.'.options'} =~ m/onlyone/) {
             $only_one = 'true';              $only_one = 'true';
         }          }
         # need to take instructor values out of list where instructor and student          # need to take instructor values out of list where instructor and student
         # values may be mixed.          # values may be mixed.
         if ($values && $stu_add) {          if ($values) {
             foreach (split(/,/,$values)) {              foreach my $item (split(/,/,$values)) {
                 $_ =~ s/^\s+//;                  $item =~ s/^\s+//;
                 $meta_options{$_} = $_;                  $meta_options{$item} = $item;
             }              }
             foreach (split(/,/,$value)) {              foreach my $item (split(/,/,$value)) {
                 $_ =~ s/^\s+//;                  $item =~ s/^\s+//;
                 if ($meta_options{$_}) {                  if ($meta_options{$item}) {
                     push(@cur_values_inst,$_);                      push(@cur_values_inst,$item);
                 } else {                  } else {
                     $cur_values_stu .= $_.',';                      $cur_values_stu .= $item.',';
                 }                  }
             }              }
         } else {          } else {
             $cur_values_stu = $value;              $cur_values_stu = $value;
         }          }
         if ($type eq 'author') {  
             return   
             '<input type="text" name="'.$fieldname.'" size="'.$size.'" '.  
             'value="'.$value.'" />'.  
         &relatedfield(1,$relatedsearchflag,$relatedsep,$fieldname,  
                       $relatedvalue);   
               
         }  
         if ($type eq 'courserestricted') {          if ($type eq 'courserestricted') {
             return ('<input type="hidden" name="new_courserestricted" value="'.$course_key.'" />');              return ('<input type="hidden" name="new_courserestricted" value="'.$course_key.'" />');
         }          }
         if ($type eq 'authorspace') {          if (($type eq 'keywords') || ($type eq 'subject')
         }               || ($type eq 'author')||($type eq  'notes')
         if ($type eq 'modifyinguser') {               || ($type eq  'abstract')|| ($type eq  'title')|| ($type eq  'standards')) {
         }  
         if ($type eq 'subject') {  
         }  
         if ($type eq 'keywords') {  
             if ($values) {              if ($values) {
                 if ($only_one) {                  if ($only_one) {
                     $output .= (&Apache::loncommon::select_form($value,'new_keywords',%meta_options));                      $output .= (&Apache::loncommon::select_form($value,'new_'.$type,%meta_options));
                 } else {                  } else {
                     $output .= (&Apache::loncommon::multiple_select_form('new_keywords',\@cur_values_inst,undef,\%meta_options));                      $output .= (&Apache::loncommon::multiple_select_form('new_'.$type,\@cur_values_inst,undef,\%meta_options));
                 }                  }
             }              }
             if ($stu_add) {              if ($stu_add) {
Line 548  sub prettyinput { Line 536  sub prettyinput {
             }              }
             return ($output);              return ($output);
         }          }
         if ($type eq  'notes') {  
         }  
         if ($type eq  'abstract') {  
  }  
   
         if (($type eq 'lowestgradelevel') ||          if (($type eq 'lowestgradelevel') ||
     ($type eq 'highestgradelevel')) {      ($type eq 'highestgradelevel')) {
     return &Apache::loncommon::select_level_form($value,$fieldname).      return &Apache::loncommon::select_level_form($value,$fieldname).
Line 1088  ENDEDIT Line 1071  ENDEDIT
  my @fields;   my @fields;
  if ($file_type eq 'portfolio') {   if ($file_type eq 'portfolio') {
     @fields =  ('author','title','subject','keywords','abstract','notes','lowestgradelevel',      @fields =  ('author','title','subject','keywords','abstract','notes','lowestgradelevel',
                 'highestgradelevel','courserestricted');                  'highestgradelevel','standards','courserestricted');
  } else {   } else {
     @fields = ('author','title','subject','keywords','abstract','notes',      @fields = ('author','title','subject','keywords','abstract','notes',
                  'copyright','customdistributionfile','language',                   'copyright','customdistributionfile','language',
Line 1116  ENDEDIT Line 1099  ENDEDIT
         if ($metacourse ne 'none') {          if ($metacourse ne 'none') {
              $r->print('Document metadata restricted by :<strong> '.$env{$metacourse.".description"}."</strong><br />");               $r->print('Document metadata restricted by :<strong> '.$env{$metacourse.".description"}."</strong><br />");
         }          }
                   foreach my $field_name(@fields) {
         foreach (@fields) {  
             if (defined($env{'form.new_'.$_})) {              if (defined($env{'form.new_'.$field_name})) {
                 $Apache::lonpublisher::metadatafields{$_}=                  $Apache::lonpublisher::metadatafields{$field_name}=
                     join(',',&Apache::loncommon::get_env_multiple('form.new_'.$_));                      join(',',&Apache::loncommon::get_env_multiple('form.new_'.$field_name));
             }              }
             my $field_name = $_;  
             if ($metacourse ne 'none') {              if ($metacourse ne 'none') {
                 # handle restrictions here                  # handle restrictions here
                 if ($env{$metacourse.'.metadata.'.$_.'.options'} =~ m/active/){                  if ($env{$metacourse.'.metadata.'.$field_name.'.options'} =~ m/active/){
                     $output.=('<p>'.$lt{$_}.': '.                      $output.=('<p>'.$lt{$field_name}.': '.
                               &prettyinput($_,                                &prettyinput($field_name,
    $Apache::lonpublisher::metadatafields{$_},     $Apache::lonpublisher::metadatafields{$field_name},
    'new_'.$_,'defaultmeta',undef,undef,undef,undef,$metacourse).'</p>');     'new_'.$field_name,'defaultmeta',undef,undef,undef,undef,$metacourse).'</p>');
                  } elsif ($_ eq 'courserestricted') {                   } elsif ($field_name eq 'courserestricted') {
                             $output.=(                              $output.=(
                                 &prettyinput($field_name,                                  &prettyinput($field_name,
     $Apache::lonpublisher::metadatafields{$_},      $Apache::lonpublisher::metadatafields{$field_name},
     'new_'.$field_name,'defaultmeta',undef,undef,undef,undef,$metacourse));      'new_'.$field_name,'defaultmeta',undef,undef,undef,undef,$metacourse));
                  }                   }
             } else {              } else {
                 if ($_ ne 'courserestricted') {                  if ($field_name ne 'courserestricted') {
                     $output.=('<p>'.$lt{$_}.': '.                      $output.=('<p>'.$lt{$field_name}.': '.
                             &prettyinput($_,                              &prettyinput($field_name,
    $Apache::lonpublisher::metadatafields{$_},     $Apache::lonpublisher::metadatafields{$field_name},
    'new_'.$_,'defaultmeta').'</p>');     'new_'.$field_name,'defaultmeta').'</p>');
         } else {          } else {
                     $output.=&prettyinput($field_name,                      $output.=&prettyinput($field_name,
    $Apache::lonpublisher::metadatafields{$_},     $Apache::lonpublisher::metadatafields{$field_name},
    'new_'.$field_name,'defaultmeta');     'new_'.$field_name,'defaultmeta');
                 }                  }
             }              }
         }          }
         $output.=('<p>'.$lt{$_}.': '.  
                  &prettyinput($_,  
  $Apache::lonpublisher::metadatafields{$_},  
  'new_'.$_,'defaultmeta',undef,undef,undef,undef,$metacourse).'</p>');  
   
         if ($env{'form.store'}) {          if ($env{'form.store'}) {
             my $mfh;              my $mfh;
             my $formname='store';               my $formname='store'; 

Removed from v.1.129  
changed lines
  Added in v.1.133


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