[LON-CAPA-cvs] cvs: loncom /interface lonnavmaps.pm rat lonuserstate.pm
raeburn
raeburn@source.lon-capa.org
Wed, 16 Jun 2010 23:42:55 -0000
raeburn Wed Jun 16 23:42:55 2010 EDT
Modified files:
/rat lonuserstate.pm
/loncom/interface lonnavmaps.pm
Log:
- Method in lonnavmaps.pm to retrieve ordered list of IDs
used in nested folders. Comma-separated lists are values in
big hash for corresponding keys of the form: map_hierarchy_$pc.
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.135 rat/lonuserstate.pm:1.136
--- rat/lonuserstate.pm:1.135 Thu Mar 25 17:38:52 2010
+++ rat/lonuserstate.pm Wed Jun 16 23:42:52 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Construct and maintain state and binary representation of course for user
#
-# $Id: lonuserstate.pm,v 1.135 2010/03/25 17:38:52 raeburn Exp $
+# $Id: lonuserstate.pm,v 1.136 2010/06/16 23:42:52 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -126,6 +126,15 @@
my $lpc=$pc;
$hash{'map_pc_'.$uri}=$lpc;
$hash{'map_id_'.$lpc}=$uri;
+ if ($parent_rid =~ /^(\d+)\.\d+$/) {
+ my $parent_pc = $1;
+ if (defined($hash{'map_hierarchy_'.$parent_pc})) {
+ $hash{'map_hierarchy_'.$lpc}=$hash{'map_hierarchy_'.$parent_pc}.','.
+ $parent_pc;
+ } else {
+ $hash{'map_hierarchy_'.$lpc}=$parent_pc;
+ }
+ }
# Determine and check filename
my $fn=&Apache::lonnet::filelocation('',&putinversion($uri));
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.447 loncom/interface/lonnavmaps.pm:1.448
--- loncom/interface/lonnavmaps.pm:1.447 Mon Mar 29 17:55:55 2010
+++ loncom/interface/lonnavmaps.pm Wed Jun 16 23:42:55 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.447 2010/03/29 17:55:55 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.448 2010/06/16 23:42:55 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
@@ -2304,7 +2304,7 @@
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):
+=item * B<getByMapPc>(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.
@@ -2574,7 +2574,7 @@
Retrieves version infomation for a url. Returns the version (a number, or
the string "mostrecent") for resources which have version information in
the big hash.
-
+
=cut
@@ -3840,6 +3840,12 @@
Returns a string with the type of the map in it.
+=item *B<map_hierarchy>:
+
+Returns a string with a comma-separated ordered list of map_pc IDs
+for the hierarchy of maps containing a map, with the top level
+map first, then descending to deeper levels, with the enclosing map last.
+
=back
=cut
@@ -3870,6 +3876,11 @@
my $pc = $self->map_pc();
return $self->navHash("map_type_$pc", 0);
}
+sub map_hierarchy {
+ my $self = shift;
+ my $pc = $self->map_pc();
+ return $self->navHash("map_hierarchy_$pc", 0);
+}
#####
# Property queries