Skip to content

Commit

Permalink
Item14465: improvements for RENDERFORMDEF
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Aug 30, 2017
1 parent 5a7d422 commit 7ff74db
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
5 changes: 4 additions & 1 deletion data/System/FlexFormPlugin.txt
Expand Up @@ -121,7 +121,9 @@ The =format= parameter may contain the following variables:
| "..." or form="..." | the topic holding the !DataForm definition | current topic |
| field="..." or fields="..." | a comma separated list of fields to render information about | all fields |
| include="..." | regular expression a field name must match to be listed | |
| includeattr="..." | regular expression field attributes must match to be included in the output | undefined |
| exclude="..." | regular expression a field name must not match to be listed | |
| excludeattr="..." | regular expression field attributes must match to be excluded from the output | undefined |
| header | header string prepended to the result | |
| format | format string for each field to be rendered in the result | |
| separator | separator between lines when field information is rendered | |
Expand Down Expand Up @@ -180,6 +182,7 @@ Note that the actual results may vary depending on the formfield type of the !Da
%$DEPENDENCIES%

---++ Change History
| 30 Aug 2016: | added =includeattr=, =excludeattr= to RENDERFORMDEF |
| 02 Sep 2016: | improved support to translate formfields using Foswiki:Extensions.MultiLingualPlugin |
| 08 Mar 2016: | clean up formfield title before trying to translate it; \
added =hideempty= for RENDERFOREDIT |
Expand Down Expand Up @@ -225,7 +228,7 @@ Note that the actual results may vary depending on the formfield type of the !Da

%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="Foswiki:MichaelDaum"}%
%META:FIELD{name="Copyright" title="Copyright" value="© 2009-2016 Michael Daum http://michaeldaumconsulting.com"}%
%META:FIELD{name="Copyright" title="Copyright" value="© 2009-2017 Michael Daum http://michaeldaumconsulting.com"}%
%META:FIELD{name="Description" title="Description" value="%25$SHORTDESCRIPTION%25"}%
%META:FIELD{name="Home" title="Home" value="Foswiki:Extensions/%TOPIC%"}%
%META:FIELD{name="License" title="License" value="[[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]]"}%
Expand Down
6 changes: 3 additions & 3 deletions lib/Foswiki/Plugins/FlexFormPlugin.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2009-2016 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2009-2017 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -18,8 +18,8 @@ package Foswiki::Plugins::FlexFormPlugin;
use strict;
use warnings;

our $VERSION = '5.21';
our $RELEASE = '02 Sep 2016';
our $VERSION = '5.30';
our $RELEASE = '30 Aug 2017';
our $SHORTDESCRIPTION = 'Flexible way to render <nop>DataForms';
our $NO_PREFS_IN_TOPIC = 1;
our $renderForEditInstance;
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/FlexFormPlugin/Base.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2009-2016 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2009-2017 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
1 change: 1 addition & 0 deletions lib/Foswiki/Plugins/FlexFormPlugin/MANIFEST
@@ -1,3 +1,4 @@
!noci
data/System/FlexFormPlugin.txt 0644
lib/Foswiki/Plugins/FlexFormPlugin/Base.pm 0644
lib/Foswiki/Plugins/FlexFormPlugin/DEPENDENCIES 0644
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/FlexFormPlugin/RenderForDisplay.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2009-2016 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2009-2017 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/FlexFormPlugin/RenderForEdit.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2009-2016 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2009-2017 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
10 changes: 9 additions & 1 deletion lib/Foswiki/Plugins/FlexFormPlugin/RenderFormDef.pm
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2009-2016 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2009-2017 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -43,6 +43,8 @@ sub handle {
my $theFields = $params->{field} || $params->{fields};
my $theExclude = $params->{exclude};
my $theInclude = $params->{include};
my $theIncludeAttr = $params->{includeattr};
my $theExcludeAttr = $params->{excludeattr};

my $form;
try {
Expand Down Expand Up @@ -70,6 +72,8 @@ sub handle {
next unless $field;
next if defined $theExclude && $field->{name} =~ /$theExclude/;
next if defined $theInclude && $field->{name} !~ /$theInclude/;
next if $theIncludeAttr && $field->{attributes} !~ /$theIncludeAttr/;
next if $theExcludeAttr && $field->{attributes} =~ /$theExcludeAttr/;

my $line = $theFormat;

Expand All @@ -93,6 +97,10 @@ sub handle {

my $result = $theHeader . join($theSep, @result) . $theFooter;
$result =~ s/\$form/$formName/g;
$result =~ s/\$nop//g;
$result =~ s/\$n/\n/g;
$result =~ s/\$perce?nt/%/g;
$result =~ s/\$dollar/\$/g;

return $result;
}
Expand Down

0 comments on commit 7ff74db

Please sign in to comment.