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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 18 Oct 2005 21:29:35 -0000


albertel		Tue Oct 18 17:29:35 2005 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - hreflocation was brain dead about /uploaded urls
  - fixed to use $perlvar for dir paths
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.665 loncom/lonnet/perl/lonnet.pm:1.666
--- loncom/lonnet/perl/lonnet.pm:1.665	Tue Oct 18 17:27:46 2005
+++ loncom/lonnet/perl/lonnet.pm	Tue Oct 18 17:29:35 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.665 2005/10/18 21:27:46 albertel Exp $
+# $Id: lonnet.pm,v 1.666 2005/10/18 21:29:35 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5787,14 +5787,15 @@
 sub hreflocation {
     my ($dir,$file)=@_;
     unless (($file=~m-^http://-i) || ($file=~m-^/-)) {
-	my $finalpath=filelocation($dir,$file);
-	$finalpath=~s-^/home/httpd/html--;
-	$finalpath=~s-^/home/(\w+)/public_html/-/~$1/-;
-	return $finalpath;
-    } elsif ($file=~m-^/home-) {
-	$file=~s-^/home/httpd/html--;
+	$file=filelocation($dir,$file);
+    }
+    if ($file=~m-^\Q$perlvar{'lonDocRoot'}\E-) {
+	$file=~s-^\Q$perlvar{'lonDocRoot'}\E--;
+    } elsif ($file=~m-/home/(\w+)/public_html/-) {
 	$file=~s-^/home/(\w+)/public_html/-/~$1/-;
-	return $file;
+    } elsif ($file=~m-^\Q$perlvar{'lonUsersDir'}\E-) {
+	$file=~s-^/home/httpd/lonUsers/([^/]*)/./././([^/]*)/userfiles/
+	    -/uploaded/$1/$2/-x;
     }
     return $file;
 }