Merge branch 'develop' into ent-1193-Comprobar-codigo-de-estado-HTTP
This commit is contained in:
commit
23c4609981
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, AIX version
|
||||
# Version 7.0NG.745, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, FreeBSD Version
|
||||
# Version 7.0NG.745, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, HP-UX Version
|
||||
# Version 7.0NG.745, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, GNU/Linux
|
||||
# Version 7.0NG.745, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, GNU/Linux
|
||||
# Version 7.0NG.745, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, Solaris Version
|
||||
# Version 7.0NG.745, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.744
|
||||
# Version 7.0NG.745
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.744, AIX version
|
||||
# Version 7.0NG.745, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.744
|
||||
# Version 7.0NG.745
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.744, HPUX Version
|
||||
# Version 7.0NG.745, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744
|
||||
# Version 7.0NG.745
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744
|
||||
# Version 7.0NG.745
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744
|
||||
# Version 7.0NG.745
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.744, Solaris version
|
||||
# Version 7.0NG.745, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, AIX version
|
||||
# Version 7.0NG.745, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.744-200415
|
||||
Version: 7.0NG.745-200519
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.744-200415"
|
||||
pandora_version="7.0NG.745-200519"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, GNU/Linux
|
||||
# Version 7.0NG.745, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, FreeBSD Version
|
||||
# Version 7.0NG.745, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, HP-UX Version
|
||||
# Version 7.0NG.745, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, GNU/Linux
|
||||
# Version 7.0NG.745, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, GNU/Linux
|
||||
# Version 7.0NG.745, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, NetBSD Version
|
||||
# Version 7.0NG.745, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.744, Solaris Version
|
||||
# Version 7.0NG.745, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -54,8 +54,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.744';
|
||||
use constant AGENT_BUILD => '200415';
|
||||
use constant AGENT_VERSION => '7.0NG.745';
|
||||
use constant AGENT_BUILD => '200519';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.744
|
||||
%define release 200415
|
||||
%define version 7.0NG.745
|
||||
%define release 200519
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.744
|
||||
%define release 200415
|
||||
%define version 7.0NG.745
|
||||
%define release 200519
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.744"
|
||||
PI_BUILD="200415"
|
||||
PI_VERSION="7.0NG.745"
|
||||
PI_BUILD="200519"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -33,9 +33,16 @@ my $freemem=`cat /proc/meminfo | grep 'MemFree' | awk '{ print \$2 } '`;
|
|||
my $cached=`cat /proc/meminfo | grep '^Cached:' | awk '{ print \$2 } '`;
|
||||
my $cachedswap=`cat /proc/meminfo | grep '^SwapCached:' | awk '{ print \$2 }'`;
|
||||
my $total_meminfo=`cat /proc/meminfo | grep 'MemTotal:' | awk '{ print \$2 }'`;
|
||||
my $available=$freemem+$cached+$cachedswap;
|
||||
my $available_new=`cat /proc/meminfo | grep 'MemAvailable:' | awk '{ print \$2 }'`;
|
||||
my $available;
|
||||
if ($available_new == 0){
|
||||
$available=$freemem+$cached+$cachedswap;
|
||||
}else{
|
||||
$available=$available_new;
|
||||
}
|
||||
my $available_percent = floor(($available / $total_meminfo)*100);
|
||||
|
||||
my $USED = 100 - $available_percent;
|
||||
|
||||
print "<module>\n";
|
||||
print "<name><![CDATA[FreeMemory]]></name>\n";
|
||||
|
|
|
@ -23,7 +23,13 @@ my $freemem=`cat /proc/meminfo | grep 'MemFree' | awk '{ print \$2 } '`;
|
|||
my $cached=`cat /proc/meminfo | grep '^Cached:' | awk '{ print \$2 } '`;
|
||||
my $cachedswap=`cat /proc/meminfo | grep '^SwapCached:' | awk '{ print \$2 }'`;
|
||||
my $total_meminfo=`cat /proc/meminfo | grep 'MemTotal:' | awk '{ print \$2 }'`;
|
||||
my $available=$freemem+$cached+$cachedswap;
|
||||
my $available_new=`cat /proc/meminfo | grep 'MemAvailable:' | awk '{ print \$2 }'`;
|
||||
my $available;
|
||||
if ($available_new == 0){
|
||||
$available=$freemem+$cached+$cachedswap;
|
||||
}else{
|
||||
$available=$available_new;
|
||||
}
|
||||
my $available_percent = floor(($available / $total_meminfo)*100);
|
||||
|
||||
my $USED = 100 - $available_percent;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.744
|
||||
# Version 7.0NG.745
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -3,13 +3,18 @@
|
|||
# The installer will be placed in ./installer/output/.
|
||||
# InstallJammer must be installed and in the PATH.
|
||||
|
||||
ARCH=`uname -m`
|
||||
# ARCH may be set by other build scripts.
|
||||
if [ "$ARCH" == "" ]; then
|
||||
ARCH=`uname -m`
|
||||
fi
|
||||
|
||||
# Set the target host.
|
||||
if [ "$ARCH" == "x86_64" ]; then
|
||||
HOST="x86_64-w64-mingw32"
|
||||
else
|
||||
HOST="i686-w64-mingw32"
|
||||
fi
|
||||
|
||||
#./autogen.sh && ./configure --host=$HOST && make clean && make && cp PandoraAgent.exe bin/ && installjammer --build installer/pandora.mpi
|
||||
# Compile and update the Pandora FMS Agent binary.
|
||||
./autogen.sh && ./configure --host=$HOST && make clean && make && cp PandoraAgent.exe bin/
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.744}
|
||||
{Pandora FMS Windows Agent v7.0NG.745}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{200415}
|
||||
{200519}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.744(Build 200415)")
|
||||
#define PANDORA_VERSION ("7.0NG.745(Build 200519)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.744(Build 200415))"
|
||||
VALUE "ProductVersion", "(7.0NG.745(Build 200519))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.744-200415
|
||||
Version: 7.0NG.745-200519
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.744-200415"
|
||||
pandora_version="7.0NG.745-200519"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -188,9 +188,10 @@ function quickShell()
|
|||
} else if ($method == 'telnet') {
|
||||
// Telnet.
|
||||
$port = $config['gotty_telnet_port'];
|
||||
$username = preg_replace('/[^a-zA-Z0-9\-\.]/', '', $username);
|
||||
$command_arguments = "var args = '?arg=-l ".$username;
|
||||
$command_arguments .= '&arg='.$address;
|
||||
$command_arguments .= '&arg='.$method_port."';";
|
||||
$command_arguments .= '&arg='.$method_port."&arg=-E';";
|
||||
} else {
|
||||
ui_print_error_message(__('Please use SSH or Telnet.'));
|
||||
return;
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
operation/servers/recon_view.php
|
||||
operation/servers/recon_view.php
|
||||
operation/users/webchat.php
|
||||
include/javascript/webchat.js
|
||||
attachment/pandora_chat.log.json.txt
|
||||
attachment/pandora_chat.user_list.json.txt
|
||||
attachment/pandora_chat.global_counter.txt
|
|
@ -1,5 +1,6 @@
|
|||
START TRANSACTION;
|
||||
|
||||
INSERT INTO `ttipo_modulo` VALUES (38,'web_server_status_code_string',9,'Remote HTTP module to check server status code','mod_web_data.png');
|
||||
ALTER TABLE trecon_task add column `rcmd_enabled` TINYINT(1) UNSIGNED DEFAULT 0 AFTER `wmi_enabled`;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -1674,6 +1674,7 @@ ALTER TABLE trecon_task ADD `alias_as_name` int(2) unsigned default '0';
|
|||
ALTER TABLE trecon_task ADD `snmp_enabled` int(2) unsigned default '0';
|
||||
ALTER TABLE trecon_task ADD `vlan_enabled` int(2) unsigned default '0';
|
||||
ALTER TABLE trecon_task ADD `wmi_enabled` tinyint(1) unsigned DEFAULT '0';
|
||||
ALTER TABLE trecon_task ADD `rcmd_enabled` tinyint(1) unsigned DEFAULT '0';
|
||||
ALTER TABLE trecon_task ADD `auth_strings` text;
|
||||
ALTER TABLE trecon_task ADD `autoconfiguration_enabled` tinyint(1) unsigned default '0';
|
||||
ALTER TABLE trecon_task ADD `summary` text;
|
||||
|
|
|
@ -81,13 +81,6 @@ if ($config['menu_type'] == 'classic') {
|
|||
}
|
||||
|
||||
|
||||
// Chat messages.
|
||||
$header_chat = "<div id='header_chat'><span id='icon_new_messages_chat' style='display: none;'>";
|
||||
$header_chat .= "<a href='index.php?sec=workspace&sec2=operation/users/webchat'>";
|
||||
$header_chat .= html_print_image('images/header_chat_gray.png', true, ['title' => __('New chat message')]);
|
||||
$header_chat .= '</a></span></div>';
|
||||
|
||||
|
||||
// Search.
|
||||
$acl_head_search = true;
|
||||
if ($config['acl_enterprise'] == 1 && !users_is_admin()) {
|
||||
|
@ -417,7 +410,7 @@ if ($config['menu_type'] == 'classic') {
|
|||
|
||||
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
|
||||
<div class="header_center">'.$header_searchbar.'</div>
|
||||
<div class="header_right">'.$header_chat, $header_autorefresh, $header_autorefresh_counter, $header_discovery, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>';
|
||||
<div class="header_right">'.$header_autorefresh, $header_autorefresh_counter, $header_discovery, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>';
|
||||
?>
|
||||
</div> <!-- Closes #table_header_inner -->
|
||||
</div> <!-- Closes #table_header -->
|
||||
|
@ -530,15 +523,34 @@ if ($config['menu_type'] == 'classic') {
|
|||
});
|
||||
}
|
||||
|
||||
function print_toast(title, subtitle, severity, url, id, onclick) {
|
||||
function closeToast(event) {
|
||||
var match = /notification-(.*)-id-([0-9]+)/.exec(event.target.id);
|
||||
var div_id = document.getElementById(match.input);
|
||||
$(div_id).attr("hidden",true);
|
||||
}
|
||||
|
||||
function print_toast(title, subtitle, severity, url, id, onclick, closeToast) {
|
||||
// TODO severity.
|
||||
severity = '';
|
||||
|
||||
// Start the toast.
|
||||
|
||||
var parent_div = document.createElement('div');
|
||||
|
||||
// Print close image
|
||||
var img = document.createElement('img');
|
||||
img.setAttribute('id', id);
|
||||
img.setAttribute("src", './images/close_button_dialog.png');
|
||||
img.setAttribute('onclick', closeToast);
|
||||
img.setAttribute('style', 'margin-left: 95%;');
|
||||
parent_div.appendChild(img);
|
||||
|
||||
// Print a element
|
||||
var toast = document.createElement('a');
|
||||
toast.setAttribute('onclick', onclick);
|
||||
toast.setAttribute('href', url);
|
||||
toast.setAttribute('target', '_blank');
|
||||
toast.setAttribute('href', url);
|
||||
toast.setAttribute('onclick', onclick);
|
||||
|
||||
var link_div = document.createElement('div');
|
||||
|
||||
// Fill toast.
|
||||
var toast_div = document.createElement('div');
|
||||
|
@ -548,9 +560,13 @@ if ($config['menu_type'] == 'classic') {
|
|||
var toast_text = document.createElement('p');
|
||||
toast_title.innerHTML = title;
|
||||
toast_text.innerHTML = subtitle;
|
||||
toast_div.appendChild(toast_title);
|
||||
|
||||
// Append Elements
|
||||
toast_div.appendChild(img);
|
||||
link_div.appendChild(toast_title);
|
||||
toast.appendChild(link_div);
|
||||
toast_div.appendChild(toast);
|
||||
toast_div.appendChild(toast_text);
|
||||
toast.appendChild(toast_div);
|
||||
|
||||
// Show and program the hide event.
|
||||
toast_div.className = toast_div.className + ' show';
|
||||
|
@ -558,9 +574,11 @@ if ($config['menu_type'] == 'classic') {
|
|||
toast_div.className = toast_div.className.replace("show", "");
|
||||
}, 8000);
|
||||
|
||||
return toast;
|
||||
}
|
||||
toast_div.appendChild(parent_div);
|
||||
|
||||
return toast_div;
|
||||
}
|
||||
|
||||
function check_new_notifications() {
|
||||
var last_id = document.getElementById('notification-ball-header')
|
||||
.getAttribute('last_id');
|
||||
|
@ -617,9 +635,11 @@ if ($config['menu_type'] == 'classic') {
|
|||
ele.criticity,
|
||||
ele.full_url,
|
||||
'notification-toast-id-' + ele.id_mensaje,
|
||||
'click_on_notification_toast(event)'
|
||||
'click_on_notification_toast(event)',
|
||||
'closeToast(event)'
|
||||
)
|
||||
);
|
||||
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -640,8 +660,6 @@ if ($config['menu_type'] == 'classic') {
|
|||
|
||||
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
|
||||
|
||||
var new_chat = <?php echo (int) $_SESSION['new_chat']; ?>;
|
||||
|
||||
function showinterpreter(){
|
||||
|
||||
document.onclick = function(e) {
|
||||
|
@ -789,9 +807,7 @@ if ($config['menu_type'] == 'classic') {
|
|||
$('div#head').addClass('fixed_header');
|
||||
$('div#main').css('padding-top', $('div#head').innerHeight() + 'px');
|
||||
}
|
||||
|
||||
check_new_chats_icon('icon_new_messages_chat');
|
||||
|
||||
|
||||
/* Temporal fix to hide graphics when ui_dialog are displayed */
|
||||
$("#yougotalert").click(function () {
|
||||
$("#agent_access").css("display", "none");
|
||||
|
|
|
@ -136,8 +136,11 @@ font-size:10pt;
|
|||
<div class='modalcontenttex'>
|
||||
<?php
|
||||
echo __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance.');
|
||||
echo '<br/> <br/>';
|
||||
echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name());
|
||||
echo '<br/> <br/>';
|
||||
echo __('Please know that all attempts to access this page are recorded in security logs of %s System Database', get_product_name());
|
||||
if ($config['logged'] == false) {
|
||||
session_destroy();
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1901,12 +1901,6 @@ if ($enable_module) {
|
|||
'Fail to enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias']
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully enabled'),
|
||||
__('Could not be enabled')
|
||||
);
|
||||
}
|
||||
|
||||
if ($disable_module) {
|
||||
|
@ -1942,12 +1936,6 @@ if ($disable_module) {
|
|||
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias']
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully disabled'),
|
||||
__('Could not be disabled')
|
||||
);
|
||||
}
|
||||
|
||||
// Fix to stop the module from being added to the agent's conf
|
||||
|
|
|
@ -16,7 +16,7 @@ global $config;
|
|||
|
||||
check_login();
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
require_once $config['homedir'].'/vendor/autoload.php';
|
||||
|
||||
use PandoraFMS\Dashboard\Manager;
|
||||
|
||||
|
@ -46,6 +46,54 @@ if ($enterprise_include) {
|
|||
enterprise_include_once('meta/include/functions_users_meta.php');
|
||||
}
|
||||
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
date_default_timezone_set('UTC');
|
||||
include 'include/javascript/timezonepicker/includes/parser.inc';
|
||||
|
||||
// Read in options for map builder.
|
||||
$bases = [
|
||||
'gray' => 'Gray',
|
||||
'blue-marble' => 'Blue marble',
|
||||
'night-electric' => 'Night Electric',
|
||||
'living' => 'Living Earth',
|
||||
];
|
||||
|
||||
$local_file = 'include/javascript/timezonepicker/images/gray-400.png';
|
||||
|
||||
// Dimensions must always be exact since the imagemap does not scale.
|
||||
$array_size = getimagesize($local_file);
|
||||
|
||||
$map_width = $array_size[0];
|
||||
$map_height = $array_size[1];
|
||||
|
||||
$timezones = timezone_picker_parse_files(
|
||||
$map_width,
|
||||
$map_height,
|
||||
'include/javascript/timezonepicker/tz_world.txt',
|
||||
'include/javascript/timezonepicker/tz_islands.txt'
|
||||
);
|
||||
|
||||
|
||||
foreach ($timezones as $timezone_name => $tz) {
|
||||
if ($timezone_name == 'America/Montreal') {
|
||||
$timezone_name = 'America/Toronto';
|
||||
} else if ($timezone_name == 'Asia/Chongqing') {
|
||||
$timezone_name = 'Asia/Shanghai';
|
||||
}
|
||||
|
||||
$area_data_timezone_polys .= '';
|
||||
foreach ($tz['polys'] as $coords) {
|
||||
$area_data_timezone_polys .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="poly" coords="'.implode(',', $coords).'" />';
|
||||
}
|
||||
|
||||
$area_data_timezone_rects .= '';
|
||||
foreach ($tz['rects'] as $coords) {
|
||||
$area_data_timezone_rects .= '<area data-timezone="'.$timezone_name.'" data-country="'.$tz['country'].'" data-pin="'.implode(',', $tz['pin']).'" data-offset="'.$tz['offset'].'" shape="rect" coords="'.implode(',', $coords).'" />';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This defines the working user. Beware with this, old code get confusses
|
||||
// and operates with current logged user (dangerous).
|
||||
$id = get_parameter('id', get_parameter('id_user', ''));
|
||||
|
@ -75,6 +123,12 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
|
|||
|
||||
$tab = get_parameter('tab', 'user');
|
||||
|
||||
if ($id) {
|
||||
$header_title = ' » '.__('Update user');
|
||||
} else {
|
||||
$header_title = ' » '.__('Create user');
|
||||
}
|
||||
|
||||
// Header
|
||||
if ($meta) {
|
||||
user_meta_print_header();
|
||||
|
@ -94,7 +148,7 @@ if ($meta) {
|
|||
$buttons[$tab]['active'] = true;
|
||||
|
||||
ui_print_page_header(
|
||||
__('User detail editor'),
|
||||
__('User detail editor').$header_title,
|
||||
'images/gm_users.png',
|
||||
false,
|
||||
'profile_tab',
|
||||
|
@ -625,59 +679,61 @@ if ($values) {
|
|||
$user_info = $values;
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'user_configuration_table';
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
if (defined('METACONSOLE')) {
|
||||
if ($id) {
|
||||
$table->head[0] = __('Update User');
|
||||
echo '<div class="user_form_title">'.__('Update User').'</div>';
|
||||
} else {
|
||||
$table->head[0] = __('Create User');
|
||||
echo '<div class="user_form_title">'.__('Create User').'</div>';
|
||||
}
|
||||
|
||||
$table->head_colspan[0] = 5;
|
||||
$table->headstyle[0] = 'text-align: center';
|
||||
}
|
||||
|
||||
$table->data = [];
|
||||
$table->colspan = [];
|
||||
$table->size = [];
|
||||
$table->size[0] = '35%';
|
||||
$table->size[1] = '65%';
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold;';
|
||||
if (!$new_user) {
|
||||
$user_id = '<div class="label_select_simple"><p class="edit_user_labels">'.__('User ID').': </p>';
|
||||
$user_id .= '<span>'.$id.'</span>';
|
||||
$user_id .= html_print_input_hidden('id_user', $id, true);
|
||||
$user_id .= '</div>';
|
||||
} else {
|
||||
$user_id = '<div class="label_select_simple">'.html_print_input_text_extended(
|
||||
'id_user',
|
||||
$id,
|
||||
'',
|
||||
'',
|
||||
20,
|
||||
100,
|
||||
!$new_user || $view_mode,
|
||||
'',
|
||||
[
|
||||
'class' => 'input_line user_icon_input',
|
||||
'placeholder' => __('User ID'),
|
||||
],
|
||||
true
|
||||
).'</div>';
|
||||
}
|
||||
|
||||
$table->data[0][0] = __('User ID');
|
||||
$table->data[0][1] = html_print_input_text_extended(
|
||||
'id_user',
|
||||
$id,
|
||||
'',
|
||||
'',
|
||||
20,
|
||||
60,
|
||||
!$new_user || $view_mode,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
if (is_user_admin($id)) {
|
||||
$avatar = html_print_image('images/people_1.png', true, ['class' => 'user_avatar']);
|
||||
} else {
|
||||
$avatar = html_print_image('images/people_2.png', true, ['class' => 'user_avatar']);
|
||||
}
|
||||
|
||||
$table->data[1][0] = __('Full (display) name');
|
||||
$table->data[1][1] = html_print_input_text_extended(
|
||||
$full_name = ' <div class="label_select_simple">'.html_print_input_text_extended(
|
||||
'fullname',
|
||||
$user_info['fullname'],
|
||||
'fullname',
|
||||
'',
|
||||
'',
|
||||
30,
|
||||
125,
|
||||
20,
|
||||
100,
|
||||
$view_mode,
|
||||
'',
|
||||
'',
|
||||
[
|
||||
'class' => 'input',
|
||||
'placeholder' => __('Full (display) name'),
|
||||
],
|
||||
true
|
||||
);
|
||||
).'</div>';
|
||||
|
||||
$table->data[2][0] = __('Language');
|
||||
$table->data[2][1] = html_print_select_from_sql(
|
||||
$language = '<div class="label_select"><p class="edit_user_labels">'.__('Language').': </p>';
|
||||
$language .= html_print_select_from_sql(
|
||||
'SELECT id_language, name FROM tlanguage',
|
||||
'language',
|
||||
$user_info['language'],
|
||||
|
@ -685,88 +741,112 @@ $table->data[2][1] = html_print_select_from_sql(
|
|||
__('Default'),
|
||||
'default',
|
||||
true
|
||||
);
|
||||
).'</div>';
|
||||
|
||||
$table->data[3][0] = __('Timezone');
|
||||
$table->data[3][1] = html_print_timezone_select('timezone', $user_info['timezone']);
|
||||
|
||||
$timezone = '<div class="label_select"><p class="edit_user_labels">'.__('Timezone').': </p>';
|
||||
$timezone .= html_print_timezone_select('timezone', $user_info['timezone']).'</div>';
|
||||
|
||||
if ($config['user_can_update_password']) {
|
||||
$table->data[4][0] = __('Password');
|
||||
$table->data[4][1] = html_print_input_text_extended(
|
||||
$new_pass = '<div class="label_select_simple"><span>'.html_print_input_text_extended(
|
||||
'password_new',
|
||||
'',
|
||||
'password_new',
|
||||
'',
|
||||
'',
|
||||
15,
|
||||
45,
|
||||
'25',
|
||||
'45',
|
||||
$view_mode,
|
||||
'',
|
||||
'',
|
||||
[
|
||||
'class' => 'input',
|
||||
'placeholder' => __('Password'),
|
||||
],
|
||||
true,
|
||||
true
|
||||
);
|
||||
$table->data[5][0] = __('Password confirmation');
|
||||
$table->data[5][1] = html_print_input_text_extended(
|
||||
).'</span></div>';
|
||||
$new_pass_confirm = '<div class="label_select_simple"><span>'.html_print_input_text_extended(
|
||||
'password_confirm',
|
||||
'',
|
||||
'password_conf',
|
||||
'',
|
||||
'',
|
||||
15,
|
||||
45,
|
||||
'20',
|
||||
'45',
|
||||
$view_mode,
|
||||
'',
|
||||
'',
|
||||
[
|
||||
'class' => 'input',
|
||||
'placeholder' => __('Password confirmation'),
|
||||
],
|
||||
true,
|
||||
true
|
||||
);
|
||||
).'</span></div>';
|
||||
}
|
||||
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if ($config['admin_can_make_admin']) {
|
||||
$table->data[6][0] = __('Global Profile');
|
||||
$table->data[6][1] = '';
|
||||
if ($own_info['is_admin'] || $user_info['is_admin']) {
|
||||
$table->data[6][1] = html_print_radio_button('is_admin', 1, '', $user_info['is_admin'], true);
|
||||
$table->data[6][1] .= __('Administrator');
|
||||
$table->data[6][1] .= ui_print_help_tip(__('This user has permissions to manage all. An admin user should not requiere additional group permissions, except for using Enterprise ACL.'), true);
|
||||
$table->data[6][1] .= '<br />';
|
||||
}
|
||||
$global_profile = '<div class="label_select_simple user_global_profile" ><span class="input_label" style="margin:0;">'.__('Global Profile').': </span>';
|
||||
$global_profile .= '<div class="switch_radio_button">';
|
||||
$global_profile .= html_print_radio_button_extended(
|
||||
'is_admin',
|
||||
1,
|
||||
[
|
||||
'label' => __('Administrator'),
|
||||
'help_tip' => __('This user has permissions to manage all. An admin user should not requiere additional group permissions, except for using Enterprise ACL.'),
|
||||
],
|
||||
$user_info['is_admin'],
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$global_profile .= html_print_radio_button_extended(
|
||||
'is_admin',
|
||||
0,
|
||||
[
|
||||
'label' => __('Standard User'),
|
||||
'help_tip' => __('This user has separated permissions to view data in his group agents, create incidents belong to his groups, add notes in another incidents, create personal assignments or reviews and other tasks, on different profiles'),
|
||||
],
|
||||
$user_info['is_admin'],
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$global_profile .= '</div></div>';
|
||||
|
||||
$table->data[6][1] .= html_print_radio_button('is_admin', 0, '', $user_info['is_admin'], true);
|
||||
$table->data[6][1] .= __('Standard User');
|
||||
$table->data[6][1] .= ui_print_help_tip(__('This user has separated permissions to view data in his group agents, create incidents belong to his groups, add notes in another incidents, create personal assignments or reviews and other tasks, on different profiles'), true);
|
||||
}
|
||||
|
||||
$table->data[7][0] = __('E-mail');
|
||||
$table->data[7][1] = html_print_input_text_extended(
|
||||
$email = '<div class="label_select_simple">'.html_print_input_text_extended(
|
||||
'email',
|
||||
$user_info['email'],
|
||||
'email',
|
||||
'',
|
||||
'',
|
||||
20,
|
||||
100,
|
||||
'25',
|
||||
'100',
|
||||
$view_mode,
|
||||
'',
|
||||
'',
|
||||
[
|
||||
'class' => 'input input_line email_icon_input',
|
||||
'placeholder' => __('E-mail'),
|
||||
],
|
||||
true
|
||||
);
|
||||
).'</div>';
|
||||
|
||||
$table->data[8][0] = __('Phone number');
|
||||
$table->data[8][1] = html_print_input_text_extended(
|
||||
$phone = '<div class="label_select_simple">'.html_print_input_text_extended(
|
||||
'phone',
|
||||
$user_info['phone'],
|
||||
'phone',
|
||||
'',
|
||||
'',
|
||||
10,
|
||||
30,
|
||||
'20',
|
||||
'30',
|
||||
$view_mode,
|
||||
'',
|
||||
'',
|
||||
[
|
||||
'class' => 'input input_line phone_icon_input',
|
||||
'placeholder' => __('Phone number'),
|
||||
],
|
||||
true
|
||||
);
|
||||
).'</div>';
|
||||
|
||||
$table->data[9][0] = __('Comments');
|
||||
$table->data[9][1] = html_print_textarea(
|
||||
$comments = '<p class="edit_user_labels">'.__('Comments').': </p>';
|
||||
$comments .= html_print_textarea(
|
||||
'comments',
|
||||
2,
|
||||
65,
|
||||
|
@ -795,16 +875,17 @@ if (!$meta) {
|
|||
// User only can change skins if has more than one group
|
||||
if (count($usr_groups) > 1) {
|
||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->data[10][0] = __('Skin');
|
||||
$table->data[10][1] = skins_print_select($id_usr, 'skin', $user_info['id_skin'], '', __('None'), 0, true);
|
||||
$skin = '<div class="label_select"><p class="edit_user_labels">'.__('Skin').': </p>';
|
||||
$skin .= skins_print_select($id_usr, 'skin', $user_info['id_skin'], '', __('None'), 0, true).'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($meta) {
|
||||
$array_filters = get_filters_custom_fields_view(0, true);
|
||||
$table->data[11][0] = __('Search custom field view').' '.ui_print_help_tip(__('Load by default the selected view in custom field view'), true);
|
||||
$table->data[11][1] = html_print_select(
|
||||
|
||||
$search_custom_fields_view = '<div class="label_select"><p class="edit_user_labels">'.__('Search custom field view').' '.ui_print_help_tip(__('Load by default the selected view in custom field view'), true).'</p>';
|
||||
$search_custom_fields_view .= html_print_select(
|
||||
$array_filters,
|
||||
'default_custom_view',
|
||||
$user_info['default_custom_view'],
|
||||
|
@ -816,7 +897,7 @@ if ($meta) {
|
|||
true,
|
||||
'',
|
||||
false
|
||||
);
|
||||
).'</div>';
|
||||
}
|
||||
|
||||
$values = [
|
||||
|
@ -825,7 +906,8 @@ $values = [
|
|||
0 => __('No'),
|
||||
];
|
||||
|
||||
$table->data[12][0] = __('Home screen').ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'), true);
|
||||
$home_screen = '<div class="label_select"><p class="edit_user_labels">'.__('Home screen').ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'), true).'</p>';
|
||||
;
|
||||
$values = [
|
||||
'Default' => __('Default'),
|
||||
'Visual console' => __('Visual console'),
|
||||
|
@ -841,7 +923,7 @@ if (!is_metaconsole()) {
|
|||
}
|
||||
|
||||
|
||||
$table->data[12][1] = html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false);
|
||||
$home_screen .= html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false).'</div>';
|
||||
|
||||
|
||||
$dashboards = Manager::getDashboards(-1, -1);
|
||||
|
@ -854,7 +936,7 @@ if ($dashboards === false) {
|
|||
}
|
||||
}
|
||||
|
||||
$table->data[12][1] .= html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true);
|
||||
$home_screen .= html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true);
|
||||
|
||||
|
||||
$layouts = visual_map_get_user_layouts($config['id_user'], true);
|
||||
|
@ -867,14 +949,14 @@ if ($layouts === false) {
|
|||
}
|
||||
}
|
||||
|
||||
$table->data[12][1] .= html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true);
|
||||
$table->data[12][1] .= html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true, false);
|
||||
$home_screen .= html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true);
|
||||
$home_screen .= html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true, false);
|
||||
|
||||
$table->data[13][0] = __('Block size for pagination');
|
||||
$table->data[13][1] = html_print_input_text('block_size', $user_info['block_size'], '', 5, 5, true);
|
||||
$size_pagination = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Block size for pagination').'</p>';
|
||||
$size_pagination .= html_print_input_text('block_size', $user_info['block_size'], '', 5, 5, true).'</div>';
|
||||
|
||||
if ($id == $config['id_user']) {
|
||||
$table->data[13][1] .= html_print_input_hidden('quick_language_change', 1, true);
|
||||
$language .= html_print_input_hidden('quick_language_change', 1, true);
|
||||
}
|
||||
|
||||
if (enterprise_installed() && defined('METACONSOLE')) {
|
||||
|
@ -883,12 +965,12 @@ if (enterprise_installed() && defined('METACONSOLE')) {
|
|||
$user_info_metaconsole_access = $user_info['metaconsole_access'];
|
||||
}
|
||||
|
||||
$table->data[13][0] = __('Metaconsole access').' '.ui_print_help_icon('meta_access', true);
|
||||
$meta_access = '<div class="label_select"><p class="edit_user_labels">'.__('Metaconsole access').' '.ui_print_help_icon('meta_access', true).'</p>';
|
||||
$metaconsole_accesses = [
|
||||
'basic' => __('Basic'),
|
||||
'advanced' => __('Advanced'),
|
||||
];
|
||||
$table->data[13][1] = html_print_select(
|
||||
$meta_access .= html_print_select(
|
||||
$metaconsole_accesses,
|
||||
'metaconsole_access',
|
||||
$user_info_metaconsole_access,
|
||||
|
@ -898,16 +980,16 @@ if (enterprise_installed() && defined('METACONSOLE')) {
|
|||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
).'</div>';
|
||||
}
|
||||
|
||||
$table->data[14][0] = __('Not Login');
|
||||
$table->data[14][0] .= ui_print_help_tip(__('The user with not login set only can access to API.'), true);
|
||||
$table->data[14][1] = html_print_checkbox('not_login', 1, $user_info['not_login'], true);
|
||||
$not_login = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Not Login').'</p>';
|
||||
$not_login .= ui_print_help_tip(__('The user with not login set only can access to API.'), true);
|
||||
$not_login .= html_print_checkbox_switch('not_login', 1, $user_info['not_login'], true).'</div>';
|
||||
|
||||
$table->data[15][0] = __('Session Time');
|
||||
$table->data[15][0] .= ui_print_help_tip(__('This is defined in minutes, If you wish a permanent session should putting -1 in this field.'), true);
|
||||
$table->data[15][1] = html_print_input_text('session_time', $user_info['session_time'], '', 5, 5, true);
|
||||
$session_time = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Session Time');
|
||||
$session_time .= ui_print_help_tip(__('This is defined in minutes, If you wish a permanent session should putting -1 in this field.'), true).'</p>';
|
||||
$session_time .= html_print_input_text('session_time', $user_info['session_time'], '', 5, 5, true.false, false, '', 'class="input_line_small"').'</div>';
|
||||
|
||||
$event_filter_data = db_get_all_rows_sql('SELECT id_name, id_filter FROM tevent_filter');
|
||||
if ($event_filter_data === false) {
|
||||
|
@ -920,69 +1002,104 @@ foreach ($event_filter_data as $filter) {
|
|||
$event_filter[$filter['id_filter']] = $filter['id_name'];
|
||||
}
|
||||
|
||||
$table->data[16][0] = __('Default event filter');
|
||||
$table->data[16][1] = html_print_select($event_filter, 'default_event_filter', $user_info['default_event_filter'], '', '', __('None'), true, false, false);
|
||||
$default_event_filter = '<div class="label_select"><p class="edit_user_labels">'.__('Default event filter').'</p>';
|
||||
$default_event_filter .= html_print_select($event_filter, 'default_event_filter', $user_info['default_event_filter'], '', '', __('None'), true, false, false).'</div>';
|
||||
|
||||
$table->data[17][0] = __('Disabled newsletter');
|
||||
$newsletter = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Disabled newsletter').'</p>';
|
||||
if ($user_info['middlename'] >= 0) {
|
||||
$middlename = false;
|
||||
} else {
|
||||
$middlename = true;
|
||||
}
|
||||
|
||||
$table->data[17][1] = html_print_checkbox(
|
||||
$newsletter .= html_print_checkbox_switch(
|
||||
'middlename',
|
||||
-1,
|
||||
$middlename,
|
||||
true
|
||||
);
|
||||
).'</div>';
|
||||
|
||||
if ($config['ehorus_user_level_conf']) {
|
||||
$table->data[18][0] = __('eHorus user acces enabled');
|
||||
$table->data[18][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true);
|
||||
$table->data[19][0] = __('eHorus user');
|
||||
$table->data[20][0] = __('eHorus password');
|
||||
$table->data[19][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true);
|
||||
$table->data[20][1] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true);
|
||||
$ehorus = '<div class="label_select_simple"><p class="edit_user_labels">'.__('eHorus user access enabled').'</p>';
|
||||
$ehorus .= html_print_checkbox_switch('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true).'</div>';
|
||||
$ehorus .= '<div class="user_edit_ehorus_outer">';
|
||||
$ehorus .= '<div class="label_select_simple user_edit_ehorus_inner"><p class="edit_user_labels">'.__('eHorus user').'</p>';
|
||||
$ehorus .= html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true).'</div>';
|
||||
$ehorus .= '<div class="label_select_simple user_edit_ehorus_inner"><p class="edit_user_labels">'.__('eHorus password').'</p>';
|
||||
$ehorus .= html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true).'</div>';
|
||||
$ehorus .= '</div>';
|
||||
}
|
||||
|
||||
|
||||
if ($meta) {
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Enable agents managment');
|
||||
$data[1] = html_print_checkbox('metaconsole_agents_manager', 1, $user_info['metaconsole_agents_manager'], true);
|
||||
$table->rowclass[] = '';
|
||||
$table->rowstyle[] = 'font-weight: bold;';
|
||||
$table->data['metaconsole_agents_manager'] = $data;
|
||||
$metaconsole_agents_manager = '<div class="label_select_simple" id="metaconsole_agents_manager_div"><p class="edit_user_labels">'.__('Enable agents managment').'</p>';
|
||||
$metaconsole_agents_manager .= html_print_checkbox_switch('metaconsole_agents_manager', 1, $user_info['metaconsole_agents_manager'], true).'</div>';
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Assigned node').ui_print_help_tip(__('Server where the agents created of this user will be placed'), true);
|
||||
$metaconsole_assigned_server = '<div class="label_select" id="metaconsole_assigned_server_div"><p class="edit_user_labels">'.__('Assigned node').ui_print_help_tip(__('Server where the agents created of this user will be placed'), true).'</p>';
|
||||
$servers = metaconsole_get_servers();
|
||||
$servers_for_select = [];
|
||||
foreach ($servers as $server) {
|
||||
$servers_for_select[$server['id']] = $server['server_name'];
|
||||
}
|
||||
|
||||
$data[1] = html_print_select($servers_for_select, 'metaconsole_assigned_server', $user_info['metaconsole_assigned_server'], '', '', -1, true, false, false);
|
||||
$table->rowclass[] = '';
|
||||
$table->rowstyle[] = 'font-weight: bold;';
|
||||
$table->data['metaconsole_assigned_server'] = $data;
|
||||
$metaconsole_assigned_server .= html_print_select($servers_for_select, 'metaconsole_assigned_server', $user_info['metaconsole_assigned_server'], '', '', -1, true, false, false).'</div>';
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Enable node access').ui_print_help_tip(__('With this option enabled, the user will can access to nodes console'), true);
|
||||
$data[2] = html_print_checkbox('metaconsole_access_node', 1, $user_info['metaconsole_access_node'], true);
|
||||
$table->rowclass[] = '';
|
||||
$table->rowstyle[] = '';
|
||||
$table->data['metaconsole_access_node'] = $data;
|
||||
$metaconsole_access_node = '<div class="label_select_simple" id="metaconsole_access_node_div"><p class="edit_user_labels">'.__('Enable node access').ui_print_help_tip(__('With this option enabled, the user will can access to nodes console'), true).'</p>';
|
||||
$metaconsole_access_node .= html_print_checkbox('metaconsole_access_node', 1, $user_info['metaconsole_access_node'], true).'</div>';
|
||||
}
|
||||
|
||||
echo '<form method="post" autocomplete="off">';
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
echo '<div style="width: '.$table->width.'" class="action-buttons">';
|
||||
if (!$id) {
|
||||
$user_id_update_view = $user_id;
|
||||
$user_id_create = '';
|
||||
} else {
|
||||
$user_id_update_view = '';
|
||||
$user_id_create = $user_id;
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$access_or_pagination = $meta_access;
|
||||
} else {
|
||||
$access_or_pagination = $size_pagination;
|
||||
}
|
||||
|
||||
|
||||
echo '<div id="user_form">
|
||||
<div class="user_edit_first_row">
|
||||
<div class="edit_user_info white_box">
|
||||
<div class="edit_user_info_left">'.$avatar.$user_id_create.'</div>
|
||||
<div class="edit_user_info_right">'.$user_id_update_view.$full_name.$new_pass.$new_pass_confirm.$global_profile.'</div>
|
||||
</div>
|
||||
<div class="edit_user_autorefresh white_box"><p style="font-weight:bold;">Extra info:</p>'.$email.$phone.$not_login.$session_time.'</div>
|
||||
</div>
|
||||
<div class="user_edit_second_row white_box">
|
||||
<div class="edit_user_options">'.$language.$access_or_pagination.$skin.$home_screen.$default_event_filter.$newsletter.'</div>
|
||||
|
||||
<div class="edit_user_timezone">'.$timezone;
|
||||
if (!is_metaconsole()) {
|
||||
echo '<div id="timezone-picker">
|
||||
<img id="timezone-image" src="'.$local_file.'" width="'.$map_width.'" height="'.$map_height.'" usemap="#timezone-map" />
|
||||
<img class="timezone-pin" src="include/javascript/timezonepicker/images/pin.png" style="padding-top: 4px;" />
|
||||
<map name="timezone-map" id="timezone-map">'.$area_data_timezone_polys.$area_data_timezone_rects.'</map>
|
||||
</div>';
|
||||
} else {
|
||||
echo $search_custom_fields_view.$metaconsole_agents_manager.$metaconsole_assigned_server.$metaconsole_access_node;
|
||||
}
|
||||
|
||||
echo '</div>
|
||||
</div>
|
||||
|
||||
<div class="user_edit_third_row white_box">
|
||||
<div class="edit_user_comments">'.$comments.'</div>
|
||||
</div>
|
||||
<div class="user_edit_third_row white_box">'.$ehorus.'</div>
|
||||
</div>';
|
||||
|
||||
echo '<div style="width: 100%" class="action-buttons">';
|
||||
if ($config['admin_can_add_user']) {
|
||||
html_print_csrf_hidden();
|
||||
if ($new_user) {
|
||||
|
@ -1005,32 +1122,62 @@ if (!empty($id) && !$new_user) {
|
|||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
?>
|
||||
|
||||
<style>
|
||||
/* Styles for timezone map */
|
||||
#timezone-picker div.timezone-picker {
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
// Set up the picker to update target timezone and country select lists.
|
||||
$('#timezone-image').timezonePicker({
|
||||
target: '#timezone',
|
||||
});
|
||||
|
||||
// Optionally an auto-detect button to trigger JavaScript geolocation.
|
||||
$('#timezone-detect').click(function() {
|
||||
$('#timezone-image').timezonePicker('detectLocation');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
// Include OpenLayers and timezone user map library.
|
||||
echo '<script type="text/javascript" src="'.ui_get_full_url('include/javascript/timezonepicker/lib/jquery.timezone-picker.min.js').'"></script>'."\n\t";
|
||||
echo '<script type="text/javascript" src="'.ui_get_full_url('include/javascript/timezonepicker/lib/jquery.maphilight.min.js').'"></script>'."\n\t";
|
||||
// Closes no meta condition.
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
$('input:radio[name="is_admin"]').change(function() {
|
||||
if($('#radiobtn0002').prop('checked')) {
|
||||
$('#user_configuration_table-metaconsole_agents_manager').show();
|
||||
$('#user_configuration_table-metaconsole_access_node').show();
|
||||
if($('#checkbox-metaconsole_agents_manager').prop('checked')) {
|
||||
$('#user_configuration_table-metaconsole_assigned_server').show();
|
||||
if($('#radiobtn0002').prop('checked')) {
|
||||
$('#metaconsole_agents_manager_div').show();
|
||||
$('#metaconsole_access_node_div').show();
|
||||
if($('#checkbox-metaconsole_agents_manager').prop('checked')) {
|
||||
$('#metaconsole_assigned_server_div').show();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$('#user_configuration_table-metaconsole_agents_manager').hide();
|
||||
$('#user_configuration_table-metaconsole_access_node').hide();
|
||||
$('#user_configuration_table-metaconsole_assigned_server').hide();
|
||||
$('#metaconsole_agents_manager_div').hide();
|
||||
$('#metaconsole_access_node_div').hide();
|
||||
$('#metaconsole_assigned_server_div').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#checkbox-metaconsole_agents_manager').change(function() {
|
||||
$('#checkbox-metaconsole_agents_manager').change(function() {
|
||||
if($('#checkbox-metaconsole_agents_manager').prop('checked')) {
|
||||
$('#user_configuration_table-metaconsole_assigned_server').show();
|
||||
$('#metaconsole_assigned_server_div').show();
|
||||
}
|
||||
else {
|
||||
$('#user_configuration_table-metaconsole_assigned_server').hide();
|
||||
else {
|
||||
$('#metaconsole_assigned_server_div').hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1101,13 +1248,11 @@ function switch_ehorus_conf()
|
|||
{
|
||||
if(!$('#checkbox-ehorus_user_level_enabled').prop('checked'))
|
||||
{
|
||||
$("#user_configuration_table-18").hide();
|
||||
$("#user_configuration_table-19").hide();
|
||||
$(".user_edit_ehorus_outer").hide();
|
||||
|
||||
}else
|
||||
{
|
||||
$("#user_configuration_table-18").show();
|
||||
$("#user_configuration_table-19").show()
|
||||
$(".user_edit_ehorus_outer").show();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -160,8 +160,6 @@ if (isset($_GET['user_del'])) {
|
|||
$result = delete_user($id_user);
|
||||
|
||||
if ($result) {
|
||||
users_save_logout($user_row, true);
|
||||
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
__('Deleted user %s', io_safe_input($id_user))
|
||||
|
|
|
@ -538,7 +538,14 @@ class DiscoveryTaskList extends HTML
|
|||
}
|
||||
|
||||
$can_be_reviewed = false;
|
||||
if ($task['review_mode'] == DISCOVERY_STANDARD) {
|
||||
if (empty($task['summary']) === false
|
||||
&& $task['summary'] == 'cancelled'
|
||||
) {
|
||||
$data[5] = __('Cancelled').ui_print_help_tip(
|
||||
__('Server has been restarted while executing this task, please retry.'),
|
||||
true
|
||||
);
|
||||
} else if ($task['review_mode'] == DISCOVERY_STANDARD) {
|
||||
if ($task['status'] <= 0
|
||||
&& empty($task['summary']) === false
|
||||
) {
|
||||
|
|
|
@ -482,6 +482,7 @@ class HostDevices extends Wizard
|
|||
$review_results = get_parameter_switch('review_results');
|
||||
$review_limited = (bool) get_parameter('review_limited', 0);
|
||||
$auto_monitor = get_parameter_switch('auto_monitor');
|
||||
$recon_ports = get_parameter('recon_ports', null);
|
||||
$autoconf_enabled = get_parameter_switch(
|
||||
'autoconfiguration_enabled'
|
||||
);
|
||||
|
@ -491,6 +492,7 @@ class HostDevices extends Wizard
|
|||
$parent_recursion = get_parameter_switch('parent_recursion');
|
||||
$vlan_enabled = get_parameter_switch('vlan_enabled');
|
||||
$wmi_enabled = get_parameter_switch('wmi_enabled');
|
||||
$rcmd_enabled = get_parameter_switch('rcmd_enabled');
|
||||
$resolve_names = get_parameter_switch('resolve_names');
|
||||
$snmp_version = get_parameter('snmp_version', null);
|
||||
$community = get_parameter('community', null);
|
||||
|
@ -532,12 +534,14 @@ class HostDevices extends Wizard
|
|||
}
|
||||
|
||||
$this->task['auto_monitor'] = $auto_monitor;
|
||||
$this->task['recon_ports'] = $recon_ports;
|
||||
$this->task['snmp_enabled'] = $snmp_enabled;
|
||||
$this->task['os_detect'] = $os_detect;
|
||||
$this->task['parent_detection'] = $parent_detection;
|
||||
$this->task['parent_recursion'] = $parent_recursion;
|
||||
$this->task['vlan_enabled'] = $vlan_enabled;
|
||||
$this->task['wmi_enabled'] = $wmi_enabled;
|
||||
$this->task['rcmd_enabled'] = $rcmd_enabled;
|
||||
$this->task['resolve_names'] = $resolve_names;
|
||||
$this->task['snmp_version'] = $snmp_version;
|
||||
$this->task['snmp_auth_user'] = $snmp_auth_user;
|
||||
|
@ -1036,6 +1040,21 @@ class HostDevices extends Wizard
|
|||
],
|
||||
];
|
||||
|
||||
$form['inputs'][] = [
|
||||
'label' => __('Filter by opened ports').ui_print_help_tip(
|
||||
__(
|
||||
'Targets will be scanned if at least one of defined ports (comma separated) is open.'
|
||||
),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'name' => 'recon_ports',
|
||||
'type' => 'text',
|
||||
'return' => true,
|
||||
'value' => $this->task['recon_ports'],
|
||||
],
|
||||
];
|
||||
|
||||
$form['inputs'][] = [
|
||||
'label' => __('Auto discover known hardware').ui_print_help_tip(
|
||||
__(
|
||||
|
|
|
@ -917,9 +917,11 @@ if ($get_response) {
|
|||
if ($perform_event_response) {
|
||||
global $config;
|
||||
|
||||
$command = get_parameter('target', '');
|
||||
|
||||
$response_id = get_parameter('response_id');
|
||||
$event_id = (int) get_parameter('event_id');
|
||||
$server_id = (int) get_parameter('server_id', 0);
|
||||
|
||||
$command = events_get_response_target($event_id, $response_id, $server_id);
|
||||
|
||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||
|
||||
|
@ -1017,6 +1019,7 @@ if ($dialogue_event_response) {
|
|||
$show_execute_again_btn = get_parameter('show_execute_again_btn');
|
||||
$out_iterator = get_parameter('out_iterator');
|
||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||
$server_id = get_parameter('server_id');
|
||||
|
||||
$event = db_get_row('tevento', 'id_evento', $event_id);
|
||||
|
||||
|
@ -1067,7 +1070,8 @@ if ($dialogue_event_response) {
|
|||
echo "<br><div id='response_out' style='text-align:left'></div>";
|
||||
|
||||
echo "<br><div id='re_exec_command' style='display:none;'>";
|
||||
html_print_button(__('Execute again'), 'btn_str', false, 'perform_response(\''.$command.'\', '.$response_id.');', "class='sub next'");
|
||||
html_print_button(__('Execute again'), 'btn_str', false, "perform_response({'target':'".$command."','event_id':".$event_id.",'server_id':".$server_id.'}, '.$response_id.');', "class='sub next'");
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1034,86 +1034,7 @@ if (check_login()) {
|
|||
}
|
||||
}
|
||||
|
||||
if (is_numeric($module['datos']) && !modules_is_string_type($module['id_tipo_modulo'])) {
|
||||
if ($config['render_proc']) {
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 2:
|
||||
case 6:
|
||||
case 9:
|
||||
case 18:
|
||||
case 21:
|
||||
case 31:
|
||||
if ($module['datos'] >= 1) {
|
||||
$salida = $config['render_proc_ok'];
|
||||
} else {
|
||||
$salida = $config['render_proc_fail'];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($module['post_process'] > 0) {
|
||||
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
|
||||
} else {
|
||||
$salida = human_milliseconds_to_string($module['datos']);
|
||||
}
|
||||
} else {
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($module['post_process'] > 0) {
|
||||
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
|
||||
} else {
|
||||
$salida = human_milliseconds_to_string($module['datos']);
|
||||
}
|
||||
} else {
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Show units ONLY in numeric data types
|
||||
if (isset($module['unit'])) {
|
||||
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
|
||||
if ($data_macro) {
|
||||
$salida = $data_macro;
|
||||
} else {
|
||||
$salida .= ' <i>'.io_safe_output($module['unit']).'</i>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
|
||||
if ($data_macro) {
|
||||
$salida = $data_macro;
|
||||
} else {
|
||||
$salida = ui_print_module_string_value(
|
||||
$module['datos'],
|
||||
$module['id_agente_modulo'],
|
||||
$module['current_interval'],
|
||||
$module['module_name']
|
||||
);
|
||||
}
|
||||
}
|
||||
$salida = modules_get_agentmodule_data_for_humans($module);
|
||||
|
||||
if ($module['id_tipo_modulo'] != 25) {
|
||||
$data[6] = ui_print_module_warn_value($module['max_warning'], $module['min_warning'], $module['str_warning'], $module['max_critical'], $module['min_critical'], $module['str_critical'], $module['warning_inverse'], $module['critical_inverse']);
|
||||
|
|
|
@ -215,6 +215,12 @@ class ConsoleSupervisor
|
|||
*/
|
||||
$this->checkConsoleServerVersions();
|
||||
|
||||
/*
|
||||
* Check if AllowOverride is None or All.
|
||||
* NOTIF.ALLOWOVERIDE.MESSAGE
|
||||
*/
|
||||
$this->checkAllowOverrideEnabled();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -440,6 +446,11 @@ class ConsoleSupervisor
|
|||
*/
|
||||
$this->checkConsoleServerVersions();
|
||||
|
||||
/*
|
||||
* Check if AllowOverride is None or All.
|
||||
*/
|
||||
$this->checkAllowOverrideEnabled();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -606,6 +617,7 @@ class ConsoleSupervisor
|
|||
case 'NOTIF.UPDATEMANAGER.MINOR':
|
||||
case 'NOTIF.UPDATEMANAGER.MESSAGES':
|
||||
case 'NOTIF.CRON.CONFIGURED':
|
||||
case 'NOTIF.ALLOWOVERRIDE.MESSAGE':
|
||||
default:
|
||||
// NOTIF.SERVER.STATUS.
|
||||
// NOTIF.SERVER.STATUS.ID_SERVER.
|
||||
|
@ -740,25 +752,41 @@ class ConsoleSupervisor
|
|||
|
||||
// Expiry.
|
||||
if (($days_to_expiry <= 15) && ($days_to_expiry > 0)) {
|
||||
if ($config['license_mode'] == 1) {
|
||||
$title = __('License is about to expire');
|
||||
$msg = 'Your license will expire in %d days. Please, contact our sales department.';
|
||||
} else {
|
||||
$title = __('Support is about to expire');
|
||||
$msg = 'Your support license will expire in %d days. Please, contact our sales department.';
|
||||
}
|
||||
|
||||
// Warn user if license is going to expire in 15 days or less.
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.LICENSE.EXPIRATION',
|
||||
'title' => __('License is about to expire'),
|
||||
'title' => $title,
|
||||
'message' => __(
|
||||
'Your license will expire in %d days. Please, contact our sales department.',
|
||||
$msg,
|
||||
$days_to_expiry
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
|
||||
]
|
||||
);
|
||||
} else if ($days_to_expiry < 0) {
|
||||
if ($config['license_mode'] == 1) {
|
||||
$title = __('Expired license');
|
||||
$msg = __('Your license has expired. Please, contact our sales department.');
|
||||
} else {
|
||||
$title = __('Support expired');
|
||||
$msg = __('This license is outside of support. Please, contact our sales department.');
|
||||
}
|
||||
|
||||
// Warn user, license has expired.
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.LICENSE.EXPIRATION',
|
||||
'title' => __('Expired license'),
|
||||
'message' => __('Your license has expired. Please, contact our sales department.'),
|
||||
'title' => $title,
|
||||
'message' => $msg,
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
|
||||
]
|
||||
);
|
||||
|
@ -2360,4 +2388,50 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if AllowOveride is None or All.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkAllowOverrideEnabled()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$message = 'If AllowOverride is disabled, .htaccess will not works.';
|
||||
$message .= '<pre>Please check /etc/httpd/conf/httpd.conf to resolve this problem.';
|
||||
|
||||
// Get content file.
|
||||
$file = file_get_contents('/etc/httpd/conf/httpd.conf');
|
||||
$file_lines = preg_split("#\r?\n#", $file, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$is_none = false;
|
||||
|
||||
$i = 0;
|
||||
foreach ($file_lines as $line) {
|
||||
$i++;
|
||||
|
||||
// Check Line and content.
|
||||
if (preg_match('/ AllowOverride/', $line) && $i === 311) {
|
||||
$result = explode(' ', $line);
|
||||
if ($result[5] == 'None') {
|
||||
$is_none = true;
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.ALLOWOVERRIDE.MESSAGE',
|
||||
'title' => __('AllowOverride is disabled'),
|
||||
'message' => __($message),
|
||||
'url' => ui_get_full_url('index.php'),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup notifications if AllowOverride is All.
|
||||
if (!$is_none) {
|
||||
$this->cleanNotifications('NOTIF.ALLOWOVERRIDE.MESSAGE');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -557,7 +557,7 @@ class Tree
|
|||
$module['id_module_type'] = (int) $module['id_tipo_modulo'];
|
||||
$module['server_type'] = (int) $module['id_modulo'];
|
||||
$module['status'] = $module['estado'];
|
||||
$module['value'] = $module['datos'];
|
||||
$module['value'] = modules_get_agentmodule_data_for_humans($module);
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$module['serverID'] = $this->serverID;
|
||||
|
@ -738,12 +738,10 @@ class Tree
|
|||
$agent['counters']['warning'],
|
||||
$agent['counters']['unknown'],
|
||||
$agent['counters']['total'],
|
||||
$agent['counters']['not_init']
|
||||
$agent['counters']['not_init'],
|
||||
$agent['counters']['alerts']
|
||||
);
|
||||
|
||||
// Alerts fired image
|
||||
$agent['alertImageHTML'] = agents_tree_view_alert_img_ball($agent['counters']['alerts']);
|
||||
|
||||
// search module recalculate counters
|
||||
if (array_key_exists('state_normal', $agent)) {
|
||||
$agent['counters']['unknown'] = $agent['state_unknown'];
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC200415';
|
||||
$pandora_version = 'v7.0NG.744';
|
||||
$build_version = 'PC200519';
|
||||
$pandora_version = 'v7.0NG.745';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -3947,7 +3947,7 @@ function get_copyright_notice()
|
|||
{
|
||||
$stored_name = enterprise_hook('enterprise_get_copyright_notice');
|
||||
if (empty($stored_name) || $stored_name == ENTERPRISE_NOT_HOOK) {
|
||||
return 'Ártica ST';
|
||||
return 'PandoraFMS.com';
|
||||
}
|
||||
|
||||
return $stored_name;
|
||||
|
|
|
@ -310,6 +310,10 @@ function agents_get_alerts_simple($id_agent=false, $filter='', $options=false, $
|
|||
$subQuery = 'SELECT id_agente_modulo
|
||||
FROM tagente_modulo WHERE delete_pending = 0';
|
||||
}
|
||||
|
||||
// Filter by agents id.
|
||||
$id_agents_list = implode(',', $id_agent);
|
||||
$subQuery .= ' AND id_agente in ('.$id_agents_list.')';
|
||||
} else if ($id_agent === false || empty($id_agent)) {
|
||||
if ($allModules) {
|
||||
$disabled = '';
|
||||
|
@ -2638,12 +2642,28 @@ function agents_tree_view_status_img($critical, $warning, $unknown, $total, $not
|
|||
|
||||
|
||||
// Returns the status ball image to display tree view
|
||||
function agents_tree_view_status_img_ball($critical, $warning, $unknown, $total, $notinit)
|
||||
function agents_tree_view_status_img_ball($critical, $warning, $unknown, $total, $notinit, $alerts)
|
||||
{
|
||||
if ($total == 0 || $total == $notinit) {
|
||||
return ui_print_status_image(
|
||||
STATUS_AGENT_NO_MONITORS_BALL,
|
||||
__('No Monitors'),
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
// Use CSS shape instead of image.
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if ($alerts > 0) {
|
||||
return ui_print_status_image(
|
||||
STATUS_ALERT_FIRED_BALL,
|
||||
__('Alert fired on agent'),
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
// Use CSS shape instead of image.
|
||||
true
|
||||
);
|
||||
}
|
||||
|
@ -2652,24 +2672,40 @@ function agents_tree_view_status_img_ball($critical, $warning, $unknown, $total,
|
|||
return ui_print_status_image(
|
||||
STATUS_AGENT_CRITICAL_BALL,
|
||||
__('At least one module in CRITICAL status'),
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
// Use CSS shape instead of image.
|
||||
true
|
||||
);
|
||||
} else if ($warning > 0) {
|
||||
return ui_print_status_image(
|
||||
STATUS_AGENT_WARNING_BALL,
|
||||
__('At least one module in WARNING status'),
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
// Use CSS shape instead of image.
|
||||
true
|
||||
);
|
||||
} else if ($unknown > 0) {
|
||||
return ui_print_status_image(
|
||||
STATUS_AGENT_DOWN_BALL,
|
||||
__('At least one module is in UKNOWN status'),
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
// Use CSS shape instead of image.
|
||||
true
|
||||
);
|
||||
} else {
|
||||
return ui_print_status_image(
|
||||
STATUS_AGENT_OK_BALL,
|
||||
__('All Monitors OK'),
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
// Use CSS shape instead of image.
|
||||
true
|
||||
);
|
||||
}
|
||||
|
|
|
@ -14294,7 +14294,7 @@ function api_get_agents_id_name_by_cluster_name($cluster_name, $trash1, $trash2,
|
|||
* @param $trash2
|
||||
* @param string $returnType
|
||||
* Example:
|
||||
* api.php?op=get&op2=agents_id_name_by_alias&return_type=json&apipass=1234&user=admin&pass=pandora&id=pandrora&id2=strict
|
||||
* api.php?op=get&op2=agents_id_name_by_alias&return_type=json&apipass=1234&user=admin&pass=pandora&id=pandorafms&id2=strict
|
||||
*/
|
||||
function api_get_agents_id_name_by_alias($alias, $strict, $trash2, $returnType)
|
||||
{
|
||||
|
@ -14307,9 +14307,9 @@ function api_get_agents_id_name_by_alias($alias, $strict, $trash2, $returnType)
|
|||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$all_agents = db_get_all_rows_sql("SELECT alias, id_agente, id_tagente,id_tmetaconsole_setup as 'id_server', server_name FROM tmetaconsole_agent WHERE $where_clause");
|
||||
$all_agents = db_get_all_rows_sql("SELECT alias, nombre, id_agente, id_tagente,id_tmetaconsole_setup as 'id_server', server_name FROM tmetaconsole_agent WHERE $where_clause");
|
||||
} else {
|
||||
$all_agents = db_get_all_rows_sql("SELECT alias, id_agente from tagente WHERE $where_clause");
|
||||
$all_agents = db_get_all_rows_sql("SELECT alias, nombre, id_agente from tagente WHERE $where_clause");
|
||||
}
|
||||
|
||||
if ($all_agents !== false) {
|
||||
|
@ -15990,3 +15990,34 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access='A
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function for get event id and node id, then we get in return the Metaconsole event ID.
|
||||
*
|
||||
* @param [string] $server_id id server (Node)
|
||||
* @param [string] $console_event_id console Id node event in tmetaconsole_event
|
||||
* @param [string] $trash2 don't use
|
||||
* @param [string] $returnType
|
||||
*
|
||||
* Example
|
||||
* api.php?op=get&op2=event_mcid&return_type=json&id=0&id2=0&apipass=1234&user=admin&pass=pandora
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function api_get_event_mcid($server_id, $console_event_id, $trash2, $returnType)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$mc_event_id = db_get_all_rows_sql("SELECT id_evento FROM tmetaconsole_event WHERE id_source_event = $console_event_id AND server_id = $server_id ");
|
||||
if ($mc_event_id !== false) {
|
||||
returnData($returnType, ['type' => 'string', 'data' => $mc_event_id]);
|
||||
} else {
|
||||
returnError('id_not_found', 'string');
|
||||
}
|
||||
} else {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2088,10 +2088,10 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
|
|||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function html_print_textarea($name, $rows, $columns, $value='', $attributes='', $return=false, $class='')
|
||||
function html_print_textarea($name, $rows, $columns, $value='', $attributes='', $return=false, $class='', $disable=false)
|
||||
{
|
||||
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' class="'.$class.'">';
|
||||
// $output .= io_safe_input ($value);
|
||||
$disabled = ($disable) ? 'disabled' : '';
|
||||
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' class="'.$class.'" '.$disabled.'>';
|
||||
$output .= ($value);
|
||||
$output .= '</textarea>';
|
||||
|
||||
|
@ -2526,8 +2526,14 @@ function html_print_radio_button_extended(
|
|||
$output .= ' '.$attributes;
|
||||
$output .= ' />';
|
||||
|
||||
if ($label != '') {
|
||||
$output .= '<label for="'.$htmlid.'">'.$label.'</label>'."\n";
|
||||
if (is_array($label)) {
|
||||
if (!empty($label)) {
|
||||
$output .= '<label for="'.$htmlid.'" title="'.$label['help_tip'].'">'.$label['label'].'</label>'."\n";
|
||||
}
|
||||
} else {
|
||||
if ($label != '') {
|
||||
$output .= '<label for="'.$htmlid.'">'.$label.'</label>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($modal && !enterprise_installed()) {
|
||||
|
|
|
@ -2271,6 +2271,102 @@ function modules_get_agentmodule_data(
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return module data in readable format.
|
||||
*
|
||||
* @param array $module Current module.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function modules_get_agentmodule_data_for_humans($module)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (is_numeric($module['datos']) && !modules_is_string_type($module['id_tipo_modulo'])) {
|
||||
if ($config['render_proc']) {
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 2:
|
||||
case 6:
|
||||
case 9:
|
||||
case 18:
|
||||
case 21:
|
||||
case 31:
|
||||
if ($module['datos'] >= 1) {
|
||||
$salida = $config['render_proc_ok'];
|
||||
} else {
|
||||
$salida = $config['render_proc_fail'];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($module['post_process'] > 0) {
|
||||
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
|
||||
} else {
|
||||
$salida = human_milliseconds_to_string($module['datos']);
|
||||
}
|
||||
} else {
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ($module['id_tipo_modulo']) {
|
||||
case 15:
|
||||
$value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
if ($value == '.1.3.6.1.2.1.1.3.0' || $value == '.1.3.6.1.2.1.25.1.1.0') {
|
||||
if ($module['post_process'] > 0) {
|
||||
$salida = human_milliseconds_to_string(($module['datos'] / $module['post_process']));
|
||||
} else {
|
||||
$salida = human_milliseconds_to_string($module['datos']);
|
||||
}
|
||||
} else {
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$salida = remove_right_zeros(number_format($module['datos'], $config['graph_precision']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Show units ONLY in numeric data types
|
||||
if (isset($module['unit'])) {
|
||||
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
|
||||
if ($data_macro) {
|
||||
$salida = $data_macro;
|
||||
} else {
|
||||
$salida .= ' <i>'.io_safe_output($module['unit']).'</i>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$data_macro = modules_get_unit_macro($module['datos'], $module['unit']);
|
||||
if ($data_macro) {
|
||||
$salida = $data_macro;
|
||||
} else {
|
||||
$salida = ui_print_module_string_value(
|
||||
$module['datos'],
|
||||
$module['id_agente_modulo'],
|
||||
$module['current_interval'],
|
||||
$module['module_name']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $salida;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function gets the modulegroup for a given group
|
||||
*
|
||||
|
|
|
@ -189,14 +189,15 @@ function profile_print_profile_table($id)
|
|||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
$table->class = 'info_table';
|
||||
if (defined('METACONSOLE')) {
|
||||
$table->head_colspan[0] = 0;
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox_tactical data';
|
||||
$table->title = $title;
|
||||
} else {
|
||||
echo '<h4>'.$title.'</h4>';
|
||||
echo '<div id="edit_user_profiles" class="white_box">';
|
||||
echo '<h4><p class="edit_user_labels">'.$title.'</p></h4>';
|
||||
}
|
||||
|
||||
$table->data = [];
|
||||
|
@ -204,8 +205,8 @@ function profile_print_profile_table($id)
|
|||
$table->align = [];
|
||||
$table->style = [];
|
||||
if (!defined('METACONSOLE')) {
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->style[1] = 'font-weight: bold';
|
||||
$table->style['name'] = 'font-weight: bold';
|
||||
$table->style['group'] = 'font-weight: bold';
|
||||
}
|
||||
|
||||
$table->head['name'] = __('Profile name');
|
||||
|
@ -324,5 +325,9 @@ function profile_print_profile_table($id)
|
|||
array_push($table->data, $data);
|
||||
|
||||
html_print_table($table);
|
||||
if (!is_metaconsole()) {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
unset($table);
|
||||
}
|
||||
|
|
|
@ -8993,22 +8993,22 @@ function reporting_get_stats_indicators($data, $width=280, $height=20, $html=tru
|
|||
|
||||
if ($html) {
|
||||
$tdata[0] = '<fieldset class="databox tactical_set">
|
||||
<legend>'.__('Server health').ui_print_help_tip(sprintf(__('%d Downed servers'), $servers['down']), true).'</legend>'.progress_bar($servers['health'], $width, $height, '', 0).'</fieldset>';
|
||||
<legend>'.__('Server health').ui_print_help_tip(sprintf(__('%d Downed servers'), (int) $servers['down']), true).'</legend>'.progress_bar($servers['health'], $width, $height, '', 0).'</fieldset>';
|
||||
$table_ind->rowclass[] = '';
|
||||
$table_ind->data[] = $tdata;
|
||||
|
||||
$tdata[0] = '<fieldset class="databox tactical_set">
|
||||
<legend>'.__('Monitor health').ui_print_help_tip(sprintf(__('%d Not Normal monitors'), $data['monitor_not_normal']), true).'</legend>'.progress_bar($data['monitor_health'], $width, $height, $data['monitor_health'].'% '.__('of monitors up'), 0).'</fieldset>';
|
||||
<legend>'.__('Monitor health').ui_print_help_tip(sprintf(__('%d Not Normal monitors'), (int) $data['monitor_not_normal']), true).'</legend>'.progress_bar($data['monitor_health'], $width, $height, $data['monitor_health'].'% '.__('of monitors up'), 0).'</fieldset>';
|
||||
$table_ind->rowclass[] = '';
|
||||
$table_ind->data[] = $tdata;
|
||||
|
||||
$tdata[0] = '<fieldset class="databox tactical_set">
|
||||
<legend>'.__('Module sanity').ui_print_help_tip(sprintf(__('%d Not inited monitors'), $data['monitor_not_init']), true).'</legend>'.progress_bar($data['module_sanity'], $width, $height, $data['module_sanity'].'% '.__('of total modules inited'), 0).'</fieldset>';
|
||||
<legend>'.__('Module sanity').ui_print_help_tip(sprintf(__('%d Not inited monitors'), (int) $data['monitor_not_init']), true).'</legend>'.progress_bar($data['module_sanity'], $width, $height, $data['module_sanity'].'% '.__('of total modules inited'), 0).'</fieldset>';
|
||||
$table_ind->rowclass[] = '';
|
||||
$table_ind->data[] = $tdata;
|
||||
|
||||
$tdata[0] = '<fieldset class="databox tactical_set">
|
||||
<legend>'.__('Alert level').ui_print_help_tip(sprintf(__('%d Fired alerts'), $data['monitor_alerts_fired']), true).'</legend>'.progress_bar($data['alert_level'], $width, $height, $data['alert_level'].'% '.__('of defined alerts not fired'), 0).'</fieldset>';
|
||||
<legend>'.__('Alert level').ui_print_help_tip(sprintf(__('%d Fired alerts'), (int) $data['monitor_alerts_fired']), true).'</legend>'.progress_bar($data['alert_level'], $width, $height, $data['alert_level'].'% '.__('of defined alerts not fired'), 0).'</fieldset>';
|
||||
$table_ind->rowclass[] = '';
|
||||
$table_ind->data[] = $tdata;
|
||||
|
||||
|
|
|
@ -1908,8 +1908,6 @@ function ui_process_page_head($string, $bitfield)
|
|||
);
|
||||
// Load base64 javascript library.
|
||||
$config['js']['base64'] = 'include/javascript/encode_decode_base64.js';
|
||||
// Load webchat javascript library.
|
||||
$config['js']['webchat'] = 'include/javascript/webchat.js';
|
||||
// Load qrcode library.
|
||||
$config['js']['qrcode'] = 'include/javascript/qrcode.js';
|
||||
// Load intro.js library (for bubbles and clippy).
|
||||
|
@ -5636,7 +5634,7 @@ function ui_get_snapshot_link($params, $only_params=false)
|
|||
$params = array_merge($default_params, $params);
|
||||
|
||||
// First parameter of js winopeng_var.
|
||||
$page = $config['homeurl_static'].'/operation/agentes/snapshot_view.php';
|
||||
$page = $config['homeurl'].'/operation/agentes/snapshot_view.php';
|
||||
|
||||
$url = $page.'?id='.$params['id_module'].'&label='.rawurlencode(urlencode(io_safe_output($params['module_name']))).'&id_node='.$params['id_node'];
|
||||
|
||||
|
|
|
@ -497,508 +497,6 @@ function users_get_user_by_id($id_user)
|
|||
}
|
||||
|
||||
|
||||
define('MAX_TIMES', 10);
|
||||
|
||||
//
|
||||
// WEBCHAT FUNCTIONS/////////////////////////////////
|
||||
//
|
||||
function users_get_last_messages($last_time=false)
|
||||
{
|
||||
$file_global_counter_chat = $config['attachment_store'].'/pandora_chat.global_counter.txt';
|
||||
|
||||
// First lock the file
|
||||
$fp_global_counter = @fopen($file_global_counter_chat, 'a+');
|
||||
if ($fp_global_counter === false) {
|
||||
echo json_encode($return);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to look MAX_TIMES times
|
||||
$tries = 0;
|
||||
while (!flock($fp_global_counter, LOCK_EX)) {
|
||||
$tries++;
|
||||
if ($tries > MAX_TIMES) {
|
||||
echo json_encode($return);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
fscanf($fp_global_counter, '%d', $global_counter_file);
|
||||
if (empty($global_counter_file)) {
|
||||
$global_counter_file = 0;
|
||||
}
|
||||
|
||||
$timestamp = time();
|
||||
if ($last_time === false) {
|
||||
$last_time = (24 * 60 * 60);
|
||||
}
|
||||
|
||||
$from = ($timestamp - $last_time);
|
||||
|
||||
$log_chat_file = $config['attachment_store'].'/pandora_chat.log.json.txt';
|
||||
|
||||
$return = [
|
||||
'correct' => false,
|
||||
'log' => [],
|
||||
];
|
||||
|
||||
if (!file_exists($log_chat_file)) {
|
||||
touch($log_chat_file);
|
||||
}
|
||||
|
||||
$text_encode = @file_get_contents($log_chat_file);
|
||||
$log = json_decode($text_encode, true);
|
||||
|
||||
if ($log !== false) {
|
||||
if ($log === null) {
|
||||
$log = [];
|
||||
}
|
||||
|
||||
$log_last_time = [];
|
||||
foreach ($log as $message) {
|
||||
if ($message['timestamp'] >= $from) {
|
||||
$log_last_time[] = $message;
|
||||
}
|
||||
}
|
||||
|
||||
$return['correct'] = true;
|
||||
$return['log'] = $log_last_time;
|
||||
$return['global_counter'] = $global_counter_file;
|
||||
}
|
||||
|
||||
echo json_encode($return);
|
||||
|
||||
fclose($fp_global_counter);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function users_save_login()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$file_global_user_list = $config['attachment_store'].'/pandora_chat.user_list.json.txt';
|
||||
|
||||
$user = db_get_row_filter(
|
||||
'tusuario',
|
||||
['id_user' => $config['id_user']]
|
||||
);
|
||||
|
||||
$message = sprintf(
|
||||
__('User %s login at %s'),
|
||||
$user['fullname'],
|
||||
date($config['date_format'])
|
||||
);
|
||||
users_save_text_message($message, 'notification');
|
||||
|
||||
// First lock the file
|
||||
$fp_user_list = @fopen($file_global_user_list, 'a+');
|
||||
if ($fp_user_list === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to look MAX_TIMES times
|
||||
$tries = 0;
|
||||
while (!flock($fp_user_list, LOCK_EX)) {
|
||||
$tries++;
|
||||
if ($tries > MAX_TIMES) {
|
||||
return;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
@fscanf($fp_user_list, "%[^\n]", $user_list_json);
|
||||
|
||||
$user_list = json_decode($user_list_json, true);
|
||||
if (empty($user_list)) {
|
||||
$user_list[$config['id_user']] = [
|
||||
'name' => $user['fullname'],
|
||||
'count' => 1,
|
||||
];
|
||||
} else if (isset($user_list[$config['id_user']])) {
|
||||
$user_list[$config['id_user']] = [
|
||||
'name' => $user['fullname'],
|
||||
'count' => $user_list[$config['id_user']]['count'],
|
||||
];
|
||||
} else {
|
||||
$users_count = count($user_list);
|
||||
$user_list[$config['id_user']] = [
|
||||
'name' => $user['fullname'],
|
||||
'count' => ++$users_count,
|
||||
];
|
||||
}
|
||||
|
||||
// Clean the file
|
||||
ftruncate($fp_user_list, 0);
|
||||
|
||||
$status = fwrite($fp_user_list, json_encode($user_list));
|
||||
|
||||
if ($status === false) {
|
||||
fclose($fp_user_list);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
fclose($fp_user_list);
|
||||
}
|
||||
|
||||
|
||||
function users_save_logout($user=false, $delete=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$return = [
|
||||
'correct' => false,
|
||||
'users' => [],
|
||||
];
|
||||
|
||||
$file_global_user_list = $config['attachment_store'].'/pandora_chat.user_list.json.txt';
|
||||
|
||||
if (empty($user)) {
|
||||
$user = db_get_row_filter(
|
||||
'tusuario',
|
||||
['id_user' => $config['id_user']]
|
||||
);
|
||||
}
|
||||
|
||||
if ($delete) {
|
||||
$no_json_output = true;
|
||||
$message = sprintf(
|
||||
__('User %s was deleted in the DB at %s'),
|
||||
$user['fullname'],
|
||||
date($config['date_format'])
|
||||
);
|
||||
} else {
|
||||
$no_json_output = false;
|
||||
$message = sprintf(
|
||||
__('User %s logout at %s'),
|
||||
$user['fullname'],
|
||||
date($config['date_format'])
|
||||
);
|
||||
}
|
||||
|
||||
users_save_text_message($message, 'notification', $no_json_output);
|
||||
|
||||
// First lock the file
|
||||
$fp_user_list = @fopen($file_global_user_list, 'a+');
|
||||
if ($fp_user_list === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to look MAX_TIMES times
|
||||
$tries = 0;
|
||||
while (!flock($fp_user_list, LOCK_EX)) {
|
||||
$tries++;
|
||||
if ($tries > MAX_TIMES) {
|
||||
return;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
@fscanf($fp_user_list, "%[^\n]", $user_list_json);
|
||||
|
||||
$user_list = json_decode($user_list_json, true);
|
||||
if (empty($user_list)) {
|
||||
$user_list = [];
|
||||
}
|
||||
|
||||
unset($user_list[$user['id_user']]);
|
||||
|
||||
// Clean the file
|
||||
ftruncate($fp_user_list, 0);
|
||||
|
||||
$status = fwrite($fp_user_list, json_encode($user_list));
|
||||
|
||||
if ($status === false) {
|
||||
fclose($fp_user_list);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
fclose($fp_user_list);
|
||||
}
|
||||
|
||||
|
||||
function users_save_text_message($message=false, $type='message', $no_json_output=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$file_global_counter_chat = $config['attachment_store'].'/pandora_chat.global_counter.txt';
|
||||
$log_chat_file = $config['attachment_store'].'/pandora_chat.log.json.txt';
|
||||
|
||||
$return = ['correct' => false];
|
||||
|
||||
$id_user = $config['id_user'];
|
||||
$user = db_get_row_filter(
|
||||
'tusuario',
|
||||
['id_user' => $id_user]
|
||||
);
|
||||
|
||||
$message_data = [];
|
||||
$message_data['type'] = $type;
|
||||
$message_data['id_user'] = $id_user;
|
||||
$message_data['user_name'] = $user['fullname'];
|
||||
$message_data['text'] = io_safe_input_html($message);
|
||||
// The $message_data['timestamp'] set when adquire the files to save.
|
||||
// First lock the file
|
||||
$fp_global_counter = @fopen($file_global_counter_chat, 'a+');
|
||||
if ($fp_global_counter === false) {
|
||||
if (!$no_json_output) {
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to look MAX_TIMES times
|
||||
$tries = 0;
|
||||
while (!flock($fp_global_counter, LOCK_EX)) {
|
||||
$tries++;
|
||||
if ($tries > MAX_TIMES) {
|
||||
if (!$no_json_output) {
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
@fscanf($fp_global_counter, '%d', $global_counter_file);
|
||||
if (empty($global_counter_file)) {
|
||||
$global_counter_file = 0;
|
||||
}
|
||||
|
||||
// Clean the file
|
||||
ftruncate($fp_global_counter, 0);
|
||||
|
||||
$message_data['timestamp'] = time();
|
||||
$message_data['human_time'] = date($config['date_format'], $message_data['timestamp']);
|
||||
|
||||
$global_counter = ($global_counter_file + 1);
|
||||
|
||||
$status = fwrite($fp_global_counter, $global_counter);
|
||||
|
||||
if ($status === false) {
|
||||
fclose($fp_global_counter);
|
||||
|
||||
if (!$no_json_output) {
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
$text_encode = @file_get_contents($log_chat_file);
|
||||
$log = json_decode($text_encode, true);
|
||||
$log[$global_counter] = $message_data;
|
||||
$status = file_put_contents($log_chat_file, json_encode($log));
|
||||
|
||||
fclose($fp_global_counter);
|
||||
|
||||
$return['correct'] = true;
|
||||
if (!$no_json_output) {
|
||||
echo json_encode($return);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function users_long_polling_check_messages($global_counter)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$file_global_counter_chat = $config['attachment_store'].'/pandora_chat.global_counter.txt';
|
||||
$log_chat_file = $config['attachment_store'].'/pandora_chat.log.json.txt';
|
||||
|
||||
$changes = false;
|
||||
|
||||
$tries_general = 0;
|
||||
|
||||
$error = false;
|
||||
|
||||
while (!$changes) {
|
||||
// First lock the file
|
||||
$fp_global_counter = @fopen($file_global_counter_chat, 'a+');
|
||||
if ($fp_global_counter) {
|
||||
// Try to look MAX_TIMES times
|
||||
$tries = 0;
|
||||
$lock = true;
|
||||
while (!flock($fp_global_counter, LOCK_EX)) {
|
||||
$tries++;
|
||||
if ($tries > MAX_TIMES) {
|
||||
$lock = false;
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
if ($lock) {
|
||||
@fscanf($fp_global_counter, '%d', $global_counter_file);
|
||||
if (empty($global_counter_file)) {
|
||||
$global_counter_file = 0;
|
||||
}
|
||||
|
||||
if ($global_counter_file > $global_counter) {
|
||||
// TODO Optimize slice the array.
|
||||
$text_encode = @file_get_contents($log_chat_file);
|
||||
$log = json_decode($text_encode, true);
|
||||
|
||||
$return_log = [];
|
||||
foreach ($log as $key => $message) {
|
||||
if ($key <= $global_counter) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$return_log[] = $message;
|
||||
}
|
||||
|
||||
$return = [
|
||||
'correct' => true,
|
||||
'global_counter' => $global_counter_file,
|
||||
'log' => $return_log,
|
||||
];
|
||||
|
||||
echo json_encode($return);
|
||||
|
||||
fclose($fp_global_counter);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fclose($fp_global_counter);
|
||||
}
|
||||
|
||||
sleep(3);
|
||||
$tries_general = ($tries_general + 3);
|
||||
|
||||
if ($tries_general > MAX_TIMES) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Because maybe the exit of loop for exaust.
|
||||
echo json_encode(['correct' => false, 'error' => $error]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the last global counter for chat.
|
||||
*
|
||||
* @param string $mode There are two modes 'json', 'return' and 'session'. And json is by default.
|
||||
*/
|
||||
function users_get_last_global_counter($mode='json')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$file_global_counter_chat = $config['attachment_store'].'/pandora_chat.global_counter.txt';
|
||||
|
||||
$global_counter_file = 0;
|
||||
|
||||
$fp_global_counter = @fopen($file_global_counter_chat, 'a+');
|
||||
if ($fp_global_counter) {
|
||||
$tries = 0;
|
||||
$lock = true;
|
||||
while (!flock($fp_global_counter, LOCK_EX)) {
|
||||
$tries++;
|
||||
if ($tries > MAX_TIMES) {
|
||||
$lock = false;
|
||||
break;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
if ($lock) {
|
||||
@fscanf($fp_global_counter, '%d', $global_counter_file);
|
||||
if (empty($global_counter_file)) {
|
||||
$global_counter_file = 0;
|
||||
}
|
||||
|
||||
fclose($fp_global_counter);
|
||||
}
|
||||
}
|
||||
|
||||
switch ($mode) {
|
||||
case 'json':
|
||||
echo json_encode(['correct' => true, 'global_counter' => $global_counter_file]);
|
||||
break;
|
||||
|
||||
case 'return':
|
||||
return $global_counter_file;
|
||||
|
||||
break;
|
||||
case 'session':
|
||||
$_SESSION['global_counter_chat'] = $global_counter_file;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the last global counter for chat.
|
||||
*
|
||||
* @param string $mode There are two modes 'json', 'return' and 'session'. And json is by default.
|
||||
*/
|
||||
function users_get_last_type_message()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$return = 'false';
|
||||
|
||||
$file_global_counter_chat = $config['attachment_store'].'/pandora_chat.global_counter.txt';
|
||||
$log_chat_file = $config['attachment_store'].'/pandora_chat.log.json.txt';
|
||||
|
||||
$global_counter_file = 0;
|
||||
|
||||
$fp_global_counter = @fopen($file_global_counter_chat, 'a+');
|
||||
if ($fp_global_counter) {
|
||||
$tries = 0;
|
||||
$lock = true;
|
||||
while (!flock($fp_global_counter, LOCK_EX)) {
|
||||
$tries++;
|
||||
if ($tries > MAX_TIMES) {
|
||||
$lock = false;
|
||||
break;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
if ($lock) {
|
||||
$text_encode = @file_get_contents($log_chat_file);
|
||||
$log = json_decode($text_encode, true);
|
||||
|
||||
// Prevent from error when chat file log doesn't exists
|
||||
if (empty($log)) {
|
||||
$return = false;
|
||||
} else {
|
||||
$last = end($log);
|
||||
$return = $last['type'];
|
||||
}
|
||||
|
||||
fclose($fp_global_counter);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
function users_is_admin($id_user=false)
|
||||
{
|
||||
global $config;
|
||||
|
@ -1026,98 +524,6 @@ function users_is_admin($id_user=false)
|
|||
}
|
||||
|
||||
|
||||
function users_is_last_system_message()
|
||||
{
|
||||
$type = users_get_last_type_message();
|
||||
|
||||
if ($type != 'message') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function users_check_users()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$return = [
|
||||
'correct' => false,
|
||||
'users' => '',
|
||||
];
|
||||
|
||||
$users_with_session = db_get_all_rows_sql('SELECT tsessions_php.data FROM pandora.tsessions_php;');
|
||||
$users_logged_now = [];
|
||||
foreach ($users_with_session as $user_with_session) {
|
||||
$tmp_id_user = explode('"', $user_with_session['data']);
|
||||
array_push($users_logged_now, $tmp_id_user[1]);
|
||||
}
|
||||
|
||||
$file_global_user_list = $config['attachment_store'].'/pandora_chat.user_list.json.txt';
|
||||
|
||||
// First lock the file
|
||||
$fp_user_list = @fopen($file_global_user_list, 'a+');
|
||||
if ($fp_user_list === false) {
|
||||
echo json_encode($return);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to look MAX_TIMES times
|
||||
$tries = 0;
|
||||
while (!flock($fp_user_list, LOCK_EX)) {
|
||||
$tries++;
|
||||
if ($tries > MAX_TIMES) {
|
||||
echo json_encode($return);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
@fscanf($fp_user_list, "%[^\n]", $user_list_json);
|
||||
|
||||
$user_list = json_decode($user_list_json, true);
|
||||
if (empty($user_list)) {
|
||||
$user_list = [];
|
||||
}
|
||||
|
||||
// Compare both user list. Meanwhile the user from chat file have an active
|
||||
// session, his continue in the list of active chat users
|
||||
$user_name_list = [];
|
||||
foreach ($user_list as $key => $user) {
|
||||
if (in_array($key, $users_logged_now)) {
|
||||
array_push($user_name_list, $user['name']);
|
||||
} else {
|
||||
unset($user_list[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Clean the file
|
||||
ftruncate($fp_user_list, 0);
|
||||
|
||||
// Update the file with the correct list of users
|
||||
$status = fwrite($fp_user_list, json_encode($user_list));
|
||||
|
||||
/*
|
||||
if ($status === false) {
|
||||
fclose($fp_user_list);
|
||||
|
||||
return;
|
||||
} */
|
||||
// Closing the resource
|
||||
fclose($fp_user_list);
|
||||
|
||||
$return['correct'] = true;
|
||||
$return['users'] = implode('<br />', $user_name_list);
|
||||
echo json_encode($return);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Check if a user can manage a group when group is all
|
||||
// This function dont check acls of the group, only if the
|
||||
// user is admin or pandora manager and the group is all
|
||||
|
|
|
@ -564,13 +564,13 @@ function visual_map_print_item(
|
|||
}
|
||||
|
||||
if ($is_a_link_to_other_visualconsole) {
|
||||
if (METACONSOLE == 1) {
|
||||
if (is_metaconsole() === true) {
|
||||
$url = $config['homeurl'].'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap='.$layoutData['id_layout_linked'].'&refr=300';
|
||||
} else {
|
||||
$url = $config['homeurl'].'index.php?sec=network&sec2=operation/visual_console/render_view&pure='.$config['pure'].'&id='.$layoutData['id_layout_linked'];
|
||||
}
|
||||
} else {
|
||||
if (METACONSOLE == 1) {
|
||||
if (is_metaconsole() === true) {
|
||||
$url = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=0&ag_group='.$layoutData['id_group'].'&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=-1&sort_field=&sort=none&pure=';
|
||||
} else {
|
||||
$url = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id='.$layoutData['id_group'];
|
||||
|
|
|
@ -41,9 +41,12 @@ if ($file === '' || $hash === '' || $hash !== md5($file_raw.$config['dbpass']) |
|
|||
$downloadable_file = '';
|
||||
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
|
||||
$parse_sec2_query = explode('=', $parse_all_queries[1]);
|
||||
// Metaconsole have a route distinct than node.
|
||||
$main_file_manager = (is_metaconsole() === true) ? 'advanced/metasetup' : 'godmode/setup/file_manager';
|
||||
$main_collections = (is_metaconsole() === true) ? 'advanced/collections' : 'enterprise/godmode/agentes/collections';
|
||||
if ($parse_sec2_query[0] === 'sec2') {
|
||||
switch ($parse_sec2_query[1]) {
|
||||
case 'godmode/setup/file_manager':
|
||||
case $main_file_manager:
|
||||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/'.$file;
|
||||
break;
|
||||
|
||||
|
@ -51,6 +54,10 @@ if ($file === '' || $hash === '' || $hash !== md5($file_raw.$config['dbpass']) |
|
|||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file;
|
||||
break;
|
||||
|
||||
case $main_collections:
|
||||
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/collection/'.$file;
|
||||
break;
|
||||
|
||||
default:
|
||||
$downloadable_file = '';
|
||||
// Do nothing
|
||||
|
|
|
@ -1181,8 +1181,16 @@ function add_agent_node(agents) {
|
|||
$("#agent_name").val("");
|
||||
$("#dialog_node_add").dialog("close");
|
||||
|
||||
const new_id =
|
||||
Math.max.apply(
|
||||
Math,
|
||||
graph.nodes.map(function(o) {
|
||||
return o.id;
|
||||
})
|
||||
) + 1;
|
||||
|
||||
var temp_node = {};
|
||||
temp_node["id"] = graph.nodes.length;
|
||||
temp_node["id"] = new_id;
|
||||
temp_node["id_db"] = data["id_node"];
|
||||
temp_node["id_agent"] = data["id_agent"];
|
||||
temp_node["id_module"] = "";
|
||||
|
@ -2423,7 +2431,13 @@ function refresh_holding_area() {
|
|||
jQuery.each(holding_area.nodes, function(i, node) {
|
||||
var temp_node = {};
|
||||
|
||||
temp_node["id"] = graph.nodes.length;
|
||||
temp_node["id"] =
|
||||
Math.max.apply(
|
||||
Math,
|
||||
graph.nodes.map(function(o) {
|
||||
return o.id;
|
||||
})
|
||||
) + 1;
|
||||
holding_area.nodes[i]["id"] = temp_node["id"];
|
||||
|
||||
temp_node["id_db"] = node["id_db"];
|
||||
|
@ -2711,6 +2725,20 @@ function set_parent(parent_data) {
|
|||
url: "ajax.php",
|
||||
success: function(data) {
|
||||
if (data["correct"]) {
|
||||
var child_index = -1;
|
||||
var parent_index = -1;
|
||||
|
||||
// Get indexes of child and parent nodes.
|
||||
$.each(graph.nodes, function(i, d) {
|
||||
if (child_data.id == d.id) {
|
||||
child_index = i;
|
||||
}
|
||||
|
||||
if (parent_data.id == d.id) {
|
||||
parent_index = i;
|
||||
}
|
||||
});
|
||||
|
||||
//Add the relationship and paint
|
||||
item = {};
|
||||
item["arrow_start"] = "";
|
||||
|
@ -2723,11 +2751,11 @@ function set_parent(parent_data) {
|
|||
item["id_module_end"] = 0;
|
||||
item["id_db"] = data["id"];
|
||||
item["source_id_db"] = child_data.id_db;
|
||||
item["target_id_db"] = parent_data.id;
|
||||
item["id_agent_start"] = graph.nodes[child_data.id]["id_agent"];
|
||||
item["id_agent_end"] = graph.nodes[parent_data.id]["id_agent"];
|
||||
item["target"] = graph.nodes[parent_data.id];
|
||||
item["source"] = graph.nodes[child_data.id];
|
||||
item["target_id_db"] = parent_data.id_db;
|
||||
item["id_agent_start"] = graph.nodes[child_index]["id_agent"];
|
||||
item["id_agent_end"] = graph.nodes[parent_index]["id_agent"];
|
||||
item["target"] = graph.nodes[parent_index];
|
||||
item["source"] = graph.nodes[child_index];
|
||||
|
||||
graph.links.push(item);
|
||||
}
|
||||
|
@ -2922,8 +2950,16 @@ function add_fictional_node() {
|
|||
if (data["correct"]) {
|
||||
$("#dialog_node_add").dialog("close");
|
||||
|
||||
const new_id =
|
||||
Math.max.apply(
|
||||
Math,
|
||||
graph.nodes.map(function(o) {
|
||||
return o.id;
|
||||
})
|
||||
) + 1;
|
||||
|
||||
var temp_node = {};
|
||||
temp_node["id"] = graph.nodes.length;
|
||||
temp_node["id"] = new_id;
|
||||
temp_node["id_db"] = data["id_node"];
|
||||
temp_node["id_agent"] = data["id_agent"];
|
||||
temp_node["id_module"] = 0;
|
||||
|
@ -2951,8 +2987,16 @@ function add_fictional_node() {
|
|||
} else {
|
||||
$("#dialog_node_add").dialog("close");
|
||||
|
||||
const new_id =
|
||||
Math.max.apply(
|
||||
Math,
|
||||
graph.nodes.map(function(o) {
|
||||
return o.id;
|
||||
})
|
||||
) + 1;
|
||||
|
||||
var temp_node = {};
|
||||
temp_node["id"] = graph.nodes.length;
|
||||
temp_node["id"] = new_id;
|
||||
temp_node["id_db"] = data["id_node"];
|
||||
temp_node["id_agent"] = data["id_agent"];
|
||||
temp_node["id_module"] = 0;
|
||||
|
|
|
@ -45,7 +45,7 @@ $(document).ready(function() {
|
|||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
page: "operation/messages/message_list"
|
||||
page: "operation/messages/message_list",
|
||||
},
|
||||
function(data, status) {
|
||||
$("#dialog_messages")
|
||||
|
@ -58,10 +58,10 @@ $(document).ready(function() {
|
|||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
background: "black",
|
||||
},
|
||||
width: 700,
|
||||
height: 300
|
||||
height: 300,
|
||||
})
|
||||
.show();
|
||||
},
|
||||
|
@ -80,7 +80,7 @@ $(document).ready(function() {
|
|||
jQuery.post(
|
||||
"ajax.php",
|
||||
{
|
||||
page: "operation/system_alert"
|
||||
page: "operation/system_alert",
|
||||
},
|
||||
function(data, status) {
|
||||
$("#alert_messages").show();
|
||||
|
@ -104,7 +104,7 @@ $(document).ready(function() {
|
|||
"ajax.php",
|
||||
{
|
||||
page: "general/alert_enterprise",
|
||||
message: elem
|
||||
message: elem,
|
||||
},
|
||||
function(data, status) {
|
||||
$("#alert_messages").show();
|
||||
|
@ -130,7 +130,7 @@ $(document).ready(function() {
|
|||
"ajax.php",
|
||||
{
|
||||
page: "general/alert_enterprise",
|
||||
message: elem
|
||||
message: elem,
|
||||
},
|
||||
function(data, status) {
|
||||
$("#alert_messages").show();
|
||||
|
@ -155,7 +155,7 @@ $(document).ready(function() {
|
|||
"ajax.php",
|
||||
{
|
||||
page: "general/alert_enterprise",
|
||||
message: elem
|
||||
message: elem,
|
||||
},
|
||||
function(data, status) {
|
||||
$("#alert_messages").show();
|
||||
|
@ -174,6 +174,11 @@ $(document).ready(function() {
|
|||
|
||||
if (typeof show_error_license == "undefined") show_error_license = 0;
|
||||
|
||||
if (typeof hide_counter == "undefined") hide_counter = 0;
|
||||
|
||||
let height = 300;
|
||||
if (typeof invalid_license != "undefined") height = 350;
|
||||
|
||||
if (process_login_ok || show_error_license) {
|
||||
$("#license_error_msg_dialog").dialog({
|
||||
dialogClass: "no-close",
|
||||
|
@ -181,29 +186,33 @@ $(document).ready(function() {
|
|||
resizable: false,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 470,
|
||||
height: height,
|
||||
width: 850,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
background: "black",
|
||||
},
|
||||
open: function() {
|
||||
var remaining = 30;
|
||||
if (hide_counter != 1) {
|
||||
var remaining = 30;
|
||||
|
||||
// Timeout counter.
|
||||
var count = function() {
|
||||
if (remaining > 0) {
|
||||
$("#license_error_remaining").text(remaining);
|
||||
remaining -= 1;
|
||||
} else {
|
||||
$("#license_error_remaining").hide();
|
||||
$("#ok_buttom").show();
|
||||
clearInterval(count);
|
||||
}
|
||||
};
|
||||
// Timeout counter.
|
||||
var count = function() {
|
||||
if (remaining > 0) {
|
||||
$("#license_error_remaining").text(remaining);
|
||||
remaining -= 1;
|
||||
} else {
|
||||
$("#license_error_remaining").hide();
|
||||
$("#ok_buttom").show();
|
||||
clearInterval(count);
|
||||
}
|
||||
};
|
||||
|
||||
setInterval(count, 1000);
|
||||
}
|
||||
setInterval(count, 1000);
|
||||
} else {
|
||||
$("#ok_buttom").show();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$("#submit-hide-license-error-msg").click(function() {
|
||||
|
@ -221,8 +230,8 @@ $(document).ready(function() {
|
|||
width: 620,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
background: "black",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -235,8 +244,8 @@ $(document).ready(function() {
|
|||
width: 520,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
background: "black",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -249,8 +258,8 @@ $(document).ready(function() {
|
|||
width: 520,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
background: "black",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -318,7 +327,7 @@ $(document).ready(function() {
|
|||
left:
|
||||
+parseInt(screen.width / 2) -
|
||||
parseInt($("#alert_messages").css("width")) / 2 +
|
||||
"px"
|
||||
"px",
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ $(document).ready(function() {
|
|||
url:
|
||||
"https://pandorafms.com/library/wp-json/wp/v2/categories?per_page=100",
|
||||
type: "GET",
|
||||
cache: false,
|
||||
crossDomain: true,
|
||||
contentType: "application/json",
|
||||
success: function(data) {
|
||||
|
@ -136,6 +137,7 @@ $(document).ready(function() {
|
|||
url:
|
||||
api_url + search_modules + "&orderby=modified&per_page=9&page=" + page,
|
||||
type: "GET",
|
||||
cache: false,
|
||||
crossDomain: true,
|
||||
contentType: "application/json",
|
||||
beforeSend: function(xhr) {
|
||||
|
@ -238,6 +240,7 @@ function library_main() {
|
|||
$.ajax({
|
||||
url: "https://pandorafms.com/library/wp-json/wp/v2/pages/121",
|
||||
type: "GET",
|
||||
cache: false,
|
||||
crossDomain: true,
|
||||
contentType: "application/json",
|
||||
beforeSend: function(xhr) {
|
||||
|
@ -313,6 +316,7 @@ function get_category(id) {
|
|||
$.ajax({
|
||||
url: "https://pandorafms.com/library/wp-json/wp/v2/categories/" + id,
|
||||
type: "GET",
|
||||
cache: false,
|
||||
contentType: "application/json",
|
||||
success: function(response) {
|
||||
$("#category_title_result h2").append(
|
||||
|
|
|
@ -244,8 +244,19 @@ function initialiceLayout(data) {
|
|||
}
|
||||
|
||||
$("#delete-widget-" + id).click(function(event) {
|
||||
var nodo = event.target.offsetParent;
|
||||
deleteCell(id, nodo.parentNode);
|
||||
// eslint-disable-next-line no-undef
|
||||
confirmDialog({
|
||||
title: "Are you sure?",
|
||||
message:
|
||||
"<h4 style='text-align: center;padding-top: 20px;'>All changes made to this widget will be lost</h4>",
|
||||
cancel: "Cancel",
|
||||
ok: "Ok",
|
||||
onAccept: function() {
|
||||
// Continue execution.
|
||||
var nodo = event.target.offsetParent;
|
||||
deleteCell(id, nodo.parentNode);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#configure-widget-" + id).click(function() {
|
||||
|
@ -656,8 +667,19 @@ function initialiceLayout(data) {
|
|||
}
|
||||
|
||||
$("#delete-widget-" + cellId).click(function(event) {
|
||||
var nodo = event.target.offsetParent;
|
||||
deleteCell(cellId, nodo.parentNode);
|
||||
// eslint-disable-next-line no-undef
|
||||
confirmDialog({
|
||||
title: "Are you sure?",
|
||||
message:
|
||||
"<h4 style='text-align: center;padding-top: 20px;'>All changes made to this widget will be lost</h4>",
|
||||
cancel: "Cancel",
|
||||
ok: "Ok",
|
||||
onAccept: function() {
|
||||
// Continue execution.
|
||||
var nodo = event.target.offsetParent;
|
||||
deleteCell(cellId, nodo.parentNode);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#configure-widget-" + cellId).click(function() {
|
||||
|
|
|
@ -118,30 +118,26 @@ function execute_response(event_id, server_id) {
|
|||
}
|
||||
|
||||
response["target"] = get_response_target(event_id, response_id, server_id);
|
||||
response["event_id"] = event_id;
|
||||
response["server_id"] = server_id;
|
||||
|
||||
switch (response["type"]) {
|
||||
case "command":
|
||||
show_response_dialog(event_id, response_id, response);
|
||||
break;
|
||||
case "url":
|
||||
if (response["new_window"] == 1) {
|
||||
window.open(response["target"], "_blank");
|
||||
} else {
|
||||
show_response_dialog(event_id, response_id, response);
|
||||
}
|
||||
break;
|
||||
if (response["type"] == "url" && response["new_window"] == 1) {
|
||||
window.open(response["target"], "_blank");
|
||||
} else {
|
||||
show_response_dialog(response_id, response);
|
||||
}
|
||||
}
|
||||
|
||||
//Show the modal window of an event response
|
||||
function show_response_dialog(event_id, response_id, response) {
|
||||
function show_response_dialog(response_id, response) {
|
||||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("dialogue_event_response=1");
|
||||
params.push("massive=0");
|
||||
params.push("event_id=" + event_id);
|
||||
params.push("event_id=" + response["event_id"]);
|
||||
params.push("target=" + response["target"]);
|
||||
params.push("response_id=" + response_id);
|
||||
params.push("server_id=" + response["server_id"]);
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
|
@ -159,7 +155,7 @@ function show_response_dialog(event_id, response_id, response) {
|
|||
draggable: true,
|
||||
modal: false,
|
||||
open: function() {
|
||||
perform_response(response["target"], response_id);
|
||||
perform_response(response, response_id);
|
||||
},
|
||||
width: response["modal_width"],
|
||||
height: response["modal_height"]
|
||||
|
@ -171,7 +167,6 @@ function show_response_dialog(event_id, response_id, response) {
|
|||
|
||||
//Show the modal window of event responses when multiple events are selected
|
||||
function show_massive_response_dialog(
|
||||
event_id,
|
||||
response_id,
|
||||
response,
|
||||
out_iterator,
|
||||
|
@ -183,13 +178,14 @@ function show_massive_response_dialog(
|
|||
params.push("massive=1");
|
||||
params.push("end=" + end);
|
||||
params.push("out_iterator=" + out_iterator);
|
||||
params.push("event_id=" + event_id);
|
||||
params.push("event_id=" + response["event_id"]);
|
||||
params.push("target=" + response["target"]);
|
||||
params.push("response_id=" + response_id);
|
||||
params.push("server_id=" + response["server_id"]);
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
response_tg: response["target"],
|
||||
response_tg: response,
|
||||
response_id: response_id,
|
||||
out_iterator: out_iterator,
|
||||
type: "POST",
|
||||
|
@ -384,7 +380,7 @@ function get_response_target(
|
|||
}
|
||||
|
||||
// Perform a response and put the output into a div
|
||||
function perform_response(target, response_id) {
|
||||
function perform_response(response, response_id) {
|
||||
$("#re_exec_command").hide();
|
||||
$("#response_loading_command").show();
|
||||
$("#response_out").html("");
|
||||
|
@ -392,8 +388,10 @@ function perform_response(target, response_id) {
|
|||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("perform_event_response=1");
|
||||
params.push("target=" + target);
|
||||
params.push("target=" + response["target"]);
|
||||
params.push("response_id=" + response_id);
|
||||
params.push("event_id=" + response["event_id"]);
|
||||
params.push("server_id=" + response["server_id"]);
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
|
@ -413,7 +411,7 @@ function perform_response(target, response_id) {
|
|||
}
|
||||
|
||||
// Perform a response and put the output into a div
|
||||
function perform_response_massive(target, response_id, out_iterator) {
|
||||
function perform_response_massive(response, response_id, out_iterator) {
|
||||
$("#re_exec_command").hide();
|
||||
$("#response_loading_command_" + out_iterator).show();
|
||||
$("#response_out_" + out_iterator).html("");
|
||||
|
@ -421,8 +419,10 @@ function perform_response_massive(target, response_id, out_iterator) {
|
|||
var params = [];
|
||||
params.push("page=include/ajax/events");
|
||||
params.push("perform_event_response=1");
|
||||
params.push("target=" + target);
|
||||
params.push("target=" + response["target"]);
|
||||
params.push("response_id=" + response_id);
|
||||
params.push("event_id=" + response["event_id"]);
|
||||
params.push("server_id=" + response["server_id"]);
|
||||
|
||||
jQuery.ajax({
|
||||
data: params.join("&"),
|
||||
|
@ -916,17 +916,24 @@ function check_massive_response_event(
|
|||
|
||||
$(".chk_val:checked").each(function() {
|
||||
var event_id = $(this).val();
|
||||
var server_id = $("#hidden-server_id_" + event_id).val();
|
||||
var meta = $("#hidden-meta").val();
|
||||
var server_id = 0;
|
||||
if (meta) {
|
||||
server_id = $("#hidden-server_id_" + event_id).val();
|
||||
}
|
||||
|
||||
response["target"] = get_response_target(
|
||||
event_id,
|
||||
response_id,
|
||||
server_id,
|
||||
response_command
|
||||
);
|
||||
response["server_id"] = server_id;
|
||||
response["event_id"] = event_id;
|
||||
|
||||
if (total_checked - 1 === counter) end = 1;
|
||||
|
||||
show_massive_response_dialog(event_id, response_id, response, counter, end);
|
||||
show_massive_response_dialog(response_id, response, counter, end);
|
||||
|
||||
counter++;
|
||||
});
|
||||
|
|
|
@ -20,7 +20,7 @@ var TreeController = {
|
|||
recipient: "",
|
||||
tree: [],
|
||||
emptyMessage: "No data found.",
|
||||
foundMessage: "Found groups",
|
||||
foundMessage: "Groups found",
|
||||
errorMessage: "Error",
|
||||
baseURL: "",
|
||||
ajaxURL: "ajax.php",
|
||||
|
@ -48,9 +48,15 @@ var TreeController = {
|
|||
.addClass("tree-root")
|
||||
.hide()
|
||||
.prepend(
|
||||
'<img src="' +
|
||||
'<div class="tree-node flex-row-vcenter">' +
|
||||
'<img src="' +
|
||||
(controller.baseURL.length > 0 ? controller.baseURL : "") +
|
||||
'images/pandora.png" />'
|
||||
'images/pandora.png" />' +
|
||||
"<span class='margin-left-1'>" +
|
||||
(controller.tree.length > 0
|
||||
? controller.foundMessage + ": " + controller.tree.length
|
||||
: "") +
|
||||
"</div>"
|
||||
);
|
||||
}
|
||||
// Normal group
|
||||
|
@ -315,7 +321,7 @@ var TreeController = {
|
|||
_processNodeCounterTitle($totalCounter, type, "total");
|
||||
|
||||
// Open the parentheses
|
||||
$counters.append(" (");
|
||||
$counters.append(" [ ");
|
||||
|
||||
$counters.append($totalCounter);
|
||||
|
||||
|
@ -409,7 +415,7 @@ var TreeController = {
|
|||
}
|
||||
|
||||
// Close the parentheses
|
||||
$counters.append(")");
|
||||
$counters.append(" ]");
|
||||
|
||||
hasCounters = true;
|
||||
}
|
||||
|
@ -541,6 +547,7 @@ var TreeController = {
|
|||
break;
|
||||
case "agent":
|
||||
// Is quiet
|
||||
|
||||
if (
|
||||
typeof element.quietImageHTML != "undefined" &&
|
||||
element.quietImageHTML.length > 0
|
||||
|
@ -560,16 +567,6 @@ var TreeController = {
|
|||
|
||||
$content.append($statusImage);
|
||||
}
|
||||
// Alerts fired image
|
||||
if (
|
||||
typeof element.alertImageHTML != "undefined" &&
|
||||
element.alertImageHTML.length > 0
|
||||
) {
|
||||
var $alertImage = $(element.alertImageHTML);
|
||||
$alertImage.addClass("agent-alerts-fired");
|
||||
|
||||
$content.append($alertImage);
|
||||
}
|
||||
|
||||
// Events by agent
|
||||
if (element.showEventsBtn == 1) {
|
||||
|
@ -690,6 +687,8 @@ var TreeController = {
|
|||
$content.append(" " + element.name);
|
||||
break;
|
||||
case "module":
|
||||
$content.addClass("module");
|
||||
|
||||
// Status image
|
||||
if (
|
||||
typeof element.statusImageHTML != "undefined" &&
|
||||
|
@ -700,17 +699,19 @@ var TreeController = {
|
|||
|
||||
$content.append($statusImage);
|
||||
}
|
||||
// Server type
|
||||
if (
|
||||
typeof element.serverTypeHTML != "undefined" &&
|
||||
element.serverTypeHTML.length > 0 &&
|
||||
element.serverTypeHTML != "--"
|
||||
) {
|
||||
var $serverTypeImage = $(element.serverTypeHTML);
|
||||
$serverTypeImage.addClass("module-server-type");
|
||||
|
||||
$content.append($serverTypeImage);
|
||||
}
|
||||
// Name max 42 chars.
|
||||
$content.append(
|
||||
'<span class="module-name">' +
|
||||
element.name.substring(0, 42) +
|
||||
(element.name.length > 42 ? "..." : "") +
|
||||
"</span>"
|
||||
);
|
||||
|
||||
// Value.
|
||||
$content.append(
|
||||
'<span class="module-value">' + element.value + "</span>"
|
||||
);
|
||||
|
||||
if (
|
||||
typeof element.showGraphs != "undefined" &&
|
||||
|
@ -832,7 +833,6 @@ var TreeController = {
|
|||
$content.append($alertsImage);
|
||||
}
|
||||
|
||||
$content.append(element.name);
|
||||
break;
|
||||
case "os":
|
||||
if (
|
||||
|
@ -1086,20 +1086,6 @@ var TreeController = {
|
|||
}
|
||||
|
||||
controller.recipient.empty();
|
||||
if (
|
||||
controller.tree.length !== undefined &&
|
||||
controller.foundMessage !== "not"
|
||||
) {
|
||||
controller.recipient.html(
|
||||
"<div> " +
|
||||
controller.foundMessage +
|
||||
": " +
|
||||
controller.tree.length +
|
||||
"</div>" +
|
||||
"<br/>"
|
||||
);
|
||||
}
|
||||
|
||||
var $children = _processGroup(this.recipient, this.tree, true);
|
||||
$children.show();
|
||||
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
function check_new_chats_icon(id_icon) {
|
||||
if (new_chat) {
|
||||
$("#" + id_icon).pulsate();
|
||||
}
|
||||
}
|
||||
|
||||
function check_new_chats_icon_ajax(id_icon) {
|
||||
var exit = false;
|
||||
|
||||
url_chunks = location.href.split("&");
|
||||
$.each(url_chunks, function(key, chunk) {
|
||||
if (chunk == "sec2=operation/users/webchat") exit = true;
|
||||
return;
|
||||
});
|
||||
|
||||
if (exit) {
|
||||
return;
|
||||
}
|
||||
|
||||
old = global_counter_chat;
|
||||
get_last_global_counter();
|
||||
|
||||
if (old < global_counter_chat) {
|
||||
$("#" + id_icon).pulsate();
|
||||
}
|
||||
|
||||
setTimeout('check_new_chats_icon("' + id_icon + '")', 5000);
|
||||
}
|
||||
|
||||
function get_last_global_counter() {
|
||||
var parameters = {};
|
||||
parameters["page"] = "operation/users/webchat";
|
||||
parameters["get_last_global_counter"] = 1;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: parameters,
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(data) {
|
||||
if (data["correct"] == 1) {
|
||||
global_counter_chat = data["global_counter"];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -1042,6 +1042,17 @@ class Manager
|
|||
$cellData['id_widget'] = $this->widgetId;
|
||||
}
|
||||
}
|
||||
|
||||
$instance = $this->instanceWidget();
|
||||
$cellData['options'] = $instance->decoders(
|
||||
$instance->getOptionsWidget()
|
||||
);
|
||||
|
||||
if (isset($cellData['options']['title']) === false) {
|
||||
$cellData['options']['title'] = $instance->getDescription();
|
||||
}
|
||||
|
||||
$cellData['options'] = json_encode($cellData['options']);
|
||||
}
|
||||
|
||||
View::render(
|
||||
|
|
|
@ -59,7 +59,7 @@ class Widget
|
|||
|
||||
$cellClass = new Cell($this->cellId, $this->dashboardId);
|
||||
$this->dataCell = $cellClass->get();
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -535,6 +535,34 @@ class Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder):array
|
||||
{
|
||||
$values = [];
|
||||
|
||||
if (isset($decoder['title']) === true) {
|
||||
$values['title'] = $decoder['title'];
|
||||
}
|
||||
|
||||
if (isset($decoder['background-color']) === true) {
|
||||
$values['background'] = $decoder['background-color'];
|
||||
}
|
||||
|
||||
if (isset($decoder['background']) === true) {
|
||||
$values['background'] = $decoder['background'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Size Cell.
|
||||
*
|
||||
|
|
|
@ -169,489 +169,11 @@ class AgentModuleWidget extends Widget
|
|||
|
||||
// This forces at least a first configuration.
|
||||
$this->configurationRequired = false;
|
||||
if (empty($this->values['moduleId']) === true) {
|
||||
$this->configurationRequired = true;
|
||||
}
|
||||
|
||||
$this->overflow_scrollbars = false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// DO NOT CHANGE THIS VALUE.
|
||||
$id_group = isset($this->options['search_group_'.$id]) ? $this->options['search_group_'.$id] : 0;
|
||||
|
||||
$agent_conf_key = 'id_agent_'.$id;
|
||||
$id_agent = $this->options[$agent_conf_key];
|
||||
$module_conf_key = 'id_module_'.$id;
|
||||
$id_module = $this->options[$module_conf_key];
|
||||
$recursion_checked = $this->options['recursion'];
|
||||
|
||||
$this->add_configuration(
|
||||
'search_group_'.$id,
|
||||
__('Group'),
|
||||
OPTION_TREE_GROUP_SELECT
|
||||
);
|
||||
|
||||
$list_agents = agents_get_group_agents(
|
||||
$id_group,
|
||||
false,
|
||||
'lower',
|
||||
false,
|
||||
$recursion_checked
|
||||
);
|
||||
|
||||
if (!isset($this->options['selection_agent_module_'.$id])
|
||||
|| $this->options['selection_agent_module_'.$id] == ''
|
||||
|| $this->options['selection_agent_module_'.$id] == null
|
||||
) {
|
||||
$selection_agent_module = 'common';
|
||||
} else {
|
||||
$selection_agent_module = $this->options['selection_agent_module_'.$id];
|
||||
}
|
||||
|
||||
$limit_common = '';
|
||||
$sql = false;
|
||||
if (!empty($id_agent)) {
|
||||
if ($selection_agent_module == 'common') {
|
||||
$limit_common = sprintf(
|
||||
' AND (SELECT count(nombre)
|
||||
FROM tagente_modulo t2
|
||||
WHERE t2.delete_pending = 0
|
||||
AND t1.nombre = t2.nombre
|
||||
AND t2.id_agente IN (%s)) = (%d)',
|
||||
implode(',', (array) $id_agent),
|
||||
count($id_agent)
|
||||
);
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT DISTINCT nombre
|
||||
FROM tagente_modulo t1
|
||||
WHERE id_agente IN (%s)
|
||||
AND delete_pending = 0 %s ORDER BY nombre',
|
||||
implode(', ', (array) $id_agent),
|
||||
$limit_common
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($id_module)) {
|
||||
$this->options[$module_conf_key] = index_array(
|
||||
db_get_all_rows_sql($sql),
|
||||
'nombre',
|
||||
'nombre'
|
||||
);
|
||||
}
|
||||
|
||||
$this->add_configuration(
|
||||
'recursion',
|
||||
__('Recursion'),
|
||||
OPTION_BOOLEAN
|
||||
);
|
||||
|
||||
$this->add_configuration(
|
||||
$agent_conf_key,
|
||||
__('Agent'),
|
||||
OPTION_SELECT_MULTISELECTION,
|
||||
['values' => $list_agents]
|
||||
);
|
||||
|
||||
$this->add_configuration(
|
||||
'selection_agent_module_'.$id,
|
||||
__('Show common modules'),
|
||||
OPTION_SINGLE_SELECT,
|
||||
[
|
||||
'values' => [
|
||||
'common' => __('Show common modules'),
|
||||
'all' => __('Show all modules'),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_configuration(
|
||||
$module_conf_key,
|
||||
__('Module'),
|
||||
OPTION_SELECT_MULTISELECTION,
|
||||
[
|
||||
'values' => index_array(
|
||||
db_get_all_rows_sql($sql),
|
||||
'nombre',
|
||||
'nombre'
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_configuration(
|
||||
'',
|
||||
'',
|
||||
OPTION_CUSTOM_INPUT,
|
||||
[
|
||||
'widget' => $this,
|
||||
'entire_row' => true,
|
||||
'update' => false,
|
||||
]
|
||||
);
|
||||
*/
|
||||
|
||||
|
||||
function print_configuration_custom($return=true)
|
||||
{
|
||||
$id = $this->getId();
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
recalculate_modules_select_agent_module(
|
||||
$("#selection_agent_module_<?php echo $id; ?>").val()
|
||||
);
|
||||
|
||||
function recalculate_modules_select_agent_module (selection_mode) {
|
||||
var idAgents = Array();
|
||||
jQuery.each ($('#id_agent_<?php echo $id; ?> option:selected'), function (i, val) {
|
||||
idAgents.push($(val).val());
|
||||
});
|
||||
jQuery.post ('ajax.php',
|
||||
{"page": "operation/agentes/ver_agente",
|
||||
"get_modules_group_value_name_json": 1,
|
||||
"selection": selection_mode == 'all' ? 1 : 0,
|
||||
"id_agents[]": idAgents
|
||||
},
|
||||
function (data, status) {
|
||||
$('#id_module_<?php echo $id; ?>').empty ();
|
||||
if (data) {
|
||||
jQuery.each (data, function (id, value) {
|
||||
$('#id_module_<?php echo $id; ?>')
|
||||
.append ($('<option></option>')
|
||||
.html(value)
|
||||
.prop("value", value)
|
||||
.prop("selected", 'selected'));
|
||||
});
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
$('#search_group_<?php echo $id; ?>').on('change',function() {
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "operation/agentes/ver_agente",
|
||||
"get_agents_group_json" : 1,
|
||||
"id_group" : this.value,
|
||||
"recursion" : ($('#checkbox-recursion-<?php echo $id; ?>').is(':checked')) ? 1 : 0
|
||||
},
|
||||
function (data, status) {
|
||||
$('#id_agent_<?php echo $id; ?>').html('');
|
||||
jQuery.each (data, function(id, value) {
|
||||
// Remove keys_prefix from the index.
|
||||
option = $("<option></option>")
|
||||
.prop("value", id)
|
||||
.prop("selected", 'selected')
|
||||
.html(value);
|
||||
$('#id_agent_<?php echo $id; ?>').append (option);
|
||||
});
|
||||
|
||||
recalculate_modules_select_agent_module(
|
||||
$("#selection_agent_module_<?php echo $id; ?>").val()
|
||||
);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
$('#checkbox-recursion-<?php echo $id; ?>').on('change', function() {
|
||||
($('#hidden-recursion_sent').val() === '1') ? $('#hidden-recursion_sent').val('0') : $('#hidden-recursion_sent').val('1');
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "operation/agentes/ver_agente",
|
||||
"get_agents_group_json" : 1,
|
||||
"id_group" : $('#search_group_<?php echo $id; ?>').val(),
|
||||
"recursion" : ($('#checkbox-recursion-<?php echo $id; ?>').is(':checked')) ? 1 : 0
|
||||
},
|
||||
function (data, status) {
|
||||
$('#id_agent_<?php echo $id; ?>').html('');
|
||||
jQuery.each (data, function(id, value) {
|
||||
// Remove keys_prefix from the index.
|
||||
option = $("<option></option>")
|
||||
.prop("value", id)
|
||||
.prop("selected", 'selected')
|
||||
.html(value);
|
||||
$('#id_agent_<?php echo $id; ?>').append (option);
|
||||
});
|
||||
|
||||
recalculate_modules_select_agent_module(
|
||||
$("#selection_agent_module_<?php echo $id; ?>").val()
|
||||
);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
$("#id_agent_<?php echo $id; ?>").on('change',function () {
|
||||
recalculate_modules_select_agent_module(
|
||||
$("#selection_agent_module_<?php echo $id; ?>").val()
|
||||
);
|
||||
});
|
||||
|
||||
$("#selection_agent_module_<?php echo $id; ?>").on('change',function(evt) {
|
||||
recalculate_modules_select_agent_module(
|
||||
$("#selection_agent_module_<?php echo $id; ?>").val()
|
||||
);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
public function generate_data_agent_module($agents, $all_modules)
|
||||
{
|
||||
$return = [];
|
||||
$cont = 0;
|
||||
$name = '';
|
||||
|
||||
foreach ($all_modules as $key => $module) {
|
||||
if ($module == $name) {
|
||||
$modules_by_name[($cont - 1)]['id'][] = $key;
|
||||
} else {
|
||||
$name = $module;
|
||||
$modules_by_name[$cont]['name'] = $name;
|
||||
$modules_by_name[$cont]['id'][] = $key;
|
||||
$cont ++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($agents as $agent) {
|
||||
if (!users_access_to_agent($agent['id_agente'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$row = [];
|
||||
$row['agent_status'] = agents_get_status($agent['id_agente'], true);
|
||||
$row['agent_name'] = $agent['nombre'];
|
||||
$row['agent_alias'] = $agent['alias'];
|
||||
$agent_modules = agents_get_modules($agent['id_agente']);
|
||||
|
||||
$row['modules'] = [];
|
||||
foreach ($modules_by_name as $module) {
|
||||
$row['modules'][$module['name']] = null;
|
||||
foreach ($module['id'] as $module_id) {
|
||||
if (array_key_exists($module_id, $agent_modules)) {
|
||||
$row['modules'][$module['name']] = modules_get_agentmodule_status($module_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$return[] = $row;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
public function generate_view_agent_module($visual_data)
|
||||
{
|
||||
$table_data = '<div>';
|
||||
$table_data .= '<table class="widget_agent_module" cellpadding="1" cellspacing="0" border="0" style="background-color: #EEE;">';
|
||||
|
||||
if (!empty($visual_data)) {
|
||||
$table_data .= '<th>'.__('Agents').' / '.__('Modules').'</th>';
|
||||
|
||||
$array_names = [];
|
||||
|
||||
foreach ($visual_data as $data) {
|
||||
foreach ($data['modules'] as $module_name => $module) {
|
||||
if ($module === null || in_array($module_name, $array_names)) {
|
||||
continue;
|
||||
} else {
|
||||
$array_names[] = $module_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
natcasesort($array_names);
|
||||
foreach ($array_names as $module_name) {
|
||||
$file_name = ui_print_truncate_text(
|
||||
$module_name,
|
||||
'module_small',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'...'
|
||||
);
|
||||
$table_data .= '<th style="padding: 10px;">'.$file_name.'</th>';
|
||||
}
|
||||
|
||||
foreach ($visual_data as $row) {
|
||||
$table_data .= "<tr style='height: 35px;'>";
|
||||
switch ($row['agent_status']) {
|
||||
case AGENT_STATUS_ALERT_FIRED:
|
||||
$rowcolor = COL_ALERTFIRED;
|
||||
$textcolor = '#000';
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
$rowcolor = COL_CRITICAL;
|
||||
$textcolor = '#FFF';
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_WARNING:
|
||||
$rowcolor = COL_WARNING;
|
||||
$textcolor = '#000';
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_NORMAL:
|
||||
$rowcolor = COL_NORMAL;
|
||||
$textcolor = '#FFF';
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
case AGENT_STATUS_ALL:
|
||||
default:
|
||||
$rowcolor = COL_UNKNOWN;
|
||||
$textcolor = '#FFF';
|
||||
break;
|
||||
}
|
||||
|
||||
$file_name = ui_print_truncate_text(
|
||||
$row['agent_alias'],
|
||||
'agent_small',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'...'
|
||||
);
|
||||
$table_data .= "<td style='background-color: ".$rowcolor.";'>".$file_name.'</td>';
|
||||
|
||||
foreach ($row['modules'] as $module_name => $module) {
|
||||
if ($module === null) {
|
||||
if (in_array($module_name, $array_names)) {
|
||||
$table_data .= "<td style='background-color: #DDD;'></td>";
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$table_data .= "<td style='text-align: center; background-color: #DDD;'>";
|
||||
switch ($module) {
|
||||
case AGENT_STATUS_NORMAL:
|
||||
$table_data .= ui_print_status_image(
|
||||
'module_ok.png',
|
||||
__(
|
||||
'%s in %s : NORMAL',
|
||||
$module_name,
|
||||
$row['agent_alias']
|
||||
),
|
||||
true,
|
||||
[
|
||||
'width' => '20px',
|
||||
'height' => '20px',
|
||||
]
|
||||
);
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
$table_data .= ui_print_status_image(
|
||||
'module_critical.png',
|
||||
__(
|
||||
'%s in %s : CRITICAL',
|
||||
$module_name,
|
||||
$row['agent_alias']
|
||||
),
|
||||
true,
|
||||
[
|
||||
'width' => '20px',
|
||||
'height' => '20px',
|
||||
]
|
||||
);
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_WARNING:
|
||||
$table_data .= ui_print_status_image(
|
||||
'module_warning.png',
|
||||
__(
|
||||
'%s in %s : WARNING',
|
||||
$module_name,
|
||||
$row['agent_alias']
|
||||
),
|
||||
true,
|
||||
[
|
||||
'width' => '20px',
|
||||
'height' => '20px',
|
||||
]
|
||||
);
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
$table_data .= ui_print_status_image(
|
||||
'module_unknown.png',
|
||||
__(
|
||||
'%s in %s : UNKNOWN',
|
||||
$module_name,
|
||||
$row['agent_alias']
|
||||
),
|
||||
true,
|
||||
[
|
||||
'width' => '20px',
|
||||
'height' => '20px',
|
||||
]
|
||||
);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$table_data .= ui_print_status_image(
|
||||
'module_no_data.png',
|
||||
__(
|
||||
'%s in %s : Not initialize',
|
||||
$module_name,
|
||||
$row['agent_alias']
|
||||
),
|
||||
true,
|
||||
[
|
||||
'width' => '20px',
|
||||
'height' => '20px',
|
||||
]
|
||||
);
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_ALERT_FIRED:
|
||||
default:
|
||||
$table_data .= ui_print_status_image(
|
||||
'module_alertsfired.png',
|
||||
__(
|
||||
'%s in %s : ALERTS FIRED',
|
||||
$module_name,
|
||||
$row['agent_alias']
|
||||
),
|
||||
true,
|
||||
[
|
||||
'width' => '20px',
|
||||
'height' => '20px',
|
||||
]
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
$table_data .= '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
$table_data .= '</tr>';
|
||||
}
|
||||
} else {
|
||||
$table_data .= '<tr><td>'.__('Please configure this widget before usage').'</td></tr>';
|
||||
}
|
||||
|
||||
$table_data .= '</table>';
|
||||
$table_data .= '</div>';
|
||||
|
||||
return $table_data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
@ -666,38 +188,12 @@ class AgentModuleWidget extends Widget
|
|||
// Retrieve global - common inputs.
|
||||
$inputs = parent::getFormInputs();
|
||||
|
||||
// Autocomplete agents.
|
||||
$inputs[] = [
|
||||
'label' => __('Agent'),
|
||||
'arguments' => [
|
||||
'type' => 'autocomplete_agent',
|
||||
'name' => 'agentAlias',
|
||||
'id_agent_hidden' => $values['agentId'],
|
||||
'name_agent_hidden' => 'agentId',
|
||||
'server_id_hidden' => $values['metaconsoleId'],
|
||||
'name_server_hidden' => 'metaconsoleId',
|
||||
'return' => true,
|
||||
'module_input' => true,
|
||||
'module_name' => 'moduleId',
|
||||
'module_none' => false,
|
||||
'size' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
// Autocomplete module.
|
||||
$inputs[] = [
|
||||
'label' => __('Module'),
|
||||
'arguments' => [
|
||||
'type' => 'autocomplete_module',
|
||||
'fields' => $fields,
|
||||
'name' => 'moduleId',
|
||||
'selected' => $values['moduleId'],
|
||||
'return' => true,
|
||||
'sort' => false,
|
||||
'agent_id' => $values['agentId'],
|
||||
'metaconsole_id' => $values['metaconsoleId'],
|
||||
'style' => 'width: inherit;',
|
||||
],
|
||||
'label' => \ui_print_error_message(
|
||||
__('This widget has been removed'),
|
||||
'',
|
||||
true
|
||||
),
|
||||
];
|
||||
|
||||
return $inputs;
|
||||
|
@ -714,12 +210,6 @@ class AgentModuleWidget extends Widget
|
|||
// Retrieve global - common inputs.
|
||||
$values = parent::getPost();
|
||||
|
||||
$values['agentId'] = \get_parameter('agentId', 0);
|
||||
$values['metaconsoleId'] = \get_parameter('metaconsoleId', 0);
|
||||
$values['moduleId'] = \get_parameter('moduleId', 0);
|
||||
$values['period'] = \get_parameter('period', 0);
|
||||
$values['showLegend'] = \get_parameter_switch('showLegend');
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
@ -733,45 +223,14 @@ class AgentModuleWidget extends Widget
|
|||
{
|
||||
global $config;
|
||||
|
||||
// TODO:XXX WIP.
|
||||
return 'WIP in this widget';
|
||||
/*
|
||||
$this->body = '';
|
||||
$id_agent = $this->options['id_agent_'.$this->getId()];
|
||||
if (! check_acl($config['id_user'], 0, 'AR')) {
|
||||
$this->body = __('You don\'t have access');
|
||||
return;
|
||||
}
|
||||
|
||||
$id_module = $this->options['id_module_'.$this->getId()];
|
||||
if ($id_agent) {
|
||||
$sql = 'SELECT id_agente,nombre,alias
|
||||
FROM tagente
|
||||
WHERE id_agente IN ('.implode(',', $id_agent).')
|
||||
ORDER BY id_agente';
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
if ($agents === false) {
|
||||
$agents = [];
|
||||
}
|
||||
|
||||
$sql = 'SELECT id_agente_modulo,nombre
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente IN ('.implode(',', $id_agent).")
|
||||
AND nombre IN ('".implode("','", $id_module)."')
|
||||
AND delete_pending = 0 ORDER BY nombre";
|
||||
$modules = index_array(db_get_all_rows_sql($sql), 'id_agente_modulo', 'nombre');
|
||||
if ($modules === false) {
|
||||
$modules = [];
|
||||
}
|
||||
} else {
|
||||
$agents = [];
|
||||
$modules = [];
|
||||
}
|
||||
|
||||
$visual_data = $this->generate_data_agent_module($agents, $modules);
|
||||
|
||||
$this->body .= $this->generate_view_agent_module($visual_data);
|
||||
*/
|
||||
$output .= '<div class="container-center">';
|
||||
$output .= \ui_print_error_message(
|
||||
__('This widget has been removed'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
$output .= '</div>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ class AlertsFiredWidget extends Widget
|
|||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -176,6 +176,31 @@ class AlertsFiredWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['group']) === true) {
|
||||
$values['groupId'] = $decoder['group'];
|
||||
}
|
||||
|
||||
if (isset($decoder['groupId']) === true) {
|
||||
$values['groupId'] = $decoder['groupId'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
@ -234,7 +259,7 @@ class AlertsFiredWidget extends Widget
|
|||
|
||||
$output = '';
|
||||
|
||||
if ($this->values['groupId'] === 0) {
|
||||
if ((int) $this->values['groupId'] === 0) {
|
||||
$groups = users_get_groups(false, 'AR', false);
|
||||
} else {
|
||||
$groups = [$this->values['groupId'] => ''];
|
||||
|
@ -254,7 +279,7 @@ class AlertsFiredWidget extends Widget
|
|||
|
||||
$flag = false;
|
||||
foreach ($groups as $id_group => $name) {
|
||||
$alerts_group = get_group_alerts($id_group);
|
||||
$alerts_group = get_group_alerts([$id_group]);
|
||||
if (isset($alerts_group['simple']) === true) {
|
||||
$alerts_group = $alerts_group['simple'];
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ class ClockWidget extends Widget
|
|||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -172,6 +172,31 @@ class ClockWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['clock_type']) === true) {
|
||||
$values['clockType'] = $decoder['clock_type'];
|
||||
}
|
||||
|
||||
if (isset($decoder['clockType']) === true) {
|
||||
$values['clockType'] = $decoder['clockType'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -104,6 +104,13 @@ class CustomGraphWidget extends Widget
|
|||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
/**
|
||||
* Cell ID.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $cellId;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
|
@ -141,8 +148,11 @@ class CustomGraphWidget extends Widget
|
|||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Cell Id.
|
||||
$this->cellId = $cellId;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -173,6 +183,43 @@ class CustomGraphWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['id_graph']) === true) {
|
||||
$values['id_graph'] = $decoder['id_graph'];
|
||||
}
|
||||
|
||||
if (isset($decoder['stacked']) === true) {
|
||||
$values['type'] = $decoder['stacked'];
|
||||
}
|
||||
|
||||
if (isset($decoder['type']) === true) {
|
||||
$values['type'] = $decoder['type'];
|
||||
}
|
||||
|
||||
if (isset($decoder['period']) === true) {
|
||||
$values['period'] = $decoder['period'];
|
||||
}
|
||||
|
||||
if (isset($decoder['showLegend']) === true) {
|
||||
$values['showLegend'] = $decoder['showLegend'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -147,7 +147,7 @@ class EventsListWidget extends Widget
|
|||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -177,6 +177,71 @@ class EventsListWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['type']) === true) {
|
||||
$values['eventType'] = $decoder['type'];
|
||||
}
|
||||
|
||||
if (isset($decoder['eventType']) === true) {
|
||||
$values['eventType'] = $decoder['eventType'];
|
||||
}
|
||||
|
||||
if (isset($decoder['event_view_hr']) === true) {
|
||||
$values['maxHours'] = $decoder['event_view_hr'];
|
||||
}
|
||||
|
||||
if (isset($decoder['maxHours']) === true) {
|
||||
$values['maxHours'] = $decoder['maxHours'];
|
||||
}
|
||||
|
||||
if (isset($decoder['limit']) === true) {
|
||||
$values['limit'] = $decoder['limit'];
|
||||
}
|
||||
|
||||
if (isset($decoder['status']) === true) {
|
||||
$values['eventStatus'] = $decoder['status'];
|
||||
}
|
||||
|
||||
if (isset($decoder['eventStatus']) === true) {
|
||||
$values['eventStatus'] = $decoder['eventStatus'];
|
||||
}
|
||||
|
||||
if (isset($decoder['severity']) === true) {
|
||||
$values['severity'] = $decoder['severity'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_groups']) === true) {
|
||||
if (is_array($decoder['id_groups']) === true) {
|
||||
$decoder['id_groups'][0] = implode(',', $decoder['id_groups']);
|
||||
}
|
||||
|
||||
$values['groupId'] = $decoder['id_groups'];
|
||||
}
|
||||
|
||||
if (isset($decoder['groupId']) === true) {
|
||||
$values['groupId'] = $decoder['groupId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['tagsId']) === true) {
|
||||
$values['tagsId'] = $decoder['tagsId'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
@ -416,13 +481,15 @@ class EventsListWidget extends Widget
|
|||
$filter['limit'] = $this->values['limit'];
|
||||
$filter['order'] = '`utimestamp` DESC';
|
||||
|
||||
if ((int) $this->values['severity'] === 20) {
|
||||
$filter['criticity'] = [
|
||||
EVENT_CRIT_WARNING,
|
||||
EVENT_CRIT_CRITICAL,
|
||||
];
|
||||
} else if ((int) $this->values['severity'] !== -1) {
|
||||
$filter['criticity'] = $this->values['severity'];
|
||||
if (isset($this->values['severity']) === true) {
|
||||
if ((int) $this->values['severity'] === 20) {
|
||||
$filter['criticity'] = [
|
||||
EVENT_CRIT_WARNING,
|
||||
EVENT_CRIT_CRITICAL,
|
||||
];
|
||||
} else if ((int) $this->values['severity'] !== -1) {
|
||||
$filter['criticity'] = $this->values['severity'];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->values['tagsId']) === false) {
|
||||
|
|
|
@ -142,7 +142,7 @@ class WelcomeWidget extends Widget
|
|||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -168,6 +168,23 @@ class WelcomeWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -106,6 +106,13 @@ class GraphModuleHistogramWidget extends Widget
|
|||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
/**
|
||||
* Cell ID.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $cellId;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
|
@ -148,8 +155,11 @@ class GraphModuleHistogramWidget extends Widget
|
|||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Cell Id.
|
||||
$this->cellId = $cellId;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -179,6 +189,63 @@ class GraphModuleHistogramWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['label_'.$this->cellId]) === true) {
|
||||
$values['label'] = $decoder['label_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['label']) === true) {
|
||||
$values['label'] = $decoder['label'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_agent_'.$this->cellId]) === true) {
|
||||
$values['agentId'] = $decoder['id_agent_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['agentId']) === true) {
|
||||
$values['agentId'] = $decoder['agentId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['metaconsoleId']) === true) {
|
||||
$values['metaconsoleId'] = $decoder['metaconsoleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_module_'.$this->cellId]) === true) {
|
||||
$values['moduleId'] = $decoder['id_module_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['moduleId']) === true) {
|
||||
$values['moduleId'] = $decoder['moduleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['size_label_'.$this->cellId]) === true) {
|
||||
$values['sizeLabel'] = $decoder['size_label_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['sizeLabel']) === true) {
|
||||
$values['sizeLabel'] = $decoder['sizeLabel'];
|
||||
}
|
||||
|
||||
if (isset($decoder['period']) === true) {
|
||||
$values['period'] = $decoder['period'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -142,7 +142,7 @@ class GroupsStatusWidget extends Widget
|
|||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -172,6 +172,31 @@ class GroupsStatusWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['groups']) === true) {
|
||||
$values['groupId'] = $decoder['groups'];
|
||||
}
|
||||
|
||||
if (isset($decoder['groupId']) === true) {
|
||||
$values['groupId'] = $decoder['groupId'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -158,7 +158,7 @@ class MapsMadeByUser extends Widget
|
|||
$this->cellId = $cellId;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -188,6 +188,31 @@ class MapsMadeByUser extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['id_layout']) === true) {
|
||||
$values['vcId'] = $decoder['id_layout'];
|
||||
}
|
||||
|
||||
if (isset($decoder['vcId']) === true) {
|
||||
$values['vcId'] = $decoder['vcId'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -142,7 +142,7 @@ class MapsStatusWidget extends Widget
|
|||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -172,6 +172,31 @@ class MapsStatusWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['maps']) === true) {
|
||||
if (is_array($decoder['maps']) === true) {
|
||||
$decoder['maps'][0] = implode(',', $decoder['maps']);
|
||||
}
|
||||
|
||||
$values['maps'] = $decoder['maps'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -114,6 +114,13 @@ class ModuleIconWidget extends Widget
|
|||
*/
|
||||
protected $dashboardId;
|
||||
|
||||
/**
|
||||
* Cell ID.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $cellId;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
|
@ -151,8 +158,11 @@ class ModuleIconWidget extends Widget
|
|||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Cell Id.
|
||||
$this->cellId = $cellId;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -183,6 +193,83 @@ class ModuleIconWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['label_'.$this->cellId]) === true) {
|
||||
$values['label'] = $decoder['label_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['label']) === true) {
|
||||
$values['label'] = $decoder['label'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_agent_'.$this->cellId]) === true) {
|
||||
$values['agentId'] = $decoder['id_agent_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['agentId']) === true) {
|
||||
$values['agentId'] = $decoder['agentId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['metaconsoleId']) === true) {
|
||||
$values['metaconsoleId'] = $decoder['metaconsoleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_module_'.$this->cellId]) === true) {
|
||||
$values['moduleId'] = $decoder['id_module_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['moduleId']) === true) {
|
||||
$values['moduleId'] = $decoder['moduleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['size_value_'.$this->cellId]) === true) {
|
||||
$values['sizeValue'] = $decoder['size_value_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['sizeValue']) === true) {
|
||||
$values['sizeValue'] = $decoder['sizeValue'];
|
||||
}
|
||||
|
||||
if (isset($decoder['size_label_'.$this->cellId]) === true) {
|
||||
$values['sizeLabel'] = $decoder['size_label_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['sizeLabel']) === true) {
|
||||
$values['sizeLabel'] = $decoder['sizeLabel'];
|
||||
}
|
||||
|
||||
if (isset($decoder['size_icon_'.$this->cellId]) === true) {
|
||||
$values['sizeIcon'] = $decoder['size_icon_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['sizeIcon']) === true) {
|
||||
$values['sizeIcon'] = $decoder['sizeIcon'];
|
||||
}
|
||||
|
||||
if (isset($decoder['icon_module_'.$this->cellId]) === true) {
|
||||
$values['imageSrc'] = $decoder['icon_module_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['imageSrc']) === true) {
|
||||
$values['imageSrc'] = $decoder['imageSrc'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -106,6 +106,13 @@ class ModuleStatusWidget extends Widget
|
|||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
/**
|
||||
* Cell ID.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $cellId;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
|
@ -146,8 +153,11 @@ class ModuleStatusWidget extends Widget
|
|||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Cell Id.
|
||||
$this->cellId = $cellId;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -177,6 +187,83 @@ class ModuleStatusWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['label_'.$this->cellId]) === true) {
|
||||
$values['label'] = $decoder['label_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['label']) === true) {
|
||||
$values['label'] = $decoder['label'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_agent_'.$this->cellId]) === true) {
|
||||
$values['agentId'] = $decoder['id_agent_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['agentId']) === true) {
|
||||
$values['agentId'] = $decoder['agentId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['metaconsoleId']) === true) {
|
||||
$values['metaconsoleId'] = $decoder['metaconsoleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_module_'.$this->cellId]) === true) {
|
||||
$values['moduleId'] = $decoder['id_module_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['moduleId']) === true) {
|
||||
$values['moduleId'] = $decoder['moduleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['size_value_'.$this->cellId]) === true) {
|
||||
$values['sizeValue'] = $decoder['size_value_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['sizeValue']) === true) {
|
||||
$values['sizeValue'] = $decoder['sizeValue'];
|
||||
}
|
||||
|
||||
if (isset($decoder['size_label_'.$this->cellId]) === true) {
|
||||
$values['sizeLabel'] = $decoder['size_label_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['sizeLabel']) === true) {
|
||||
$values['sizeLabel'] = $decoder['sizeLabel'];
|
||||
}
|
||||
|
||||
if (isset($decoder['size_icon_'.$this->cellId]) === true) {
|
||||
$values['sizeIcon'] = $decoder['size_icon_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['sizeIcon']) === true) {
|
||||
$values['sizeIcon'] = $decoder['sizeIcon'];
|
||||
}
|
||||
|
||||
if (isset($decoder['icon_module_'.$this->cellId]) === true) {
|
||||
$values['imageSrc'] = $decoder['icon_module_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['imageSrc']) === true) {
|
||||
$values['imageSrc'] = $decoder['imageSrc'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -107,6 +107,13 @@ class ModuleTableValueWidget extends Widget
|
|||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
/**
|
||||
* Cell ID.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $cellId;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
|
@ -148,8 +155,11 @@ class ModuleTableValueWidget extends Widget
|
|||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Cell Id.
|
||||
$this->cellId = $cellId;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -179,6 +189,59 @@ class ModuleTableValueWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['id_agent_'.$this->cellId]) === true) {
|
||||
$values['agentId'] = $decoder['id_agent_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['agentId']) === true) {
|
||||
$values['agentId'] = $decoder['agentId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['metaconsoleId']) === true) {
|
||||
$values['metaconsoleId'] = $decoder['metaconsoleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_module_'.$this->cellId]) === true) {
|
||||
$values['moduleId'] = $decoder['id_module_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['moduleId']) === true) {
|
||||
$values['moduleId'] = $decoder['moduleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['size_text_'.$this->cellId]) === true) {
|
||||
$values['sizeLabel'] = $decoder['size_text_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['sizeLabel']) === true) {
|
||||
$values['sizeLabel'] = $decoder['sizeLabel'];
|
||||
}
|
||||
|
||||
if (isset($decoder['separator_data_'.$this->cellId]) === true) {
|
||||
$values['separator'] = $decoder['separator_data_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['separator']) === true) {
|
||||
$values['separator'] = $decoder['separator'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -109,6 +109,13 @@ class ModuleValueWidget extends Widget
|
|||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
/**
|
||||
* Cell ID.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $cellId;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
|
@ -146,8 +153,11 @@ class ModuleValueWidget extends Widget
|
|||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Cell Id.
|
||||
$this->cellId = $cellId;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -177,6 +187,67 @@ class ModuleValueWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['label_'.$this->cellId]) === true) {
|
||||
$values['label'] = $decoder['label_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['label']) === true) {
|
||||
$values['label'] = $decoder['label'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_agent_'.$this->cellId]) === true) {
|
||||
$values['agentId'] = $decoder['id_agent_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['agentId']) === true) {
|
||||
$values['agentId'] = $decoder['agentId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['metaconsoleId']) === true) {
|
||||
$values['metaconsoleId'] = $decoder['metaconsoleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_module_'.$this->cellId]) === true) {
|
||||
$values['moduleId'] = $decoder['id_module_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['moduleId']) === true) {
|
||||
$values['moduleId'] = $decoder['moduleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['size_value_'.$this->cellId]) === true) {
|
||||
$values['sizeValue'] = $decoder['size_value_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['sizeValue']) === true) {
|
||||
$values['sizeValue'] = $decoder['sizeValue'];
|
||||
}
|
||||
|
||||
if (isset($decoder['size_label_'.$this->cellId]) === true) {
|
||||
$values['sizeLabel'] = $decoder['size_label_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['sizeLabel']) === true) {
|
||||
$values['sizeLabel'] = $decoder['sizeLabel'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -142,7 +142,7 @@ class MonitorHealthWidget extends Widget
|
|||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -164,14 +164,28 @@ class MonitorHealthWidget extends Widget
|
|||
|
||||
// This forces at least a first configuration.
|
||||
$this->configurationRequired = false;
|
||||
if (isset($this->values['title']) === false) {
|
||||
$this->configurationRequired = true;
|
||||
}
|
||||
|
||||
$this->overflow_scrollbars = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
@ -234,8 +248,11 @@ class MonitorHealthWidget extends Widget
|
|||
$data['mW'] = (int) $all_data['_monitors_warning_'];
|
||||
$data['mC'] = (int) $all_data['_monitors_critical_'];
|
||||
$data['mNN'] = (int) $all_data['_monitor_not_normal_'];
|
||||
$data['monitor_not_normal'] = (int) $all_data['_monitor_not_normal_'];
|
||||
$data['monitor_not_init'] = (int) $all_data['_monitors_not_init_'];
|
||||
$data['monitor_alerts'] = (int) $all_data['_monitors_alerts_'];
|
||||
$data['mAFired'] = (int) $all_data['_monitors_alerts_fired_'];
|
||||
$data['monitor_alerts_fired'] = (int) $all_data['_monitors_alerts_fired_'];
|
||||
|
||||
$data['total_agents'] = (int) $all_data['_total_agents_'];
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ class NetworkMapWidget extends Widget
|
|||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -184,6 +184,55 @@ class NetworkMapWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['networkmaps']) === true) {
|
||||
$values['networkmapId'] = $decoder['networkmaps'];
|
||||
}
|
||||
|
||||
if (isset($decoder['networkmapId']) === true) {
|
||||
$values['networkmapId'] = $decoder['networkmapId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['map_translate_x']) === true) {
|
||||
$values['xOffset'] = $decoder['map_translate_x'];
|
||||
}
|
||||
|
||||
if (isset($decoder['xOffset']) === true) {
|
||||
$values['xOffset'] = $decoder['xOffset'];
|
||||
}
|
||||
|
||||
if (isset($decoder['map_translate_y']) === true) {
|
||||
$values['yOffset'] = $decoder['map_translate_y'];
|
||||
}
|
||||
|
||||
if (isset($decoder['yOffset']) === true) {
|
||||
$values['yOffset'] = $decoder['yOffset'];
|
||||
}
|
||||
|
||||
if (isset($decoder['zoom_level_dash']) === true) {
|
||||
$values['zoomLevel'] = $decoder['zoom_level_dash'];
|
||||
}
|
||||
|
||||
if (isset($decoder['zoomLevel']) === true) {
|
||||
$values['zoomLevel'] = $decoder['zoomLevel'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -142,7 +142,7 @@ class PostWidget extends Widget
|
|||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -172,6 +172,31 @@ class PostWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['textit']) === true) {
|
||||
$values['text'] = $decoder['textit'];
|
||||
}
|
||||
|
||||
if (isset($decoder['text']) === true) {
|
||||
$values['text'] = $decoder['text'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -148,7 +148,7 @@ class ReportsWidget extends Widget
|
|||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -178,6 +178,31 @@ class ReportsWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['id_report']) === true) {
|
||||
$values['reportId'] = $decoder['id_report'];
|
||||
}
|
||||
|
||||
if (isset($decoder['reportId']) === true) {
|
||||
$values['reportId'] = $decoder['reportId'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -146,7 +146,7 @@ class ServiceMapWidget extends Widget
|
|||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -176,6 +176,39 @@ class ServiceMapWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['service_id']) === true) {
|
||||
$values['serviceId'] = $decoder['service_id'];
|
||||
}
|
||||
|
||||
if (isset($decoder['serviceId']) === true) {
|
||||
$values['serviceId'] = $decoder['serviceId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['show_legend']) === true) {
|
||||
$values['showLegend'] = (int) $decoder['show_legend'];
|
||||
}
|
||||
|
||||
if (isset($decoder['showLegend']) === true) {
|
||||
$values['showLegend'] = $decoder['showLegend'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -106,6 +106,13 @@ class SingleGraphWidget extends Widget
|
|||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
/**
|
||||
* Cell ID.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $cellId;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
|
@ -143,8 +150,11 @@ class SingleGraphWidget extends Widget
|
|||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Cell Id.
|
||||
$this->cellId = $cellId;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -174,6 +184,55 @@ class SingleGraphWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['id_agent_'.$this->cellId]) === true) {
|
||||
$values['agentId'] = $decoder['id_agent_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['agentId']) === true) {
|
||||
$values['agentId'] = $decoder['agentId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['metaconsoleId']) === true) {
|
||||
$values['metaconsoleId'] = $decoder['metaconsoleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_module_'.$this->cellId]) === true) {
|
||||
$values['moduleId'] = $decoder['id_module_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['moduleId']) === true) {
|
||||
$values['moduleId'] = $decoder['moduleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['period']) === true) {
|
||||
$values['period'] = $decoder['period'];
|
||||
}
|
||||
|
||||
if (isset($decoder['show_full_legend']) === true) {
|
||||
$values['showLegend'] = $decoder['show_full_legend'];
|
||||
}
|
||||
|
||||
if (isset($decoder['showLegend']) === true) {
|
||||
$values['showLegend'] = $decoder['showLegend'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
|
|
@ -110,6 +110,13 @@ class SLAPercentWidget extends Widget
|
|||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
/**
|
||||
* Cell ID.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $cellId;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
|
@ -147,8 +154,11 @@ class SLAPercentWidget extends Widget
|
|||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Cell Id.
|
||||
$this->cellId = $cellId;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -178,6 +188,71 @@ class SLAPercentWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['label_'.$this->cellId]) === true) {
|
||||
$values['label'] = $decoder['label_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['label']) === true) {
|
||||
$values['label'] = $decoder['label'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_agent_'.$this->cellId]) === true) {
|
||||
$values['agentId'] = $decoder['id_agent_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['agentId']) === true) {
|
||||
$values['agentId'] = $decoder['agentId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['metaconsoleId']) === true) {
|
||||
$values['metaconsoleId'] = $decoder['metaconsoleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['id_module_'.$this->cellId]) === true) {
|
||||
$values['moduleId'] = $decoder['id_module_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['moduleId']) === true) {
|
||||
$values['moduleId'] = $decoder['moduleId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['size_value_'.$this->cellId]) === true) {
|
||||
$values['sizeValue'] = $decoder['size_value_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['sizeValue']) === true) {
|
||||
$values['sizeValue'] = $decoder['sizeValue'];
|
||||
}
|
||||
|
||||
if (isset($decoder['size_label_'.$this->cellId]) === true) {
|
||||
$values['sizeLabel'] = $decoder['size_label_'.$this->cellId];
|
||||
}
|
||||
|
||||
if (isset($decoder['sizeLabel']) === true) {
|
||||
$values['sizeLabel'] = $decoder['sizeLabel'];
|
||||
}
|
||||
|
||||
if (isset($decoder['period']) === true) {
|
||||
$values['period'] = $decoder['period'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
@ -387,7 +462,7 @@ class SLAPercentWidget extends Widget
|
|||
|
||||
if (empty($label) === false) {
|
||||
// Div Label.
|
||||
$output .= '<div style="flex: 1 1; font-size:'.$sizeLabel.'px;">'.$label.'</div>';
|
||||
$output .= '<div style="flex: 1 1; font-size:'.$sizeLabel.'px; text-align: left;">'.$label.'</div>';
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
|
|
@ -142,7 +142,7 @@ class SystemGroupStatusWidget extends Widget
|
|||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -164,14 +164,80 @@ class SystemGroupStatusWidget extends Widget
|
|||
|
||||
// This forces at least a first configuration.
|
||||
$this->configurationRequired = false;
|
||||
if (empty($this->values['groupId']) === true) {
|
||||
$this->configurationRequired = true;
|
||||
}
|
||||
|
||||
$this->overflow_scrollbars = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['status']) === true) {
|
||||
if (is_array($decoder['status']) === true) {
|
||||
$compatibilityStatus = [];
|
||||
foreach ($decoder['status'] as $key => $value) {
|
||||
switch ((int) $value) {
|
||||
case 2:
|
||||
$compatibilityStatus[] = AGENT_STATUS_WARNING;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$compatibilityStatus[] = AGENT_STATUS_CRITICAL;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$compatibilityStatus[] = 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 1:
|
||||
$compatibilityStatus[] = AGENT_STATUS_NORMAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$decoder['status'][0] = implode(',', $compatibilityStatus);
|
||||
}
|
||||
|
||||
$values['status'] = $decoder['status'];
|
||||
} else {
|
||||
$values['status'][0] = implode(
|
||||
',',
|
||||
[
|
||||
AGENT_STATUS_NORMAL,
|
||||
AGENT_STATUS_WARNING,
|
||||
AGENT_STATUS_CRITICAL,
|
||||
4,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($decoder['id_groups']) === true) {
|
||||
if (is_array($decoder['id_groups']) === true) {
|
||||
$decoder['id_groups'][0] = implode(',', $decoder['id_groups']);
|
||||
}
|
||||
|
||||
$values['groupId'] = $decoder['id_groups'];
|
||||
}
|
||||
|
||||
if (isset($decoder['groupId']) === true) {
|
||||
$values['groupId'] = $decoder['groupId'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
@ -186,6 +252,19 @@ class SystemGroupStatusWidget extends Widget
|
|||
// Retrieve global - common inputs.
|
||||
$inputs = parent::getFormInputs();
|
||||
|
||||
// Default values.
|
||||
if (isset($values['status']) === false) {
|
||||
$values['status'][0] = implode(
|
||||
',',
|
||||
[
|
||||
AGENT_STATUS_NORMAL,
|
||||
AGENT_STATUS_WARNING,
|
||||
AGENT_STATUS_CRITICAL,
|
||||
4,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// Restrict access to group.
|
||||
$inputs[] = [
|
||||
'label' => __('Groups'),
|
||||
|
@ -439,7 +518,7 @@ class SystemGroupStatusWidget extends Widget
|
|||
}
|
||||
}
|
||||
|
||||
$height = (count($table->data) * 30);
|
||||
$height = (count($table->data) * 32);
|
||||
$style = 'min-width:200px; min-height:'.$height.'px;';
|
||||
$output = '<div class="container-center" style="'.$style.'">';
|
||||
if ($flag_groups === true) {
|
||||
|
|
|
@ -160,7 +160,7 @@ class TacticalWidget extends Widget
|
|||
$this->pmAccess = \users_can_manage_group_all('PM');
|
||||
|
||||
// Options.
|
||||
$this->values = $this->getOptionsWidget();
|
||||
$this->values = $this->decoders($this->getOptionsWidget());
|
||||
|
||||
// Positions.
|
||||
$this->position = $this->getPositionWidget();
|
||||
|
@ -193,6 +193,43 @@ class TacticalWidget extends Widget
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decoders hack for retrocompability.
|
||||
*
|
||||
* @param array $decoder Values.
|
||||
*
|
||||
* @return array Returns the values with the correct key.
|
||||
*/
|
||||
public function decoders(array $decoder): array
|
||||
{
|
||||
$values = [];
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::decoders($decoder);
|
||||
|
||||
if (isset($decoder['statusmonitors']) === true) {
|
||||
$values['statusMonitor'] = $decoder['statusmonitors'];
|
||||
}
|
||||
|
||||
if (isset($decoder['statusMonitor']) === true) {
|
||||
$values['statusMonitor'] = $decoder['statusMonitor'];
|
||||
}
|
||||
|
||||
if (isset($decoder['serverperf']) === true) {
|
||||
$values['serverPerformance'] = $decoder['serverperf'];
|
||||
}
|
||||
|
||||
if (isset($decoder['serverPerformance']) === true) {
|
||||
$values['serverPerformance'] = $decoder['serverPerformance'];
|
||||
}
|
||||
|
||||
if (isset($decoder['summary']) === true) {
|
||||
$values['summary'] = $decoder['summary'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
|
@ -366,7 +403,7 @@ class TacticalWidget extends Widget
|
|||
);
|
||||
}
|
||||
|
||||
if ($this->values['statusMonitor'] === 1) {
|
||||
if ((int) $this->values['statusMonitor'] === 1) {
|
||||
$table = new \stdClass();
|
||||
$table->width = '100%';
|
||||
|
||||
|
@ -396,7 +433,7 @@ class TacticalWidget extends Widget
|
|||
$output .= \html_print_table($table, true);
|
||||
}
|
||||
|
||||
if ($this->values['serverPerformance'] === 1
|
||||
if ((int) $this->values['serverPerformance'] === 1
|
||||
&& $this->pmAccess === true
|
||||
) {
|
||||
$table = new \stdClass();
|
||||
|
@ -414,7 +451,7 @@ class TacticalWidget extends Widget
|
|||
$output .= \html_print_table($table, true);
|
||||
}
|
||||
|
||||
if ($this->values['summary'] === 1) {
|
||||
if ((int) $this->values['summary'] === 1) {
|
||||
$table = new \stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = '';
|
||||
|
|
|
@ -375,7 +375,7 @@ class TopNWidget extends Widget
|
|||
}
|
||||
|
||||
// This function check ACL.
|
||||
$agents = agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
|
||||
$agents = @agents_get_group_agents(0, ['aliasRegex' => $agentRegex]);
|
||||
$agentsId = \array_keys($agents);
|
||||
$agentsIdString = \implode(',', $agentsId);
|
||||
|
||||
|
@ -414,7 +414,7 @@ class TopNWidget extends Widget
|
|||
$quantity
|
||||
);
|
||||
|
||||
$modules = \db_get_all_rows_sql(
|
||||
$modules = @db_get_all_rows_sql(
|
||||
$sql,
|
||||
$search_in_history_db
|
||||
);
|
||||
|
@ -422,7 +422,7 @@ class TopNWidget extends Widget
|
|||
if (empty($modules) === true) {
|
||||
$output .= '<div class="container-center">';
|
||||
$output .= \ui_print_info_message(
|
||||
__('There are no Agent/Modules defined'),
|
||||
__('There are no agents/modules found matching filter set'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue