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) public static function showInfo($item)
{ {
// Manage locks pictures $config = Config::getConfigurationValues('plugin:Remotesupport');
//PluginFusioninventoryLock::showLockIcon('Computer');
if ($config["show_in_computers"] == false)
return true;
if ($config["fusion"] == true && $config["easy_novnc"] == true) {
$pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer(); $pfInventoryComputerComputer = new PluginFusioninventoryInventoryComputerComputer();
$a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($item->getID()); $a_computerextend = $pfInventoryComputerComputer->hasAutomaticInventory($item->getID());
if (empty($a_computerextend)) { if (empty($a_computerextend)) {
return true; 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 '<table class="tab_glpi" width="100%">';
echo '<tr>'; echo '<tr>';
echo '<th>' . __('Remote Support') . '</th>'; echo '<th>' . __('Remote Support') . '</th>';
@@ -25,7 +34,7 @@ class PluginRemotesupportRemotesupport extends CommonDBTM
echo '<tr class="tab_bg_1">'; echo '<tr class="tab_bg_1">';
echo '<td>'; 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 != "") { if ($url != "") {
echo "<div><ul class=\"timeline_choices\"><h2>VNC connect : </h2>"; echo "<div><ul class=\"timeline_choices\"><h2>VNC connect : </h2>";
@@ -72,6 +81,11 @@ class PluginRemotesupportRemotesupport extends CommonDBTM
{ {
global $DB; global $DB;
$config = Config::getConfigurationValues('plugin:Remotesupport');
if ($config["fusion"])
return 0;
Toolbox::logInFile("remotsupport", "Starting search of agents\n"); Toolbox::logInFile("remotsupport", "Starting search of agents\n");
$pfConfig = new PluginFusioninventoryConfig(); $pfConfig = new PluginFusioninventoryConfig();
$port = $pfConfig->getValue('agent_port'); $port = $pfConfig->getValue('agent_port');