A patch, which delegates the
WebForm table to the table renderer.
Why?
Generally,
it is a good idea to blend table colour/shading style
with the other web background/colour settings; cf
TableFormatOnTwikiOrg.
To do so, give up <table> markup altogether,
but simply use the | twiki | table | syntax |.
The diff for
CVS:lib/TWiki.pm
***************
*** 1543,1560 ****
my %form = $meta->findOne( "FORM" );
if( %form ) {
my $name = $form{"name"};
! $metaText = "<p />\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n <tr>";
! $metaText .= "<th colspan=\"2\" align=\"center\" bgcolor=\"#99CCCC\"> $name </th></tr>\n";
my @fields = $meta->find( "FIELD" );
foreach my $field ( @fields ) {
my $title = $field->{"title"};
my $value = $field->{"value"};
! $metaText .= "<tr><th bgcolor=\"#99CCCC\" align=\"right\"> $title:</th><td align=\"left\"> $value </td></tr>\n";
}
- $metaText .= "</table>\n";
-
$metaText = getRenderedVersion( $metaText, $web );
}
--- 1579,1595 ----
my %form = $meta->findOne( "FORM" );
if( %form ) {
my $name = $form{"name"};
! $metaText = "\n|*$name: $topic*||\n";
my @fields = $meta->find( "FIELD" );
foreach my $field ( @fields ) {
my $title = $field->{"title"};
my $value = $field->{"value"};
! $value =~ s/\n/<br>/g; # undo
expansion
! $metaText .= "| $title:|$value |\n"
! if ($value);
}
$metaText = getRenderedVersion( $metaText, $web );
}
--
PeterKlausner - 12 May 2003
Thanks Peter for the patch. I commited the
CVS:lib/TWiki.pm changes into
TWikiAlphaRelease and TWiki.org with some small changes:
***************
*** 115,121 ****
# ===========================
# TWiki version:
! $wikiversion = "10 Apr 2003";
# ===========================
# Key Global variables, required for writeDebug
--- 115,121 ----
# ===========================
# TWiki version:
! $wikiversion = "13 May 2003";
# ===========================
# Key Global variables, required for writeDebug
***************
*** 2121,2138 ****
my %form = $meta->findOne( "FORM" );
if( %form ) {
my $name = $form{"name"};
! $metaText = "<p />\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n <tr>";
! $metaText .= "<th colspan=\"2\" align=\"center\" bgcolor=\"#99CCCC\"> $name </th></tr>\n";
my @fields = $meta->find( "FIELD" );
foreach my $field ( @fields ) {
my $title = $field->{"title"};
my $value = $field->{"value"};
! $metaText .= "<tr><th bgcolor=\"#99CCCC\" align=\"right\"> $title:</th><td align=\"left\"> $value </td></tr>\n";
}
- $metaText .= "</table>\n";
-
$metaText = getRenderedVersion( $metaText, $web );
}
--- 2121,2136 ----
my %form = $meta->findOne( "FORM" );
if( %form ) {
my $name = $form{"name"};
! $metaText = "\n|*[[$name]]*||\n";
my @fields = $meta->find( "FIELD" );
foreach my $field ( @fields ) {
my $title = $field->{"title"};
my $value = $field->{"value"};
! $value =~ s/\n/<br \/>/g; # undo expansion
! $metaText .= "| $title:|$value |\n";
}
$metaText = getRenderedVersion( $metaText, $web );
}
A similar change is pending for the form in edit mode.
BTW, the link color in table headings of
TableFormatOnTwikiOrg needs to be fixed. The correct way is to add a new parameter for that to the
TablePlugin.
--
PeterThoeny - 13 May 2003