From 509f5fd46c1c05b8b0524aba8394b67a9818685d Mon Sep 17 00:00:00 2001 From: Jaroslav Drzik Date: Fri, 26 Nov 2021 08:18:31 +0100 Subject: [PATCH] Add inc directory with class remotesupport - add dependency on fusioninventory --- inc/remotesupport.class.php | 43 +++++++++++++++++++++++++++++++++++++ js/support.js | 11 ---------- setup.php | 9 +++++++- 3 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 inc/remotesupport.class.php delete mode 100644 js/support.js diff --git a/inc/remotesupport.class.php b/inc/remotesupport.class.php new file mode 100644 index 0000000..3890107 --- /dev/null +++ b/inc/remotesupport.class.php @@ -0,0 +1,43 @@ +hasAutomaticInventory($item->getID()); + if (empty($a_computerextend)) { + return true; + } + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '
'.__('Remote Support').'
'; + + $url .= "
  • " . $a_computerextend['remote_addr'] . "
  • "; + + if ($url != ""){ + echo "

      VNC connect :

      "; + echo $url; + echo "
    "; + } + echo '
    '; + + } +} diff --git a/js/support.js b/js/support.js deleted file mode 100644 index e7ed40b..0000000 --- a/js/support.js +++ /dev/null @@ -1,11 +0,0 @@ - -$(document).on('ready', function() { - -//commento di check se carica - if ($(location).attr('href').includes('computer') ){ - name = $(".navigationheader").find("span").first().text().split(" ")[0].trim(); - u = "VNC Connection
    RDP Connection
    "; - $(".navigationheader").find("span").first().after(u); - } - -}); diff --git a/setup.php b/setup.php index 5c32839..9dee62a 100644 --- a/setup.php +++ b/setup.php @@ -24,6 +24,7 @@ define('PLUGIN_REMOTESUPPORT_VERSION', '0.0.1'); define('PLUGIN_REMOTESUPPORT_MIN_GLPI', '9.5.0'); define('PLUGIN_REMOTESUPPORT_MAX_GLPI', '9.6.0'); +define("PLUGIN_REMOTESUPPORT_DIR", GLPI_ROOT . "/plugins/remotesupport"); function plugin_init_remotesupport() { @@ -32,7 +33,13 @@ function plugin_init_remotesupport() if (Plugin::isPluginActive('remotesupport')) { - $PLUGIN_HOOKS['add_javascript']['remotesupport'][] = 'js/support.js'; +// $PLUGIN_HOOKS['add_javascript']['remotesupport'][] = 'js/support.js'; + include(PLUGIN_REMOTESUPPORT_DIR . "/inc/remotesupport.class.php"); + + $PLUGIN_HOOKS['autoinventory_information']['remotesupport'] = array( + 'Computer' => array('PluginRemoteSupportComputer', 'showInfo') + ); + // Add Config Page // Plugin::registerClass('PluginRemotesupportConfig', ['addtabon' => 'Config']);