[LON-CAPA-cvs] cvs: loncom /interface lonmeta.pm

banghart lon-capa-cvs@mail.lon-capa.org
Mon, 07 Nov 2005 23:03:17 -0000


banghart		Mon Nov  7 18:03:17 2005 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm 
  Log:
  	Metadata keywords multiple select now working.
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.122 loncom/interface/lonmeta.pm:1.123
--- loncom/interface/lonmeta.pm:1.122	Tue Nov  1 20:02:31 2005
+++ loncom/interface/lonmeta.pm	Mon Nov  7 18:03:17 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.122 2005/11/02 01:02:31 banghart Exp $
+# $Id: lonmeta.pm,v 1.123 2005/11/07 23:03:17 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -507,6 +507,11 @@
         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{$_} = $_;
@@ -514,7 +519,7 @@
             if ($only_one) {
                 return(&Apache::loncommon::select_form($def,'new_keywords',%hash));
             } else {
-                return(&Apache::loncommon::multiple_select_form('new_keywords',$value,undef,%hash));
+                return(&Apache::loncommon::multiple_select_form('new_keywords',\@cur_values,undef,%hash));
             }
         }
         if ($type eq  'notes') {
@@ -1085,7 +1090,7 @@
         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
@@ -1109,7 +1114,7 @@
             my $file_content;
             foreach my $meta_field (keys %env) {
                 if (&Apache::loncommon::get_env_multiple('form.new_keywords')) {
-                $Apache::lonpublisher::metadatafields{'keywords'} = 
+                    $Apache::lonpublisher::metadatafields{'keywords'} = 
                         join (',', &Apache::loncommon::get_env_multiple('form.new_keywords'));
                 }
             }