--- loncom/interface/lonnavmaps.pm 2003/07/21 20:25:42 1.217 +++ loncom/interface/lonnavmaps.pm 2003/08/07 14:29:43 1.220 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.217 2003/07/21 20:25:42 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.220 2003/08/07 14:29:43 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -129,9 +129,7 @@ sub real_handler { $r->send_http_header; # Create the nav map - my $navmap = Apache::lonnavmaps::navmap->new( - $ENV{"request.course.fn"}.".db", - $ENV{"request.course.fn"}."_parms.db", 1, 1); + my $navmap = Apache::lonnavmaps::navmap->new(1, 1); if (!defined($navmap)) { @@ -564,11 +562,11 @@ other modules. =head1 OVERVIEW X When a user enters a course, LON-CAPA examines the - course structure and caches it in what is often referred to as the - "big hash" X. You can see it if you are logged into - LON-CAPA, in a course, by going to /adm/test. (You may need to - tweak the /home/httpd/lonTabs/htpasswd file to view it.) The - content of the hash will be under the heading "Big Hash". +course structure and caches it in what is often referred to as the +"big hash" X. You can see it if you are logged into +LON-CAPA, in a course, by going to /adm/test. (You may need to +tweak the /home/httpd/lonTabs/htpasswd file to view it.) The +content of the hash will be under the heading "Big Hash". Big Hash contains, among other things, how resources are related to each other (next/previous), what resources are maps, which @@ -1172,9 +1170,7 @@ sub render { if (!$ENV{'form.folderManip'} && !defined($args->{'iterator'})) { # Step 1: Check to see if we have a navmap if (!defined($navmap)) { - $navmap = Apache::lonnavmaps::navmap->new( - $ENV{"request.course.fn"}.".db", - $ENV{"request.course.fn"}."_parms.db", 1, 1); + $navmap = Apache::lonnavmaps::navmap->new(1, 1); $mustCloseNavMap = 1; } $navmap->init(); @@ -1238,9 +1234,7 @@ sub render { # Step 1: Check to see if we have a navmap if (!defined($navmap)) { - $navmap = Apache::lonnavmaps::navmap->new($r, - $ENV{"request.course.fn"}.".db", - $ENV{"request.course.fn"}."_parms.db", 1, 1); + $navmap = Apache::lonnavmaps::navmap->new(1, 1); $mustCloseNavMap = 1; } # Paranoia: Make sure it's ready @@ -1646,11 +1640,10 @@ To create a navmap object, use the follo =over 4 -=item * Bnew>(navHashFile, parmHashFile, +=item * Bnew>( genCourseAndUserOptions, genMailDiscussStatus, getUserData): -Binds a new navmap object to the compiled nav map hash and parm hash -given as filenames. genCourseAndUserOptions is a flag saying whether +Creates a new navmap object. genCourseAndUserOptions is a flag saying whether the course options and user options hash should be generated. This is for when you are using the parameters of the resources that require them; see documentation in resource object @@ -1692,8 +1685,6 @@ sub new { my $class = ref($proto) || $proto; my $self = {}; - $self->{NAV_HASH_FILE} = shift; - $self->{PARM_HASH_FILE} = shift; $self->{GENERATE_COURSE_USER_OPT} = shift; $self->{GENERATE_EMAIL_DISCUSS_STATUS} = shift; $self->{GET_USER_DATA} = shift; @@ -1710,12 +1701,13 @@ sub new { my %navmaphash; my %parmhash; - if (!(tie(%navmaphash, 'GDBM_File', $self->{NAV_HASH_FILE}, + my $courseFn = $ENV{"request.course.fn"}; + if (!(tie(%navmaphash, 'GDBM_File', "${courseFn}.db", &GDBM_READER(), 0640))) { return undef; } - if (!(tie(%parmhash, 'GDBM_File', $self->{PARM_HASH_FILE}, + if (!(tie(%parmhash, 'GDBM_File', "${courseFn}_parms.db", &GDBM_READER(), 0640))) { untie %{$self->{PARM_HASH}}; @@ -2027,7 +2019,7 @@ sub parmval { sub parmval_real { my $self = shift; - my ($what,$symb) = @_; + my ($what,$symb,$recurse) = @_; my $cid=$ENV{'request.course.id'}; my $csec=$ENV{'request.course.sec'}; @@ -2099,9 +2091,12 @@ sub parmval_real { my $id=pop(@parts); my $part=join('_',@parts); if ($part eq '') { $part='0'; } - my $partgeneral=$self->parmval($part.".$qualifier",$symb); + my $partgeneral=$self->parmval($part.".$qualifier",$symb,1); if (defined($partgeneral)) { return $partgeneral; } } + if ($recurse) { return undef; } + my $pack_def=&Apache::lonnet::packages_tab_default($fn,'resource.'.$what); + if (defined($pack_def)) { return $pack_def; } return ''; }