From 275757fc9db2c16ed5cc5e8dd1183f4796634f3a Mon Sep 17 00:00:00 2001 From: Stanislas Date: Tue, 25 Oct 2022 10:35:56 +0200 Subject: [PATCH] fix(widget): fix widget from central page --- inc/history.class.php | 17 +++++++++++++---- js/central.js.php | 27 +++++++++------------------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/inc/history.class.php b/inc/history.class.php index 315614f7..1d81758d 100644 --- a/inc/history.class.php +++ b/inc/history.class.php @@ -269,8 +269,13 @@ static function showCentralSpecificList($type) { $options['criteria'][2]['value'] = 'mygroups'; $options['criteria'][2]['link'] = 'AND'; - echo ""; - echo "
"; + echo "
"; + echo "
"; + echo "
"; + echo "
"; + echo ""; + echo ""; + echo ""; echo ""; echo ""; - echo ""; + echo ""; for ($i = 0; $i < $number; $i++) { $ID = $DB->result($result, $i, "id"); Ticket::showVeryShort($ID, 'Ticket$2'); } } echo "
"; echo "". Html::makeTitle($title, $number, $numrows).""; @@ -281,14 +286,18 @@ static function showCentralSpecificList($type) { echo "".__('Requester')."".__('Associated element')."".__('Description')."
".__('Description')."
"; - echo "
"; + echo "
"; + echo "
"; + echo "
"; + echo "
"; + echo "
"; } } } diff --git a/js/central.js.php b/js/central.js.php index adae02a1..1273c4d9 100644 --- a/js/central.js.php +++ b/js/central.js.php @@ -49,24 +49,15 @@ if ($('.nav-link.active:contains($locale_group_view)').length == 0) { return; } - - // get central list for plugin and insert in group tab - $(".masonry_grid").each(function(){ - var masonry_id = $(this).attr('id'); - - if (this.innerHTML.indexOf('escalade_block') < 0) { - //prepare a span element to load new elements - $(this).prepend("
"); - - //ajax request - $("#escalade_block").load(CFG_GLPI.root_doc+"/"+GLPI_PLUGINS_PATH.escalade+'/ajax/central.php', function() { - if ($("#escalade_block").html() == "") { - $("#escalade_block").closest('.grid-item').remove(); - } else { - var msnry = new Masonry('#'+masonry_id); - msnry.layout(); - } - }); + $.ajax({ type: "GET", + url: CFG_GLPI.root_doc+"/"+GLPI_PLUGINS_PATH.escalade+'/ajax/central.php', + async: false, + success : function(text) + { + if (text !== "") { + $(".masonry_grid").append(text); + window.msnry = new Masonry('.masonry_grid'); + } } }); }, 100);