From accd5670fe0b04a0ff5c156fb811ee93c982890a Mon Sep 17 00:00:00 2001 From: Molkobain Date: Mon, 24 Apr 2023 17:25:33 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B05890=20-=20Handle=20locked=20object=20pr?= =?UTF-8?q?operly=20in=20modals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/cmdbabstract.class.inc.php | 19 ++++++++++++------- application/displayblock.class.inc.php | 5 +++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index e3b5552f6..f5352cc0d 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -1126,15 +1126,20 @@ HTML $this->DisplayBareProperties($oPage, $bEditMode); $this->DisplayBareRelations($oPage, $bEditMode); + // Note: Adding the JS snippet which enables the image upload should have been done directly by the ActivityPanel which would have kept the independance principle // of the UIBlock. For now we keep it this way in order to move on and trace this known limitation in N°3736. - /** @var ActivityPanel $oActivityPanel */ - $oActivityPanel = $oPage->GetContentLayout()->GetSubBlock(ActivityPanel::BLOCK_CODE); - // Note: Testing if block exists is necessary as during the 'release_lock_and_details' operation we don't have an activity panel - if (!is_null($oActivityPanel) && $oActivityPanel->HasTransactionId()) { - $iTransactionId = $oActivityPanel->GetTransactionId(); - $sTempId = utils::GetUploadTempId($iTransactionId); - $oPage->add_ready_script(InlineImage::EnableCKEditorImageUpload($this, $sTempId)); + // + // Note: Don't do it in modals as we don't display the activity panel + if (false === ($oPage instanceof AjaxPage)) { + /** @var ActivityPanel $oActivityPanel */ + $oActivityPanel = $oPage->GetContentLayout()->GetSubBlock(ActivityPanel::BLOCK_CODE); + // Note: Testing if block exists is necessary as during the 'release_lock_and_details' operation we don't have an activity panel + if (!is_null($oActivityPanel) && $oActivityPanel->HasTransactionId()) { + $iTransactionId = $oActivityPanel->GetTransactionId(); + $sTempId = utils::GetUploadTempId($iTransactionId); + $oPage->add_ready_script(InlineImage::EnableCKEditorImageUpload($this, $sTempId)); + } } } diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 7d2e553b1..d03dfd291 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -2076,6 +2076,11 @@ class MenuBlock extends DisplayBlock } } + // Lock removal button is not supported in modals yet + if (utils::IsXmlHttpRequest()) { + $bCanKill = false; + } + if ($bCanKill) { $this->AddMenuSeparator($aRegularActions); $aRegularActions['concurrent_lock_unlock'] = array(