--- loncom/interface/lonnavmaps.pm 2003/05/27 21:00:23 1.193 +++ loncom/interface/lonnavmaps.pm 2003/06/10 15:45:16 1.195 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.193 2003/05/27 21:00:23 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.195 2003/06/10 15:45:16 bowersj2 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1021,7 +1021,7 @@ sub render_long_status { $result .= '(randomly select ' . $resource->randompick() .')'; } - $result .= " \n"; + $result .= " - $part  \n"; return $result; } @@ -1588,7 +1588,14 @@ sub new { return undef; } - $self->{NAV_HASH} = \%navmaphash; + # try copying into memory + my %tmpnavhash; + while (my ($k, $v) = each(%navmaphash)) { + $tmpnavhash{$k} = $v; + } + untie %navmaphash; + + $self->{NAV_HASH} = \%tmpnavhash; $self->{PARM_HASH} = \%parmhash; $self->{INITED} = 0; @@ -1779,6 +1786,16 @@ object for that resource. This method, o (as in the resource object) is the only proper way to obtain a resource object. +=item * B(symb): + +Based on the symb of the resource, get a resource object for that +resource. This is one of the proper ways to get a resource object. + +=item * B(map_pc): + +Based on the map_pc of the resource, get a resource object for +the given map. This is one of the proper ways to get a resource object. + =cut # The strategy here is to cache the resource objects, and only construct them @@ -1809,6 +1826,14 @@ sub getBySymb { return $self->getById($map->map_pc() . '.' . $id); } +sub getByMapPc { + my $self = shift; + my $map_pc = shift; + my $map_id = $self->{NAV_HASH}->{'map_id_' . $map_pc}; + $map_id = $self->{NAV_HASH}->{'ids_' . $map_id}; + return $self->getById($map_id); +} + =pod =item * B():