[LON-CAPA-cvs] cvs: loncom /interface lonhelper.pm lonnavmaps.pm

bowersj2 lon-capa-cvs@mail.lon-capa.org
Thu, 29 May 2003 17:39:41 -0000


bowersj2		Thu May 29 13:39:41 2003 EDT

  Modified files:              
    /loncom/interface	lonhelper.pm lonnavmaps.pm 
  Log:
  Fixes bug 1511.
  
  
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.34 loncom/interface/lonhelper.pm:1.35
--- loncom/interface/lonhelper.pm:1.34	Tue May 27 15:59:38 2003
+++ loncom/interface/lonhelper.pm	Thu May 29 13:39:40 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # .helper XML handler to implement the LON-CAPA helper
 #
-# $Id: lonhelper.pm,v 1.34 2003/05/27 19:59:38 bowersj2 Exp $
+# $Id: lonhelper.pm,v 1.35 2003/05/29 17:39:40 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2669,7 +2669,7 @@
         my $navmap = Apache::lonnavmaps::navmap->new(
                            $ENV{"request.course.fn"}.".db",
                            $ENV{"request.course.fn"}."_parms.db", 0, 0);
-        my $res = $navmap->getById($vars->{RESOURCE_ID});
+        my $res = $navmap->getByMapPc($vars->{RESOURCE_ID});
         my $title = $res->compTitle();
         $symb = $res->symb();
         $navmap->untieHashes();
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.193 loncom/interface/lonnavmaps.pm:1.194
--- loncom/interface/lonnavmaps.pm:1.193	Tue May 27 17:00:23 2003
+++ loncom/interface/lonnavmaps.pm	Thu May 29 13:39:41 2003
@@ -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.194 2003/05/29 17:39:41 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1779,6 +1779,16 @@
 (as in the resource object) is the only proper way to obtain a
 resource object.
 
+=item * B<getBySymb>(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<getMapByMapPc>(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
@@ -1807,6 +1817,14 @@
     my ($mapUrl, $id, $filename) = split (/___/, $symb);
     my $map = $self->getResourceByUrl($mapUrl);
     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