--- loncom/interface/lonnavmaps.pm 2004/10/04 21:35:52 1.299 +++ loncom/interface/lonnavmaps.pm 2004/10/07 22:12:47 1.300 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.299 2004/10/04 21:35:52 raeburn Exp $ +# $Id: lonnavmaps.pm,v 1.300 2004/10/07 22:12:47 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -35,7 +35,7 @@ use Apache::loncommon(); use Apache::lonmenu(); use Apache::lonlocal; use POSIX qw (floor strftime); -use Data::Dumper; # for debugging, not always used +use Data::Dumper; # for debugging, not always # symbolic constants sub SYMB { return 1; } @@ -410,7 +410,6 @@ ENDSUBM 'caller' => 'navmapsdisplay', 'linkitems' => \%toplinkitems}; my $render = render($renderArgs); - $navmap->untieHashes(); # If no resources were printed, print a reassuring message so the # user knows there was no error. @@ -1940,8 +1939,6 @@ if (location.href.indexOf('#curloc')==-1 $r->rflush(); } - if ($mustCloseNavMap) { $navmap->untieHashes(); } - return $result; } @@ -2042,10 +2039,6 @@ successful, or B if not. =back -When you are done with the $navmap object, you I call -$navmap->untieHashes(), or you'll prevent the current user from using that -course until the web server is restarted. (!) - =head2 Methods =over 4 @@ -2262,13 +2255,6 @@ sub getIterator { return $iterator; } -# unties the hash when done -sub untieHashes { - my $self = shift; - untie %{$self->{NAV_HASH}}; - untie %{$self->{PARM_HASH}}; -} - # Private method: Does the given resource (as a symb string) have # current discussion? Returns 0 if chat/mail data not extracted. sub hasDiscussion { @@ -2649,7 +2635,7 @@ sub hasResource { 1; package Apache::lonnavmaps::iterator; - +use WeakRef; =pod =back @@ -2789,7 +2775,7 @@ sub new { my $class = ref($proto) || $proto; my $self = {}; - $self->{NAV_MAP} = shift; + weaken($self->{NAV_MAP} = shift); return undef unless ($self->{NAV_MAP}); # Handle the parameters @@ -3125,7 +3111,7 @@ sub populateStack { 1; package Apache::lonnavmaps::DFSiterator; - +use WeakRef; # Not documented in the perldoc: This is a simple iterator that just walks # through the nav map and presents the resources in a depth-first search # fashion, ignorant of conditionals, randomized resources, etc. It presents @@ -3153,7 +3139,7 @@ sub new { my $class = ref($proto) || $proto; my $self = {}; - $self->{NAV_MAP} = shift; + weaken($self->{NAV_MAP} = shift); return undef unless ($self->{NAV_MAP}); $self->{FIRST_RESOURCE} = shift || $self->{NAV_MAP}->firstResource(); @@ -3307,7 +3293,7 @@ sub populateStack { 1; package Apache::lonnavmaps::resource; - +use WeakRef; use Apache::lonnet; =pod @@ -3389,7 +3375,7 @@ sub new { my $class = ref($proto) || $proto; my $self = {}; - $self->{NAV_MAP} = shift; + weaken($self->{NAV_MAP} = shift); $self->{ID} = shift; # Store this new resource in the parent nav map's cache.