--- loncom/lonnet/perl/lonnet.pm 2001/08/04 14:45:28 1.137 +++ loncom/lonnet/perl/lonnet.pm 2001/08/07 14:33:53 1.141 @@ -122,7 +122,7 @@ # 5/30 H. K. Ng # 6/1 Gerd Kortemeyer # July Guy Albertelli -# 8/4 Gerd Kortemeyer +# 8/4,8/7 Gerd Kortemeyer package Apache::lonnet; @@ -896,7 +896,7 @@ sub rolesinit { my $author=0; map { %thesepriv=(); - if ($_!~/^st/) { $adv=1; } + if (($_!~/^st/) && ($_!~/^ta/)) { $adv=1; } if (($_=~/^au/) || ($_=~/^ca/)) { $author=1; } map { if ($_ ne '') { @@ -1846,15 +1846,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,21 +1868,23 @@ sub metadata { } else { $metacache{$uri.':packages'}=$package.$keyroot; } - undef %thispackagekeys; map { if ($_=~/^$package\&/) { my ($pack,$name,$subp)=split(/\&/,$_); - my $unikey='parameter_'.$keyroot.'_'.$name; - $thispackagekeys{$unikey}=1; - $metacache{$uri.':'.$unikey.'.'.$subp}=$packagetab{$_}; + my $value=$packagetab{$_}; + if ($subp eq 'display') { + my $part=$keyroot; + $part=~s/^\_//; + $value.=' [Part: '.$part.']'; + } + my $unikey='parameter'.$keyroot.'_'.$name; + $metathesekeys{$unikey}=1; + 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; @@ -1894,11 +1897,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]}; @@ -1908,8 +1907,9 @@ sub metadata { $metacache{$uri.':'.$unikey.'.default'}; } } - } + } } + $metacache{$uri.':keys'}=join(',',keys %metathesekeys); } return $metacache{$uri.':'.$what}; }