From 040f74e3aed52c87a6797c27e4c0a036db3a57d1 Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Tue, 15 Sep 2026 11:40:56 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B09557=20-=20Small=20improvement=20to=20sh?= =?UTF-8?q?ortcut=20preferences?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/shortcut.class.inc.php | 16 ++++++++++++---- pages/ajax.render.php | 22 ++++++++++++++++++++-- pages/preferences.php | 2 +- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/application/shortcut.class.inc.php b/application/shortcut.class.inc.php index 7867b5d59f..c356e7c7ea 100644 --- a/application/shortcut.class.inc.php +++ b/application/shortcut.class.inc.php @@ -109,10 +109,18 @@ $('#shortcut_rename_dlg').dialog({ modal: true, title: '$sDialogTitle', buttons: [ - { text: "$sOkButtonLabel", click: ShortcutRenameOK}, - { text: "$sCancelButtonLabel", click: function() { - $(this).dialog( "close" ); $(this).remove(); - } }, + { + text: "$sCancelButtonLabel", + click: function() { + $(this).dialog( "close" ); $(this).remove(); + }, + 'class': 'ibo-button ibo-is-alternative ibo-is-neutral action cancel' + }, + { + text: "$sOkButtonLabel", + click: ShortcutRenameOK, + 'class': 'ibo-is-regular ibo-is-primary' + }, ], close: function() { $(this).remove(); } }); diff --git a/pages/ajax.render.php b/pages/ajax.render.php index 2b9bc00583..d0dce4f7a4 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -1239,13 +1239,31 @@ JS $oSearch = new DBObjectSearch('Shortcut'); $aShortcuts = utils::ReadMultipleSelection($oSearch); $iShortcut = $aShortcuts[0]; - $oShortcut = MetaModel::GetObject('Shortcut', $iShortcut); + $oShortcutSearch = new DBObjectSearch('Shortcut'); + $oShortcutSearch->AddCondition('user_id', UserRights::GetUserId(), '='); + $oShortcutSearch->AddCondition('id', $iShortcut, '='); + $oShortcutSet = new CMDBObjectSet($oShortcutSearch); + if ($oShortcutSet->Count() === 0) { + throw new SecurityException(Dict::S('UI:ObjectDoesNotExist')); + } + + $oShortcut = $oShortcutSet->Fetch(); + $oShortcut->StartRenameDialog($oPage); break; case 'shortcut_rename_go': $iShortcut = utils::ReadParam('id', 0); - $oShortcut = MetaModel::GetObject('Shortcut', $iShortcut); + + $oShortcutSearch = new DBObjectSearch('Shortcut'); + $oShortcutSearch->AddCondition('user_id', UserRights::GetUserId(), '='); + $oShortcutSearch->AddCondition('id', $iShortcut, '='); + $oShortcutSet = new CMDBObjectSet($oShortcutSearch); + if ($oShortcutSet->Count() === 0) { + throw new SecurityException(Dict::S('UI:ObjectDoesNotExist')); + } + + $oShortcut = $oShortcutSet->Fetch(); $sName = utils::ReadParam('attr_name', '', false, 'raw_data'); if (strlen($sName) > 0) { diff --git a/pages/preferences.php b/pages/preferences.php index 0f69190a6b..d984abc170 100644 --- a/pages/preferences.php +++ b/pages/preferences.php @@ -243,7 +243,7 @@ JS ); $oShortcutsToolBar->AddSubBlock($oShortcutsRenameButton); // - Delete button - $oShortcutsDeleteButton = ButtonUIBlockFactory::MakeForSecondaryAction( + $oShortcutsDeleteButton = ButtonUIBlockFactory::MakeForDestructiveAction( Dict::S('UI:Button:Delete'), null, null,