From 8280159eee7d3d27d60e549114e902b25ecab373 Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Fri, 2 Sep 2016 12:56:21 +0000 Subject: [PATCH] (Retrofit from trunk) Forms (portal): fix the rendering of a TEXT AREA in read-only mode. 1) format=text -> several lines were displayed on a single line 2) format=html -> characters encoded twice SVN:2.3[4372] --- .../bssimplefieldrenderer.class.inc.php | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/sources/renderer/bootstrap/fieldrenderer/bssimplefieldrenderer.class.inc.php b/sources/renderer/bootstrap/fieldrenderer/bssimplefieldrenderer.class.inc.php index 9543003405..4593d5ceab 100644 --- a/sources/renderer/bootstrap/fieldrenderer/bssimplefieldrenderer.class.inc.php +++ b/sources/renderer/bootstrap/fieldrenderer/bssimplefieldrenderer.class.inc.php @@ -211,8 +211,6 @@ EOF case 'Combodo\\iTop\\Form\\Field\\StringField': case 'Combodo\\iTop\\Form\\Field\\TextAreaField': - $bEncodeHtmlEntities = (($sFieldClass === 'Combodo\\iTop\\Form\\Field\\TextAreaField') && ($this->oField->GetFormat() === TextAreaField::ENUM_FORMAT_HTML)) ? false : true; - $oOutput->AddHtml('
'); // Showing label / value only if read-only but not hidden if (!$this->oField->GetHidden()) @@ -221,7 +219,25 @@ EOF { $oOutput->AddHtml(''); } - $oOutput->AddHtml('
')->AddHtml($this->oField->GetCurrentValue(), $bEncodeHtmlEntities)->AddHtml('
'); + + if($sFieldClass === 'Combodo\\iTop\\Form\\Field\\TextAreaField') + { + $bEncodeHtmlEntities = false; + if($this->oField->GetFormat() === TextAreaField::ENUM_FORMAT_HTML) + { + $sDisplayValue = $this->oField->GetCurrentValue(); + } + else + { + $sDisplayValue = utils::TextToHtml($this->oField->GetCurrentValue()); + } + } + else + { + $bEncodeHtmlEntities = true; + $sDisplayValue = $this->oField->GetCurrentValue(); + } + $oOutput->AddHtml('
')->AddHtml($sDisplayValue, $bEncodeHtmlEntities)->AddHtml('
'); } $oOutput->AddHtml(''); $oOutput->AddHtml('
');