[LON-CAPA-cvs] cvs: loncom(version_2_8_X) /xml londefdef.pm

raeburn raeburn@source.lon-capa.org
Sat, 11 Apr 2009 01:12:58 -0000


raeburn		Sat Apr 11 01:12:58 2009 EDT

  Modified files:              (Branch: version_2_8_X)
    /loncom/xml	londefdef.pm 
  Log:
  - Backport 1.400.
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.396.2.1 loncom/xml/londefdef.pm:1.396.2.2
--- loncom/xml/londefdef.pm:1.396.2.1	Thu Dec 11 23:57:04 2008
+++ loncom/xml/londefdef.pm	Sat Apr 11 01:12:58 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.396.2.1 2008/12/11 23:57:04 raeburn Exp $
+# $Id: londefdef.pm,v 1.396.2.2 2009/04/11 01:12:58 raeburn Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -1650,6 +1650,26 @@
 	my $href=&Apache::lonxml::get_param('href',$parstack,$safeeval,
 					    undef,1);
 	$currentstring=&Apache::lonenc::encrypt_ref($token,{'href'=>$href});
+        if ($href =~ /\S/) {
+            if ($href !~ m{^https?://}) {
+                my $url=&Apache::lonnet::hreflocation('',$env{'request.filename'});
+                my $linkurl;
+                if ($href =~ m{^/uploaded/}) {
+                    $linkurl = $href;
+                } elsif ($href =~ m{^[^/]}) {
+                    my $path = $url;
+                    $path  =~ s{[^/]*$}{};
+                    $linkurl = $path.$href;
+                }
+                if ($linkurl =~ m{^/uploaded/}) {
+                    if (!&Apache::lonnet::allowed('bre',$linkurl)) {
+                        if (&Apache::lonnet::is_on_map($url)) {
+                            &Apache::lonxml::extlink($linkurl);
+                        }
+                    }
+                }
+            }
+        }
     }
     return $currentstring;
 }