We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
Tags:
create new tag
, view all tags
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

Topic revision: r2 - 13 May 2003 - 07:48:00 - PeterThoeny
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback