[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm lontable.pm
foxr
foxr@source.lon-capa.org
Tue, 05 Apr 2011 10:02:58 -0000
foxr Tue Apr 5 10:02:58 2011 EDT
Modified files:
/loncom/xml londefdef.pm lontable.pm
Log:
Bug 6317 - Made rules for all but "groups" work correctly. Have to think
much harder about the data structures needed for row and column groups
(which are currently not processed in printing) to get that last to
work correctly.
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.427 loncom/xml/londefdef.pm:1.428
--- loncom/xml/londefdef.pm:1.427 Sun Nov 28 02:46:23 2010
+++ loncom/xml/londefdef.pm Tue Apr 5 10:02:57 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.427 2010/11/28 02:46:23 raeburn Exp $
+# $Id: londefdef.pm,v 1.428 2011/04/05 10:02:57 foxr Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -2063,15 +2063,22 @@
if ((defined $border) && ($border > 0)) {
# &Apache::lonnet::logthis("Turning on table borders: $border");
$table->table_border(1);
- if ($cell_border ne 'none') {
- $table->cell_border(1); # html specs that border turns on both...unless rules='none'.
+ if (!defined $cell_border) {
+ $table->cell_border(1); # Default for rules is all if rules not defined.
}
}
# 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);
+ if ((defined $cell_border)) {
+ if ($cell_border eq 'all') {
+ $table->cell_border(1);
+ } elsif ($cell_border eq 'rows') {
+ $table->cell_border(2);
+ } elsif ($cell_border eq 'cols') {
+ $table->cell_border(3);
+ } else {
+ $table->cell_border(0);
+ }
}
if (defined $theme) {
$table->theme($theme);
Index: loncom/xml/lontable.pm
diff -u loncom/xml/lontable.pm:1.15 loncom/xml/lontable.pm:1.16
--- loncom/xml/lontable.pm:1.15 Thu Nov 18 17:12:14 2010
+++ loncom/xml/lontable.pm Tue Apr 5 10:02:58 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Generating TeX tables.
#
-# $Id: lontable.pm,v 1.15 2010/11/18 17:12:14 raeburn Exp $
+# $Id: lontable.pm,v 1.16 2011/04/05 10:02:58 foxr Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -347,6 +347,20 @@
drawn around them. If a paramter is passed, it will be treated as
a new value for the cell border configuration. Regardless,the final
value of that configuration parameter is returned.
+Valid values for the parameter are:
+
+=over 2
+
+=item 0 - no borders present.
+
+=item 1 - All borders (borders around all four sides of the cell.
+
+=item 2 - Border at top and bottom of the cell.
+
+=item 3 - Border at the left and right sides of the cell.
+
+
+=over -2
=head3 Examples:
@@ -846,9 +860,12 @@
my $outer_border = $this->{'outer_border'};
my $column_count = $this->{'column_count'};
+ my $cell_ul_border = (($inner_border == 1) || ($inner_border == 2)) ? 1 : 0;
+ my $cell_lr_border = (($inner_border == 1) || ($inner_border == 3)) ? 1 : 0;
+
# Add a top line if the outer or inner border is enabled:
- if ($outer_border || $inner_border) {
+ if ($outer_border || $cell_ul_border) {
push(@data, ["\\cline{1-$column_count}"]);
}
@@ -908,10 +925,10 @@
$contents = $embeddedAlignStart . $contents . $embeddedAlignEnd;
}
- if ($inner_border || ($outer_border && ($cell == 0))) {
+ if ($cell_lr_border || ($outer_border && ($cell == 0))) {
$col_align = '|'.$col_align;
}
- if ($inner_border || ($outer_border && ($cell == ($cell_count -1)))) {
+ if ($cell_lr_border || ($outer_border && ($cell == ($cell_count -1)))) {
$col_align = $col_align.'|';
}
@@ -935,7 +952,7 @@
$contents .= ' \\\\';
}
}
- if ($inner_border && ($cells->[$cell]->{'rowspan'} == 1)) {
+ if ($cell_ul_border && ($cells->[$cell]->{'rowspan'} == 1)) {
my $lastcol = $nextcol -1;
push(@underlines, "\\cline{$startcol-$lastcol}");
}
@@ -946,7 +963,7 @@
}
push(@data, \@row);
- if ($inner_border) {
+ if ($cell_ul_border) {
for (my $i =0; $i < scalar(@underlines); $i++) {
push(@data, [$underlines[$i]]);
}
@@ -957,14 +974,14 @@
# Add bottom border if necessary: if the inner border was on, the loops above
# will have done a bottom line under the last cell.
#
- if ($outer_border && !$inner_border) {
+ if ($outer_border && !$cell_ul_border) {
push(@data, ["\\cline{1-$column_count}"]);
}
$table->set_data(\@data);
my $coldef = "";
- if ($outer_border || $inner_border) {
+ if ($outer_border || $cell_lr_border) {
$coldef .= '|';
}
for (my $i =0; $i < $column_count; $i++) {
@@ -973,7 +990,7 @@
} else {
$coldef .= 'l';
}
- if ($inner_border ||
+ if ($cell_lr_border ||
($outer_border && ($i == $column_count-1))) {
$coldef .= '|';
}