[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm
bowersj2
lon-capa-cvs@mail.lon-capa.org
Tue, 15 Oct 2002 19:51:25 -0000
bowersj2 Tue Oct 15 15:51:25 2002 EDT
Modified files:
/loncom/interface lonnavmaps.pm
Log:
Three small changes:
* There seems to be some people making 'multipart problems' that have only
one part. The display will no longer show "(1 parts)". It occurs to me
as I write this that I also ought to prevent the detail display, so that
1-part multipart problems look just like single-part problems on the nav
map. See next commit, I guess.
* The resource object only tries to retrieve info about multiple parts if
the resource is a problem. (The lack of metadata for course documents
was causing the faulty "host down" errors; those should now stop unless
you put problems into the course doc area. Bad bad bad!)
* Showing all resources and re-closing some of the folders should work
again; I thought I had that right but I guess not.
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.81 loncom/interface/lonnavmaps.pm:1.82
--- loncom/interface/lonnavmaps.pm:1.81 Mon Oct 14 14:48:13 2002
+++ loncom/interface/lonnavmaps.pm Tue Oct 15 15:51:25 2002
@@ -2,7 +2,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.81 2002/10/14 18:48:13 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.82 2002/10/15 19:51:25 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1135,7 +1135,8 @@
# Display the correct icon, link to open or shut map
if ($curRes->is_map()) {
my $mapId = $curRes->map_pc();
- my $nowOpen = !defined($filterHash{$mapId});
+ my $nowOpen = (!defined($filterHash{$mapId}));
+ if ($condition) {$nowOpen = !$nowOpen;}
$icon = $nowOpen ?
"navmap.folder.closed.gif" : "navmap.folder.open.gif";
$icon = "<img src=\"/adm/lonIcons/$icon\" alt=\"\" border=\"0\" />";
@@ -1201,7 +1202,7 @@
$partLabel = " (Part $part)";
$title = "";
}
- if ($multipart && $condensed) {
+ if ($multipart && $condensed && $curRes->countParts > 1) {
$nonLinkedText .= ' (' . $curRes->countParts() . ' parts)';
}
@@ -2581,24 +2582,26 @@
$self->{PARTS} = [];
- # Retrieve part count
- my $metadata = &Apache::lonnet::metadata($self->src(), 'allpossiblekeys');
- if (!$metadata) {
- $self->{RESOURCE_ERROR} = 1;
- $self->{PARTS} = [];
- return;
- }
-
- foreach (split(/\,/,$metadata)) {
- if ($_ =~ /^parameter\_(.*)\_opendate$/) {
- push @{$self->{PARTS}}, $1;
+ # Retrieve part count, if this is a problem
+ if ($self->is_problem()) {
+ my $metadata = &Apache::lonnet::metadata($self->src(), 'allpossiblekeys');
+ if (!$metadata) {
+ $self->{RESOURCE_ERROR} = 1;
+ $self->{PARTS} = [];
+ return;
+ }
+
+ foreach (split(/\,/,$metadata)) {
+ if ($_ =~ /^parameter\_(.*)\_opendate$/) {
+ push @{$self->{PARTS}}, $1;
+ }
}
+
+
+ # Is this possible to do in one line? - Jeremy
+ my @sortedParts = sort @{$self->{PARTS}};
+ $self->{PARTS} = \@sortedParts;
}
-
-
- # Is this possible to do in one line? - Jeremy
- my @sortedParts = sort @{$self->{PARTS}};
- $self->{PARTS} = \@sortedParts;
return;
}