From a22049a9b4b22df54c2cf0a9e0822d7cdffd4a61 Mon Sep 17 00:00:00 2001 From: Curtis Conard Date: Mon, 15 Apr 2024 16:12:24 -0400 Subject: [PATCH] fix missing menu option for simplified interface --- hook.php | 13 +++++++++++++ setup.php | 7 ++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/hook.php b/hook.php index cba49c3..cc3a0bb 100644 --- a/hook.php +++ b/hook.php @@ -224,3 +224,16 @@ function plugin_webresources_preItemPurge(CommonDBTM $item) ]); } } + +function plugin_webresources_redefine_menus($menu) +{ + $menu['webresources'] = [ + 'title' => PluginWebresourcesResource::getTypeName(Session::getPluralNumber()), + 'default' => PluginWebresourcesDashboard::getSearchURL(false), + 'icon' => PluginWebresourcesDashboard::getIcon(), + 'links' => [ + 'search' => PluginWebresourcesDashboard::getSearchURL(false), + ], + ]; + return $menu; +} diff --git a/setup.php b/setup.php index 6ddebd4..d3c6dcd 100644 --- a/setup.php +++ b/setup.php @@ -32,9 +32,14 @@ function plugin_init_webresources() $plugin = new Plugin(); if ($plugin->isInstalled('webresources') && $plugin->isActivated('webresources')) { + Profile::$helpdesk_rights[] = PluginWebresourcesResource::$rightname; $config = Config::getConfigurationValues('plugin:Webresources', ['menu']); if (Session::haveRight(PluginWebresourcesResource::$rightname, READ)) { - $PLUGIN_HOOKS['menu_toadd']['webresources'] = [$config['menu'] ?? 'plugins' => 'PluginWebresourcesDashboard']; + if (Session::getCurrentInterface() === 'central') { + $PLUGIN_HOOKS['menu_toadd']['webresources'] = [$config['menu'] ?? 'plugins' => 'PluginWebresourcesDashboard']; + } else { + $PLUGIN_HOOKS[\Glpi\Plugin\Hooks::REDEFINE_MENUS]['webresources'] = 'plugin_webresources_redefine_menus'; + } } Plugin::registerClass('PluginWebresourcesProfile', ['addtabon' => ['Profile']]); Plugin::registerClass('PluginWebresourcesConfig', ['addtabon' => 'Config']);