From bb3c5639270d6f17baee83ae4235ffbd685bd91e Mon Sep 17 00:00:00 2001 From: Stanislas KITA Date: Wed, 2 Jun 2021 08:00:12 +0200 Subject: [PATCH 1/2] fix(core): do not display treeview frame on login page --- inc/config.class.php | 14 ++++++++++++++ setup.php | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/inc/config.class.php b/inc/config.class.php index d70d938..eb53c18 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -563,4 +563,18 @@ function getNodesFromDb() { echo "d.openTo(" .$nodes[count($nodes)-1]. ");\n"; } } + + + /** + * Make sure that GLPI index page location is on top of window hierarchy + */ + public static function loginPageToTop() { + echo HTML::scriptBlock(" + $(document).ready( + function() { + if (top != self) + top.location = self.location; + }); + "); + } } diff --git a/setup.php b/setup.php index aed115d..267fdc1 100644 --- a/setup.php +++ b/setup.php @@ -100,6 +100,15 @@ function plugin_init_treeview() { if (Session::haveRight("config", UPDATE) || Session::haveRight("profile", UPDATE)) { $PLUGIN_HOOKS['config_page']['treeview'] = 'front/config.form.php'; } + + + $currentPage = explode("/", $_SERVER['PHP_SELF']); + if (array_pop($currentPage) == "index.php") { + $PLUGIN_HOOKS['display_login']['treeview'] = [ + "PluginTreeviewConfig", + "loginPageToTop" + ]; + } } From 0a13da9d6a525de14246a3363ec121c85c548337 Mon Sep 17 00:00:00 2001 From: Stanislas KITA Date: Wed, 2 Jun 2021 08:03:36 +0200 Subject: [PATCH 2/2] fix CS --- setup.php | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.php b/setup.php index 267fdc1..20fb27d 100644 --- a/setup.php +++ b/setup.php @@ -101,7 +101,6 @@ function plugin_init_treeview() { $PLUGIN_HOOKS['config_page']['treeview'] = 'front/config.form.php'; } - $currentPage = explode("/", $_SERVER['PHP_SELF']); if (array_pop($currentPage) == "index.php") { $PLUGIN_HOOKS['display_login']['treeview'] = [