mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
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:trunk[4369]
This commit is contained in:
@@ -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('<div class="form-group">');
|
||||
// Showing label / value only if read-only but not hidden
|
||||
if (!$this->oField->GetHidden())
|
||||
@@ -221,7 +219,25 @@ EOF
|
||||
{
|
||||
$oOutput->AddHtml('<label for="' . $this->oField->GetGlobalId() . '" class="control-label">')->AddHtml($this->oField->GetLabel(), true)->AddHtml('</label>');
|
||||
}
|
||||
$oOutput->AddHtml('<div class="form-control-static">')->AddHtml($this->oField->GetCurrentValue(), $bEncodeHtmlEntities)->AddHtml('</div>');
|
||||
|
||||
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('<div class="form-control-static">')->AddHtml($sDisplayValue, $bEncodeHtmlEntities)->AddHtml('</div>');
|
||||
}
|
||||
$oOutput->AddHtml('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="')->AddHtml($this->oField->GetCurrentValue(), true)->AddHtml('" class="form-control" />');
|
||||
$oOutput->AddHtml('</div>');
|
||||
|
||||
Reference in New Issue
Block a user