[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm
raeburn
raeburn at source.lon-capa.org
Fri Sep 13 22:04:47 EDT 2013
raeburn Sat Sep 14 02:04:47 2013 EDT
Modified files:
/loncom/xml londefdef.pm
Log:
- Bug 6668
- Append inhibitmenu=yes in a query string within an iframe's src attribute
where src points at an HTML resource (/uploaded/, /res, or relative path).
- Example use case: <iframe src="title_player.html"> in title.html file
created in Camtasia 8.1.
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.444 loncom/xml/londefdef.pm:1.445
--- loncom/xml/londefdef.pm:1.444 Tue Jun 4 22:20:20 2013
+++ loncom/xml/londefdef.pm Sat Sep 14 02:04:47 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.444 2013/06/04 22:20:20 raeburn Exp $
+# $Id: londefdef.pm,v 1.445 2013/09/14 02:04:47 raeburn Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -3570,8 +3570,47 @@
my ($target,$token) = @_;
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
- $currentstring = $token->[4];
- }
+ my ($src,$url,$query);
+ if ($token->[2]->{'src'}) {
+ $src = $token->[2]->{'src'};
+ } elsif ($token->[2]->{'SRC'}) {
+ $src = $token->[2]->{'SRC'};
+ }
+ if ($src) {
+ ($url,$query) = ($src =~ /^([^?]+)\??([^?]*)$/);
+ if ($query =~ /inhibitmenu=yes/) {
+ $currentstring = $token->[4];
+ } else {
+ my $inhibit;
+ if ($url =~ m{^[^/.].*\.x?html?$}) {
+ $inhibit = 1;
+ } elsif ($url =~ m{^/(uploaded|res)/.*\.x?html?$}) {
+ $inhibit = 1;
+ }
+ if ($inhibit) {
+ $currentstring = '<iframe ';
+ foreach my $attrib (@{$token->[3]}) {
+ if (lc($attrib) eq 'src') {
+ if ($query) {
+ $query.='&inhibitmenu=yes';
+ } else {
+ $query = 'inhibitmenu=yes';
+ }
+ $currentstring .= 'src="'.$url.'?'.$query.'" ';
+ } else {
+ $currentstring .= lc($attrib).'="'.$token->[2]->{$attrib}.'" ';
+ }
+ }
+ $currentstring =~ s/\s+$//;
+ $currentstring .= '>';
+ } else {
+ $currentstring = $token->[4];
+ }
+ }
+ } else {
+ $currentstring = $token->[4];
+ }
+ }
return $currentstring;
}
More information about the LON-CAPA-cvs
mailing list