diff --git a/data/System/DBConnectorPlugin.txt b/data/System/DBConnectorPlugin.txt index d892d3b..18df4d9 100644 --- a/data/System/DBConnectorPlugin.txt +++ b/data/System/DBConnectorPlugin.txt @@ -44,6 +44,7 @@ With the macro !%EDITFIELDBUTTON% you can let apear a button for editing a field | _topic_ | Current topic | Sets the topic name of which you want to edit the field | | _field_ | - | *required* Name of the field you want to edit | | _type_ | "" | optional Type of the field. This is used to use different edit templates. Look *Customizing Field-Editor User Interface* for informations| + | _buttonName_ | $field | Sets the name of the button, which will be displayed to the user | *Example:* !%EDITFIELDBUTTON{ field="samplefield2" }% -> %EDITFIELDBUTTON{ field="samplefield2" }% ---+++ Display a value in a topic @@ -53,6 +54,7 @@ With the macro !%DISPLAYDBFIELD% you can let display the value of a field in a t | _topic_ | Current topic | Sets the topic name of which you want to display the field | | _field_ | - | *required* Name of the field you want to display | | _format_ | _field_ | here you can use a format string, while !%VALUE% get replaced by the field value | +| _raw_ | 0 | if you set this to true, the result field will not be rendered, so no TML->HTML conversion | *Example:* !%DISPLAYDBFIELD{ field="samplefield2" }% -> %DISPLAYDBFIELD{ field="samplefield2" }% ---++ Methods ---+++ getValues( $web, $topic, @fields ) -> ( %result ) diff --git a/lib/Foswiki/Plugins/DBConnectorPlugin.pm b/lib/Foswiki/Plugins/DBConnectorPlugin.pm index 382fea5..dd79557 100644 --- a/lib/Foswiki/Plugins/DBConnectorPlugin.pm +++ b/lib/Foswiki/Plugins/DBConnectorPlugin.pm @@ -598,12 +598,18 @@ sub _displayFieldValue { $topic = $params->{'topic'} || $topic; my $fieldname = $params->{'field'} || ""; my $format = $params->{'format'} || ""; + my $raw = $params->{'raw'} || 0; return "error, no field given" if ($fieldname eq ""); my %result = getValues($web,$topic,[$fieldname],0); return "not defined" if(!defined %result); - my $fieldvalue = Foswiki::entityEncode($result{$fieldname}); + my $fieldvalue = $result{$fieldname}; + if($raw) { + $fieldvalue = Foswiki::entityEncode($fieldvalue); + } else { + $fieldvalue = Foswiki::Func::renderText( $fieldvalue, $web); + } if($format ne "") { $format =~ s/%VALUE%/$fieldvalue/g; return $format;