version 1.419, 2010/08/04 14:20:26
|
version 1.424, 2010/10/19 19:33:21
|
Line 43 use Apache::lonnet;
|
Line 43 use Apache::lonnet;
|
use strict; |
use strict; |
use Apache::lonxml; |
use Apache::lonxml; |
use Apache::lontable; |
use Apache::lontable; |
use Apache::File(); |
|
use Image::Magick; |
use Image::Magick; |
use Apache::lonmenu(); |
use Apache::lonmenu(); |
use Apache::lonmeta(); |
use Apache::lonmeta(); |
Line 2048 sub start_table {
|
Line 2047 sub start_table {
|
my $width = &Apache::lonxml::get_param('TeXwidth', $parstack, $safeeval, undef, 0); |
my $width = &Apache::lonxml::get_param('TeXwidth', $parstack, $safeeval, undef, 0); |
my $theme = &Apache::lonxml::get_param('TeXtheme', $parstack, $safeeval, undef, 0); |
my $theme = &Apache::lonxml::get_param('TeXtheme', $parstack, $safeeval, undef, 0); |
my $align = &Apache::lonxml::get_param('align', $parstack, $safeeval, undef, 0); |
my $align = &Apache::lonxml::get_param('align', $parstack, $safeeval, undef, 0); |
|
my $cell_border = &Apache::lonxml::get_param('rules', $parstack, $safeeval, undef, 0); |
|
|
# The only thing that needs any figuring out is the width.. and then only if it is |
# The only thing that needs any figuring out is the width.. and then only if it is |
# a percent. If not it's assumed to be some valid TeX measurement unit e.g. 3.0cm |
# a percent. If not it's assumed to be some valid TeX measurement unit e.g. 3.0cm |
# |
# |
|
|
my $table = new Apache::lontable(); |
my $table = new Apache::lontable(); |
if ($border ne '' && $border != 0) { |
if ((defined $border) && ($border > 0)) { |
|
# &Apache::lonnet::logthis("Turning on table borders: $border"); |
$table->table_border(1); |
$table->table_border(1); |
|
if ($cell_border ne 'none') { |
|
$table->cell_border(1); # html specs that border turns on both...unless rules='none'. |
|
} |
|
} |
|
# Only all or nothing for cell borders for now: |
|
|
|
if ((defined $cell_border) && ($cell_border ne 'none')) { |
|
# &Apache::lonnet::logthis("Turning on cell borders: $cell_border"); |
$table->cell_border(1); |
$table->cell_border(1); |
} |
} |
if ($theme ne '') { |
if (defined $theme) { |
$table->theme($theme); |
$table->theme($theme); |
} |
} |
if ($align ne '') { |
if (defined $align) { |
$table->alignment($align); |
$table->alignment($align); |
} |
} |
|
|
# Missing width is most of page width |
# Missing width is most of page width |
|
|
if ($width eq "") { |
if (!(defined $width)) { |
$width = '70%'; |
$width = '70%'; |
} |
} |
|
|
# If a percentage, need to calculate what this means in terms of |
# If a percentage, need to calculate what this means in terms of |
# page width: |
# page width: |
|
|
Line 2183 sub end_table {
|
Line 2192 sub end_table {
|
|
|
my $table = pop(@Apache::londefdef::table); |
my $table = pop(@Apache::londefdef::table); |
my $t = $table->generate(); |
my $t = $table->generate(); |
|
# &Apache::lonnet::logthis("Generating string"); |
$currentstring = $t->generate_string(); |
$currentstring = $t->generate_string(); |
|
# &Apache::lonnet::logthis("Generated: $currentstring"); |
&enable_para(); |
&enable_para(); |
#-------------------------------------------------------------- |
#-------------------------------------------------------------- |
# Old table code: |
# Old table code: |
Line 4604 sub get_eps_image {
|
Line 4615 sub get_eps_image {
|
|
|
#if replication failed try to produce eps file dynamically |
#if replication failed try to produce eps file dynamically |
$src=~s/\.ps$/\.eps/; |
$src=~s/\.ps$/\.eps/; |
my $temp_file; |
if (open(FILE,">>/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat")) { |
open(FILE,">>/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat"); |
my $newsrc=$orig_src; |
my $newsrc=$orig_src; |
$newsrc =~ s|(.*)/res/|/home/httpd/html/res/|; |
$newsrc =~ s|(.*)/res/|/home/httpd/html/res/|; |
&Apache::lonxml::debug("queueing $newsrc for dynamic eps production."); |
&Apache::lonxml::debug("queueing $newsrc for dynamic eps production."); |
print FILE ("$newsrc\n"); |
print FILE ("$newsrc\n"); |
close(FILE); |
close(FILE); |
} |
$src=~s|/home/httpd/html/res|/home/httpd/prtspool|; |
$src=~s|/home/httpd/html/res|/home/httpd/prtspool|; |
$src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|; |
$src=~s|/home/([^/]*)/public_html/|/home/httpd/prtspool/$1/|; |
if ($sext ne "") { # Put the ext. back in to uniquify. |
if ($sext ne "") { # Put the ext. back in to uniquify. |
Line 4643 sub get_eps_image {
|
Line 4654 sub get_eps_image {
|
sub eps_generation { |
sub eps_generation { |
my ($src,$file,$width_param) = @_; |
my ($src,$file,$width_param) = @_; |
my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat"; |
my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.dat"; |
my $temp_file = Apache::File->new('>>'.$filename); |
if (open(my $tmpfile,">>$filename")) { |
print $temp_file "$src\n"; |
print $tmpfile "$src\n"; |
|
close($tmpfile); |
|
} |
my $newsrc = $src; |
my $newsrc = $src; |
$newsrc =~ s/(\.bmp|\.gif|\.jpg|\.jpeg)$/\.eps/i; |
$newsrc =~ s/(\.bmp|\.gif|\.jpg|\.jpeg)$/\.eps/i; |
$newsrc=~s{/home/httpd/html/res}{}; |
$newsrc=~s{/home/httpd/html/res}{}; |