mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 23:32:17 +02:00
N°7146 - Fix style not applied in list in the end-users portal in iTop 3.0+
This commit is contained in:
@@ -1410,7 +1410,6 @@ class ObjectController extends BrickController
|
||||
$sObjectClass = get_class($oObject);
|
||||
$aObjectData = [
|
||||
'id' => $oObject->GetKey(),
|
||||
'object_class' => $sObjectClass,
|
||||
'name' => $oObject->GetName(),
|
||||
'attributes' => [],
|
||||
];
|
||||
@@ -1431,18 +1430,29 @@ class ObjectController extends BrickController
|
||||
foreach ($aAttDefs as $oAttDef)
|
||||
{
|
||||
$aAttData = [
|
||||
'att_code' => $oAttDef->GetCode(),
|
||||
'attribute-type' => get_class($oAttDef),
|
||||
'object_class' => $sObjectClass,
|
||||
'object_id' => $oObject->GetKey(),
|
||||
'attribute_code' => $oAttDef->GetCode(),
|
||||
'attribute_type' => get_class($oAttDef),
|
||||
];
|
||||
|
||||
// - Value raw
|
||||
if ($oAttDef::IsScalar()) {
|
||||
$aAttData['value-raw'] =utils::HtmlEntities( (string)$oObject->Get($oAttDef->GetCode()));
|
||||
// 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()))
|
||||
@@ -1474,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)
|
||||
{
|
||||
|
||||
@@ -66,32 +66,35 @@
|
||||
"title": oColumnProperties[sKey].title,
|
||||
"defaultContent": "",
|
||||
"type": "html",
|
||||
"data": "attributes."+sKey+".att_code",
|
||||
"render": function(data, type, row){
|
||||
"data": "attributes."+sKey+".attribute_code",
|
||||
"render": function(attribute_code, type, row){
|
||||
var cellElem;
|
||||
var metadataNames = ['object_class', 'object_id', 'attribute_code', 'attribute_type', 'value_raw'];
|
||||
|
||||
// Preparing the cell data
|
||||
if(row.attributes[data].url !== undefined)
|
||||
if(row.attributes[attribute_code].url !== undefined)
|
||||
{
|
||||
cellElem = $('<a></a>');
|
||||
cellElem.attr('target', '_blank').attr('href', row.attributes[data].url);
|
||||
cellElem.attr('target', '_blank').attr('href', row.attributes[attribute_code].url);
|
||||
}
|
||||
else
|
||||
{
|
||||
cellElem = $('<span></span>');
|
||||
}
|
||||
//Add markup
|
||||
cellElem.attr('data-object-id', row.id)
|
||||
cellElem.attr('data-object-class', row.object_class);
|
||||
cellElem.attr('data-attribute-type', row.attributes[data]['attribute-type']);
|
||||
cellElem.attr('data-attribute-code', row.attributes[data]['att_code']);
|
||||
console.warn('bob');
|
||||
if (row.attributes[data]['value-raw']!== undefined) {
|
||||
cellElem.attr('data-value-raw', row.attributes[data]['value-raw']);
|
||||
for(var sPropName in row.attributes[attribute_code])
|
||||
{
|
||||
var propValue = row.attributes[attribute_code][sPropName];
|
||||
if(sPropName === 'value_html')
|
||||
{
|
||||
cellElem.html(propValue);
|
||||
}
|
||||
else if(metadataNames.indexOf(sPropName) > -1)
|
||||
{
|
||||
cellElem.attr('data-'+sPropName.replace('_', '-'), propValue)
|
||||
}
|
||||
}
|
||||
|
||||
cellElem.html( row.attributes[data].value );
|
||||
|
||||
return cellElem.prop('outerHTML');
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user