[LON-CAPA-cvs] cvs: loncom /interface lonsearchcat.pm /metadata_database/LONCAPA lonmetadata.pm /publisher lonpublisher.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Wed, 14 Apr 2004 18:29:32 -0000
matthew Wed Apr 14 14:29:32 2004 EDT
Modified files:
/loncom/metadata_database/LONCAPA lonmetadata.pm
/loncom/publisher lonpublisher.pm
/loncom/interface lonsearchcat.pm
Log:
Added &LONCAPA::lonmetadata::metadata_col_to_hash.
Modified lonpublisher.pm and lonsearchcat.pm to use it instead of the
version in lonmeta.pm.
Index: loncom/metadata_database/LONCAPA/lonmetadata.pm
diff -u loncom/metadata_database/LONCAPA/lonmetadata.pm:1.5 loncom/metadata_database/LONCAPA/lonmetadata.pm:1.6
--- loncom/metadata_database/LONCAPA/lonmetadata.pm:1.5 Mon Apr 12 17:11:45 2004
+++ loncom/metadata_database/LONCAPA/lonmetadata.pm Wed Apr 14 14:29:31 2004
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonmetadata.pm,v 1.5 2004/04/12 21:11:45 matthew Exp $
+# $Id: lonmetadata.pm,v 1.6 2004/04/14 18:29:31 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -372,7 +372,7 @@
=item delete_metadata()
-
+Not implemented yet
=cut
@@ -383,6 +383,27 @@
######################################################################
######################################################################
+=pod
+
+=item metdata_col_to_hash
+
+Input: Array of metadata columns
+
+Return: Hash with the metadata columns as keys and the array elements
+passed in as values
+
+=cut
+
+######################################################################
+######################################################################
+sub metadata_col_to_hash {
+ my @cols=@_;
+ my %hash=();
+ for (my $i=0; $i<=$#Metadata_Table_Description;$i++) {
+ $hash{$Metadata_Table_Description[$i]->{'name'}}=$cols[$i];
+ }
+ return %hash;
+}
######################################################################
######################################################################
@@ -560,6 +581,7 @@
return %data;
}
+
######################################################################
######################################################################
##
@@ -578,6 +600,8 @@
$str =~ s/(\W)/"%".unpack('H2',$1)/eg;
return $str;
}
+
+
1;
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.165 loncom/publisher/lonpublisher.pm:1.166
--- loncom/publisher/lonpublisher.pm:1.165 Wed Mar 31 00:24:00 2004
+++ loncom/publisher/lonpublisher.pm Wed Apr 14 14:29:32 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Publication Handler
#
-# $Id: lonpublisher.pm,v 1.165 2004/03/31 05:24:00 albertel Exp $
+# $Id: lonpublisher.pm,v 1.166 2004/04/14 18:29:32 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -126,7 +126,7 @@
use Apache::lonmysql;
use Apache::lonlocal;
use Apache::loncfile;
-use Apache::lonmeta;
+use LONCAPA::lonmetadata;
use Apache::lonmsg;
use vars qw(%metadatafields %metadatakeys);
@@ -809,7 +809,7 @@
$metadata{'url'}."'");
if ($#oldmeta==0) {
# yes, there is one old entry, transfer to newmetadata
- %newmetadata=&Apache::lonmeta::metadata_col_to_hash(@{$oldmeta[0]});
+ %newmetadata=&LONCAPA::lonmetadata::metadata_col_to_hash(@{$oldmeta[0]});
# remove old entry
$status=&Apache::lonmysql::remove_from_table
('metadata','url',$metadata{'url'});
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.205 loncom/interface/lonsearchcat.pm:1.206
--- loncom/interface/lonsearchcat.pm:1.205 Mon Mar 8 12:31:37 2004
+++ loncom/interface/lonsearchcat.pm Wed Apr 14 14:29:32 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.205 2004/03/08 17:31:37 www Exp $
+# $Id: lonsearchcat.pm,v 1.206 2004/04/14 18:29:32 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2236,11 +2236,10 @@
sub parse_raw_result {
my ($result,$hostname) = @_;
# conclude from self to others regarding fields
- my %Fields=&Apache::lonmeta::metadata_col_to_hash(
- map {
- &Apache::lonnet::unescape($_);
- } (split(/\,/,$result))
- );
+ my %Fields=&LONCAPA::lonmetadata::metadata_col_to_hash
+ (map {
+ &Apache::lonnet::unescape($_);
+ } (split(/\,/,$result)) );
return %Fields;
}