Diff for /loncom/interface/lonmeta.pm between versions 1.125 and 1.131

version 1.125, 2005/11/11 21:25:50 version 1.131, 2005/11/19 22:47:07
Line 483  sub prettyinput { Line 483  sub prettyinput {
     if (! defined($size)) {      if (! defined($size)) {
         $size = 80;          $size = 80;
     }      }
       my $output;
     if (defined($course_key)) {      if (defined($course_key)) {
         my $stu_add;          my $stu_add;
         my $only_one;          my $only_one;
           my %meta_options;
           my @cur_values_inst;
           my $cur_values_stu;
         my $values = $env{$course_key.'.metadata.'.$_.'.values'};          my $values = $env{$course_key.'.metadata.'.$_.'.values'};
         if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/stuadd/) {          if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/stuadd/) {
             $stu_add = 'true';              $stu_add = 'true';
Line 493  sub prettyinput { Line 497  sub prettyinput {
         if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/onlyone/) {          if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/onlyone/) {
             $only_one = 'true';              $only_one = 'true';
         }          }
         if ($type eq 'author') {          # need to take instructor values out of list where instructor and student
             return           # values may be mixed.
             '<input type="text" name="'.$fieldname.'" size="'.$size.'" '.          if ($values && $stu_add) {
             'value="'.$value.'" />'.              foreach (split(/,/,$values)) {
         &relatedfield(1,$relatedsearchflag,$relatedsep,$fieldname,                  $_ =~ s/^\s+//;
                       $relatedvalue);                   $meta_options{$_} = $_;
                           }
               foreach (split(/,/,$value)) {
                   $_ =~ s/^\s+//;
                   if ($meta_options{$_}) {
                       push(@cur_values_inst,$_);
                   } else {
                       $cur_values_stu .= $_.',';
                   }
               }
           } else {
               $cur_values_stu = $value;
         }          }
         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')) {
         }              if ($values) {
         if ($type eq 'subject') {                  if ($only_one) {
         }                      $output .= (&Apache::loncommon::select_form($value,'new_'.$type,%meta_options));
         if ($type eq 'keywords') {                  } else {
             my %hash;                      $output .= (&Apache::loncommon::multiple_select_form('new_'.$type,\@cur_values_inst,undef,\%meta_options));
             my $def;                  }
             my @cur_values;  
             foreach (split(/,/,$value)) {  
                 $_ =~ s/^\s+//;  
                 push(@cur_values,$_);  
             }  
             foreach (split(/,/,$values)) {  
                 $_ =~ s/^\s+//;  
                 $hash{$_} = $_;  
             }              }
             if ($only_one) {              if ($stu_add) {
                 return(&Apache::loncommon::select_form($def,'new_keywords',%hash));                  $output .= '<input type="text" name="'.$fieldname.'" size="'.$size.'" '.
             } else {                  'value="'.$cur_values_stu.'" />'.
                 return (&Apache::loncommon::multiple_select_form('new_keywords',\@cur_values,undef,\%hash));                  &relatedfield(1,$relatedsearchflag,$relatedsep,$fieldname,
                         $relatedvalue); 
             }              }
               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 1102  ENDEDIT Line 1105  ENDEDIT
                 $Apache::lonpublisher::metadatafields{$_}=                  $Apache::lonpublisher::metadatafields{$_}=
                     join(',',&Apache::loncommon::get_env_multiple('form.new_'.$_));                      join(',',&Apache::loncommon::get_env_multiple('form.new_'.$_));
             }              }
               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.'.$_.'.options'} =~ m/active/){
                     ($_ eq 'courserestricted'))  {  
                     $output.=('<p>'.$lt{$_}.': '.                      $output.=('<p>'.$lt{$_}.': '.
                             &prettyinput($_,                                &prettyinput($_,
    $Apache::lonpublisher::metadatafields{$_},     $Apache::lonpublisher::metadatafields{$_},
    'new_'.$_,'defaultmeta',undef,undef,undef,undef,$metacourse).'</p>');     'new_'.$_,'defaultmeta',undef,undef,undef,undef,$metacourse).'</p>');
                 }                   } elsif ($_ eq 'courserestricted') {
                               $output.=(
                                   &prettyinput($field_name,
       $Apache::lonpublisher::metadatafields{$_},
       'new_'.$field_name,'defaultmeta',undef,undef,undef,undef,$metacourse));
                    }
             } else {              } else {
                 $output.=('<p>'.$lt{$_}.': '.                  if ($_ ne 'courserestricted') {
                       $output.=('<p>'.$lt{$_}.': '.
                             &prettyinput($_,                              &prettyinput($_,
    $Apache::lonpublisher::metadatafields{$_},     $Apache::lonpublisher::metadatafields{$_},
    'new_'.$_,'defaultmeta').'</p>');     'new_'.$_,'defaultmeta').'</p>');
           } else {
                       $output.=&prettyinput($field_name,
      $Apache::lonpublisher::metadatafields{$_},
      '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.125  
changed lines
  Added in v.1.131


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