diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d9cc3b1..70b1d41b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +### Changed + +- Make the plugin compatible with the Content Security Policy + ## [1.10.4] - 2026-11-04 ### Fixed diff --git a/ajax/dropdownExport.php b/ajax/dropdownExport.php index efac9bac..da7ca2ef 100644 --- a/ajax/dropdownExport.php +++ b/ajax/dropdownExport.php @@ -54,9 +54,9 @@ "style='margin: 0; padding: 0' target='_blank'>"; echo ""; echo ""; + "value='" . _sx('button', 'Post') . "' />"; Html::Closeform(); - echo ""; + "); } else { echo " "; - echo ""; + "); } } diff --git a/front/popup.php b/front/popup.php index efb54c49..82ea6e9a 100644 --- a/front/popup.php +++ b/front/popup.php @@ -41,6 +41,7 @@ echo "
"; echo '
'; -echo "" . __s('Back') . ''; +echo "" . __s('Back') . ''; +echo Html::scriptBlock("$('#mreporting_popup_close').on('click', function (e) { e.preventDefault(); window.close(); });"); echo '
'; Html::popFooter(); diff --git a/inc/common.class.php b/inc/common.class.php index eba36547..2052c0e4 100644 --- a/inc/common.class.php +++ b/inc/common.class.php @@ -260,9 +260,9 @@ public static function getSelectAllReports($onchange = false, $setIdInOptionsVal return ''; } - $js_onchange = $onchange ? " onchange='window.location.href=this.options[this.selectedIndex].value'" : ''; + $select_id = 'mreporting_report_select' . mt_rand(); - $select = ""; $select .= "'; foreach ($reports as $classname => $report) { @@ -325,6 +325,12 @@ function ($a, $b) { } $select .= ''; + if ($onchange) { + $select .= Html::scriptBlock( + "$('#$select_id').on('change', function () { window.location.href = this.options[this.selectedIndex].value; });", + ); + } + return $select; } @@ -400,9 +406,13 @@ public function showCentral($params) echo "
"; echo __s('Export') . ' : '; - echo ""; + $export_id = 'mreporting_odt_export' . mt_rand(); + echo ""; echo 'ODT'; + echo Html::scriptBlock( + "$('#$export_id').on('click', function () { var w = window.open(this.dataset.popupUrl, 'glpipopup', " . + "'height=" . (int) $height . ", width=1000, top=100, left=100, scrollbars=yes'); w.focus(); });", + ); echo '
'; } else { echo __s('No report is available !', 'mreporting'); @@ -518,16 +528,17 @@ public function showExportForm($opt) echo ''; $formname = 'exportform'; + $rand = mt_rand(); echo ""; $arrow = 'fas fa-level-up-alt'; echo ''; echo ""; echo "'; + echo "" . __s('Check all') . ''; echo ''; echo "'; + echo "" . __s('Uncheck all') . ''; $option[0] = __s('Without data', 'mreporting'); $option[1] = __s('With data', 'mreporting'); @@ -539,7 +550,9 @@ public function showExportForm($opt) Html::closeForm(); echo ''; - echo ""; + });", + ); } } @@ -999,15 +1012,18 @@ public static function showGraphDatas( echo ""; echo ''; echo ''; echo '
"; - echo "" . __s('Check all') . '/"; - echo "" . __s('Uncheck all') . '
'; - echo ""; + echo ""; $img = $show_graph ? 'deplier_down.png' : 'deplier_up.png'; echo " "; echo __s('data', 'mreporting') . ''; + echo Html::scriptBlock( + "$('#mreporting_toggle_datas$rand').on('click', function (e) { e.preventDefault(); showHideDiv('view_datas$rand', 'viewimg', '" . + jsescape($CFG_GLPI['root_doc'] . '/pics/deplier_down.png') . "', '" . + jsescape($CFG_GLPI['root_doc'] . '/pics/deplier_up.png') . "'); });", + ); echo '
'; diff --git a/inc/dashboard.class.php b/inc/dashboard.class.php index c0f3a0b1..93349a87 100644 --- a/inc/dashboard.class.php +++ b/inc/dashboard.class.php @@ -53,15 +53,17 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ ) { echo "
"; - echo ""; - - echo ""; + $('#mreporting_central_iframe').on('load', function () { + resizeIframe(this); + }); + "); echo '
'; } @@ -115,8 +117,7 @@ public function showDashBoard($show_reports_dropdown = true) "; echo ''; $modal_html = json_encode($this->getFormForColumn()); - echo " - "; + "); if (empty($widgets)) { echo ''; @@ -202,7 +203,7 @@ public function showDashBoard($show_reports_dropdown = true) $rand_widget = mt_rand(); - echo " + "); + echo "