--- loncom/interface/lonnavmaps.pm 2003/02/21 20:05:00 1.145 +++ loncom/interface/lonnavmaps.pm 2003/03/23 07:12:41 1.166 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.145 2003/02/21 20:05:00 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.166 2003/03/23 07:12:41 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -38,17 +38,18 @@ # YEAR=2002 # 1/1 Gerd Kortemeyer # Oct-Nov Jeremy Bowers +# YEAR=2003 +# Jeremy Bowers ... lots of days package Apache::lonnavmaps; +use vars qw($test @refsToUntie %navmaphash %parmhash); use strict; use Apache::Constants qw(:common :http); use Apache::loncommon(); +use Apache::lonmenu(); use POSIX qw (floor strftime); -my %navmaphash; -my %parmhash; - # symbolic constants sub SYMB { return 1; } sub URL { return 2; } @@ -95,8 +96,12 @@ my %colormap = # And a special case in the nav map; what to do when the assignment # is not yet done and due in less then 24 hours my $hurryUpColor = "#FF0000"; - +$test = 'abc'; sub cleanup { + &Apache::lonnet::logthis("Cleanup called."); + &Apache::lonnet::logthis("refs size".scalar(@refsToUntie)); + &Apache::lonnet::logthis("test is ".$test); + $test = '467'; if (tied(%navmaphash)){ &Apache::lonnet::logthis('Cleanup navmaps: navmaphash'); unless (untie(%navmaphash)) { @@ -109,6 +114,15 @@ sub cleanup { &Apache::lonnet::logthis('Failed cleanup navmaps: parmhash'); } } + # Apparently, if you take a reference to a tied hash, both the + # original hash and the tied hash must be untied. Bleh. + for my $ref (@refsToUntie) { + &Apache::lonnet::logthis('Cleanup navmaps: reference'); + unless (untie($ref)) { + &Apache::lonnet::logthis('Failed cleanup navmaps: reference'); + } + } + @refsToUntie = (); } sub handler { @@ -140,7 +154,7 @@ sub real_handler { $r->send_http_header; # Create the nav map - my $navmap = Apache::lonnavmaps::navmap->new( + my $navmap = Apache::lonnavmaps::navmap->new($r, $ENV{"request.course.fn"}.".db", $ENV{"request.course.fn"}."_parms.db", 1, 1); @@ -152,11 +166,22 @@ sub real_handler { } $r->print("
\n"); - $r->print("