From 4b888a3805d5d9b135969b7bd03a511d942b0f8f Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Tue, 9 Nov 2021 09:46:23 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B04378=20Restore=20keyboard=20shortcuts=20?= =?UTF-8?q?behavior=20for=20object=20details?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/displayblock.class.inc.php | 2 +- .../PopoverMenuItem/PopoverMenuItem.php | 15 ++++++++- sources/application/UI/Base/UIBlock.php | 2 +- .../popover-menu/item/mode_js.html.twig | 2 +- .../popover-menu/item/mode_url.html.twig | 2 +- .../object/object-details/layout.js.twig | 33 +++++++++++++++++-- 6 files changed, 48 insertions(+), 8 deletions(-) diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 4e5fb21cf..495589717 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -2331,7 +2331,7 @@ class MenuBlock extends DisplayBlock } $sTarget = isset($aAction['target']) ? $aAction['target'] : ''; - $oActionButton = ButtonUIBlockFactory::MakeLinkNeutral($sUrl, $sLabel, $sIconClass, $sTarget, $sActionId); + $oActionButton = ButtonUIBlockFactory::MakeLinkNeutral($sUrl, $sLabel, $sIconClass, $sTarget, utils::Sanitize($sActionId, '', utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER)); $oActionButton->AddCSSClasses(['ibo-action-button', 'ibo-regular-action-button']); if (empty($sLabel)) { if (empty($aAction['tooltip'])) { diff --git a/sources/application/UI/Base/Component/PopoverMenu/PopoverMenuItem/PopoverMenuItem.php b/sources/application/UI/Base/Component/PopoverMenu/PopoverMenuItem/PopoverMenuItem.php index 22a521db1..44a32c2fc 100644 --- a/sources/application/UI/Base/Component/PopoverMenu/PopoverMenuItem/PopoverMenuItem.php +++ b/sources/application/UI/Base/Component/PopoverMenu/PopoverMenuItem/PopoverMenuItem.php @@ -22,6 +22,7 @@ namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem use ApplicationPopupMenuItem; use Combodo\iTop\Application\UI\Base\UIBlock; +use utils; /** * Class PopoverMenuItem @@ -56,7 +57,7 @@ class PopoverMenuItem extends UIBlock */ protected function GenerateId() { - return static::BLOCK_CODE.'-'.$this->oPopupMenuItem->GetUID(); + return parent::GenerateId().'--'.utils::GetSafeId($this->oPopupMenuItem->GetUID()); } /** @@ -148,4 +149,16 @@ class PopoverMenuItem extends UIBlock return $this; } + + /** + * @return string + * @uses oPopupMenuItem + * @uses \ApplicationPopupMenuItem::GetUID() + */ + public function GetUID() + { + return $this->oPopupMenuItem->GetUID(); + } + + } \ No newline at end of file diff --git a/sources/application/UI/Base/UIBlock.php b/sources/application/UI/Base/UIBlock.php index 5193e35aa..6639517b6 100644 --- a/sources/application/UI/Base/UIBlock.php +++ b/sources/application/UI/Base/UIBlock.php @@ -347,7 +347,7 @@ abstract class UIBlock implements iUIBlock protected function GenerateId() { $sUniqId = uniqid(static::BLOCK_CODE.'-', true); - $sUniqId = str_replace('.', '-', $sUniqId); + $sUniqId = utils::Sanitize($sUniqId, '', utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER); return $sUniqId; } diff --git a/templates/base/components/popover-menu/item/mode_js.html.twig b/templates/base/components/popover-menu/item/mode_js.html.twig index b44ac0782..2704d53f5 100644 --- a/templates/base/components/popover-menu/item/mode_js.html.twig +++ b/templates/base/components/popover-menu/item/mode_js.html.twig @@ -1,7 +1,7 @@ {% extends 'base/components/popover-menu/item/layout.html.twig' %} {% block iboPopoverMenuItem %} -