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

www lon-capa-cvs@mail.lon-capa.org
Wed, 08 May 2002 17:40:04 -0000


www		Wed May  8 13:40:04 2002 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  fixes "verify symb" bug by going through all applicable symbs and comparing.
  Bug 279
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.215 loncom/lonnet/perl/lonnet.pm:1.216
--- loncom/lonnet/perl/lonnet.pm:1.215	Wed May  8 11:21:04 2002
+++ loncom/lonnet/perl/lonnet.pm	Wed May  8 13:40:03 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.215 2002/05/08 15:21:04 www Exp $
+# $Id: lonnet.pm,v 1.216 2002/05/08 17:40:03 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2524,23 +2524,33 @@
 sub symbverify {
     my ($symb,$thisfn)=@_;
     $thisfn=&declutter($thisfn);
-
-    &logthis("Symb verify: $symb $thisfn");
-
 # direct jump to resource in page or to a sequence - will construct own symbs
     if ($thisfn=~/\.(page|sequence)$/) { return 1; }
 # check URL part
     my ($map,$resid,$url)=split(/\_\_\_/,$symb);
     unless (&symbclean($url) eq &symbclean($thisfn)) { return 0; }
 
-# FIXME: done for now
-    return 1;
+    $symb=&symbclean($symb);
 
     my %bighash;
     my $okay=0;
     if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
                             &GDBM_READER,0640)) {
-        
+        my $ids=$bighash{'ids_/res/'.$thisfn};
+        unless ($ids) { 
+           $ids=$bighash{'ids_/'.$thisfn};
+        }
+        if ($ids) {
+# ------------------------------------------------------------------- Has ID(s)
+	    foreach (split(/\,/,$ids)) {
+               my ($mapid,$resid)=split(/\./,$_);
+               if (
+  &symbclean(&declutter($bighash{'map_id_'.$mapid}).'___'.$resid.'___'.$thisfn)
+   eq $symb) { 
+                  $okay=1; 
+               }
+	   }
+        }
 	untie(%bighash);
     }
     return $okay;