[LON-CAPA-cvs] cvs: loncom / lonenc.pm /xml londefdef.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Wed, 19 Jan 2005 18:16:36 -0000
albertel Wed Jan 19 13:16:36 2005 EDT
Modified files:
/loncom lonenc.pm
/loncom/xml londefdef.pm
Log:
- BUG#3831, objects with relative links in a document that is encrypturled break
Index: loncom/lonenc.pm
diff -u loncom/lonenc.pm:1.9 loncom/lonenc.pm:1.10
--- loncom/lonenc.pm:1.9 Mon Dec 20 14:26:53 2004
+++ loncom/lonenc.pm Wed Jan 19 13:16:35 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# URL translation for encrypted filenames
#
-# $Id: lonenc.pm,v 1.9 2004/12/20 19:26:53 albertel Exp $
+# $Id: lonenc.pm,v 1.10 2005/01/19 18:16:35 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -146,6 +146,22 @@
return $str;
}
+sub encrypt_ref {
+ my ($token,$elements)=@_;
+ my $html;
+ if ($ENV{'request.enc'}) {
+ while (my ($name,$value)= each(%{ $elements })) {
+ if (!$value) { next; }
+ my $href=&Apache::lonnet::hreflocation($Apache::lonxml::pwd[-1],$value);
+ if ($href !~ /^http:/) { $href=&Apache::lonenc::encrypted($href); }
+ $token->[2]->{$name}=$href;
+ }
+ $html = &Apache::edit::rebuild_tag($token);
+ } else {
+ $html = $token->[4];
+ }
+ return $html;
+}
1;
__END__
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.249 loncom/xml/londefdef.pm:1.250
--- loncom/xml/londefdef.pm:1.249 Wed Dec 29 06:39:25 2004
+++ loncom/xml/londefdef.pm Wed Jan 19 13:16:35 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.249 2004/12/29 11:39:25 foxr Exp $
+# $Id: londefdef.pm,v 1.250 2005/01/19 18:16:35 albertel Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -1463,7 +1463,9 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
my $currentstring = '';
if ($target eq 'web') {
- $currentstring .= $token->[4];
+ my $href=&Apache::lonxml::get_param('href',$parstack,$safeeval,
+ undef,1);
+ $currentstring=&Apache::lonenc::encrypt_ref($token,{'href'=>$href});
} elsif ($target eq 'tex') {
my $a=&Apache::lonxml::get_param('href',$parstack,$safeeval,undef,1);
my $b=&Apache::lonxml::get_param('name',$parstack,$safeeval,undef,1);
@@ -2446,7 +2448,7 @@
if ($target eq 'web') {
if ($ENV{'browser.imagesuppress'} ne 'on') {
- $currentstring.= $token->[4];
+ $currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});
} else {
my $alttag= &Apache::lonxml::get_param
('alt',$parstack,$safeeval,undef,1);
@@ -2668,7 +2670,10 @@
my $currentstring = '';
if ($target eq 'web') {
if ($ENV{'browser.appletsuppress'} ne 'on') {
- $currentstring = $token->[4];
+ $currentstring = &Apache::lonenc::encrypt_ref($token,
+ {'code'=>$code,
+ 'archive'=>$archive}
+ );
} else {
my $alttag= &Apache::lonxml::get_param('alt',$parstack,
$safeeval,undef,1);
@@ -2711,7 +2716,7 @@
my $currentstring = '';
if ($target eq 'web') {
if ($ENV{'browser.embedsuppress'} ne 'on') {
- $currentstring = $token->[4];
+ $currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});
} else {
my $alttag=&Apache::lonxml::get_param
('alt',$parstack,$safeeval,undef,1);
@@ -2747,7 +2752,13 @@
&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
my $currentstring = '';
if ($target eq 'web') {
- $currentstring = $token->[4];
+ my %toconvert;
+ my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
+ if ($src) { $toconvert{'src'}= $src; }
+ my $name=&Apache::lonxml::get_param('name',$parstack,$safeeval,
+ undef,1);
+ if ($name=~/^cabbase$/i) { $toconvert{'name'}= $name; }
+ $currentstring = &Apache::lonenc::encrypt_ref($token,\%toconvert);
} elsif ($target eq 'tex') {
}
return $currentstring;