Tags:
create new tag
, view all tags
We are playing with using TWiki to serve as our project development space for a small project here at my work. We have created a web/zone for the project. We then have templates and forms created for a heirarchy of Requirement Sources, Requirements, and Design Points. Each of these areas also have topics for online and printable-sytle displays of these topics. Much like the topics here in codev, there is an HTML form at the top of the online that is used to create the detail topics using the correct template and form.

Up to this point everything is working great!

However, we wanted to be able to have a form field of type checkbox+buttons listing all the topic from the earlier type in the heirarchy. This would allow us to track where requirements came from and which design points meet which requirements and so on. This is where we hit a snag, forms do not process tags before creating the HTML table for view or HTML form for edit.

I took a look at the TWiki code (TWiki 01 Dec 2001 Production Release) (great code I might add) and added the following two lines:

$ diff -C 17 Form.pm.orig Form.pm
*** Form.pm.orig        Tue Jul 23 17:24:00 2002
--- Form.pm     Tue Jul 23 17:24:09 2002
***************
*** 119,170 ****
--- 119,172 ----
  # ============================
  # Get array of field definition, given form name
  # If form contains Web this overrides webName
  sub getFormDef
  {
      my( $webName, $form ) = @_;
      
      if( $form =~ /^(.*)\.(.*)$/ ) {
          $webName = $1;
          $form = $2;
      }
      
      my @fieldDefs = ();    
     
      # Read topic that defines the form
      if( &TWiki::Store::topicExists( $webName, $form ) ) {
          my( $meta, $text ) = &TWiki::Store::readTopic( $webName, $form );
+         $text = &TWiki::handleCommonTags( $text, $form );
          @fieldDefs = getFormDefinition( $text );
      } else {
          # FIXME - do what if there is an error?
      }
      
      my @fieldsInfo = ();
          
      # Get each field definition
      foreach my $fieldDefP ( @fieldDefs ) {
          my @fieldDef = @$fieldDefP;
          my( $name, $title, $type, $size, $posValuesS, $tooltip ) = @fieldDef;
          my @posValues = ();
          if( $posValuesS ) {
             @posValues = split( /,\s*/, $posValuesS );
          }
  
          if( ( ! @posValues ) && &TWiki::Store::topicExists( $webName, $name ) ) {
              my( $meta, $text ) = &TWiki::Store::readTopic( $webName, $name );
+             $text = &TWiki::handleCommonTags( $text, $form );
              @posValues = getPossibleFieldValues( $text );
              if( ! $type ) {
                  $type = "select";  #FIXME keep?
              }
          } else {
              # FIXME no list matters for some types
          }

          push @fieldsInfo, [ ( $name, $title, $type, $size, $tooltip, @posValues ) ];
      }
  
      return @fieldsInfo;
  }
  
  
  # ============================
  sub link
  {

This seems to do everything I need and does not break anything that we do on our site.

Thoughts, suggestions, free money?

-- JimPatterson - 24 Jul 2002

Related to this is TWikiFormsDontExpandVariables (preferred place to follow up) and FormValuesFromSearch.

-- PeterThoeny - 25 Jul 2002

Thanks for this patch, I had the exact same problem and I implemented it on our site. Admins, please put this in the normal code! (perhaps protected by a TWiki.cfg setting)

-- WoutMertens - 21 Oct 2002

I've applied this patch to our 01Feb2003 server and it works great. One side benefit - if you update a form (add fields, whatever) the new form is reflected in edit mode without having to go through a form CHANGE. At least, this appears to be a benefit to me ;->

-- SteveRJones - 13 Sep 2003

This sounds like a useful patch. Is anyone else using this?

-- RichardDonkin - 13 Sep 2003

This is a useful enhancement but brings some compatibility issues, see TWikiFormsDontExpandVariables.

-- PeterThoeny - 14 Sep 2003


Category: TWikiPatches
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2003-09-14 - JohnTalintyre
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.