--- loncom/publisher/lonpublisher.pm	2001/12/17 01:50:54	1.66
+++ loncom/publisher/lonpublisher.pm	2001/12/25 21:58:54	1.67
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.66 2001/12/17 01:50:54 harris41 Exp $
+# $Id: lonpublisher.pm,v 1.67 2001/12/25 21:58:54 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -42,6 +42,7 @@
 # 12/05 Guy Albertelli
 # 12/06,12/07 Gerd Kortemeyer
 # 12/15,12/16 Scott Harrison
+# 12/25 Gerd Kortemeyer
 #
 ###
 
@@ -541,6 +542,7 @@ sub publish {
 
 	my $keywordout='<p><b>Keywords:</b><br><table border=2><tr>';
         my $colcount=0;
+        my %keywords=();
         
 	if (length($content)<500000) {
 	    my $textonly=$content;
@@ -551,22 +553,27 @@ sub publish {
             $textonly=~s/[\$\&][a-z]\w*//g;
             $textonly=~s/[^a-z\s]//g;
 
-            my %keywords=();
             foreach ($textonly=~m/(\w+)/g) {
 		unless ($nokey{$_}) {
                    $keywords{$_}=1;
                 } 
             }
+        }
 
+            
             foreach (split(/\W+/,$metadatafields{'keywords'})) {
 		$keywords{$_}=1;
             }
 
             foreach (sort keys %keywords) {
                 $keywordout.='<td><input type=checkbox name="key.'.$_.'"';
-                if ($metadatafields{'keywords'}=~/$_/) { 
-                   $keywordout.=' checked'; 
-                }
+                if ($metadatafields{'keywords'}) {
+                   if ($metadatafields{'keywords'}=~/$_/) { 
+                      $keywordout.=' checked'; 
+                   }
+	        } elsif (&Apache::loncommon::keyword($_)) {
+		    $keywordout.=' checked';
+                } 
                 $keywordout.='>'.$_.'</td>';
                 if ($colcount>10) {
 		    $keywordout.="</tr><tr>\n";
@@ -574,10 +581,6 @@ sub publish {
                 }
                 $colcount++;
             }
-
-        } else {
-	    $keywordout.='<td>File too long for keyword analysis</td>';
-        }         
         
 	$keywordout.='</tr></table>';