--- loncom/interface/lonmeta.pm 2005/10/31 01:49:21 1.120 +++ loncom/interface/lonmeta.pm 2005/11/07 23:03:17 1.123 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Metadata display handler # -# $Id: lonmeta.pm,v 1.120 2005/10/31 01:49:21 banghart Exp $ +# $Id: lonmeta.pm,v 1.123 2005/11/07 23:03:17 banghart Exp $ # # Copyright Michigan State University Board of Trustees # @@ -495,6 +495,9 @@ sub prettyinput { } if ($type eq 'author') { } + if ($type eq 'courserestricted') { + return (''); + } if ($type eq 'authorspace') { } if ($type eq 'modifyinguser') { @@ -504,13 +507,19 @@ sub prettyinput { if ($type eq 'keywords') { my %hash; my $def; + my @cur_values; + foreach (split(/,/,$value)) { + $_ =~ s/^\s+//; + push(@cur_values,$_); + } foreach (split(/,/,$values)) { + $_ =~ s/^\s+//; $hash{$_} = $_; } if ($only_one) { return(&Apache::loncommon::select_form($def,'new_keywords',%hash)); } else { - return(&Apache::loncommon::multiple_select_form('new_keywords',undef,undef,%hash)); + return(&Apache::loncommon::multiple_select_form('new_keywords',\@cur_values,undef,%hash)); } } if ($type eq 'notes') { @@ -1078,15 +1087,15 @@ ENDEDIT $Apache::lonpublisher::metadatafields{'copyright'}= 'default'; } - &Apache::lonnet::logthis($metacourse.' is the restriction'); foreach (@fields) { if (defined($env{'form.new_'.$_})) { $Apache::lonpublisher::metadatafields{$_}= - $env{'form.new_'.$_}; + join(',',&Apache::loncommon::get_env_multiple('form.new_'.$_)); } if ($metacourse ne 'none') { # handle restrictions here - if ($env{$metacourse.'.metadata.'.$_.'.options'} =~ m/active/) { + if (($env{$metacourse.'.metadata.'.$_.'.options'} =~ m/active/)|| + ($_ eq 'courserestricted')) { $output.=('

'.$lt{$_}.': '. &prettyinput($_, $Apache::lonpublisher::metadatafields{$_}, @@ -1104,9 +1113,9 @@ ENDEDIT my $formname='store'; my $file_content; foreach my $meta_field (keys %env) { - if (&Apache::loncommon::get_env_multiple('form.keywords')) { - $Apache::lonpublisher::metadatafields{'coursekeyword'} = - join (', ', &Apache::loncommon::get_env_multiple('form.keywords')); + if (&Apache::loncommon::get_env_multiple('form.new_keywords')) { + $Apache::lonpublisher::metadatafields{'keywords'} = + join (',', &Apache::loncommon::get_env_multiple('form.new_keywords')); } } foreach (sort keys %Apache::lonpublisher::metadatafields) {