- # $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 +2272,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 +2288,7 @@ sub cell_config_hash {
$config{'rowspan'} = $rowspan;
}
if ($width ne '') {
- $config{'width'} = $width;
+ $config{'width'} = $width;
}
return \%config;
}
@@ -3105,24 +2716,13 @@ sub start_img {
# 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)));
+ $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
@@ -3223,7 +2823,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 +2837,10 @@ sub start_img {
if ($token->[2]{'src'}=~/\$/) {
$currentstring.=&mt('Variable image source');
} elsif ($token->[2]{'src'}=~/\S/) {
- $currentstring .= '
$code,
- 'archive'=>$archive}
- );
- } 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;
@@ -3391,16 +2977,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;
@@ -3410,31 +2987,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);
@@ -3831,13 +3434,34 @@ sub end_col {
return $currentstring;
}
-#--
tag (end tag optional)
+#-- [4];
}
+ if ($target eq 'tex') {
+ # TODO: Ensure this tag is in a table:
+
+ # 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 $table = $Apache::londefdef::table[-1];
+ $table->define_colgroup(\%colgroup_params);
+
+ }
return $currentstring;
}
@@ -3850,12 +3474,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;
}
@@ -3864,7 +3492,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;
}
@@ -4324,6 +3955,12 @@ sub start_tbody {
if ($target eq 'web' || $target eq 'webgrade') {
$currentstring = $token->[4];
}
+ if ($target eq 'tex') {
+ # TODO: Ensure this tag is within a table:
+
+ my $table = $Apache::londefdef::table[-1];
+ $table->start_body();
+ }
return $currentstring;
}
@@ -4333,6 +3970,12 @@ sub end_tbody {
if ($target eq 'web' || $target eq 'webgrade') {
$currentstring = $token->[2];
}
+ if($target eq 'tex') {
+ # TODO: Ensure this tag is within a table:
+
+ my $table = $Apache::londefdef::table[-1];
+ $table->end_body();
+ }
return $currentstring;
}
@@ -4343,6 +3986,11 @@ sub start_tfoot {
if ($target eq 'web' || $target eq 'webgrade') {
$currentstring = $token->[4];
}
+ if ($target eq 'tex') {
+ # TODO: ensure this is within a table tag.
+ my $table = $Apache::londefdef::table[-1];
+ $table->start_foot();
+ }
return $currentstring;
}
@@ -4352,6 +4000,11 @@ sub end_tfoot {
if ($target eq 'web' || $target eq 'webgrade') {
$currentstring = $token->[2];
}
+ if ($target eq 'tex') {
+ # TODO: Ensure this is in side a table
+ my $table = $Apache::londefdef::table[-1];
+ $table->end_foot();
+ }
return $currentstring;
}
@@ -4362,6 +4015,11 @@ sub start_thead {
if ($target eq 'web' || $target eq 'webgrade') {
$currentstring = $token->[4];
}
+ if ($target eq 'tex') {
+ # Assume we're in a table... TODO: Verify that and ignore tag if not.
+ my $table = $Apache::londefdef::table[-1];
+ $table->start_head();
+ }
return $currentstring;
}
@@ -4371,6 +4029,12 @@ sub end_thead {
if ($target eq 'web' || $target eq 'webgrade') {
$currentstring = $token->[2];
}
+ if ($target eq 'tex') {
+ # TODO: Verify we are in a table and ignore tag if not.
+
+ my $table = $Apache::londefdef::table[-1];
+ $table->end_head();
+ }
return $currentstring;
}
@@ -4573,15 +4237,15 @@ sub get_eps_image {
#if replication failed try to produce eps file dynamically
$src=~s/\.ps$/\.eps/;
- my $temp_file;
- open(FILE,">>/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat");
- my $newsrc=$orig_src;
- $newsrc =~ s|(.*)/res/|/home/httpd/html/res/|;
- &Apache::lonxml::debug("queueing $newsrc for dynamic eps production.");
- print FILE ("$newsrc\n");
- close(FILE);
+ if (open(FILE,">>/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat")) {
+ my $newsrc=$orig_src;
+ $newsrc =~ s|(.*)/res/|/home/httpd/html/res/|;
+ &Apache::lonxml::debug("queueing $newsrc for dynamic eps production.");
+ print FILE ("$newsrc\n");
+ close(FILE);
+ }
$src=~s|/home/httpd/html/res|/home/httpd/prtspool|;
- $src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|;
+ $src=~s|/home/httpd/html/priv/[^/]+/([^/]*)/|/home/httpd/prtspool/$1/|;
if ($sext ne "") { # Put the ext. back in to uniquify.
$src =~ s/\.eps$/$sext.eps/;
}
@@ -4600,7 +4264,7 @@ sub get_eps_image {
print FILE "$src\n";
close FILE;
$src=~s|/home/httpd/html/res|/home/httpd/prtspool|;
- $src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|;
+ $src=~s|/home/httpd/html/priv/[^/]+/([^/]*)/|/home/httpd/prtspool/$1/|;
}
my ($path,$file)=($src=~m|(.*)/([^/]*)$|);
$path =~ s/ /\_/g;
@@ -4612,12 +4276,14 @@ sub get_eps_image {
sub eps_generation {
my ($src,$file,$width_param) = @_;
my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat";
- my $temp_file = Apache::File->new('>>'.$filename);
- print $temp_file "$src\n";
+ if (open(my $tmpfile,">>$filename")) {
+ print $tmpfile "$src\n";
+ close($tmpfile);
+ }
my $newsrc = $src;
$newsrc =~ s/(\.bmp|\.gif|\.jpg|\.jpeg)$/\.eps/i;
$newsrc=~s{/home/httpd/html/res}{};
- $newsrc=~s{/home/($LONCAPA::username_re)/public_html/}{/$1/};
+ $newsrc=~s{/home/httpd/html/priv/[^/]+/($LONCAPA::username_re)/}{/$1/};
$newsrc=~s{/\./}{/};
$newsrc=~s{/([^/]+)\.(ps|eps)}{/};
if ($newsrc=~m{/home/httpd/lonUsers/}) {
@@ -4800,6 +4466,7 @@ sub latex_header {
"\\usepackage{xcolor}\n".
'\usepackage{calc}'.
'\usepackage{amsmath}'.
+ '\usepackage{soul}',
'\usepackage{amssymb}'.
'\usepackage{amsfonts}'.
'\usepackage{amsthm}'.