diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8585680..71aa279 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+### Changed
+
+- Make the plugin compatible with the Content Security Policy
+
### Fixed
- Performance: remove an unused query, read only the displayed columns, load `treeview.css` on the tree frame only, add an index on the preferences `users_id` column
diff --git a/front/config.form.php b/front/config.form.php
index 31e9609..334be63 100644
--- a/front/config.form.php
+++ b/front/config.form.php
@@ -55,10 +55,7 @@
} else {
Html::header(__s('Setup'), $_SERVER['PHP_SELF'], 'config', 'plugin');
// close frame if open
- echo " ";
+ echo Html::scriptBlock('if (top != self) top.location = self.location;');
}
Html::footer();
diff --git a/hook.php b/hook.php
index 6e6d870..2166f48 100644
--- a/hook.php
+++ b/hook.php
@@ -291,7 +291,7 @@ function plugin_treeview_uninstall()
function plugin_item_update_treeview($item)
{
if (in_array('locations_id', $item->updates)) {
- echo "";
+ echo Html::scriptBlock('parent.left.location.reload(true);');
}
}
@@ -301,7 +301,7 @@ function plugin_item_update_treeview($item)
*/
function plugin_treeview_reload($item)
{
- echo "";
+ echo Html::scriptBlock('parent.left.location.reload(true);');
}
@@ -312,6 +312,6 @@ function plugin_change_entity_Treeview()
&& (isset($_SESSION['glpi_plugin_treeview_loaded'])
&& $_SESSION['glpi_plugin_treeview_loaded'] == 1)
) {
- echo "";
+ echo Html::scriptBlock('parent.left.location.reload(true);');
}
}
diff --git a/inc/config.class.php b/inc/config.class.php
index a738ef6..0e01798 100644
--- a/inc/config.class.php
+++ b/inc/config.class.php
@@ -31,6 +31,8 @@
use Glpi\DBAL\QueryExpression;
use function Safe\json_encode;
+use function Safe\ob_get_clean;
+use function Safe\ob_start;
/**
* Contains the display configuration of the treeview
@@ -164,10 +166,8 @@ public function seeTreeview()
$CFG_GLPI['root_doc'] . "/pics/favicon.ico' >\n";
// Must be always the top window
- echo '';
+ echo Html::scriptBlock('if (top != self) top.location = self.location;');
+ echo '';
echo "