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

bowersj2 lon-capa-cvs@mail.lon-capa.org
Fri, 11 Oct 2002 21:34:42 -0000


bowersj2		Fri Oct 11 17:34:42 2002 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  Remember that we've already opened the necessary maps to see the current
  resource, so the user can open and close the maps with impunity, with the
  nav map still remembering the current location.
  
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.74 loncom/interface/lonnavmaps.pm:1.75
--- loncom/interface/lonnavmaps.pm:1.74	Fri Oct 11 17:29:18 2002
+++ loncom/interface/lonnavmaps.pm	Fri Oct 11 17:34:42 2002
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.74 2002/10/11 21:29:18 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.75 2002/10/11 21:34:42 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -917,7 +917,13 @@
     my $currenturl = $ENV{'form.postdata'};
     $currenturl=~s/^http\:\/\///;
     $currenturl=~s/^[^\/]+//;
-    my $queryAdd = "postdata=" . &Apache::lonnet::escape($currenturl);
+    # alreadyHere allows us to only open the maps necessary to view
+    # the current location once, while at the same time remembering
+    # the current location. Without that check, the user would never
+    # be able to close those maps; the user would close it, and the
+    # currenturl scan would re-open it.
+    my $queryAdd = "postdata=" . &Apache::lonnet::escape($currenturl) .
+        "&alreadyHere=1";
 
     $r->print('<a href="navmaps?condition=1&filter=">Show All Resources</a><br /><br />');
 
@@ -935,7 +941,7 @@
     # loop should be obvious.
     # Here's a simple example of the iterator.
     # If there is a current resource
-    if ($currenturl) {
+    if ($currenturl && !$ENV{'form.alreadyHere'}) {
         # Give me every resource...
         my $mapIterator = $navmap->getIterator(undef, undef, {}, 1);
         my $found != 0;