--- loncom/interface/lonnavmaps.pm 2005/12/02 23:06:02 1.352 +++ loncom/interface/lonnavmaps.pm 2005/12/15 00:53:30 1.354 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.352 2005/12/02 23:06:02 raeburn Exp $ +# $Id: lonnavmaps.pm,v 1.354 2005/12/15 00:53:30 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2265,6 +2265,25 @@ sub get_user_data { $self->{RETRIEVED_USER_DATA} = 1; } +sub get_discussion_data { + my $self = shift; + if ($self->{RETRIEVED_DISCUSSION_DATA}) { + return $self->{DISCUSSION_DATA}; + } + + my $cid=$env{'request.course.id'}; + my $cdom=$env{'course.'.$cid.'.domain'}; + my $cnum=$env{'course.'.$cid.'.num'}; + + # Retrieve discussion data for resources in course + my %discussion_data = &Apache::lonnet::dump($cid,$cdom,$cnum); + + $self->{DISCUSSION_DATA} = \%discussion_data; + $self->{RETRIEVED_DISCUSSION_DATA} = 1; + return $self->{DISCUSSION_DATA}; +} + + # Internal function: Takes a key to look up in the nav hash and implements internal # memory caching of that key. sub navhash { @@ -2640,19 +2659,15 @@ sub getResourceByUrl { if (ref($resUrl)) { return $resUrl; } $resUrl = &Apache::lonnet::clutter($resUrl); - if (defined($multiple)) { - if ($multiple) { - my @resIds = $self->{NAV_HASH}->{'ids_' . $resUrl}; - } - } my $resId = $self->{NAV_HASH}->{'ids_' . $resUrl}; if (!$resId) { return ''; } if ($multiple) { my @resources = (); my @resIds = split (/,/, $resId); foreach my $id (@resIds) { - if ($id) { - push(@resources,$self->getById($id)); + my $resourceId = $self->getById($id); + if ($resourceId) { + push(@resources,$resourceId); } } return @resources;