mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
Merge remote-tracking branch 'origin/support/2.7' into develop
# Conflicts: # core/attributedef.class.inc.php # core/config.class.inc.php # core/htmlsanitizer.class.inc.php # sources/Renderer/RenderingOutput.php # test/core/sanitizer/HTMLDOMSanitizerTest.php # test/integration/DictionariesConsistencyTest.php
This commit is contained in:
@@ -107,18 +107,36 @@ EOF
|
||||
// ... in view mode
|
||||
else
|
||||
{
|
||||
$aItems = $oOrmItemSet->GetTags();
|
||||
if ($oOrmItemSet instanceof \ormTagSet) {
|
||||
$aItems = $oOrmItemSet->GetTags();
|
||||
$fExtractTagData = static function($oTag, &$sItemLabel, &$sItemDescription) {
|
||||
$sItemLabel = $oTag->Get('label');
|
||||
$sItemDescription = $oTag->Get('description');
|
||||
};
|
||||
} else {
|
||||
$aItems = $oOrmItemSet->GetValues();
|
||||
$oAttDef = MetaModel::GetAttributeDef($oOrmItemSet->GetClass(), $oOrmItemSet->GetAttCode());
|
||||
$fExtractTagData = static function($sEnumSetValue, &$sItemLabel, &$sItemDescription) use ($oAttDef) {
|
||||
$sItemLabel = $oAttDef->GetValueLabel($sEnumSetValue);
|
||||
$sItemDescription = '';
|
||||
};
|
||||
}
|
||||
|
||||
$oOutput->AddHtml('<div class="form-control-static">')
|
||||
->AddHtml('<span class="label-group">');
|
||||
foreach($aItems as $sItemCode => $oItem)
|
||||
foreach($aItems as $sItemCode => $value)
|
||||
{
|
||||
$sItemLabel = $oItem->Get('label');
|
||||
$sItemDescription = $oItem->Get('description');
|
||||
$fExtractTagData($value, $sItemLabel, $sItemDescription);
|
||||
|
||||
$sDescriptionAttr = (empty($sItemDescription))
|
||||
? ''
|
||||
: ' data-description="'.utils::HtmlEntities($sItemDescription).'"';
|
||||
|
||||
$oOutput->AddHtml('<span class="label label-default" data-code="'.$sItemCode.'" data-label="')
|
||||
->AddHtml($sItemLabel, true)
|
||||
->AddHtml('" data-description="')
|
||||
->AddHtml($sItemDescription, true)
|
||||
->AddHtml('">')
|
||||
->AddHtml('"')
|
||||
->AddHtml($sDescriptionAttr)
|
||||
->AddHtml('>')
|
||||
->AddHtml($sItemLabel, true)
|
||||
->AddHtml('</span>');
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
namespace Combodo\iTop\Renderer;
|
||||
|
||||
use utils;
|
||||
|
||||
/**
|
||||
* Description of RenderingOutput
|
||||
*
|
||||
@@ -111,15 +113,15 @@ class RenderingOutput
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sHtml
|
||||
* @param bool $bEncodeHtmlEntities
|
||||
* @param ?string $sHtml
|
||||
* @param bool $bEscapeHtmlEntities
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function AddHtml(?string $sHtml, bool $bEncodeHtmlEntities = false)
|
||||
public function AddHtml(?string $sHtml, bool $bEscapeHtmlEntities = false)
|
||||
{
|
||||
if (!is_null($sHtml)) {
|
||||
$this->sHtml .= ($bEncodeHtmlEntities) ? htmlentities($sHtml, ENT_QUOTES, 'UTF-8') : $sHtml;
|
||||
$this->sHtml .= ($bEscapeHtmlEntities) ? utils::Escapehtml($sHtml) : $sHtml;
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
Reference in New Issue
Block a user