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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 10 Feb 2006 22:37:17 -0000


albertel		Fri Feb 10 17:37:17 2006 EDT

  Modified files:              (Branch: version_2_1_X)
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - bakport 1.710
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.683.2.17 loncom/lonnet/perl/lonnet.pm:1.683.2.18
--- loncom/lonnet/perl/lonnet.pm:1.683.2.17	Fri Feb 10 05:00:46 2006
+++ loncom/lonnet/perl/lonnet.pm	Fri Feb 10 17:37:15 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.683.2.17 2006/02/10 10:00:46 albertel Exp $
+# $Id: lonnet.pm,v 1.683.2.18 2006/02/10 22:37:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3435,16 +3435,17 @@
    return 'F';
 }
 
+sub split_uri_for_cond {
+    my $uri=&deversion(&declutter(shift));
+    my @uriparts=split(/\//,$uri);
+    my $filename=pop(@uriparts);
+    my $pathname=join('/',@uriparts);
+    return ($pathname,$filename);
+}
 # --------------------------------------------------- Is a resource on the map?
 
 sub is_on_map {
-    my $uri=&deversion(&declutter(shift));
-    my @uriparts=split(/\//,$uri);
-    my $filename=$uriparts[$#uriparts];
-    my $pathname=$uri;
-    $pathname=~s|/\Q$filename\E$||;
-    $pathname=~s/^adm\/wrapper\///;
-    $pathname=~s/^adm\/coursedocs\/showdoc\///;
+    my ($pathname,$filename) = &split_uri_for_cond(shift);
     #Trying to find the conditional for the file
     my $match=($env{'acc.res.'.$env{'request.course.id'}.'.'.$pathname}=~
 	       /\&\Q$filename\E\:([\d\|]+)\&/);