From bcdb6bdac8f4bcd282f92cb37c690903234c4d2e Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Mon, 15 Feb 2021 16:50:11 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B03670=20Display=20filetype=20icons=20in?= =?UTF-8?q?=20portal=20attachment=20display?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../portal/src/Controller/ObjectController.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php b/datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php index 443ade031..22a9ccf07 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php @@ -1154,9 +1154,13 @@ class ObjectController extends BrickController $iAttId = $oAttachment->DBInsert(); $aData['msg'] = htmlentities($oDocument->GetFileName(), ENT_QUOTES, 'UTF-8'); - // TODO : Change icon location when itop-attachment is refactored - //$aData['icon'] = utils::GetAbsoluteUrlAppRoot() . AttachmentPlugIn::GetFileIcon($oDoc->GetFileName()); - $aData['icon'] = utils::GetAbsoluteUrlAppRoot().'env-'.utils::GetCurrentEnvironment().'/itop-attachments/icons/image.png'; + $aData['icon'] = utils::GetAbsoluteUrlAppRoot().'env-'.utils::GetCurrentEnvironment().'/itop-attachments/icons/icons8-image-file.svg'; + + // Checking if the instance has attachments + if (class_exists('AttachmentPlugIn')) { + $aData['icon'] = utils::GetAbsoluteUrlAppRoot() . AttachmentPlugIn::GetFileIcon($oDocument->GetFileName()); + } + $aData['att_id'] = $iAttId; $aData['preview'] = $oDocument->IsPreviewAvailable() ? 'true' : 'false'; $aData['file_size'] = $oDocument->GetFormattedSize();