[LON-CAPA-cvs] cvs: loncom /interface lonmeta.pm
www
lon-capa-cvs@mail.lon-capa.org
Wed, 31 May 2006 17:44:14 -0000
www Wed May 31 13:44:14 2006 EDT
Modified files:
/loncom/interface lonmeta.pm
Log:
Bug #4803: dynamic metadata again visible in lonindexer.
Still no idea why the old solution stopped working.
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.157 loncom/interface/lonmeta.pm:1.158
--- loncom/interface/lonmeta.pm:1.157 Tue May 30 08:46:09 2006
+++ loncom/interface/lonmeta.pm Wed May 31 13:44:14 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.157 2006/05/30 12:46:09 www Exp $
+# $Id: lonmeta.pm,v 1.158 2006/05/31 17:44:14 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -73,20 +73,7 @@
if (! defined($authordom) || ! defined($author)) {
return ();
}
- my @Fields = ('url','count','course','course_list',
- 'goto','goto_list',
- 'comefrom','comefrom_list',
- 'sequsage','sequsage_list',
- 'stdno','stdno_list',
- 'dependencies',
- 'avetries','avetries_list',
- 'difficulty','difficulty_list',
- 'disc','disc_list',
- 'clear','technical','correct',
- 'helpful','depth');
- #
- my $query = 'SELECT '.join(',',@Fields).
- ' FROM metadata WHERE url LIKE "'.$url.'%"';
+ my $query = 'SELECT * FROM metadata WHERE url LIKE "'.$url.'%"';
my $server = &Apache::lonnet::homeserver($author,$authordom);
my $reply = &Apache::lonnet::metadata_query($query,undef,undef,
,[$server]);
@@ -108,13 +95,9 @@
while (my $result = <$fh>) {
chomp($result);
next if (! $result);
- my @Data =
- map {
- &unescape($_);
- } split(',',$result);
- my $url = $Data[0];
- for (my $i=0;$i<=$#Fields;$i++) {
- $ReturnHash{$url}->{$Fields[$i]}=$Data[$i];
+ my %hash=&LONCAPA::lonmetadata::metadata_col_to_hash(map { &unescape($_) } split(/\,/,$result));
+ foreach my $key (keys(%hash)) {
+ $ReturnHash{$hash{'url'}}->{$key}=$hash{$key};
}
}
$finished = 1;