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

foxr foxr at source.lon-capa.org
Tue Nov 29 06:58:53 EST 2011


foxr		Tue Nov 29 11:58:53 2011 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  BZ 6454 - Correctly handle attempt to get navmap for a user other than
            the current one by using lonmap to read the map in that case
            rather than binding to a map file.
  
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.469 loncom/interface/lonnavmaps.pm:1.470
--- loncom/interface/lonnavmaps.pm:1.469	Tue Nov 29 01:49:00 2011
+++ loncom/interface/lonnavmaps.pm	Tue Nov 29 11:58:53 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.469 2011/11/29 01:49:00 www Exp $
+# $Id: lonnavmaps.pm,v 1.470 2011/11/29 11:58:53 foxr Exp $
 
 #
 # Copyright Michigan State University Board of Trustees
@@ -225,7 +225,7 @@
 
 =over 4
 
-=item * B<iterator>: default: constructs one from %env
+=item * B<iterator: default: constructs one from %env
 
 A reference to a fresh ::iterator to use from the navmaps. The
 rendering will reflect the options passed to the iterator, so you can
@@ -487,7 +487,7 @@
 
 # For debugging
 
-use Data::Dumper;
+# use Data::Dumper;
 
 
 # symbolic constants
@@ -1397,6 +1397,7 @@
         }
     }
 
+
     # (re-)Locate the jump point, if any
     # Note this does not take filtering or hidden into account... need
     # to be fixed?
@@ -1649,6 +1650,7 @@
 	    $curRes = shift(@resources);
 	} else {
 	    $curRes = $it->next($closeAllPages);
+
 	}
 	if (!$curRes) { last; }
 
@@ -1995,7 +1997,7 @@
     # assume there are course hashes for the specific requested user at domamin:
     #
 
-    if (($self->{USERNAME} eq $env{'user.name'}) && ($self->{DOMAIN} eq $env{'user.domain'})) {
+    if ( ($self->{USERNAME} eq $env{'user.name'}) && ($self->{DOMAIN} eq $env{'user.domain'})) {
 	
 	# tie the nav hash
 	
@@ -2020,7 +2022,9 @@
     } else {
 	$self->change_user($self->{USERNAME}, $self->{DOMAIN});
     }
-        
+
+    my $d = Data::Dumper->new([$self]);
+
     return $self;
 }
 
@@ -2055,6 +2059,8 @@
     &Apache::lonmap::loadmap($cnum, $cdom, $self->{USERNAME}, $self->{DOMAIN}, \%big_hash);
     $self->{NAV_HASH} = \%big_hash;
 
+
+
     # Now clear the parm cache and reconstruct the parm hash fromt he big_hash
     # param.xxxx keys.
 
@@ -2070,6 +2076,7 @@
     }
 
     $self->{PARM_HASH} = \%parm_hash;
+   
 
 
     
@@ -3062,12 +3069,15 @@
     if ($resourceCount == 1 && $resource->is_sequence() && !$self->{FORCE_TOP}) { 
         my $firstResource = $resource->map_start();
         my $finishResource = $resource->map_finish();
-        return 
-            Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource,
-                                              $finishResource, $self->{FILTER},
-                                              $self->{ALREADY_SEEN}, 
-                                              $self->{CONDITION},
-					      $self->{FORCE_TOP});
+	my $result;
+	my $rdump  = Data::Dumper->new([$result]);
+	$result =  Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource,
+						     $finishResource, $self->{FILTER},
+						     $self->{ALREADY_SEEN}, 
+						     $self->{CONDITION},
+						     $self->{FORCE_TOP});
+	return $result;
+           
         
     }
 
@@ -3087,6 +3097,7 @@
     $self->{ALREADY_SEEN}->{$self->{FIRST_RESOURCE}->{ID}} = 1;
 
     bless ($self);
+    my $selfDump = Data::Dumper->new([$self]);
 
     return $self;
 }
@@ -3102,6 +3113,8 @@
     # do so.
     if ($self->{RETURN_0} && !$self->{HAVE_RETURNED_0}) {
         $self->{HAVE_RETURNED_0} = 1;
+	my $nextTopLevel = $self->{NAV_MAP}->getById('0.0');
+
         return $self->{NAV_MAP}->getById('0.0');
     }
     if ($self->{RETURN_0} && !$self->{HAVE_RETURNED_0_BEGIN_MAP}) {
@@ -3121,13 +3134,13 @@
         if ($self->{RECURSIVE_DEPTH} == 0) {
             $self->{RECURSIVE_ITERATOR_FLAG} = 0;
         }
-
         return $next;
     }
 
     if (defined($self->{FORCE_NEXT})) {
         my $tmp = $self->{FORCE_NEXT};
         $self->{FORCE_NEXT} = undef;
+
         return $tmp;
     }
 
@@ -3197,6 +3210,8 @@
     # So we need to look at all the resources we can get to from here,
     # categorize them if we haven't seen them, remember if we have a new
     my $nextUnfiltered = $here->getNext();
+
+
     my $maxDepthAdded = -1;
     
     for (@$nextUnfiltered) {
@@ -3230,7 +3245,6 @@
         $self->{RECURSIVE_ITERATOR_FLAG} = 1;
         my $firstResource = $self->{HERE}->map_start();
         my $finishResource = $self->{HERE}->map_finish();
-
         $self->{RECURSIVE_ITERATOR} = 
             Apache::lonnavmaps::iterator->new($self->{NAV_MAP}, $firstResource,
                                               $finishResource, $self->{FILTER},
@@ -3248,6 +3262,8 @@
         return $self->next($closeAllPages);
     }
 
+    my $hereResource = $self->{HERE};
+
     return $self->{HERE};
 
 }
@@ -3414,6 +3430,7 @@
     my $nextUnfiltered;
     if ($self->{DIRECTION} == FORWARD()) {
         $nextUnfiltered = $self->{HERE}->getNext();
+
     } else {
         $nextUnfiltered = $self->{HERE}->getPrevious();
     }




More information about the LON-CAPA-cvs mailing list