--- loncom/lonnet/perl/lonnet.pm	2001/08/04 20:13:17	1.139
+++ loncom/lonnet/perl/lonnet.pm	2001/08/08 17:56:57	1.144
@@ -122,7 +122,7 @@
 # 5/30 H. K. Ng
 # 6/1 Gerd Kortemeyer
 # July Guy Albertelli
-# 8/4 Gerd Kortemeyer
+# 8/4,8/7,8/8 Gerd Kortemeyer
 
 package Apache::lonnet;
 
@@ -1823,6 +1823,12 @@ sub EXT {
       $metadata=&metadata($ENV{'request.filename'},
                                          'parameter_'.$spacequalifierrest);
       if ($metadata) { return $metadata; }
+      
+      $spacequalifierrest=~/[^\_]+$/;
+      
+      $metadata=&metadata($ENV{'request.filename'},'parameter_0'.$1);
+
+      if ($metadata) { return $metadata; }
 
 # ---------------------------------------------------- Any other user namespace
     } elsif ($realm eq 'environment') {
@@ -1846,15 +1852,16 @@ sub metadata {
     my $filename=$uri;
     $uri=~s/\.meta$//;
     unless ($metacache{$uri.':keys'}) {
+        my %metathesekeys=();
         unless ($filename=~/\.meta$/) { $filename.='.meta'; }
 	my $metastring=&getfile($perlvar{'lonDocRoot'}.'/res/'.$filename);
         my $parser=HTML::TokeParser->new(\$metastring);
         my $token;
+        undef %metathesekeys;
         while ($token=$parser->get_token) {
            if ($token->[0] eq 'S') {
 	     if (defined($token->[2]->{'package'})) {
 	      my $package=$token->[2]->{'package'};
-              my %thispackagekeys=();
 	      my $keyroot='';
               if (defined($token->[2]->{'part'})) { 
                  $keyroot.='_'.$token->[2]->{'part'}; 
@@ -1867,27 +1874,24 @@ sub metadata {
               } else {
                  $metacache{$uri.':packages'}=$package.$keyroot;
 	      }
-              undef %thispackagekeys;
               map {
 		  if ($_=~/^$package\&/) {
 		      my ($pack,$name,$subp)=split(/\&/,$_);
                       my $value=$packagetab{$_};
+		      my $part=$keyroot;
+                      $part=~s/^\_//;
                       if ($subp eq 'display') {
-			  my $part=$keyroot;
-                          $part=~s/^\_//;
 			  $value.=' [Part: '.$part.']';
                       }
                       my $unikey='parameter'.$keyroot.'_'.$name;
-                      $thispackagekeys{$unikey}=1;
-                      $metacache{$uri.':'.$unikey.'.'.$subp}=$value;
+                      $metathesekeys{$unikey}=1;
+                      $metacache{$uri.':'.$unikey.'.part'}=$part;
+                      unless 
+                       (defined($metacache{$uri.':'.$unikey.'.'.$subp})) {
+                         $metacache{$uri.':'.$unikey.'.'.$subp}=$value;
+		      }
                   }
               } keys %packagetab;
-              my $addpackagekeys=join(',',keys %thispackagekeys);
-              if ($metacache{$uri.':keys'}) {
-                 $metacache{$uri.':keys'}.=','.$addpackagekeys;
-              } else {
-                 $metacache{$uri.':keys'}=$addpackagekeys;
-	      }
              } else {
 	      my $entry=$token->[1];
               my $unikey=$entry;
@@ -1900,11 +1904,7 @@ sub metadata {
               if (defined($token->[2]->{'name'})) { 
                  $unikey.='_'.$token->[2]->{'name'}; 
 	      }
-              if ($metacache{$uri.':keys'}) {
-                 $metacache{$uri.':keys'}.=','.$unikey;
-              } else {
-                 $metacache{$uri.':keys'}=$unikey;
-	      }
+              $metathesekeys{$unikey}=1;
               map {
 		  $metacache{$uri.':'.$unikey.'.'.$_}=$token->[2]->{$_};
               } @{$token->[3]};
@@ -1914,8 +1914,9 @@ sub metadata {
 			      $metacache{$uri.':'.$unikey.'.default'};
 		      }
 	    }
-	  }
+	 }
        }
+       $metacache{$uri.':keys'}=join(',',keys %metathesekeys);
     }
     return $metacache{$uri.':'.$what};
 }
@@ -2203,7 +2204,11 @@ if ($readit ne 'done') {
     while (my $configline=<$config>) {
        chomp($configline);
        my ($short,$plain)=split(/:/,$configline);
-       if ($plain ne '') { $packagetab{$short}=$plain; }
+       my ($pack,$name)=split(/\&/,$short);
+       if ($plain ne '') {
+          $packagetab{$pack.'&'.$name.'&name'}=$name; 
+          $packagetab{$short}=$plain; 
+       }
     }
 }