- # $Apache::londefdef::table[-1]{'output'} .= $header_of_table.$Apache::londefdef::table[-1]{'hinc'}.$output.'\end{tabular}\strut\newline\strut ';
- $Apache::londefdef::table[-1]{'output'} .= $header_of_table.$Apache::londefdef::table[-1]{'hinc'}.$output.'\end{tabular}\strut'.'\\\\'."\n".'\strut ';
- if ($#Apache::londefdef::table > 0) {
- my $inmemory = $Apache::londefdef::table[-1]{'output'};
- # Figure out max/and min width by summing us and then
- # apply that to the current column of the table we nest in
- # if it's larger than the current width or the current width
- # is undefined.
- #
- my $min_nested_width = 0;
- my $max_nested_width = 0;
- for (my $col = 0; $col <= $Apache::londefdef::table[-1]{'counter_columns'}; $col++) {
- $min_nested_width += $min_len[$col];
- $max_nested_width += $max_len[$col];
-
- }
- # Fudge in an extra 5 mm for borders etc:
-
- $min_nested_width += 5;
- $max_nested_width += 5;
-
- my $outer_column = $Apache::londefdef::table[-2]{'counter_columns'};
- my $outer_row = $Apache::londefdef::table[-2]{'row_number'};
- if ($min_nested_width > $Apache::londefdef::table[-2]{'minlen'}[$outer_row][$outer_column]) {
- $Apache::londefdef::table[-2]{'minlen'}[$outer_row][$outer_column] = $min_nested_width;
- }
- if ($max_nested_width > $Apache::londefdef::table[-2]{'maxlen'}[$outer_row][$outer_column]) {
- $Apache::londefdef::table[-2]{'maxlen'}[$outer_row][$outer_column] = $max_nested_width;
- }
-
- pop @Apache::londefdef::table;
- push @{$Apache::londefdef::table[-1]{'include'}}, $inmemory;
- } else {
- $currentstring .= $Apache::londefdef::table[-1]{'output'};
- pop @Apache::londefdef::table;
- undef @Apache::londefdef::table;
- }
- }
- &enable_para();
- }
+
}
return $currentstring;
}
@@ -2661,7 +2316,7 @@ sub tag_check {
sub cell_config_hash {
my ($align, $rowspan, $colspan, $width) = @_;
if ($rowspan ne '') {
- $rowspan =~ s/^\s+|\s+$//g;
+ $rowspan =~ s/^\s+|\s+$//g;
}
if ($colspan ne '') {
$colspan =~ s/^\s+|\s+$//g;
@@ -2677,7 +2332,7 @@ sub cell_config_hash {
$config{'rowspan'} = $rowspan;
}
if ($width ne '') {
- $config{'width'} = $width;
+ $config{'width'} = $width;
}
return \%config;
}
@@ -3098,31 +2753,24 @@ sub start_img {
my $inside = &Apache::lonxml::get_all_text("/img",$parser,$style);
return '';
}
- &Apache::lonxml::extlink($src);
+ unless ($src =~ m{^data\:image/gif;base64,}) {
+ &Apache::lonxml::extlink($src);
+ }
my $currentstring = '';
my $scaling = .3;
# Render unto browsers that which are the browser's...
if ($target eq 'web' || $target eq 'webgrade') {
- if ($env{'browser.imagesuppress'} ne 'on') {
- my $enc = ('yes' eq
- lc(&Apache::lonxml::get_param('encrypturl',$parstack,
- $safeeval)));
- $currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src},
- $enc);
- } else {
- my $alttag = &Apache::lonxml::get_param('alt',$parstack,$safeeval,
- undef,1);
- if (!$alttag) {
- $alttag = &Apache::lonmeta::alttag($Apache::lonxml::pwd[-1],
- $src);
- }
- $currentstring.='[IMAGE: '.$alttag.']';
- }
-
- # and render unto TeX that which is LaTeX
+ my $enc = ('yes' eq
+ lc(&Apache::lonxml::get_param('encrypturl',$parstack,
+ $safeeval)));
+ unless ($src =~ m{^data\:image/gif;base64,}) {
+ $currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src},
+ $enc);
+ }
+ # and render unto TeX that which is LaTeX
} elsif ($target eq 'tex') {
#
# The alignment will require some superstructure to be put around
@@ -3163,7 +2811,7 @@ sub start_img {
# &Apache::lonxml::debug("LaTeX rendering = $latex_rendering image file: $src");
- #if original bmp/gif/jpg/png file exist do following:
+ #if original bmp/gif/jpg/png/svg file exist do following:
my $origsrc=$src;
my ($path,$file) = &get_eps_image($src);
# &Apache::lonnet::logthis("Image source: $src result: $path $file");
@@ -3223,7 +2871,7 @@ sub start_img {
['', 'none','parbox', 'parpic', 'wrapfigure'], $token, 2);
my $alt= &Apache::lonxml::get_param('alt',$parstack,$safeeval);
my $enc= &Apache::lonxml::get_param('encrypturl',$parstack,$safeeval);
-
+
$currentstring .=&Apache::edit::select_arg('Encrypt URL:','encrypturl',
['no','yes'], $token, 2);
if (($alt=~/\S/) && (lc($enc) eq 'yes')) {
@@ -3237,10 +2885,10 @@ sub start_img {
if ($token->[2]{'src'}=~/\$/) {
$currentstring.=&mt('Variable image source');
} elsif ($token->[2]{'src'}=~/\S/) {
- $currentstring .= '
[4];
- } else {
- my $alttag= &Apache::lonxml::get_param('alt',$parstack,
- $safeeval,undef,1);
- unless ($alttag) {
- $alttag=&Apache::lonmeta::alttag($Apache::lonxml::pwd[-1],
- $code);
- }
- $currentstring='[APPLET: '.$alttag.']';
- }
+ $currentstring = $token->[4];
} elsif ($target eq 'tex') {
- # Turn off some stuff we can't be inside thank you LaTeX
-
+ # Turn off some stuff we can't be inside thank you LaTeX
my $restart_sub = 0;
my $restart_sup = 0;
@@ -3388,16 +3025,7 @@ sub start_embed {
&Apache::lonxml::extlink($src);
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
- if ($env{'browser.embedsuppress'} ne 'on') {
- $currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});
- } else {
- my $alttag=&Apache::lonxml::get_param
- ('alt',$parstack,$safeeval,undef,1);
- unless ($alttag) {
- $alttag=&Apache::lonmeta::alttag($Apache::lonxml::pwd[-1],$src);
- }
- $currentstring='[EMBED: '.$alttag.']';
- }
+ $currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});
} elsif ($target eq 'tex') {
}
return $currentstring;
@@ -3407,31 +3035,57 @@ sub end_embed {
my ($target,$token) = @_;
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
- $currentstring = $token->[2];
- } elsif ($target eq 'tex') {
- }
+ $currentstring = $token->[2];
+ } elsif ($target eq 'tex') {
+ # ./.
+ }
return $currentstring;
}
#--
tag (end tag forbidden)
sub start_param {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
- if (&Apache::lonxml::get_param('name',$parstack,
- $safeeval,undef,1)=~/^cabbase$/i) {
+ my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval,
+ undef,1);
+ if ($name =~/^cabbase$/i) {
my $value=&Apache::lonxml::get_param('value',$parstack,
$safeeval,undef,1);
&Apache::lonxml::extlink($value);
- }
-
+ } elsif ($name eq 'flashvars') {
+ if (lc(&Apache::lonxml::get_param('type',$parstack,$safeeval,-2,1))
+ eq 'application/x-shockwave-flash') {
+ my $launcher =
+ &Apache::lonxml::get_param('data',$parstack,$safeeval,-2,1);
+ if ($launcher) {
+ &Apache::lonxml::extlink($launcher);
+ }
+ my $flashvars=&Apache::lonxml::get_param('value',$parstack,
+ $safeeval,undef,1);
+ if ($flashvars ne '') {
+ foreach my $item (split(/\&/,$flashvars)) {
+ my ($key,$value)=split(/=/,$item,2);
+ if ($key eq 'content') {
+ if ($value ne '') {
+ my ($dir) = ($launcher =~ m{(.+/)[^/]+$});
+ &Apache::lonxml::extlink($dir.$value);
+ }
+ } elsif ($key eq 'thumb') {
+ if ($value ne '') {
+ &Apache::lonxml::extlink($value);
+ }
+ }
+ }
+ }
+ }
+ }
my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
- &Apache::lonxml::extlink($src);
+ if ($src ne '') {
+ &Apache::lonxml::extlink($src);
+ }
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
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{'value'}=&Apache::lonxml::get_param('value',$parstack,
$safeeval,undef,1);
@@ -3828,32 +3482,32 @@ sub end_col {
return $currentstring;
}
-#--
tag (end tag optional)
+#-- [4];
- }
+ }
if ($target eq 'tex') {
- # TODO: Ensure this tag is in a table:
+ # TODO: Ensure this tag is in a table:
- # Fetch the attributes and build the hash for the
- # call to define_colgroup.
+ # Fetch the attributes and build the hash for the
+ # call to define_colgroup.
- my $span = &Apache::lonxml::get_param('span', $parstack, $safeeval);
- my $halign = &Apache::lonxml::get_param('halign', $parstack, $safeeval);
-
- my %colgroup_params;
- if ($span ne '') {
- $colgroup_params{'span'} = $span;
- }
- if ($halign ne '') {
- $colgroup_params{'halign'} = $halign;
- }
+ my $span = &Apache::lonxml::get_param('span', $parstack, $safeeval);
+ my $halign = &Apache::lonxml::get_param('halign', $parstack, $safeeval);
- my $table = $Apache::londefdef::table[-1];
- $table->define_colgroup(\%colgroup_params);
+ my %colgroup_params;
+ if ($span ne '') {
+ $colgroup_params{'span'} = $span;
+ }
+ if ($halign ne '') {
+ $colgroup_params{'halign'} = $halign;
+ }
+
+ my $table = $Apache::londefdef::table[-1];
+ $table->define_colgroup(\%colgroup_params);
}
return $currentstring;
@@ -3868,12 +3522,16 @@ sub end_colgroup {
return $currentstring;
}
+
#-- tag (end tag required)
sub start_del {
my ($target,$token) = @_;
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
$currentstring = $token->[4];
+ } elsif ($target eq 'tex') {
+ &disable_para();
+ $currentstring .= '\st{';
}
return $currentstring;
}
@@ -3882,7 +3540,10 @@ sub end_del {
my ($target,$token) = @_;
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
- $currentstring = $token->[2];
+ $currentstring = $token->[2];
+ } elsif ($target eq 'tex') {
+ &enable_para();
+ $currentstring = '}';
}
return $currentstring;
}
@@ -3930,8 +3591,68 @@ sub start_iframe {
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 = '