[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 05 Aug 2002 21:02:07 -0000
albertel Mon Aug 5 17:02:07 2002 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
- tries to generate correct part 0 information
BUG#285
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.260 loncom/lonnet/perl/lonnet.pm:1.261
--- loncom/lonnet/perl/lonnet.pm:1.260 Fri Aug 2 17:11:55 2002
+++ loncom/lonnet/perl/lonnet.pm Mon Aug 5 17:02:07 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.260 2002/08/02 21:11:55 ng Exp $
+# $Id: lonnet.pm,v 1.261 2002/08/05 21:02:07 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2703,11 +2703,40 @@
# the next is the end of "start tag"
}
}
+ &metadata_generate_part0(\%metathesekeys,\%metacache,$uri);
$metacache{$uri.':keys'}=join(',',keys %metathesekeys);
$metacache{$uri.':cachedtimestamp'}=time;
# this is the end of "was not already recently cached
}
return $metacache{$uri.':'.$what};
+}
+
+sub metadata_generate_part0 {
+ my ($metadata,$metacache,$uri) = @_;
+ my %allnames;
+ foreach my $metakey (sort keys %$metadata) {
+ if ($metakey=~/^parameter\_(.*)/) {
+ my $part=$$metacache{$uri.':'.$metakey.'.part'};
+ my $name=$$metacache{$uri.':'.$metakey.'.name'};
+ if (! exists($$metadata{'parameter_0_'.$name})) {
+ $allnames{$name}=$part;
+ }
+ }
+ }
+ foreach my $name (keys(%allnames)) {
+ $$metadata{"parameter_0_$name"}=1;
+ my $key="$uri:parameter_0_$name";
+ $$metacache{"$key.part"}='0';
+ $$metacache{"$key.name"}=$name;
+ $$metacache{"$key.type"}=$$metacache{$uri.':parameter_'.
+ $allnames{$name}.'_'.$name.
+ '.type'};
+ my $olddis=$$metacache{$uri.':parameter_'.$allnames{$name}.'_'.$name.
+ '.display'};
+ my $expr='\\[Part: '.$allnames{$name}.'\\]';
+ $olddis=~s/$expr/\[Part: 0\]/;
+ $$metacache{"$key.display"}=$olddis;
+ }
}
# ------------------------------------------------- Update symbolic store links