From 4e8ad9dd837dee50c75792ee66fe6eca5061aaca Mon Sep 17 00:00:00 2001 From: MichaelDaum Date: Thu, 25 Sep 2014 11:20:30 +0200 Subject: [PATCH] Item13036: improve cross-engine compatibility ... displaying formfield values --- .gitignore | 9 +++++++++ data/System/FlexFormPlugin.txt | 3 ++- lib/Foswiki/Plugins/FlexFormPlugin.pm | 4 ++-- lib/Foswiki/Plugins/FlexFormPlugin/Core.pm | 6 +++--- 4 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79cd3aa --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.gz +*.swp +FlexFormPlugin.md5 +FlexFormPlugin.sha1 +FlexFormPlugin.tgz +FlexFormPlugin.txt +FlexFormPlugin.zip +FlexFormPlugin_installer +FlexFormPlugin_installer.pl diff --git a/data/System/FlexFormPlugin.txt b/data/System/FlexFormPlugin.txt index 30b26e0..206e81f 100644 --- a/data/System/FlexFormPlugin.txt +++ b/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% @@ -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: |   | +| 29 Sep 2014: | improved cross-engine compatibility displaying formfield values | | 28 Aug 2014: | added new feature %RENDERFORMDEF | | 03 Mar 2014: | work around different styles of inconsistencies in =renderForDisplay= across foswiki core releases | | 07 Nov 2013: | properly render =checkbox+buttons= formfields | diff --git a/lib/Foswiki/Plugins/FlexFormPlugin.pm b/lib/Foswiki/Plugins/FlexFormPlugin.pm index 44ce13f..83674e1 100644 --- a/lib/Foswiki/Plugins/FlexFormPlugin.pm +++ b/lib/Foswiki/Plugins/FlexFormPlugin.pm @@ -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 DataForms'; our $NO_PREFS_IN_TOPIC = 1; our $doneInit; diff --git a/lib/Foswiki/Plugins/FlexFormPlugin/Core.pm b/lib/Foswiki/Plugins/FlexFormPlugin/Core.pm index 02bf0cd..6a6b598 100644 --- a/lib/Foswiki/Plugins/FlexFormPlugin/Core.pm +++ b/lib/Foswiki/Plugins/FlexFormPlugin/Core.pm @@ -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, { @@ -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;