N°4346 - Restore HTML metadata (data-xxx) on lists in the backoffice

This commit is contained in:
Eric Espie
2021-11-04 14:55:53 +01:00
parent aba0d4144c
commit 3d7df7600f
2 changed files with 19 additions and 4 deletions

View File

@@ -77,9 +77,11 @@ try
switch ($operation) {
case 'search_and_refresh':
$oPage->SetContentType('application/json');
$oPage = new JsonPage();
// Feeds dataTables directly
$oPage->SetOutputDataOnly(true);
$aResult = AjaxRenderController::SearchAndRefresh($sFilter);
$oPage->add(json_encode($aResult));
$oPage->SetData($aResult);
break;
case 'search':

View File

@@ -14,6 +14,7 @@ use AttributeOneWayPassword;
use BinaryExpression;
use BulkExport;
use BulkExportException;
use cmdbAbstractObject;
use CMDBObjectSet;
use CMDBSource;
use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableSettings;
@@ -77,8 +78,20 @@ class AjaxRenderController
$aObj[$sAlias."/hyperlink"] = $aObject[$sAlias]->GetHyperlink();
foreach ($aColumnsLoad[$sAlias] as $sAttCode) {
$aObj[$sAlias."/".$sAttCode] = $aObject[$sAlias]->GetAsHTML($sAttCode);
$oRawValue = $aObject[$sAlias]->Get($sAttCode);
if (is_scalar($oRawValue)) {
$bExcludeRawValue = false;
// Only retrieve raw (stored) value for simple fields
foreach (cmdbAbstractObject::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude)
{
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
if (is_a($oAttDef, $sAttDefClassToExclude, true))
{
$bExcludeRawValue = true;
break;
}
}
if (!$bExcludeRawValue) {
$oRawValue = $aObject[$sAlias]->Get($sAttCode);
$aObj[$sAlias."/".$sAttCode."/raw"] = $oRawValue;
}
}