Add inc directory with class remotesupport

- add dependency on fusioninventory
This commit is contained in:
Jaroslav Drzik
2021-11-26 08:18:31 +01:00
parent 203b8ad51f
commit 509f5fd46c
3 changed files with 51 additions and 12 deletions

View File

@@ -0,0 +1,43 @@
<?php
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access directly to this file");
}
class PluginRemoteSupportComputer extends CommonDBTM {
static function showInfo($item) {
$fi_path = Plugin::getWebDir('fusioninventory');
// Manage locks pictures
PluginFusioninventoryLock::showLockIcon('Computer');
$pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer();
$a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($item->getID());
if (empty($a_computerextend)) {
return true;
}
echo '<table class="tab_glpi" width="100%">';
echo '<tr>';
echo '<th>'.__('Remote Support').'</th>';
echo '</tr>';
echo '<tr class="tab_bg_1">';
echo '<td>';
$url .= "<li class=\"document\"> <a target=\"_blank\" href=\"https://" . $_SERVER['SERVER_ADDR']. "/vnc.html?path=vnc%2F". $a_computerextend['remote_addr'] ."&autoconnect=true&resize=scale&reconnect=true&show_dot=true\"><i class=\"fa fa-laptop-medical\"></i>" . $a_computerextend['remote_addr'] . "</a></li>";
if ($url != ""){
echo "<div><ul class=\"timeline_choices\"><h2>VNC connect : </h2>";
echo $url;
echo "</ul></div>";
}
echo '</td>';
echo '</tr>';
echo '</table>';
}
}

View File

@@ -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 = "<span><a href='vnc://" + name +"'>VNC Connection</a><br><a href='rdp://" + name +"'>RDP Connection</a></span>";
$(".navigationheader").find("span").first().after(u);
}
});

View File

@@ -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']);