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

foxr lon-capa-cvs@mail.lon-capa.org
Thu, 02 Dec 2004 22:50:16 -0000


foxr		Thu Dec  2 17:50:16 2004 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  BUG 3663 Fix inability to pop into resources with ' in their names as a 
  course coordinator.  Need to still check this for other roles as I have
  a hunch the same issues are lurking for other roles as well.
  
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.305 loncom/interface/lonnavmaps.pm:1.306
--- loncom/interface/lonnavmaps.pm:1.305	Thu Nov 11 17:47:55 2004
+++ loncom/interface/lonnavmaps.pm	Thu Dec  2 17:50:16 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.305 2004/11/11 22:47:55 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.306 2004/12/02 22:50:16 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -35,6 +35,7 @@
 use Apache::lonmenu();
 use Apache::lonenc();
 use Apache::lonlocal;
+use Apache::lonnet;
 use POSIX qw (floor strftime);
 use Data::Dumper; # for debugging, not always 
 
@@ -1010,6 +1011,15 @@
     my $nonLinkedText = ''; # stuff after resource title not in link
 
     my $link = $params->{"resourceLink"};
+
+    #  The URL part is not escaped at this point, but the symb is... 
+    #  The stuff to the left of the ? must have ' replaced by \' since
+    #  it will be quoted with ' in the href.
+
+    my ($left,$right) = split(/\?/, $link);
+    $left =~ s/'/\\'/g;
+    $link = $left.'?'.$right;
+
     my $src = $resource->src();
     my $it = $params->{"iterator"};
     my $filter = $it->{FILTER};
@@ -1025,7 +1035,11 @@
     }
 
     # links to open and close the folder
+
+    
     my $linkopen = "<a href='$link'>";
+
+
     my $linkclose = "</a>";
 
     # Default icon: unknown page
@@ -1066,6 +1080,7 @@
                 '&jump=' .
                 &Apache::lonnet::escape($resource->symb()) . 
                 "&folderManip=1'>";
+
         } else {
             # Don't allow users to manipulate folder
             $icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') .
@@ -1093,6 +1108,7 @@
     }
 
     # Decide what to display
+
     $result .= "$newBranchText$linkopen$icon$linkclose";
     
     my $curMarkerBegin = '';