Use configurable variables

This commit is contained in:
Jaroslav Drzik
2021-12-22 19:19:23 +01:00
parent cffcb3ea64
commit 1dc3c4a557

View File

@@ -9,15 +9,24 @@ class PluginRemotesupportRemotesupport extends CommonDBTM
public static function showInfo($item)
{
// Manage locks pictures
//PluginFusioninventoryLock::showLockIcon('Computer');
$config = Config::getConfigurationValues('plugin:Remotesupport');
$pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer();
$a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($item->getID());
if (empty($a_computerextend)) {
return true;
}
if ($config["show_in_computers"] == false)
return true;
if ($config["fusion"] == true && $config["easy_novnc"] == true) {
$pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer();
$a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($item->getID());
if (empty($a_computerextend)) {
return true;
}
$href = "https://" . $_SERVER['SERVER_ADDR'] . "/vnc.html?path=vnc%2F" . $a_computerextend['remote_addr'] . "&autoconnect=true&resize=scale&reconnect=true&show_dot=true";
$name = $a_computerextend['remote_addr'];
} else {
$href = "vnc://" . $item->fields["name"];
$name = $item->fields["name"];
}
echo '<table class="tab_glpi" width="100%">';
echo '<tr>';
echo '<th>' . __('Remote Support') . '</th>';
@@ -25,7 +34,7 @@ class PluginRemotesupportRemotesupport extends CommonDBTM
echo '<tr class="tab_bg_1">';
echo '<td>';
$url = "<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\"><li class=\"document\"><i class=\"fa fa-laptop-medical\"></i>" . $a_computerextend['remote_addr'] . "</li></a>";
$url = "<a target=\"_blank\" href=\"". $href ."\"><li class=\"document\"><i class=\"fa fa-laptop-medical\"></i>" . $name . "</li></a>";
if ($url != "") {
echo "<div><ul class=\"timeline_choices\"><h2>VNC connect : </h2>";
@@ -72,6 +81,11 @@ class PluginRemotesupportRemotesupport extends CommonDBTM
{
global $DB;
$config = Config::getConfigurationValues('plugin:Remotesupport');
if ($config["fusion"])
return 0;
Toolbox::logInFile("remotsupport", "Starting search of agents\n");
$pfConfig = new PluginFusioninventoryConfig();
$port = $pfConfig->getValue('agent_port');