[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

www lon-capa-cvs@mail.lon-capa.org
Sat, 12 Jun 2004 22:09:33 -0000


www		Sat Jun 12 18:09:33 2004 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Bug #3114: NAV directly jumping into /adm/wrapper.
  
  Maybe one day, I will get this correct. The correct symb for URL
  
   /adm/wrapper/res/msu/fred/foo.5.gif
  
  looks like
  
   msu/fred/bar.sequence___42___msu/fred/foo.gif
  
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.509 loncom/lonnet/perl/lonnet.pm:1.510
--- loncom/lonnet/perl/lonnet.pm:1.509	Thu Jun 10 18:15:53 2004
+++ loncom/lonnet/perl/lonnet.pm	Sat Jun 12 18:09:32 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.509 2004/06/10 22:15:53 albertel Exp $
+# $Id: lonnet.pm,v 1.510 2004/06/12 22:09:32 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4370,7 +4370,10 @@
 # --------------------------------------------------------------- Verify a symb
 
 sub symbverify {
-    my ($symb,$thisfn)=@_;
+    my ($symb,$thisurl)=@_;
+    my $thisfn=$thisurl;
+# wrapper not part of symbs
+    $thisfn=~s/^\/adm\/wrapper//;
     $thisfn=&declutter($thisfn);
 # direct jump to resource in page or to a sequence - will construct own symbs
     if ($thisfn=~/\.(page|sequence)$/) { return 1; }
@@ -4380,6 +4383,7 @@
     unless ($url eq $thisfn) { return 0; }
 
     $symb=&symbclean($symb);
+    $thisurl=&deversion($thisurl);
     $thisfn=&deversion($thisfn);
 
     my %bighash;
@@ -4387,9 +4391,9 @@
 
     if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
                             &GDBM_READER(),0640)) {
-        my $ids=$bighash{'ids_'.&clutter($thisfn)};
+        my $ids=$bighash{'ids_'.&clutter($thisurl)};
         unless ($ids) { 
-           $ids=$bighash{'ids_/'.$thisfn};
+           $ids=$bighash{'ids_/'.$thisurl};
         }
         if ($ids) {
 # ------------------------------------------------------------------- Has ID(s)
@@ -4420,7 +4424,7 @@
 
 # remove wrapper
 
-    $symb=~s/(\_\_\_\d+\_\_\_)adm\/wrapper\//$1/;
+    $symb=~s/(\_\_\_\d+\_\_\_)adm\/wrapper\/(res\/)*/$1/;
     return $symb;
 }