Skip to content

Commit

Permalink
Item13036: improve cross-engine compatibility
Browse files Browse the repository at this point in the history
... displaying formfield values
  • Loading branch information
MichaelDaum committed Sep 25, 2014
1 parent 202c686 commit 4e8ad9d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
9 changes: 9 additions & 0 deletions .gitignore
@@ -0,0 +1,9 @@
*.gz
*.swp
FlexFormPlugin.md5
FlexFormPlugin.sha1
FlexFormPlugin.tgz
FlexFormPlugin.txt
FlexFormPlugin.zip
FlexFormPlugin_installer
FlexFormPlugin_installer.pl
3 changes: 2 additions & 1 deletion data/System/FlexFormPlugin.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="autosave" date="1356278771" format="1.1" version="3"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1411636821" format="1.1" version="1"}%
---+!! %TOPIC%
%$SHORTDESCRIPTION%

Expand Down Expand Up @@ -186,6 +186,7 @@ Note that the actual results may vary depending on the formfield type of the !Da
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 29 Sep 2014: | improved cross-engine compatibility displaying formfield values |
| 28 Aug 2014: | added new feature %<nop>RENDERFORMDEF |
| 03 Mar 2014: | work around different styles of inconsistencies in =renderForDisplay= across foswiki core releases |
| 07 Nov 2013: | properly render =checkbox+buttons= formfields |
Expand Down
4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/FlexFormPlugin.pm
Expand Up @@ -18,8 +18,8 @@ package Foswiki::Plugins::FlexFormPlugin;
use strict;
use warnings;

our $VERSION = '3.00';
our $RELEASE = '3.00';
our $VERSION = '3.10';
our $RELEASE = '3.10';
our $SHORTDESCRIPTION = 'Flexible way to render <nop>DataForms';
our $NO_PREFS_IN_TOPIC = 1;
our $doneInit;
Expand Down
6 changes: 3 additions & 3 deletions lib/Foswiki/Plugins/FlexFormPlugin/Core.pm
Expand Up @@ -355,9 +355,7 @@ sub handleRENDERFORDISPLAY {
# - patch in (display) value as $value
# - use raw value as $origvalue
my $origValue = $fieldValue;
if ($field->can('getDisplayValue')) {
$fieldValue = $field->getDisplayValue($fieldValue);
}
$line =~ s/\$value([^\(]|$)/\$value(display)\0$1/g;

# now dive into the core and see what we get out of it
$line = $field->renderForDisplay($line, $fieldValue, {
Expand All @@ -366,6 +364,8 @@ sub handleRENDERFORDISPLAY {
display=> 1,
});

$line =~ s/(?:\(display\))?\0//g;

# render left-overs by ourselfs
$line =~ s/\$name\b/$fieldName/g;
$line =~ s/\$type\b/$fieldType/g;
Expand Down

0 comments on commit 4e8ad9d

Please sign in to comment.