--- loncom/interface/lonmeta.pm 2005/11/15 19:20:12 1.127 +++ loncom/interface/lonmeta.pm 2005/11/18 23:47:33 1.128 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Metadata display handler # -# $Id: lonmeta.pm,v 1.127 2005/11/15 19:20:12 banghart Exp $ +# $Id: lonmeta.pm,v 1.128 2005/11/18 23:47:33 banghart Exp $ # # Copyright Michigan State University Board of Trustees # @@ -483,9 +483,13 @@ sub prettyinput { if (! defined($size)) { $size = 80; } + my $output; if (defined($course_key)) { my $stu_add; my $only_one; + my %meta_options; + my @cur_values_inst; + my $cur_values_stu; my $values = $env{$course_key.'.metadata.'.$_.'.values'}; if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/stuadd/) { $stu_add = 'true'; @@ -493,6 +497,22 @@ sub prettyinput { if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/onlyone/) { $only_one = 'true'; } + # need to take instructor values out of list where instructor and student + # values may be mixed. + if ($values && $stu_add) { + foreach (split(/,/,$values)) { + $_ =~ s/^\s+//; + $meta_options{$_} = $_; + } + foreach (split(/,/,$value)) { + $_ =~ s/^\s+//; + if ($meta_options{$_}) { + push(@cur_values_inst,$_); + } else { + $cur_values_stu .= $_.','; + } + } + } if ($type eq 'author') { return ''. + &relatedfield(1,$relatedsearchflag,$relatedsep,$fieldname, + $relatedvalue); } + return ($output); } if ($type eq 'notes') { }