[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm
sakharuk
lon-capa-cvs@mail.lon-capa.org
Mon, 15 Mar 2004 19:19:04 -0000
sakharuk Mon Mar 15 14:19:04 2004 EDT
Modified files:
/loncom/xml londefdef.pm
Log:
Bug 2751 (<table width="100%"> is ignored when printing) is fixed.
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.202 loncom/xml/londefdef.pm:1.203
--- loncom/xml/londefdef.pm:1.202 Fri Mar 12 10:21:49 2004
+++ loncom/xml/londefdef.pm Mon Mar 15 14:19:04 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.202 2004/03/12 15:21:49 sakharuk Exp $
+# $Id: londefdef.pm,v 1.203 2004/03/15 19:19:04 sakharuk Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -1795,13 +1795,14 @@
if (not defined $TeXwidth) {
my $htmlwidth = &Apache::lonxml::get_param('width',$parstack,$safeeval,undef,1);
if ($htmlwidth=~/%/) {
+ $Apache::londefdef::table[-1]{'percent'}=1;
$htmlwidth=~/(\d+)/;
- my $value=$1*$textwidth/100;
- $Apache::londefdef::table[-1]{'width'}=$value;
+ $Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100;;
} else {
$Apache::londefdef::table[-1]{'width'}=$textwidth;
}
} elsif ($TeXwidth=~/%/) {
+ $Apache::londefdef::table[-1]{'percent'}=1;
$TeXwidth=~/(\d+)/;
my $value=$1*$textwidth/100;
$Apache::londefdef::table[-1]{'width'}=$value;
@@ -1879,6 +1880,17 @@
for (my $jn=0;$jn<=$#length_row_final;$jn++) {
if ($length_row_final[$jn]==0) {
$length_row_final[$jn]=0.9*$available_length/$needed;
+ }
+ }
+ #recalculation for the use of all available width if width is defined in %
+ if ($Apache::londefdef::table[-1]{'percent'}==1) {
+ my $current=0;
+ for (my $i=0;$i<=$#length_row_final;$i++) {
+ $current+=$length_row_final[$i];
+ }
+ my $coef=$Apache::londefdef::table[-1]{'width'}/$current;
+ for (my $i=0;$i<=$#length_row_final;$i++) {
+ $length_row_final[$i]*=$coef;
}
}
#fill the table