mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-26 03:58:45 +02:00
N°7146 - Fix style not applied in list in the end-users portal in iTop 3.0+ (#635)
* N°7146 - Fix style not applied in list in the end-users portal in iTop 3.0+ - Add Markup in search list in order to use style * N°7146 - Fix style not applied in list in the end-users portal in iTop 3.0+ * WIP * Fix link on external Key * Add new markup * Update datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com> --------- Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>
This commit is contained in:
@@ -1408,14 +1408,14 @@ class ObjectController extends BrickController
|
||||
protected function PrepareObjectInformation(DBObject $oObject, $aAttCodes = array())
|
||||
{
|
||||
$sObjectClass = get_class($oObject);
|
||||
$aObjectData = array(
|
||||
$aObjectData = [
|
||||
'id' => $oObject->GetKey(),
|
||||
'name' => $oObject->GetName(),
|
||||
'attributes' => array(),
|
||||
);
|
||||
'attributes' => [],
|
||||
];
|
||||
|
||||
// Retrieving attributes definitions
|
||||
$aAttDefs = array();
|
||||
$aAttDefs = [];
|
||||
foreach ($aAttCodes as $sAttCode)
|
||||
{
|
||||
if ($sAttCode === 'id')
|
||||
@@ -1429,13 +1429,30 @@ class ObjectController extends BrickController
|
||||
// Preparing attribute data
|
||||
foreach ($aAttDefs as $oAttDef)
|
||||
{
|
||||
$aAttData = array(
|
||||
'att_code' => $oAttDef->GetCode(),
|
||||
);
|
||||
$aAttData = [
|
||||
'object_class' => $sObjectClass,
|
||||
'object_id' => $oObject->GetKey(),
|
||||
'attribute_code' => $oAttDef->GetCode(),
|
||||
'attribute_type' => get_class($oAttDef),
|
||||
];
|
||||
|
||||
// - Value raw
|
||||
// For simple fields, we get the raw (stored) value as well
|
||||
$bExcludeRawValue = false;
|
||||
foreach (ApplicationHelper::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude)
|
||||
{
|
||||
if (is_a($oAttDef, $sAttDefClassToExclude, true))
|
||||
{
|
||||
$bExcludeRawValue = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$aAttData['value_raw'] = ($bExcludeRawValue === false) ? $oObject->Get($oAttDef->GetCode()) : null;
|
||||
|
||||
|
||||
if ($oAttDef->IsExternalKey())
|
||||
{
|
||||
$aAttData['value'] = $oObject->GetAsHTML($oAttDef->GetCode().'_friendlyname');
|
||||
$aAttData['value_html'] = $oObject->GetAsHTML($oAttDef->GetCode().'_friendlyname');
|
||||
|
||||
// Checking if user can access object's external key
|
||||
if ($this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $oAttDef->GetTargetClass()))
|
||||
@@ -1467,14 +1484,14 @@ class ObjectController extends BrickController
|
||||
{
|
||||
$sUrl = $oAttDef->Get('default_image');
|
||||
}
|
||||
$aAttData['value'] = '<img src="'.$sUrl.'" />';
|
||||
$aAttData['value_html'] = '<img src="'.$sUrl.'" />';
|
||||
}
|
||||
elseif ($oAttDef instanceof AttributeEnum) {
|
||||
$aAttData['value'] = $oAttDef->GetAsPlainText($oObject->Get($oAttDef->GetCode()));
|
||||
$aAttData['value_html'] = $oAttDef->GetAsPlainText($oObject->Get($oAttDef->GetCode()));
|
||||
}
|
||||
else
|
||||
{
|
||||
$aAttData['value'] = $oAttDef->GetAsHTML($oObject->Get($oAttDef->GetCode()));
|
||||
$aAttData['value_html'] = $oAttDef->GetAsHTML($oObject->Get($oAttDef->GetCode()));
|
||||
|
||||
if ($oAttDef instanceof AttributeFriendlyName)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user