--- loncom/interface/lonmeta.pm 2005/11/15 19:20:12 1.127
+++ loncom/interface/lonmeta.pm 2005/11/19 22:47:07 1.131
@@ -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.131 2005/11/19 22:47:07 albertel 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,45 +497,45 @@ sub prettyinput {
if ($env{$course_key.'.metadata.'.$_.'.options'} =~ m/onlyone/) {
$only_one = 'true';
}
- if ($type eq 'author') {
- return
- ''.
- &relatedfield(1,$relatedsearchflag,$relatedsep,$fieldname,
- $relatedvalue);
-
+ # 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 .= $_.',';
+ }
+ }
+ } else {
+ $cur_values_stu = $value;
}
if ($type eq 'courserestricted') {
return ('');
}
- if ($type eq 'authorspace') {
- }
- if ($type eq 'modifyinguser') {
- }
- if ($type eq 'subject') {
- }
- if ($type eq 'keywords') {
- my %hash;
- my @cur_values;
- foreach (split(/,/,$value)) {
- $_ =~ s/^\s+//;
- push(@cur_values,$_);
- }
- foreach (split(/,/,$values)) {
- $_ =~ s/^\s+//;
- $hash{$_} = $_;
+ if (($type eq 'keywords') || ($type eq 'subject')
+ || ($type eq 'author')||($type eq 'notes')
+ || ($type eq 'abstract')|| ($type eq 'title')) {
+ if ($values) {
+ if ($only_one) {
+ $output .= (&Apache::loncommon::select_form($value,'new_'.$type,%meta_options));
+ } else {
+ $output .= (&Apache::loncommon::multiple_select_form('new_'.$type,\@cur_values_inst,undef,\%meta_options));
+ }
}
- if ($only_one) {
- return(&Apache::loncommon::select_form($value,'new_keywords',%hash));
- } else {
- return (&Apache::loncommon::multiple_select_form('new_keywords',\@cur_values,undef,\%hash));
+ if ($stu_add) {
+ $output .= ''.
+ &relatedfield(1,$relatedsearchflag,$relatedsep,$fieldname,
+ $relatedvalue);
}
+ return ($output);
}
- if ($type eq 'notes') {
- }
- if ($type eq 'abstract') {
- }
-
if (($type eq 'lowestgradelevel') ||
($type eq 'highestgradelevel')) {
return &Apache::loncommon::select_level_form($value,$fieldname).