Merge remote-tracking branch 'origin/develop' into ent-6802-super-8

Conflicts:
	pandora_console/include/class/HTML.class.php
This commit is contained in:
fbsanchez 2022-01-25 14:16:47 +01:00
commit 1207463f16
115 changed files with 1820 additions and 1089 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.759-220110 Version: 7.0NG.759-220125
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.759-220110" pandora_version="7.0NG.759-220125"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.759'; use constant AGENT_VERSION => '7.0NG.759';
use constant AGENT_BUILD => '220110'; use constant AGENT_BUILD => '220125';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.759 %define version 7.0NG.759
%define release 220110 %define release 220125
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.759 %define version 7.0NG.759
%define release 220110 %define release 220125
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.759" PI_VERSION="7.0NG.759"
PI_BUILD="220110" PI_BUILD="220125"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{220110} {220125}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.759 Build 220110") #define PANDORA_VERSION ("7.0NG.759 Build 220125")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.759(Build 220110))" VALUE "ProductVersion", "(7.0NG.759(Build 220125))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.759-220110 Version: 7.0NG.759-220125
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.759-220110" pandora_version="7.0NG.759-220125"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -202,9 +202,7 @@ function extension_api_checker()
echo '</fieldset>'; echo '</fieldset>';
echo "<div class='right'>"; echo "<div class='right'>";
echo '</div>'; echo '</div>';
echo '</form>';
echo "<form method='post'>";
echo '<fieldset>'; echo '<fieldset>';
echo '<legend>'.__('Custom URL').'</legend>'; echo '<legend>'.__('Custom URL').'</legend>';
html_print_table($table3); html_print_table($table3);

View File

@ -302,7 +302,7 @@ function mainModuleGroups()
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;'; $table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;';
$table->width = '100%'; $table->width = '100%';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$background_color = '#333'; $background_color = '#333';
} else { } else {
$background_color = '#fff'; $background_color = '#fff';

View File

@ -42,7 +42,7 @@ function pandora_realtime_graphs()
global $config; global $config;
check_login(); check_login();
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
ui_require_css_file('pandora_black', 'include/styles/', true); ui_require_css_file('pandora_black', 'include/styles/', true);
} }

View File

@ -116,3 +116,5 @@ mobile/include/javascript/jquery.mobile-1.3.1.js
mobile/include/style/jquery.mobile-1.3.1.css mobile/include/style/jquery.mobile-1.3.1.css
godmode/alerts/configure_alert_special_days.php godmode/alerts/configure_alert_special_days.php
godmode/admin_access_logs.php godmode/admin_access_logs.php
enterprise/extensions/backup/main.php
enterprise/extensions/backup.php

View File

@ -1,5 +1,5 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE `tpolicy_queue` MODIFY COLUMN `progress` int(10) NOT NULL default '0'; ALTER TABLE `tpolicy_queue` MODIFY COLUMN `progress` int(10) NOT NULL default '0';
CREATE INDEX `IDX_tservice_element` ON `tservice_element`(`id_service`,`id_agente_modulo`);
COMMIT; COMMIT;

View File

@ -480,7 +480,8 @@ CREATE TABLE IF NOT EXISTS `tservice_element` (
`id_agent` int(10) unsigned NOT NULL default 0, `id_agent` int(10) unsigned NOT NULL default 0,
`id_service_child` int(10) unsigned NOT NULL default 0, `id_service_child` int(10) unsigned NOT NULL default 0,
`id_server_meta` int(10) unsigned NOT NULL default 0, `id_server_meta` int(10) unsigned NOT NULL default 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`),
INDEX `IDX_tservice_element` (`id_service`,`id_agente_modulo`)
) ENGINE=InnoDB ) ENGINE=InnoDB
COMMENT = 'Table to define the modules and the weights of the modules that define a service' COMMENT = 'Table to define the modules and the weights of the modules that define a service'
DEFAULT CHARSET=utf8; DEFAULT CHARSET=utf8;
@ -1450,13 +1451,13 @@ ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default '';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 50); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 51);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 758); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 759);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields'; UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password'; DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';

View File

@ -330,8 +330,30 @@ if ($config['enterprise_installed']) {
$reset_pass_link = 'reset_pass.php'; $reset_pass_link = 'reset_pass.php';
// Reset password link. // Reset password link.
echo '<div class="reset_password">'; echo '<div class="reset_password">';
if ((!$config['centralized_management'])) {
echo '<a href="index.php?reset=true&first=true">'.__('Forgot your password?'); echo '<a href="index.php?reset=true&first=true">'.__('Forgot your password?');
echo '</a>'; echo '</a>';
} else {
echo '<a href="javascript:centralized_mode_reset_dialog();">'.__('Forgot your password?');
echo '</a>';
echo '<div id="centralized_mode_reset_dialog" title="'.__('Password reset').'" style="display:none">';
echo '<div class="content_alert">';
echo '<div class="icon_message_alert">';
echo html_print_image('images/icono_stop.png', true, ['alt' => __('Password reset'), 'border' => 0]);
echo '</div>';
echo '<div class="content_message_alert">';
echo '<div class="text_message_alert">';
echo '<p>'.__('This node is configured with centralized mode. Go to metaconsole to reset the password').'</p>';
echo '</div>';
echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'centralized_mode_reset_button', false);
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
}
echo '</div>'; echo '</div>';
} }
} }
@ -826,5 +848,23 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
}); });
}); });
function centralized_mode_reset_dialog() {
$("#centralized_mode_reset_dialog").dialog({
resizable: true,
draggable: true,
modal: true,
height: 220,
width: 528,
overlay: {
opacity: 0.5,
background: "black"
}
});
$("#submit-centralized_mode_reset_button").click (function () {
$("#centralized_mode_reset_dialog").dialog('close');
});
}
/* ]]> */ /* ]]> */
</script> </script>

View File

@ -98,7 +98,7 @@ function add_component_selection($id_network_component_type)
global $table_simple; global $table_simple;
global $config; global $config;
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$background_row = 'background-color: #444'; $background_row = 'background-color: #444';
} else { } else {
$background_row = 'background-color: #cfcfcf'; $background_row = 'background-color: #cfcfcf';

View File

@ -694,12 +694,21 @@ $(document).ready (function () {
} }
} }
else { else {
var is_element_select = $("[name=field" + i + "_value]").is("select");
$("[name=field" + i + "_value]").val(old_value); $("[name=field" + i + "_value]").val(old_value);
if (is_element_select === true) {
$("[name=field" + i + "_value]").trigger('change'); $("[name=field" + i + "_value]").trigger('change');
}
$("[name=field" + i + "_recovery_value]").val(old_recovery_value); $("[name=field" + i + "_recovery_value]").val(old_recovery_value);
if (is_element_select === true) {
$("[name=field" + i + "_recovery_value]").trigger('change'); $("[name=field" + i + "_recovery_value]").trigger('change');
} }
} }
}
else { else {
if ($("[name=field" + i + "_value]").val() != 'text/plain') { if ($("[name=field" + i + "_value]").val() != 'text/plain') {
$("[name=field" + i + "_value]") $("[name=field" + i + "_value]")

View File

@ -463,21 +463,12 @@ foreach ($listConnectionTemp as $connectionTemp) {
} }
$table->data[1][0] = __('Add Map connection').$iconError; $table->data[1][0] = __('Add Map connection').$iconError;
$table->data[1][1] = "<table class='no-class' border='0' id='map_connection'> $table->data[1][1] = ".html_print_select($listConnection, 'map_connection_list', '', '', '', '0', true)."
<tr> < / td > < td > < a href = 'javascript: addConnectionMap();' > ".html_print_image(
<td >
".html_print_select($listConnection, 'map_connection_list', '', '', '', '0', true)."
</td>
<td >
<a href='javascript: addConnectionMap();'>".html_print_image(
'images/add.png', 'images/add.png',
true, true,
['class' => 'invert_filter'] ['class' => 'invert_filter']
)."</a> )." < / a > < input type = 'hidden' name = 'map_connection_list' value = '' id = 'map_connection_list' / > < input type = 'hidden' name = 'layer_list' value = '' id = 'layer_list' / > < / td > < / tr > (".gis_add_conection_maps_in_form($map_connection_list).'
<input type='hidden' name='map_connection_list' value='' id='map_connection_list' />
<input type='hidden' name='layer_list' value='' id='layer_list' />
</td>
</tr> ".gis_add_conection_maps_in_form($map_connection_list).'
</table>'; </table>';
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
@ -553,9 +544,9 @@ $table->data = [];
$table->data[0][0] = '<h4>'.__('List of layers').'</h4>'; $table->data[0][0] = '<h4>'.__('List of layers').'</h4>';
$table->data[0][1] = '<div class="right">'.html_print_button(__('New layer'), 'new_layer', false, 'newLayer();', 'class="sub add "', true).'</div>'; $table->data[0][1] = '<div class="right">'.html_print_button(__('New layer'), 'new_layer', false, 'newLayer();', 'class="sub add "', true).'</div>';
$table->data[1][0] = '<table class="databox" border="0" cellpadding="4" cellspacing="4" id="list_layers"></table>'; $table->data[1][0] = '<table class="databox' border='0' cellpadding='4' cellspacing='4' id='list_layers"></table>';
$table->data[1][1] = '<div id="form_layer" class="invisible"> $table->data[1][1] = '<div id="form_layer' class='invisible'>
<table id="form_layer_table" class="" border="0" cellpadding="4" cellspacing="4"> <table id='form_layer_table' class="" border='0' cellpadding='4' cellspacing='4">
<tr> <tr>
<td>'.__('Layer name').':</td> <td>'.__('Layer name').':</td>
<td>'.html_print_input_text('layer_name_form', '', '', 20, 40, true).'</td> <td>'.html_print_input_text('layer_name_form', '', '', 20, 40, true).'</td>
@ -598,7 +589,7 @@ $table->data[1][1] .= '</td>
<tr> <tr>
<td colspan="4"> <td colspan="4">
<h4>'.__('List of Agents to be shown in the layer').'</h4> <h4>'.__('List of Agents to be shown in the layer').'</h4>
<table class="databox" border="0" cellpadding="4" cellspacing="4" id="list_agents"> <table class="databox' border='0' cellpadding='4' cellspacing='4' id='list_agents">
</table> </table>
</td> </td>
</tr>'; </tr>';
@ -632,18 +623,18 @@ $table->data[1][1] .= '<tr><td colspan="4"><hr /></td></tr>
<td colspan="3">'.$agent_for_group_input.'</td> <td colspan="3">'.$agent_for_group_input.'</td>
</tr> </tr>
<tr> <tr>
<td colspan="4" align="right">'.$add_group_btn.'</td> <td colspan="4' align='right">'.$add_group_btn.'</td>
</tr> </tr>
<tr> <tr>
<td colspan="4"> <td colspan="4">
<h4>'.__('List of groups to be shown in the layer').'</h4> <h4>'.__('List of groups to be shown in the layer').'</h4>
<table class="databox" border="0" cellpadding="4" cellspacing="4" id="list_groups"> <table class="databox' border='0' cellpadding='4' cellspacing='4' id='list_groups">
</table> </table>
</td> </td>
</tr>'; </tr>';
$table->data[1][1] .= '<tr> $table->data[1][1] .= '<tr>
<td align="right" colspan="4">'.html_print_button(__('Save Layer'), 'save_layer', false, 'javascript:saveNewLayer();', 'class="sub wand"', true).' <td align="right' colspan='4">'.html_print_button(__('Save Layer'), 'save_layer', false, 'javascript:saveNewLayer();', 'class="sub wand"', true).'
'.html_print_input_hidden('current_edit_layer_id', '', true).' '.html_print_input_hidden('current_edit_layer_id', '', true).'
</td> </td>
</tr> </tr>
@ -653,7 +644,7 @@ $table->data[1][1] .= '<tr>
html_print_table($table); html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action - buttons' style=')width: '.$table->width.'">';
switch ($action) { switch ($action) {
case 'save_new': case 'save_new':
case 'edit_map': case 'edit_map':
@ -678,12 +669,12 @@ echo '</form>';
// -------------------------INI CHUNKS--------------------------------------- // -------------------------INI CHUNKS---------------------------------------
?> ?>
<table style="visibility: hidden;"> <table style="visibility: hidden;('>
<tbody id="chunk_map_connection"> <tbody id='chunk_map_connection'>
<tr class="row_0"> <tr class='row_0">
<td><?php html_print_input_text('map_connection_name', $map_name, '', 20, 40, false, true); ?></td> <td><?php html_print_input_text('map_connection_name', $map_name, '', 20, 40, false, true); ?></td>
<td><?php html_print_radio_button_extended('map_connection_default', '', '', true, false, 'changeDefaultConection(this.value)', ''); ?></td> <td><?php html_print_radio_button_extended('map_connection_default', '', '', true, false, 'changeDefaultConection(this.value)', ''); ?></td>
<td><a id="delete_row" href="none"> <td><a id="delete_row' href='none">
<?php <?php
html_print_image( html_print_image(
'images/cross.png', 'images/cross.png',
@ -706,36 +697,43 @@ ui_require_jquery_file('cluetip');
ui_require_jquery_file('pandora.controls'); ui_require_jquery_file('pandora.controls');
ui_require_jquery_file('json'); ui_require_jquery_file('json');
?> ?>
<script type="text/javascript"> <script type="text / javascript'>
function active_button_add_agent() { function active_button_add_agent() {
$("#button-add_agent").prop("disabled", false); $(')
// button-add_agent").prop("disabled", false);
} }
function addAgentClick (event) {
var $layerFormAgentIdInput = $("#hidden-agent_id"); function addAgentClick(event)
var $layerFormAgentAliasInput = $("#text-agent_alias"); {
var $layerFormAgentIdInput = $('#hidden-agent_id');
var $layerFormAgentAliasInput = $('#text-agent_alias');
var agentId = Number.parseInt($layerFormAgentIdInput.val()); var agentId = Number.parseInt($layerFormAgentIdInput.val());
var agentAlias = $layerFormAgentAliasInput.val(); var agentAlias = $layerFormAgentAliasInput.val();
var layerId = $("input#hidden-current_edit_layer_id").val(); var layerId = $('input#hidden-current_edit_layer_id').val();
if (Number.isNaN(agentId) || agentId === 0 || agentAlias.length === 0) return; if (Number.isNaN(agentId) || agentId === 0 || agentAlias.length === 0) {
return;
}
addAgentRow(layerId, agentId, agentAlias); addAgentRow(layerId, agentId, agentAlias);
// Clear agent inputs // Clear agent inputs
$layerFormAgentIdInput.val(""); $layerFormAgentIdInput.val('');
$layerFormAgentAliasInput.val(""); $layerFormAgentAliasInput.val('');
$("#button-add_agent").prop("disabled", true); $('#button-add_agent').prop('disabled', true);
} }
function toggleAddGroupBtn () {
var groupId = Number.parseInt($("select#layer_group_id").val()); function toggleAddGroupBtn()
{
var groupId = Number.parseInt($('select#layer_group_id').val());
var existGroupId = $("table#list_groups tr.groups_list_item[data-group-id='" + groupId + "']").length > 0; var existGroupId = $("table#list_groups tr.groups_list_item[data-group-id='" + groupId + "']").length > 0;
var agentId = Number.parseInt($("input#hidden-agent_id_for_data").val()); var agentId = Number.parseInt($('input#hidden-agent_id_for_data').val());
var agentAlias = $("input#text-agent_alias_for_data").val(); var agentAlias = $('input#text-agent_alias_for_data').val();
var enabled = ( var enabled = (
!existGroupId !existGroupId
@ -746,17 +744,19 @@ function toggleAddGroupBtn () {
&& agentAlias.length > 0 && agentAlias.length > 0
); );
$("#button-add_group").prop("disabled", !enabled); $('#button-add_group').prop('disabled', !enabled);
} }
function addGroupClick (event) {
var $layerFormGroupIdInput = $("select#layer_group_id");
var $layerFormAgentIdInput = $("input#hidden-agent_id_for_data");
var $layerFormAgentAliasInput = $("input#text-agent_alias_for_data");
var layerId = $("input#hidden-current_edit_layer_id").val(); function addGroupClick(event)
{
var $layerFormGroupIdInput = $('select#layer_group_id');
var $layerFormAgentIdInput = $('input#hidden-agent_id_for_data');
var $layerFormAgentAliasInput = $('input#text-agent_alias_for_data');
var layerId = $('input#hidden-current_edit_layer_id').val();
var groupId = Number.parseInt($layerFormGroupIdInput.val()); var groupId = Number.parseInt($layerFormGroupIdInput.val());
var groupName = $layerFormGroupIdInput.find(":selected").text(); var groupName = $layerFormGroupIdInput.find(':selected').text();
var agentId = Number.parseInt($layerFormAgentIdInput.val()); var agentId = Number.parseInt($layerFormAgentIdInput.val());
var agentAlias = $layerFormAgentAliasInput.val(); var agentAlias = $layerFormAgentAliasInput.val();
@ -769,46 +769,61 @@ function addGroupClick (event) {
&& agentAlias.length > 0 && agentAlias.length > 0
); );
if (!valid) return; if (!valid) {
return;
}
addGroupRow(layerId, groupId, groupName, agentId, agentAlias); addGroupRow(layerId, groupId, groupName, agentId, agentAlias);
// Clear inputs // Clear inputs
// $layerFormGroupIdInput.val(0); // $layerFormGroupIdInput.val(0);
$layerFormAgentIdInput.val(""); $layerFormAgentIdInput.val('');
$layerFormAgentAliasInput.val(""); $layerFormAgentAliasInput.val('');
$("#button-add_group").prop("disabled", true); $('#button-add_group').prop('disabled', true);
} }
function moveLayerRowUpOnClick (event) {
function moveLayerRowUpOnClick(event)
{
var $row = $(event.currentTarget).parent().parent(); var $row = $(event.currentTarget).parent().parent();
$row.insertBefore($row.prev()); $row.insertBefore($row.prev());
} }
function moveLayerRowDownOnClick (event) {
function moveLayerRowDownOnClick(event)
{
var $row = $(event.currentTarget).parent().parent(); var $row = $(event.currentTarget).parent().parent();
$row.insertAfter($row.next()); $row.insertAfter($row.next());
} }
function removeLayerRowOnClick (event) {
function removeLayerRowOnClick(event)
{
var $layerRow = $(event.currentTarget).parent().parent(); var $layerRow = $(event.currentTarget).parent().parent();
var layerRowId = $layerRow.find("input.layer_id").val(); var layerRowId = $layerRow.find('input.layer_id').val();
var layerEditorId = $("input#hidden-current_edit_layer_id").val(); var layerEditorId = $('input#hidden-current_edit_layer_id').val();
if (layerRowId == layerEditorId) hideLayerEditor(); if (layerRowId == layerEditorId) {
hideLayerEditor();
}
// Remove row // Remove row
$(event.currentTarget).parent().parent().remove(); $(event.currentTarget).parent().parent().remove();
} }
function hideLayerEditor () {
function hideLayerEditor()
{
// Clean editor // Clean editor
cleanLayerEditor(); cleanLayerEditor();
// Hide editor // Hide editor
$("div#form_layer").hide(); $('div#form_layer').hide();
} }
function showLayerEditor (layerId) {
var $layerSaveBtn = $("input#button-save_layer"); function showLayerEditor(layerId)
{
var $layerSaveBtn = $('input#button-save_layer');
// Clean editor // Clean editor
cleanLayerEditor(); cleanLayerEditor();
@ -832,33 +847,39 @@ function showLayerEditor (layerId) {
} }
// Show editor (if hidden) // Show editor (if hidden)
$("div#form_layer").show(); $('div#form_layer').show();
} }
function getLayerData (layerId) {
var $layerRow = $("tr#layer_row_" + layerId); function getLayerData(layerId)
var layerName = $layerRow.find("input.layer_name").val(); {
var layerVisible = $layerRow.find("input.layer_visible").val() == 1; var $layerRow = $('tr#layer_row_' + layerId);
var layerAgentsFromGroup = $layerRow.find("input.layer_agents_from_group").val(); var layerName = $layerRow.find('input.layer_name').val();
var layerAgents = $layerRow.find("input.layer_agent_alias").map(function () { var layerVisible = $layerRow.find('input.layer_visible').val() == 1;
var layerAgentsFromGroup = $layerRow.find('input.layer_agents_from_group').val();
var layerAgents = $layerRow.find('input.layer_agent_alias').map(
function () {
return { return {
"id": $(this).data("agent-id"), 'id': $(this).data('agent-id'),
"alias": $(this).val() 'alias': $(this).val()
}; };
}).get(); }
var layerGroups = $layerRow.find("input.layer_group_id").map(function () { ).get();
var layerGroups = $layerRow.find('input.layer_group_id').map(
function () {
var groupId = $(this).val(); var groupId = $(this).val();
var groupName = $(this).siblings("input.layer_group_name[data-group-id='" + groupId + "']").val(); var groupName = $(this).siblings(("input.layer_group_name[data-group-id='" + groupId + "']")).val();
var agentId = $(this).siblings("input.layer_agent_id_for_data[data-group-id='" + groupId + "']").val(); var agentId = $(this).siblings(("input.layer_agent_id_for_data[data-group-id='" + groupId + "']")).val();
var agentAlias = $(this).siblings("input.layer_agent_alias_for_data[data-group-id='" + groupId + "']").val(); var agentAlias = $(this).siblings(("input.layer_agent_alias_for_data[data-group-id='" + groupId + "']")).val();
return { return {
"id": groupId, 'id': groupId,
"name": groupName, 'name': groupName,
"agentId": agentId, 'agentId': agentId,
"agentAlias": agentAlias 'agentAlias': agentAlias
}; };
}).get(); }
).get();
return { return {
id: layerId, id: layerId,
@ -870,142 +891,185 @@ function getLayerData (layerId) {
} }
} }
function setLayerEditorData (data) {
if (data == null) data = {}; function setLayerEditorData(data)
{
if (data == null) {
data = {};
}
// Set defaults // Set defaults
data = { data = {
id: data.id || 0, id: data.id || 0,
name: data.name || "", name: data.name || '',
visible: data.visible != null ? !!data.visible : true, visible: data.visible != null ? !!data.visible : true,
agentsFromGroup: data.agentsFromGroup || -1, agentsFromGroup: data.agentsFromGroup || -1,
agents: data.agents || [], agents: data.agents || [],
groups: data.groups || [] groups: data.groups || []
} }
var $layerFormIdInput = $("input#hidden-current_edit_layer_id"); var $layerFormIdInput = $('input#hidden-current_edit_layer_id');
var $layerFormNameInput = $("input#text-layer_name_form"); var $layerFormNameInput = $('input#text-layer_name_form');
var $layerFormVisibleCheckbox = $("input#checkbox-layer_visible_form"); var $layerFormVisibleCheckbox = $('input#checkbox-layer_visible_form');
var $layerFormAgentsFromGroupSelect = $("#layer_group_form"); var $layerFormAgentsFromGroupSelect = $('#layer_group_form');
var $layerFormAgentInput = $("input#text-agent_alias"); var $layerFormAgentInput = $('input#text-agent_alias');
var $layerFormAgentButton = $("input#button-add_agent"); var $layerFormAgentButton = $('input#button-add_agent');
var $layerFormAgentsListItems = $("tr.agents_list_item"); var $layerFormAgentsListItems = $('tr.agents_list_item');
var $layerFormGroupsListItems = $("tr.groups_list_item"); var $layerFormGroupsListItems = $('tr.groups_list_item');
$layerFormIdInput.val(data.id); $layerFormIdInput.val(data.id);
$layerFormNameInput.val(data.name); $layerFormNameInput.val(data.name);
$layerFormVisibleCheckbox.prop("checked", data.visible); $layerFormVisibleCheckbox.prop('checked', data.visible);
$(`#layer_group_form option[value=${data.agentsFromGroup}]`).attr('selected', 'selected'); $(`#layer_group_form option[value=${data.agentsFromGroup
}]`).attr('selected', 'selected');
$(`#layer_group_form`).trigger('change'); $(`#layer_group_form`).trigger('change');
$layerFormAgentInput.val(""); $layerFormAgentInput.val('');
$layerFormAgentButton.prop("disabled", true); $layerFormAgentButton.prop('disabled', true);
$layerFormAgentsListItems.remove(); $layerFormAgentsListItems.remove();
$layerFormGroupsListItems.remove(); $layerFormGroupsListItems.remove();
var $tableAgents = $("table#list_agents"); var $tableAgents = $('table#list_agents');
data.agents.forEach(function (agent) { data.agents.foreach (function (agent) {
addAgentRow(data.id, agent.id, agent.alias); addAgentRow(data.id, agent.id, agent.alias);
}); }) {
var $tableGroups = $("table#list_groups");
data.groups.forEach(function (group) {
addGroupRow(data.id, group.id, group.name, group.agentId, group.agentAlias);
});
} }
function newLayer () { var $tableGroups = $('table#list_groups');
data.groups.foreach (function (group) {
addGroupRow(data.id, group.id, group.name, group.agentId, group.agentAlias);
}) {
}
}
function newLayer()
{
showLayerEditor(null); showLayerEditor(null);
} }
function saveNewLayer () {
var $layerFormNameInput = $("input#text-layer_name_form");
var $layerFormVisibleCheckbox = $("input#checkbox-layer_visible_form");
var $layerFormAgentsFromGroupSelect = $("select#layer_group_form");
var $layerFormAgentsListItems = $("tr.agents_list_item > td > span.agent_alias");
var $layerFormGroupsListItems = $("tr.groups_list_item");
var newLayerId = "new_" + ($("tr.layer_row").length + 1);
addLayerRow(newLayerId, { function saveNewLayer()
{
var $layerFormNameInput = $('input#text-layer_name_form');
var $layerFormVisibleCheckbox = $('input#checkbox-layer_visible_form');
var $layerFormAgentsFromGroupSelect = $('select#layer_group_form');
var $layerFormAgentsListItems = $('tr.agents_list_item > td > span.agent_alias');
var $layerFormGroupsListItems = $('tr.groups_list_item');
var newLayerId = ('new_' + ($('tr.layer_row').length + 1));
addLayerRow(
newLayerId,
{
id: newLayerId, id: newLayerId,
name: $layerFormNameInput.val(), name: $layerFormNameInput.val(),
visible: $layerFormVisibleCheckbox.prop("checked"), visible: $layerFormVisibleCheckbox.prop('checked'),
agentsFromGroup: $layerFormAgentsFromGroupSelect.val(), agentsFromGroup: $layerFormAgentsFromGroupSelect.val(),
agents: $layerFormAgentsListItems.map(function () { agents: $layerFormAgentsListItems.map(
function () {
return { return {
"id": $(this).data("agent-id"), 'id': $(this).data('agent-id'),
"alias": $(this).text() 'alias': $(this).text()
}; };
}).get(), }
groups: $layerFormGroupsListItems.map(function () { ).get(),
groups: $layerFormGroupsListItems.map(
function () {
return { return {
"id": $(this).data("group-id"), 'id': $(this).data('group-id'),
"name": $(this).data("group-name"), 'name': $(this).data('group-name'),
"agentId": $(this).data("agent-id"), 'agentId': $(this).data('agent-id'),
"agentAlias": $(this).data("agent-alias") 'agentAlias': $(this).data('agent-alias')
}; };
}).get() }
}); ).get()
}
);
} }
function cleanLayerEditor () {
function cleanLayerEditor()
{
// Clear editor events // Clear editor events
unbindLayerEditorEvents(); unbindLayerEditorEvents();
// Add default data to the editor // Add default data to the editor
setLayerEditorData(); setLayerEditorData();
} }
function bindLayerEditorEvents (layerId) {
var $layerFormNameInput = $("input#text-layer_name_form");
var $layerFormVisibleCheckbox = $("input#checkbox-layer_visible_form");
var $layerFormAgentsFromGroupSelect = $("select#layer_group_form");
var $layerRow = $("tr#layer_row_" + layerId); function bindLayerEditorEvents(layerId)
{
var $layerFormNameInput = $('input#text-layer_name_form');
var $layerFormVisibleCheckbox = $('input#checkbox-layer_visible_form');
var $layerFormAgentsFromGroupSelect = $('select#layer_group_form');
if ($layerRow.length === 0) return; var $layerRow = $('tr#layer_row_' + layerId);
$layerFormNameInput.bind("change", function (event) { if ($layerRow.length === 0) {
var name = event.currentTarget.value; return;
$layerRow.find("span.layer_name").html(name);
$layerRow.find("input.layer_name").val(name);
});
$layerFormVisibleCheckbox.bind("click", function (event) {
var visible = $(event.currentTarget).prop("checked");
$layerRow.find("input.layer_visible").val(visible ? 1 : 0);
});
$layerFormAgentsFromGroupSelect.bind("change", function (event) {
var group = event.currentTarget.value;
$layerRow.find("input.layer_agents_from_group").val(group);
});
} }
function unbindLayerEditorEvents () { $layerFormNameInput.bind(
var $layerFormNameInput = $("input#text-layer_name_form"); 'change',
var $layerFormVisibleCheckbox = $("input#checkbox-layer_visible_form"); function (event) {
var $layerFormAgentsFromGroupSelect = $("select#layer_group_form"); var name = event.currentTarget.value;
$layerRow.find('span.layer_name').html(name);
$layerRow.find('input.layer_name').val(name);
}
);
$layerFormVisibleCheckbox.bind(
'click',
function (event) {
var visible = $(event.currentTarget).prop('checked');
$layerRow.find('input.layer_visible').val(visible ? 1 : 0);
}
);
$layerFormAgentsFromGroupSelect.bind(
'change',
function (event) {
var group = event.currentTarget.value;
$layerRow.find('input.layer_agents_from_group').val(group);
}
);
}
$layerFormNameInput.unbind("change");
$layerFormVisibleCheckbox.unbind("click"); function unbindLayerEditorEvents()
{
var $layerFormNameInput = $('input#text-layer_name_form');
var $layerFormVisibleCheckbox = $('input#checkbox-layer_visible_form');
var $layerFormAgentsFromGroupSelect = $('select#layer_group_form');
$layerFormNameInput.unbind('change');
$layerFormVisibleCheckbox.unbind('click');
$layerFormAgentsFromGroupSelect.val('-1'); $layerFormAgentsFromGroupSelect.val('-1');
} }
function getAgentRow (layerId, agentId, agentAlias) {
var $row = $("<tr class=\"agents_list_item\" />");
var $nameCol = $("<td />");
var $deleteCol = $("<td />");
var $agentAlias = $("<span class=\"agent_alias\" data-agent-id=\"" + agentId + "\">" + agentAlias + "</span>"); function getAgentRow(layerId, agentId, agentAlias)
{
var $row = $('<tr class="agents_list_item" />');
var $nameCol = $('<td />');
var $deleteCol = $('<td />');
var $agentAlias = $('<span class="agent_alias" data-agent-id="' + agentId + '">' + agentAlias + '</span>');
var $removeBtn = $('<a class="delete_row" href="javascript:" <?php echo html_print_image('images / cross.png', false, ['class' => 'invert_filter']); ?> </a>'); var $removeBtn = $('<a class="delete_row" href="javascript:" <?php echo html_print_image('images / cross.png', false, ['class' => 'invert_filter']); ?> </a>');
$removeBtn.click(function (event) { $removeBtn.click(
var $layerRow = $("tr#layer_row_" + layerId); function (event) {
var $layerRow = $('tr#layer_row_' + layerId);
if ($layerRow.length > 0) { if ($layerRow.length > 0) {
$layerRow.find("input.layer_agent_id[data-agent-id='" + agentId + "']").remove(); $layerRow.find(("input.layer_agent_id[data-agent-id='" + agentId + "']")).remove();
$layerRow.find("input.layer_agent_alias[data-agent-id='" + agentId + "']").remove(); $layerRow.find(("input.layer_agent_alias[data-agent-id='" + agentId + "']")).remove();
} }
var $agentListItemRow = $(event.currentTarget).parent().parent(); var $agentListItemRow = $(event.currentTarget).parent().parent();
$agentListItemRow.remove(); $agentListItemRow.remove();
}); }
);
$nameCol.append($agentAlias); $nameCol.append($agentAlias);
$deleteCol.append($removeBtn); $deleteCol.append($removeBtn);
@ -1015,55 +1079,64 @@ function getAgentRow (layerId, agentId, agentAlias) {
return $row; return $row;
} }
function addAgentRow (layerId, agentId, agentAlias) {
if (agentId == null || agentId == 0 || agentAlias.length === 0) return;
var $layerRow = $("tr#layer_row_" + layerId); function addAgentRow(layerId, agentId, agentAlias)
if ($layerRow && $layerRow.find("input.layer_agent_id[value='" + agentId + "']").length === 0) { {
$layerRow if (agentId == null || agentId == 0 || agentAlias.length === 0) {
.find("td:first-child") return;
.append(getLayerAgentIdInput(layerId, agentId))
.append(getLayerAgentAliasInput(layerId, agentId, agentAlias));
} }
$("table#list_agents").append(getAgentRow(layerId, agentId, agentAlias)); var $layerRow = $('tr#layer_row_' + layerId);
if ($layerRow && $layerRow.find(("input.layer_agent_id[value='" + agentId + "']")).length === 0) {
$layerRow.find('td:first-child').append(getLayerAgentIdInput(layerId, agentId)).append(getLayerAgentAliasInput(layerId, agentId, agentAlias));
} }
function getLayerAgentIdInput (layerId, agentId) { $('table#list_agents').append(getAgentRow(layerId, agentId, agentAlias));
return $("<input class=\"layer_agent_id\" type=\"hidden\" data-agent-id=\"" + agentId + "\" name=\"layers[" + layerId + "][agents][" + agentId + "][id]\" value=\"" + agentId + "\">");
} }
function getLayerAgentAliasInput (layerId, agentId, agentAlias) {
return $("<input class=\"layer_agent_alias\" type=\"hidden\" data-agent-id=\"" + agentId + "\" name=\"layers[" + layerId + "][agents][" + agentId + "][alias]\" value=\"" + agentAlias + "\">"); function getLayerAgentIdInput(layerId, agentId)
{
return $('<input class="layer_agent_id" type="hidden" data-agent-id="' + agentId + '" name="layers[' + layerId + '][agents][' + agentId + '][id]" value="' + agentId + '">');
} }
function getGroupRow (layerId, groupId, groupName, agentId, agentAlias) {
var $row = $("<tr class=\"groups_list_item\" data-group-id=\"" + groupId + "\" data-group-name=\"" + groupName + "\" data-agent-id=\"" + agentId + "\" data-agent-alias=\"" + agentAlias + "\" />");
var $nameCol = $("<td />");
var $deleteCol = $("<td />");
var $groupName = $("<span class=\"group_desc\">" function getLayerAgentAliasInput(layerId, agentId, agentAlias)
{
return $('<input class="layer_agent_alias" type="hidden" data-agent-id="' + agentId + '" name="layers[' + layerId + '][agents][' + agentId + '][alias]" value="' + agentAlias + '">');
}
function getGroupRow(layerId, groupId, groupName, agentId, agentAlias)
{
var $row = $('<tr class="groups_list_item" data-group-id="' + groupId + '" data-group-name="' + groupName + '" data-agent-id="' + agentId + '" data-agent-alias="' + agentAlias + '" />');
var $nameCol = $('<td />');
var $deleteCol = $('<td />');
var $groupName = $('<span class="group_desc">'
+ groupName + groupName
+ " (" + ' ('
+ "<?php echo __('Using data from'); ?> " + "<?php echo __('Using data from'); ?> "
+ "<i>" + agentAlias + "</i>" + '<i>' + agentAlias + '</i>'
+ ")" + ')'
+ "</span>"); + '</span>');
var $removeBtn = $('<a class="delete_row" href="javascript:;"><?php echo html_print_image('images / cross.png', true, ['class' => 'invert_filter']); ?></a>'); var $removeBtn = $('<a class="delete_row" href="javascript:;"><?php echo html_print_image('images / cross.png', true, ['class' => 'invert_filter']); ?></a>');
$removeBtn.click(function (event) { $removeBtn.click(
var $layerRow = $("tr#layer_row_" + layerId); function (event) {
var $layerRow = $('tr#layer_row_' + layerId);
if ($layerRow.length > 0) { if ($layerRow.length > 0) {
$layerRow.find("input.layer_group_id[data-group-id='" + groupId + "']").remove(); $layerRow.find(("input.layer_group_id[data-group-id='" + groupId + "']")).remove();
$layerRow.find("input.layer_group_name[data-group-id='" + groupId + "']").remove(); $layerRow.find(("input.layer_group_name[data-group-id='" + groupId + "']")).remove();
$layerRow.find("input.layer_agent_id_for_data[data-group-id='" + groupId + "']").remove(); $layerRow.find(("input.layer_agent_id_for_data[data-group-id='" + groupId + "']")).remove();
$layerRow.find("input.layer_agent_alias_for_data[data-group-id='" + groupId + "']").remove(); $layerRow.find(("input.layer_agent_alias_for_data[data-group-id='" + groupId + "']")).remove();
} }
var $groupListItemRow = $(event.currentTarget).parent().parent(); var $groupListItemRow = $(event.currentTarget).parent().parent();
$groupListItemRow.remove(); $groupListItemRow.remove();
}); }
);
$nameCol.append($groupName); $nameCol.append($groupName);
$deleteCol.append($removeBtn); $deleteCol.append($removeBtn);
@ -1073,132 +1146,144 @@ function getGroupRow (layerId, groupId, groupName, agentId, agentAlias) {
return $row; return $row;
} }
function addGroupRow (layerId, groupId, groupName, agentId, agentAlias) {
if (
groupId == null ||
groupId == 0 ||
groupName.length === 0 ||
agentId == null ||
agentId == 0 ||
agentAlias.length === 0
) return;
var $layerRow = $("tr#layer_row_" + layerId); function addGroupRow(layerId, groupId, groupName, agentId, agentAlias)
if ($layerRow && $layerRow.find("input.layer_group_id[value='" + groupId + "']").length === 0) { {
$layerRow if (groupId == null
.find("td:first-child") || groupId == 0
.append(getLayerGroupIdInput(layerId, groupId)) || groupName.length === 0
.append(getLayerGroupNameInput(layerId, groupId, groupName)) || agentId == null
.append(getLayerAgentIdForDataInput(layerId, groupId, agentId)) || agentId == 0
.append(getLayerAgentAliasForDataInput(layerId, groupId, agentAlias)); || agentAlias.length === 0
) {
return;
} }
$("table#list_groups").append(getGroupRow(layerId, groupId, groupName, agentId, agentAlias)); var $layerRow = $('tr#layer_row_' + layerId);
if ($layerRow && $layerRow.find(("input.layer_group_id[value='" + groupId + "']")).length === 0) {
$layerRow.find('td:first-child').append(getLayerGroupIdInput(layerId, groupId)).append(getLayerGroupNameInput(layerId, groupId, groupName)).append(getLayerAgentIdForDataInput(layerId, groupId, agentId)).append(getLayerAgentAliasForDataInput(layerId, groupId, agentAlias));
} }
function getLayerGroupIdInput (layerId, groupId) { $('table#list_groups').append(getGroupRow(layerId, groupId, groupName, agentId, agentAlias));
return $("<input class=\"layer_group_id\" type=\"hidden\" data-group-id=\"" + groupId + "\" name=\"layers[" + layerId + "][groups][" + groupId + "][id]\" value=\"" + groupId + "\">");
} }
function getLayerGroupNameInput (layerId, groupId, groupName) {
return $("<input class=\"layer_group_name\" type=\"hidden\" data-group-id=\"" + groupId + "\" name=\"layers[" + layerId + "][groups][" + groupId + "][name]\" value=\"" + groupName + "\">"); function getLayerGroupIdInput(layerId, groupId)
{
return $('<input class="layer_group_id" type="hidden" data-group-id="' + groupId + '" name="layers[' + layerId + '][groups][' + groupId + '][id]" value="' + groupId + '">');
} }
function getLayerAgentIdForDataInput (layerId, groupId, agentId) {
return $("<input class=\"layer_agent_id_for_data\" type=\"hidden\" data-group-id=\"" + groupId + "\" name=\"layers[" + layerId + "][groups][" + groupId + "][agent_id]\" value=\"" + agentId + "\">"); function getLayerGroupNameInput(layerId, groupId, groupName)
{
return $('<input class="layer_group_name" type="hidden" data-group-id="' + groupId + '" name="layers[' + layerId + '][groups][' + groupId + '][name]" value="' + groupName + '">');
} }
function getLayerAgentAliasForDataInput (layerId, groupId, agentAlias) {
return $("<input class=\"layer_agent_alias_for_data\" type=\"hidden\" data-group-id=\"" + groupId + "\" name=\"layers[" + layerId + "][groups][" + groupId + "][agent_alias]\" value=\"" + agentAlias + "\">"); function getLayerAgentIdForDataInput(layerId, groupId, agentId)
{
return $('<input class="layer_agent_id_for_data" type="hidden" data-group-id="' + groupId + '" name="layers[' + layerId + '][groups][' + groupId + '][agent_id]" value="' + agentId + '">');
} }
function getLayerRow (layerId, layerData) {
var $row = $("<tr id=\"layer_row_" + layerId + "\" class=\"layer_row\" />");
var $nameCol = $("<td />");
var $sortCol = $("<td />");
var $editCol = $("<td />");
var $deleteCol = $("<td />");
var $layerIdInput = $("<input class=\"layer_id\" type=\"hidden\" name=\"layer_ids[]\" value=\"" + layerId + "\">"); function getLayerAgentAliasForDataInput(layerId, groupId, agentAlias)
var $layerNameInput = $("<input class=\"layer_name\" type=\"hidden\" name=\"layers[" + layerId + "][name]\" value=\"" + layerData.name + "\">"); {
var $layerVisibleInput = $("<input class=\"layer_visible\" type=\"hidden\" name=\"layers[" + layerId + "][visible]\" value=\"" + (layerData.visible ? 1 : 0) + "\">"); return $('<input class="layer_agent_alias_for_data" type="hidden" data-group-id="' + groupId + '" name="layers[' + layerId + '][groups][' + groupId + '][agent_alias]" value="' + agentAlias + '">');
var $layerAgentsFromGroupInput = $("<input class=\"layer_agents_from_group\" type=\"hidden\" name=\"layers[" + layerId + "][agents_from_group]\" value=\"" + layerData.agentsFromGroup + "\">"); }
var $layerName = $("<span class=\"layer_name\">" + layerData.name + "</span>");
var $sortUpBtn = $("<a class=\"up_arrow\" href=\"javascript:;\" />"); function getLayerRow(layerId, layerData)
var $sortDownBtn = $("<a class=\"down_arrow\" href=\"javascript:;\" />"); {
var $row = $('<tr id="layer_row_' + layerId + '" class="layer_row" />');
var $nameCol = $('<td />');
var $sortCol = $('<td />');
var $editCol = $('<td />');
var $deleteCol = $('<td />');
var $layerIdInput = $('<input class="layer_id" type="hidden" name="layer_ids[]" value="' + layerId + '">');
var $layerNameInput = $('<input class="layer_name" type="hidden" name="layers[' + layerId + '][name]" value="' + layerData.name + '">');
var $layerVisibleInput = $('<input class="layer_visible" type="hidden" name="layers[' + layerId + '][visible]" value="' + (layerData.visible ? 1 : 0) + '">');
var $layerAgentsFromGroupInput = $('<input class="layer_agents_from_group" type="hidden" name="layers[' + layerId + '][agents_from_group]" value="' + layerData.agentsFromGroup + '">');
var $layerName = $('<span class="layer_name">' + layerData.name + '</span>');
var $sortUpBtn = $('<a class="up_arrow" href="javascript:;" />');
var $sortDownBtn = $('<a class="down_arrow" href="javascript:;" />');
var $editBtn = $('<a class="edit_layer" href="javascript:;"><?php echo html_print_image('images / config.png', true, ['class' => 'invert_filter']); ?></a>'); var $editBtn = $('<a class="edit_layer" href="javascript:;"><?php echo html_print_image('images / config.png', true, ['class' => 'invert_filter']); ?></a>');
var $removeBtn = $('<a class="delete_row" href="javascript:;"><?php echo html_print_image('images / cross.png', true, ['class' => 'invert_filter']); ?></a>'); var $removeBtn = $('<a class="delete_row" href="javascript:;"><?php echo html_print_image('images / cross.png', true, ['class' => 'invert_filter']); ?></a>');
$sortUpBtn.click(moveLayerRowUpOnClick); $sortUpBtn.click(moveLayerRowUpOnClick);
$sortDownBtn.click(moveLayerRowDownOnClick); $sortDownBtn.click(moveLayerRowDownOnClick);
$editBtn.click(function () { showLayerEditor(layerId); }); $editBtn.click(
function () {
showLayerEditor(layerId);
}
);
$removeBtn.click(removeLayerRowOnClick); $removeBtn.click(removeLayerRowOnClick);
$nameCol $nameCol.append($layerName).append($layerIdInput).append($layerNameInput).append($layerVisibleInput).append($layerAgentsFromGroupInput);
.append($layerName)
.append($layerIdInput)
.append($layerNameInput)
.append($layerVisibleInput)
.append($layerAgentsFromGroupInput);
if (layerData.agents && layerData.agents.length > 0) { if (layerData.agents && layerData.agents.length > 0) {
layerData.agents.forEach(function (agent) { layerData.agents.foreach (function (agent) {
$nameCol.append(getLayerAgentIdInput(layerId, agent.id)); $nameCol.append(getLayerAgentIdInput(layerId, agent.id));
$nameCol.append(getLayerAgentAliasInput(layerId, agent.id, agent.alias)); $nameCol.append(getLayerAgentAliasInput(layerId, agent.id, agent.alias));
}); }) {
}
} }
if (layerData.groups && layerData.groups.length > 0) { if (layerData.groups && layerData.groups.length > 0) {
layerData.groups.forEach(function (group) { layerData.groups.foreach (function (group) {
$nameCol.append(getLayerGroupIdInput(layerId, group.id)); $nameCol.append(getLayerGroupIdInput(layerId, group.id));
$nameCol.append(getLayerGroupNameInput(layerId, group.id, group.name)); $nameCol.append(getLayerGroupNameInput(layerId, group.id, group.name));
$nameCol.append(getLayerAgentIdForDataInput(layerId, group.id, group.agentId)); $nameCol.append(getLayerAgentIdForDataInput(layerId, group.id, group.agentId));
$nameCol.append(getLayerAgentAliasForDataInput(layerId, group.id, group.agentAlias)); $nameCol.append(getLayerAgentAliasForDataInput(layerId, group.id, group.agentAlias));
}); }) {
}
} }
$sortCol $sortCol.append($sortUpBtn).append($sortDownBtn);
.append($sortUpBtn) $editCol.append($editBtn);
.append($sortDownBtn); $deleteCol.append($removeBtn);
$editCol
.append($editBtn);
$deleteCol
.append($removeBtn);
$row $row.append($nameCol).append($sortCol).append($editCol).append($deleteCol);
.append($nameCol)
.append($sortCol)
.append($editCol)
.append($deleteCol);
return $row; return $row;
} }
function addLayerRow (layerId, layerData) {
$("table#list_layers").append(getLayerRow(layerId, layerData)); function addLayerRow(layerId, layerData)
{
$('table#list_layers').append(getLayerRow(layerId, layerData));
showLayerEditor(layerId); showLayerEditor(layerId);
} }
function hightlightRow (layerId) {
var highlightColor = "#E9F3D2"; function hightlightRow(layerId)
$("tr.layer_row").css("background", ""); {
$("tr#layer_row_" + layerId).css("background", highlightColor); var highlightColor = '#E9F3D2';
$('tr.layer_row').css('background', '');
$('tr#layer_row_' + layerId).css('background', highlightColor);
} }
function existInvalidLayerNames () {
function existInvalidLayerNames()
{
var exist = false; var exist = false;
$("table#list_layers input.layer_name").each(function () { $('table#list_layers input.layer_name').each(
function () {
if ($(this).val().trim().length === 0) { if ($(this).val().trim().length === 0) {
exist = true; exist = true;
return false; // Break jQuery object each return false;
// Break jQuery object each
} }
}); }
);
return exist; return exist;
} }
function onFormSubmit (event) {
function onFormSubmit(event)
{
// Validate layer names // Validate layer names
if (existInvalidLayerNames()) { if (existInvalidLayerNames()) {
event.preventDefault(); event.preventDefault();
@ -1206,25 +1291,31 @@ function onFormSubmit (event) {
alert("<?php echo __('Empty layer names are not supported'); ?>"); alert("<?php echo __('Empty layer names are not supported'); ?>");
return false; return false;
} }
// Save connection list // Save connection list
$('#map_connection_list').val(connectionMaps.toString()); $('#map_connection_list').val(connectionMaps.toString());
} }
function onLayerGroupIdChange (event) {
function onLayerGroupIdChange(event)
{
// Clear agent inputs // Clear agent inputs
$("input#hidden-agent_id_for_data").val(0); $('input#hidden-agent_id_for_data').val(0);
$("input#text-agent_alias_for_data").val(""); $('input#text-agent_alias_for_data').val('');
toggleAddGroupBtn(); toggleAddGroupBtn();
} }
// Bind events // Bind events
$("form#form_setup").submit(onFormSubmit); $('form#form_setup').submit(onFormSubmit);
$("input#button-add_agent").click(addAgentClick); $('input#button-add_agent').click(addAgentClick);
$("select#layer_group_id").change(onLayerGroupIdChange); $('select#layer_group_id').change(onLayerGroupIdChange);
$("input#button-add_group").click(addGroupClick); $('input#button-add_group').click(addGroupClick);
// Populate layer list // Populate layer list
var layers = <?php echo json_encode($layer_list); ?>; var layers = < ? php echo json_encode($layer_list);
?>
;
layers.forEach(function (layer) { layers.forEach(function (layer) {
$("table#list_layers").append( $("table#list_layers").append(
getLayerRow(layer["id"], { getLayerRow(layer["id"], {

View File

@ -406,6 +406,7 @@ if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, '
$sub['extensions/dbmanager']['text'] = __('DB Interface'); $sub['extensions/dbmanager']['text'] = __('DB Interface');
$sub['extensions/dbmanager']['id'] = 'DB Interface'; $sub['extensions/dbmanager']['id'] = 'DB Interface';
$sub['extensions/dbmanager']['sec'] = 'gbman'; $sub['extensions/dbmanager']['sec'] = 'gbman';
enterprise_hook('dbBackupManager');
enterprise_hook('elasticsearch_interface_menu'); enterprise_hook('elasticsearch_interface_menu');
} }
} }

View File

@ -3914,7 +3914,7 @@ function print_SLA_list($width, $action, $idItem=null)
<input id="hidden-id_server" name="id_server" value="" type="hidden"> <input id="hidden-id_server" name="id_server" value="" type="hidden">
<?php <?php
// Set autocomplete image. // Set autocomplete image.
$autocompleteImage = html_print_image(($config['style'] === 'pandora_black') ? 'images/agent_mc.menu.png' : 'images/search_agent.png', true, false, true); $autocompleteImage = html_print_image(($config['style'] === 'pandora_black' && !is_metaconsole()) ? 'images/agent_mc.menu.png' : 'images/search_agent.png', true, false, true);
// Params for agent autocomplete input. // Params for agent autocomplete input.
$params = []; $params = [];
$params['show_helptip'] = true; $params['show_helptip'] = true;

View File

@ -116,7 +116,7 @@ $table_remote->data['ehorus_test'] = $row;
// Print. // Print.
echo '<div class="center pdd_b_20px">'; echo '<div class="center pdd_b_20px">';
echo '<a target="_blank" rel="noopener noreferrer" href="http://ehorus.com">'; echo '<a target="_blank" rel="noopener noreferrer" href="http://ehorus.com">';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
html_print_image('include/ehorus/images/ehorus-logo.png'); html_print_image('include/ehorus/images/ehorus-logo.png');
} else { } else {
html_print_image('include/ehorus/images/ehorus-logo-grey.png'); html_print_image('include/ehorus/images/ehorus-logo-grey.png');

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

View File

@ -1189,14 +1189,25 @@ if (check_login()) {
$data[8] = ' '; $data[8] = ' ';
if ($module['history_data'] == 1) { if ($module['history_data'] == 1) {
$tresholds = true;
if (empty((float) $module['min_warning']) === true
&& empty((float) $module['max_warning']) === true
&& empty($module['warning_inverse']) === true
&& empty((float) $module['min_critical']) === true
&& empty((float) $module['max_critical']) === true
&& empty($module['critical_inverse']) === true
) {
$tresholds = false;
}
$nombre_tipo_modulo = modules_get_moduletype_name($module['id_tipo_modulo']); $nombre_tipo_modulo = modules_get_moduletype_name($module['id_tipo_modulo']);
$handle = 'stat'.$nombre_tipo_modulo.'_'.$module['id_agente_modulo']; $handle = 'stat'.$nombre_tipo_modulo.'_'.$module['id_agente_modulo'];
$url = 'include/procesos.php?agente='.$module['id_agente_modulo']; $url = 'include/procesos.php?agente='.$module['id_agente_modulo'];
$win_handle = dechex(crc32($module['id_agente_modulo'].$module['nombre'])); $win_handle = dechex(crc32($module['id_agente_modulo'].$module['nombre']));
// Try to display the SNMP module realtime graph // Try to display the SNMP module realtime graph.
$rt_button = get_module_realtime_link_graph($module); $rt_button = get_module_realtime_link_graph($module);
if (!empty($rt_button)) { if (empty($rt_button) === false) {
$data[8] = $rt_button.'&nbsp;&nbsp;'; $data[8] = $rt_button.'&nbsp;&nbsp;';
} }
@ -1207,6 +1218,19 @@ if (check_login()) {
$draw_events = 0; $draw_events = 0;
} }
if ($tresholds === true || $graph_type === 'boolean') {
$link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&amp;".'period='.SECONDS_1DAY.'&amp;id='.$module['id_agente_modulo'].'&amp;refresh='.SECONDS_10MINUTES.'&amp;'."histogram=1', 'day_".$win_handle."', 800, 480)";
$data[8] .= '<a href="javascript:'.$link.'">'.html_print_image(
'images/histograma.png',
true,
[
'border' => '0',
'alt' => '',
'class' => 'invert_filter',
]
).'</a> &nbsp;&nbsp;';
}
$link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&amp;".'period='.SECONDS_1DAY.'&amp;id='.$module['id_agente_modulo'].'&amp;refresh='.SECONDS_10MINUTES.'&amp;'."draw_events=$draw_events', 'day_".$win_handle."', 800, 480)"; $link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&amp;".'period='.SECONDS_1DAY.'&amp;id='.$module['id_agente_modulo'].'&amp;refresh='.SECONDS_10MINUTES.'&amp;'."draw_events=$draw_events', 'day_".$win_handle."', 800, 480)";
if (!is_snapshot_data($module['datos'])) { if (!is_snapshot_data($module['datos'])) {
$data[8] .= '<a href="javascript:'.$link.'">'.html_print_image( $data[8] .= '<a href="javascript:'.$link.'">'.html_print_image(
@ -1349,13 +1373,34 @@ if (check_login()) {
metaconsole_connect($server); metaconsole_connect($server);
} }
if ($params['histogram'] === true) {
$params['id_agent_module'] = $params['agent_module_id'];
$params['dinamic_proc'] = 1;
$output .= '<div class="stat_win_histogram">';
if ($params['compare'] === 'separated') {
$graph = \reporting_module_histogram_graph(
['datetime' => ($params['begin_date'] - $params['period'])],
$params
);
$output .= $graph['chart'];
}
$graph = \reporting_module_histogram_graph(
['datetime' => $params['begin_date']],
$params
);
$output .= $graph['chart'];
$output .= '</div>';
} else {
$output .= grafico_modulo_sparse($params); $output .= grafico_modulo_sparse($params);
echo $output; }
if (is_metaconsole() === true && empty($server_id) === false) { if (is_metaconsole() === true && empty($server_id) === false) {
metaconsole_restore_db(); metaconsole_restore_db();
} }
echo $output;
return; return;
} }

View File

@ -36,6 +36,7 @@ $ajax = true;
$render_map = (bool) get_parameter('render_map', false); $render_map = (bool) get_parameter('render_map', false);
$graph_javascript = (bool) get_parameter('graph_javascript', false); $graph_javascript = (bool) get_parameter('graph_javascript', false);
$force_remote_check = (bool) get_parameter('force_remote_check', false);
if ($render_map) { if ($render_map) {
$width = (int) get_parameter('width', '400'); $width = (int) get_parameter('width', '400');
@ -55,3 +56,36 @@ if ($render_map) {
); );
return; return;
} }
if ($force_remote_check) {
$id_layout = (int) get_parameter('id_layout', false);
$data = db_get_all_rows_sql(
sprintf(
'SELECT id_agent FROM tlayout_data WHERE id_layout = %d AND id_agent <> 0',
$id_layout
)
);
if (empty($data)) {
echo '0';
} else {
$ids = [];
foreach ($data as $key => $value) {
$ids[] = $value['id_agent'];
}
$sql = sprintf(
'UPDATE `tagente_modulo` SET flag = 1 WHERE `id_agente` IN (%s)',
implode(',', $ids)
);
$result = db_process_sql($sql);
if ($result) {
echo true;
} else {
echo '0';
}
}
return;
}

View File

@ -474,7 +474,7 @@ class HTML
) { ) {
global $config; global $config;
$text_color = ''; $text_color = '';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$text_color = 'style="color: white"'; $text_color = 'style="color: white"';
} }

View File

@ -671,15 +671,20 @@ class Tree
// HTML of the server type image // HTML of the server type image
$module['serverTypeHTML'] = servers_show_type($module['server_type']); $module['serverTypeHTML'] = servers_show_type($module['server_type']);
// Link to the Module graph // Link to the Module graph.
// ACL // ACL.
$acl_graphs = false; $acl_graphs = false;
$module['showGraphs'] = 0; $module['showGraphs'] = 0;
// Avoid the check on the metaconsole. Too slow to show/hide an icon depending on the permissions // Avoid the check on the metaconsole.
if (!empty($group_id) && !is_metaconsole()) { // Too slow to show/hide an icon depending on the permissions.
$acl_graphs = check_acl_one_of_groups($config['id_user'], $all_groups, 'RR'); if (empty($group_id) === false && is_metaconsole() === false) {
} else if (!empty($all_groups)) { $acl_graphs = check_acl_one_of_groups(
$config['id_user'],
$all_groups,
'RR'
);
} else if (empty($all_groups) === false) {
$acl_graphs = true; $acl_graphs = true;
} }
@ -688,8 +693,24 @@ class Tree
} }
if ($module['showGraphs']) { if ($module['showGraphs']) {
$tresholds = true;
if (empty((float) $module['min_warning']) === true
&& empty((float) $module['max_warning']) === true
&& empty($module['warning_inverse']) === true
&& empty((float) $module['min_critical']) === true
&& empty((float) $module['max_critical']) === true
&& empty($module['critical_inverse']) === true
) {
$tresholds = false;
}
$graphType = return_graphtype($module['id_module_type']); $graphType = return_graphtype($module['id_module_type']);
$url = ui_get_full_url('operation/agentes/stat_win.php', false, false, false); $url = ui_get_full_url(
'operation/agentes/stat_win.php',
false,
false,
false
);
$winHandle = dechex(crc32($module['id'].$module['name'])); $winHandle = dechex(crc32($module['id'].$module['name']));
$graph_params = [ $graph_params = [
@ -699,20 +720,20 @@ class Tree
'refresh' => SECONDS_10MINUTES, 'refresh' => SECONDS_10MINUTES,
]; ];
if (is_metaconsole()) { if (is_metaconsole() === true) {
// Set the server id // Set the server id.
$graph_params['server'] = $module['serverID']; $graph_params['server'] = $module['serverID'];
} }
$graph_params_str = http_build_query($graph_params); $graph_params_str = http_build_query($graph_params);
$moduleGraphURL = "$url?$graph_params_str"; $moduleGraphURL = $url.'?'.$graph_params_str;
$module['moduleGraph'] = [ $module['moduleGraph'] = [
'url' => $moduleGraphURL, 'url' => $moduleGraphURL,
'handle' => $winHandle, 'handle' => $winHandle,
]; ];
// Info to be able to open the snapshot image new page // Info to be able to open the snapshot image new page.
$module['snapshot'] = ui_get_snapshot_link( $module['snapshot'] = ui_get_snapshot_link(
[ [
'id_module' => ($module['id'] ?? null), 'id_module' => ($module['id'] ?? null),
@ -722,6 +743,16 @@ class Tree
], ],
true true
); );
if ($tresholds === true || $graphType === 'boolean') {
$graph_params['histogram'] = 1;
$graph_params_str_th = http_build_query($graph_params);
$moduleGraphURLTh = $url.'?'.$graph_params_str_th;
$module['histogramGraph'] = [
'url' => $moduleGraphURLTh,
'handle' => $winHandle,
];
}
} }
$module_alerts = alerts_get_alerts_agent_module($module['id']); $module_alerts = alerts_get_alerts_agent_module($module['id']);

View File

@ -430,6 +430,7 @@ class TreeService extends Tree
$tmp['searchChildren'] = 1; $tmp['searchChildren'] = 1;
} else { } else {
$tmp['searchChildren'] = 0; $tmp['searchChildren'] = 0;
$tmp['noAcl'] = 1;
} }
$tmp['showEventsBtn'] = 1; $tmp['showEventsBtn'] = 1;

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC220110'; $build_version = 'PC220125';
$pandora_version = 'v7.0NG.759'; $pandora_version = 'v7.0NG.759';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -113,6 +113,7 @@ define('SECONDS_3YEARS', 94608000);
// Separator constats. // Separator constats.
define('SEPARATOR_COLUMN', ';'); define('SEPARATOR_COLUMN', ';');
define('SEPARATOR_ROW', chr(10)); define('SEPARATOR_ROW', chr(10));
define('SEPARATOR_META_MODULE', '|-|-|-|');
// Chr(10) is \n. // Chr(10) is \n.
define('SEPARATOR_COLUMN_CSV', '#'); define('SEPARATOR_COLUMN_CSV', '#');
define('SEPARATOR_ROW_CSV', "@\n"); define('SEPARATOR_ROW_CSV', "@\n");

View File

@ -874,10 +874,10 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
* *
* @return the first value of the first row of a table result from query. * @return the first value of the first row of a table result from query.
*/ */
function mysql_db_get_value_sql($sql, $dbconnection=false) function mysql_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
{ {
$sql .= ' LIMIT 1'; $sql .= ' LIMIT 1';
$result = mysql_db_get_all_rows_sql($sql, false, true, $dbconnection); $result = mysql_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
if ($result === false) { if ($result === false) {
return false; return false;

View File

@ -977,10 +977,10 @@ function oracle_recode_query($sql, $values, $join='AND', $return=true)
* *
* @return the first value of the first row of a table result from query. * @return the first value of the first row of a table result from query.
*/ */
function oracle_db_get_value_sql($sql, $dbconnection=false) function oracle_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
{ {
$sql = 'SELECT * FROM ('.$sql.') WHERE rownum < 2'; $sql = 'SELECT * FROM ('.$sql.') WHERE rownum < 2';
$result = oracle_db_get_all_rows_sql($sql, false, true, $dbconnection); $result = oracle_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
if ($result === false) { if ($result === false) {
return false; return false;

View File

@ -686,10 +686,10 @@ function postgresql_db_format_array_where_clause_sql($values, $join='AND', $pref
* *
* @return the first value of the first row of a table result from query. * @return the first value of the first row of a table result from query.
*/ */
function postgresql_db_get_value_sql($sql, $dbconnection=false) function postgresql_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
{ {
$sql .= ' LIMIT 1'; $sql .= ' LIMIT 1';
$result = postgresql_db_get_all_rows_sql($sql, false, true, $dbconnection); $result = postgresql_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
if ($result === false) { if ($result === false) {
return false; return false;

View File

@ -4189,6 +4189,9 @@ function generator_chart_to_pdf(
) { ) {
$width_img = 650; $width_img = 650;
$height_img = ($params['height'] + 50); $height_img = ($params['height'] + 50);
} else if ($type_graph_pdf === 'hbar') {
$width_img = ($params['width'] ?? 550);
$height_img = $params['height'];
} else { } else {
$width_img = 550; $width_img = 550;
$height_img = $params['height']; $height_img = $params['height'];

View File

@ -162,10 +162,14 @@ function agents_locate_agent(string $field)
* *
* @return array|boolean Agents ids or false if error. * @return array|boolean Agents ids or false if error.
*/ */
function agents_get_agent_id_by_alias($alias) function agents_get_agent_id_by_alias($alias, $is_metaconsole=false)
{ {
if ($is_metaconsole === true) {
return db_get_all_rows_sql("SELECT id_tagente FROM tmetaconsole_agent WHERE upper(alias) LIKE upper('%$alias%')");
} else {
return db_get_all_rows_sql("SELECT id_agente FROM tagente WHERE upper(alias) LIKE upper('%$alias%')"); return db_get_all_rows_sql("SELECT id_agente FROM tagente WHERE upper(alias) LIKE upper('%$alias%')");
} }
}
/** /**
@ -906,7 +910,11 @@ function agents_process_manage_config($source_id_agent, $destiny_id_agents, $cop
[ [
'nombre' => $module['nombre'], 'nombre' => $module['nombre'],
'disabled' => false, 'disabled' => false,
] ],
true,
true,
false,
false
); );
// Keep all modules repeated // Keep all modules repeated
@ -1439,7 +1447,8 @@ function agents_get_modules(
$filter=false, $filter=false,
$indexed=true, $indexed=true,
$get_not_init_modules=true, $get_not_init_modules=true,
$force_tags=false $force_tags=false,
$filter_include_sql=true
) { ) {
global $config; global $config;
@ -1538,18 +1547,18 @@ function agents_get_modules(
} }
} }
if ($value[0] == '%') { if ($value[0] == '%' && $filter_include_sql === true) {
array_push( array_push(
$fields, $fields,
$field.' LIKE "'.$value.'"' $field.' LIKE "'.$value.'"'
); );
} else if ($operatorDistin) { } else if ($operatorDistin && $filter_include_sql === true) {
array_push($fields, $field.' <> '.substr($value, 2)); array_push($fields, $field.' <> '.substr($value, 2));
} else if (substr($value, -1) == '%') { } else if (substr($value, -1) == '%' && $filter_include_sql === true) {
array_push($fields, $field.' LIKE "'.$value.'"'); array_push($fields, $field.' LIKE "'.$value.'"');
} else if (strncmp($value, '666=666', 7) == 0) { } else if (strncmp($value, '666=666', 7) == 0) {
array_push($fields, ' '.$value); array_push($fields, ' '.$value);
} else if (preg_match('/\bin\b/i', $field)) { } else if (preg_match('/\bin\b/i', $field) && $filter_include_sql === true) {
array_push($fields, $field.' '.$value); array_push($fields, $field.' '.$value);
} else { } else {
array_push($fields, 'tagente_modulo.'.$field.' = "'.$value.'"'); array_push($fields, 'tagente_modulo.'.$field.' = "'.$value.'"');
@ -3872,7 +3881,7 @@ function agents_get_status_animation($up=true)
$red = 'images/heartbeat_green.gif'; $red = 'images/heartbeat_green.gif';
$green = 'images/heartbeat_green.gif'; $green = 'images/heartbeat_green.gif';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$red = 'images/heartbeat_green_black.gif'; $red = 'images/heartbeat_green_black.gif';
$green = 'images/heartbeat_green_black.gif'; $green = 'images/heartbeat_green_black.gif';
} }

View File

@ -2183,6 +2183,7 @@ function get_group_alerts(
// WHEN SELECT ALL TAGS TO FILTER ALERTS // WHEN SELECT ALL TAGS TO FILTER ALERTS
if ($action_filter) { if ($action_filter) {
$filter .= ' AND (talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions where id_alert_action = '.$action_filter.'))'; $filter .= ' AND (talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions where id_alert_action = '.$action_filter.'))';
$filter .= ' OR talert_template_modules.id_alert_template IN (SELECT talert_templates.id FROM talert_templates where talert_templates.id_alert_action = '.$action_filter.')';
} }
if (is_array($options)) { if (is_array($options)) {

View File

@ -9925,12 +9925,19 @@ function otherParameter2Filter($other, $return_as_array=false, $use_agent_name=f
if (isset($other['data'][2]) && $other['data'][2] != '') { if (isset($other['data'][2]) && $other['data'][2] != '') {
if ($use_agent_name === false) { if ($use_agent_name === false) {
$idAgents = agents_get_agent_id_by_alias($other['data'][2]); $idAgents = agents_get_agent_id_by_alias($other['data'][2], is_metaconsole());
if (!empty($idAgents)) { if (!empty($idAgents)) {
$idAgent = []; $idAgent = [];
$id_agent_field = 'id_agente';
if (is_metaconsole() === true) {
$id_agent_field = 'id_tagente';
}
foreach ($idAgents as $key => $value) { foreach ($idAgents as $key => $value) {
$idAgent[] .= $value['id_agente']; $idAgent[] .= $value[$id_agent_field];
} }
$filter[] = 'id_agente IN ('.implode(',', $idAgent).')'; $filter[] = 'id_agente IN ('.implode(',', $idAgent).')';
@ -9985,6 +9992,10 @@ function otherParameter2Filter($other, $return_as_array=false, $use_agent_name=f
} }
} }
if (isset($idTemplate) && $idTemplate != '') {
$filter['id_alert_template'] = $idTemplate;
}
if (isset($other['data'][5]) && $other['data'][5] != '') { if (isset($other['data'][5]) && $other['data'][5] != '') {
$filter['id_usuario'] = $other['data'][5]; $filter['id_usuario'] = $other['data'][5];
} }
@ -11434,7 +11445,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
global $config; global $config;
$table_events = 'tevento'; $table_events = 'tevento';
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
$table_events = 'tmetaconsole_event'; $table_events = 'tmetaconsole_event';
} }
@ -11451,10 +11462,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
$event_view_hr = 0; $event_view_hr = 0;
$tag = ''; $tag = '';
$group_rep = 0; $group_rep = 0;
$offset = 0;
$pagination = 40;
$utimestamp_upper = 0; $utimestamp_upper = 0;
$utimestamp_bottom = 0; $utimestamp_bottom = 0;
$id_alert_template = -1;
$use_agent_name = ($other['data'][16] === '1') ? true : false; $use_agent_name = ($other['data'][16] === '1') ? true : false;
@ -11469,7 +11479,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
} }
if (isset($filter['id_agentmodule'])) { if (isset($filter['id_agentmodule'])) {
$id_agentmodule = $filter['id_agentmodule']; $id_agentmodule = $filter['id_agentmodule'][0];
} }
if (isset($filter['id_alert_am'])) { if (isset($filter['id_alert_am'])) {
@ -11488,12 +11498,8 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
$search = $filter['evento']; $search = $filter['evento'];
} }
if (isset($filter['limit'])) { if (isset($filter['id_alert_template'])) {
$pagination = $filter['limit']; $id_alert_template = $filter['id_alert_template'];
}
if (isset($filter['offset'])) {
$offset = $filter['offset'];
} }
$id_group = (int) $filter['id_group']; $id_group = (int) $filter['id_group'];
@ -11611,10 +11617,6 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
$sql_post .= ' AND id_agentmodule = '.$id_agentmodule; $sql_post .= ' AND id_agentmodule = '.$id_agentmodule;
} }
if ($id_alert_am != -1) {
$sql_post .= ' AND id_alert_am = '.$id_alert_am;
}
if ($id_event != -1) { if ($id_event != -1) {
$sql_post .= ' AND id_evento = '.$id_event; $sql_post .= ' AND id_evento = '.$id_event;
} }
@ -11647,6 +11649,21 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
$sql_post .= ' AND ('.$filter['sql'].') '; $sql_post .= ' AND ('.$filter['sql'].') ';
} }
// Inject agent ID filter (it is set as the first numeric key in filter array).
if (isset($filter[0]) === true) {
$sql_post .= ' AND '.$filter[0];
}
if ($id_alert_template !== -1) {
$sql_post .= ' AND talert_template_modules.id_alert_template = '.$id_alert_template;
}
$alert_join = '';
if ($id_alert_template !== -1) {
$alert_join = ' INNER JOIN talert_template_modules ON '.$table_events.'.id_alert_am=talert_template_modules.id';
}
if ($group_rep == 0) { if ($group_rep == 0) {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
@ -11661,7 +11678,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
ORDER BY criticity DESC ORDER BY criticity DESC
LIMIT 1'; LIMIT 1';
} else { } else {
if (defined('METACONSOLE')) { if (is_metaconsole() === true) {
$sql = 'SELECT *, $sql = 'SELECT *,
(SELECT t2.nombre (SELECT t2.nombre
FROM tgrupo t2 FROM tgrupo t2
@ -11669,10 +11686,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
(SELECT t2.icon (SELECT t2.icon
FROM tgrupo t2 FROM tgrupo t2
WHERE t2.id_grupo = '.$table_events.'.id_grupo) AS group_icon WHERE t2.id_grupo = '.$table_events.'.id_grupo) AS group_icon
FROM '.$table_events.' FROM '.$table_events.$alert_join.'
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
ORDER BY utimestamp DESC ORDER BY utimestamp DESC';
LIMIT '.$offset.','.$pagination;
} else { } else {
$sql = 'SELECT *, $sql = 'SELECT *,
(SELECT t1.alias (SELECT t1.alias
@ -11690,10 +11706,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
SELECT tagente_modulo.id_modulo SELECT tagente_modulo.id_modulo
FROM tagente_modulo FROM tagente_modulo
WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name
FROM '.$table_events.' FROM '.$table_events.$alert_join.'
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
ORDER BY utimestamp DESC ORDER BY utimestamp DESC';
LIMIT '.$offset.','.$pagination;
} }
} }
break; break;
@ -11718,15 +11733,12 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name
FROM tevento FROM tevento
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
ORDER BY utimestamp DESC ORDER BY utimestamp DESC';
LIMIT '.$pagination.' OFFSET '.$offset;
break; break;
case 'oracle': case 'oracle':
// TODO TOTAL // TODO TOTAL
$set = []; $set = [];
$set['limit'] = $pagination;
$set['offset'] = $offset;
$sql = 'SELECT *, $sql = 'SELECT *,
(SELECT t1.alias (SELECT t1.alias
@ -11764,8 +11776,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
FROM ".$table_events.' FROM ".$table_events.'
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
GROUP BY evento, id_agentmodule GROUP BY evento, id_agentmodule
ORDER BY timestamp_rep DESC ORDER BY timestamp_rep DESC';
LIMIT '.$offset.','.$pagination;
break; break;
case 'postgresql': case 'postgresql':
@ -11776,14 +11787,11 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
FROM ".$table_events.' FROM ".$table_events.'
WHERE 1=1 '.$sql_post.' WHERE 1=1 '.$sql_post.'
GROUP BY evento, id_agentmodule GROUP BY evento, id_agentmodule
ORDER BY timestamp_rep DESC ORDER BY timestamp_rep DESC';
LIMIT '.$pagination.' OFFSET '.$offset;
break; break;
case 'oracle': case 'oracle':
$set = []; $set = [];
$set['limit'] = $pagination;
$set['offset'] = $offset;
// TODO: Remove duplicate user comments // TODO: Remove duplicate user comments
$sql = 'SELECT a.*, b.event_rep, b.timestamp_rep $sql = 'SELECT a.*, b.event_rep, b.timestamp_rep
FROM (SELECT * FROM (SELECT *
@ -11971,7 +11979,7 @@ function api_set_event($id_event, $unused1, $params, $unused2, $unused3)
* @param $returnType * @param $returnType
* @param $user_in_db * @param $user_in_db
*/ */
function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db=null) function api_get_events($node_id, $trash2, $other, $returnType, $user_in_db=null)
{ {
if ($user_in_db !== null) { if ($user_in_db !== null) {
$correct = get_events_with_user( $correct = get_events_with_user(
@ -12016,6 +12024,10 @@ function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db=null)
} }
if (is_metaconsole()) { if (is_metaconsole()) {
if ((int) $node_id !== 0) {
$filterString .= ' AND server_id = '.$node_id;
}
$dataRows = db_get_all_rows_filter('tmetaconsole_event', $filterString); $dataRows = db_get_all_rows_filter('tmetaconsole_event', $filterString);
} else { } else {
$dataRows = db_get_all_rows_filter('tevento', $filterString); $dataRows = db_get_all_rows_filter('tevento', $filterString);
@ -15159,12 +15171,24 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
} }
if ($element['type'] == 'AA') { if ($element['type'] == 'AA') {
$id_agent = db_get_value_sql('SELECT id_agent FROM tcluster WHERE id = '.$element['id_cluster']);
$module_exists_sql = sprintf(
'SELECT id_agente_modulo FROM tagente_modulo tam INNER JOIN tcluster_agent tca WHERE tam.id_agente=tca.id_agent AND tca.id_cluster=%d AND tam.nombre="%s"',
$element['id_cluster'],
io_safe_input($element['name'])
);
$module_exists = db_process_sql($module_exists_sql);
if ($module_exists === false) {
continue;
}
$tcluster_module = db_process_sql_insert('tcluster_item', ['name' => io_safe_input($element['name']), 'id_cluster' => $element['id_cluster'], 'critical_limit' => $element['critical_limit'], 'warning_limit' => $element['warning_limit']]); $tcluster_module = db_process_sql_insert('tcluster_item', ['name' => io_safe_input($element['name']), 'id_cluster' => $element['id_cluster'], 'critical_limit' => $element['critical_limit'], 'warning_limit' => $element['warning_limit']]);
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$element['id_cluster']);
$id_parent_modulo = db_process_sql( $id_parent_modulo = db_process_sql(
'select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent[0]['id_agent'].' and nombre = "'.io_safe_input('Cluster status').'"' 'select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent.' and nombre = "'.io_safe_input('Cluster status').'"'
); );
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.io_safe_input($element['name']).'" limit 1'); $get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.io_safe_input($element['name']).'" limit 1');
@ -15179,7 +15203,7 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
'nombre' => io_safe_input($element['name']), 'nombre' => io_safe_input($element['name']),
'id_modulo' => 0, 'id_modulo' => 0,
'prediction_module' => 6, 'prediction_module' => 6,
'id_agente' => $id_agent[0]['id_agent'], 'id_agente' => $id_agent,
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'], 'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
'custom_integer_1' => $element['id_cluster'], 'custom_integer_1' => $element['id_cluster'],
'custom_integer_2' => $tcluster_module, 'custom_integer_2' => $tcluster_module,
@ -15203,15 +15227,27 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
db_pandora_audit('Report management', 'Failed to assign AA item module to cluster '.$element['name']); db_pandora_audit('Report management', 'Failed to assign AA item module to cluster '.$element['name']);
} }
} else if ($element['type'] == 'AP') { } else if ($element['type'] == 'AP') {
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$element['id_cluster']); $id_agent = db_get_value_sql('SELECT id_agent FROM tcluster WHERE id = '.$element['id_cluster']);
$id_parent_modulo = db_process_sql( $module_exists_sql = sprintf(
'select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent[0]['id_agent'].' and nombre = "'.io_safe_input('Cluster status').'"' 'SELECT id_agente_modulo FROM tagente_modulo tam INNER JOIN tcluster_agent tca WHERE tam.id_agente=tca.id_agent AND tca.id_cluster=%d AND tam.nombre="%s"',
$element['id_cluster'],
io_safe_input($element['name'])
); );
$tcluster_balanced_module = db_process_sql_insert('tcluster_item', ['name' => $element['name'], 'id_cluster' => $element['id_cluster'], 'item_type' => 'AP', 'is_critical' => $element['is_critical']]); $module_exists = db_process_sql($module_exists_sql);
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.io_safe_input($element['name']).'" limit 1'); if ($module_exists === false) {
continue;
}
$id_parent_modulo = db_process_sql(
'select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent.' and nombre = "'.io_safe_input('Cluster status').'"'
);
$tcluster_balanced_module = db_process_sql_insert('tcluster_item', ['name' => io_safe_input($element['name']), 'id_cluster' => $element['id_cluster'], 'item_type' => 'AP', 'is_critical' => $element['is_critical']]);
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval,ip_target,id_module_group from tagente_modulo where nombre = "'.io_safe_input($element['name']).'" limit 1');
$get_module_type_value = $get_module_type[0]['id_tipo_modulo']; $get_module_type_value = $get_module_type[0]['id_tipo_modulo'];
$get_module_description_value = $get_module_type[0]['descripcion']; $get_module_description_value = $get_module_type[0]['descripcion'];
@ -15220,33 +15256,28 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
$get_module_interval_value = $get_module_type[0]['module_interval']; $get_module_interval_value = $get_module_type[0]['module_interval'];
$get_module_type_nombre = db_process_sql('select nombre from ttipo_modulo where id_tipo = '.$get_module_type_value); $get_module_type_nombre = db_process_sql('select nombre from ttipo_modulo where id_tipo = '.$get_module_type_value);
$get_module_type_nombre_value = $get_module_type_nombre[0]['nombre']; $get_module_type_nombre_value = $get_module_type_nombre[0]['nombre'];
$get_module_ip_target = $get_module_type[0]['ip_target'];
if (strpos($get_module_type_nombre_value, 'inc') != false) { $get_module_id_module_group = $get_module_type[0]['id_module_group'];
$get_module_type_value_normal = 4; $get_module_id_flag = $get_module_type[0]['flag'];
} else if (strpos($get_module_type_nombre_value, 'proc') != false) { $get_module_dynamic_two_tailed = $get_module_type[0]['dynamic_two_tailed'];
$get_module_type_value_normal = 2;
} else if (strpos($get_module_type_nombre_value, 'data') != false) {
$get_module_type_value_normal = 1;
} else if (strpos($get_module_type_nombre_value, 'string') != false) {
$get_module_type_value_normal = 3;
} else {
$get_module_type_value_normal = 1;
}
$values_module = [ $values_module = [
'nombre' => $element['name'], 'nombre' => $element['name'],
'id_modulo' => 5, 'id_modulo' => 0,
'prediction_module' => 7, 'prediction_module' => 7,
'id_agente' => $id_agent[0]['id_agent'], 'id_agente' => $id_agent,
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'], 'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
'custom_integer_1' => $element['id_cluster'], 'custom_integer_1' => $element['id_cluster'],
'custom_integer_2' => $tcluster_balanced_module, 'custom_integer_2' => $tcluster_balanced_module,
'id_tipo_modulo' => $get_module_type_value_normal, 'id_tipo_modulo' => 1,
'descripcion' => $get_module_description_value, 'descripcion' => $get_module_description_value,
'min_warning' => $get_module_warning_value, 'min_warning' => $get_module_warning_value,
'min_critical' => $get_module_critical_value, 'min_critical' => $get_module_critical_value,
'tcp_port' => $element['is_critical'], 'tcp_port' => $element['is_critical'],
'module_interval' => $get_module_interval_value, 'module_interval' => $get_module_interval_value,
'ip_target' => $get_module_ip_target,
'tcp_port' => 1,
'id_module_group' => $get_module_id_module_group,
]; ];
$id_module = modules_create_agent_module($values_module['id_agente'], $values_module['nombre'], $values_module, true); $id_module = modules_create_agent_module($values_module['id_agente'], $values_module['nombre'], $values_module, true);
@ -16559,7 +16590,11 @@ function api_get_user_info($thrash1, $thrash2, $other, $returnType)
$other = json_decode(base64_decode($other['data']), true); $other = json_decode(base64_decode($other['data']), true);
$sql = 'select * from tusuario where id_user = "'.$other[0]['id_user'].'" and password = "'.$other[0]['password'].'"'; $sql = sprintf(
'SELECT * FROM tusuario WHERE id_user = "%s" and password = "%s"',
mysql_escape_string_sql($other[0]['id_user']),
mysql_escape_string_sql($other[0]['password'])
);
$user_info = db_get_all_rows_sql($sql); $user_info = db_get_all_rows_sql($sql);

View File

@ -414,21 +414,21 @@ function db_get_value_filter($field, $table, $filter, $where_join='AND', $search
* *
* @return mixed the first value of the first row of a table result from query. * @return mixed the first value of the first row of a table result from query.
*/ */
function db_get_value_sql($sql, $dbconnection=false) function db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
{ {
global $config; global $config;
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
return mysql_db_get_value_sql($sql, $dbconnection); return mysql_db_get_value_sql($sql, $dbconnection, $search_history_db);
break; break;
case 'postgresql': case 'postgresql':
return postgresql_db_get_value_sql($sql, $dbconnection); return postgresql_db_get_value_sql($sql, $dbconnection, $search_history_db);
break; break;
case 'oracle': case 'oracle':
return oracle_db_get_value_sql($sql, $dbconnection); return oracle_db_get_value_sql($sql, $dbconnection, $search_history_db);
break; break;
} }

View File

@ -1157,7 +1157,7 @@ function events_get_all(
} }
if ($tags[0] === $id_tag) { if ($tags[0] === $id_tag) {
$_tmp .= ' AND ( '; $_tmp .= ' AND (( ';
} else { } else {
$_tmp .= ' OR ( '; $_tmp .= ' OR ( ';
} }
@ -1185,7 +1185,7 @@ function events_get_all(
$_tmp .= ') '; $_tmp .= ') ';
} }
$sql_filters[] = $_tmp; $sql_filters[] = $_tmp.')';
} }
} }

View File

@ -1555,7 +1555,7 @@ function graphic_combined_module(
$long_index = ''; $long_index = '';
if ($config['style'] === 'pandora_black' && ($params['pdf'] === false || $params['pdf'] === null ) if (($config['style'] === 'pandora_black' && !is_metaconsole()) && ($params['pdf'] === false || $params['pdf'] === null )
) { ) {
$background_color = '#222'; $background_color = '#222';
$params['legend_color'] = '#fff'; $params['legend_color'] = '#fff';

View File

@ -608,24 +608,15 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0)
* *
* @return integer Status of the agents. * @return integer Status of the agents.
*/ */
function groups_get_status($id_group=0, $strict_user=false) function groups_get_status($id_group=0, $ignore_alerts=false)
{ {
global $config; global $config;
include_once $config['homedir'].'/include/functions_reporting.php'; include_once $config['homedir'].'/include/functions_reporting.php';
if ($strict_user) {
$acltags = tags_get_user_groups_and_tags($config['id_user'], 'AR', $strict_user);
$group_status = group_get_data($config['id_user'], $strict_user, $acltags, false, 'group');
$data['monitor_alerts_fired'] = $groups_status['_monitors_alerts_fired_'];
$data['agent_critical'] = $groups_status['_agents_critical_'];
$data['agent_warning'] = $groups_status['_agents_warning_'];
$data['agent_unknown'] = $groups_status['_agents_unknown_'];
} else {
$data = reporting_get_group_stats_resume($id_group); $data = reporting_get_group_stats_resume($id_group);
}
if ($data['monitor_alerts_fired'] > 0) { if ($data['monitor_alerts_fired'] > 0 && $ignore_alerts == false) {
return AGENT_STATUS_ALERT_FIRED; return AGENT_STATUS_ALERT_FIRED;
} else if ($data['agent_critical'] > 0) { } else if ($data['agent_critical'] > 0) {
return AGENT_STATUS_CRITICAL; return AGENT_STATUS_CRITICAL;

View File

@ -481,7 +481,7 @@ function html_print_select_groups(
global $config; global $config;
$select2_css = 'select2.min'; $select2_css = 'select2.min';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$select2_css = 'select2_dark.min'; $select2_css = 'select2_dark.min';
} }
@ -787,11 +787,11 @@ function html_print_select(
if ($style === false) { if ($style === false) {
$styleText = ' '; $styleText = ' ';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$styleText = 'style="color: white"'; $styleText = 'style="color: white"';
} }
} else { } else {
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$style .= ' color: white'; $style .= ' color: white';
} }
@ -932,7 +932,7 @@ function html_print_select(
} }
$select2 = 'select2.min'; $select2 = 'select2.min';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$select2 = 'select2_dark.min'; $select2 = 'select2_dark.min';
} }
@ -1490,7 +1490,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
'return' => true, 'return' => true,
'nothing' => __('All'), 'nothing' => __('All'),
'nothing_value' => 0, 'nothing_value' => 0,
'script' => 'fmModuleChange(\''.$uniqId.'\')', 'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
] ]
); );
$output .= '</div>'; $output .= '</div>';
@ -1543,7 +1543,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
'return' => true, 'return' => true,
'multiple' => true, 'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;', 'style' => 'min-width: 200px;max-width:200px;',
'script' => 'fmModuleChange(\''.$uniqId.'\')', 'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
] ]
); );
@ -1560,39 +1560,29 @@ function html_print_select_multiple_modules_filtered(array $data):string
'name' => 'filtered-module-show-common-modules-'.$uniqId, 'name' => 'filtered-module-show-common-modules-'.$uniqId,
'selected' => $data['mShowCommonModules'], 'selected' => $data['mShowCommonModules'],
'return' => true, 'return' => true,
'script' => 'fmModuleChange(\''.$uniqId.'\')', 'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
] ]
); );
if ($data['mAgents'] !== null) { if ($data['mAgents'] !== null) {
$all_modules = select_modules_for_agent_group( $all_modules = get_modules_agents(
$data['mModuleGroup'], $data['mModuleGroup'],
explode(',', $data['mAgents']), explode(',', $data['mAgents']),
$data['mShowCommonModules'], $data['mShowCommonModules'],
false false,
true
); );
} else { } else {
$all_modules = []; $all_modules = [];
} }
if ($data['mShowSelectedOtherGroups']) {
$selected_modules_ids = explode(',', $data['mModules']);
foreach ($selected_modules_ids as $id) {
if (!array_key_exists($id, $all_modules)) {
$module_data = modules_get_agentmodule($id);
$all_modules[$id] = $module_data['nombre'];
}
}
}
$output .= html_print_input( $output .= html_print_input(
[ [
'label' => __('Modules'), 'label' => __('Modules'),
'type' => 'select', 'type' => 'select',
'fields' => $all_modules, 'fields' => $all_modules,
'name' => 'filtered-module-modules-'.$uniqId, 'name' => 'filtered-module-modules-'.$uniqId,
'selected' => explode(',', $data['mModules']), 'selected' => explode((is_metaconsole() === true) ? SEPARATOR_META_MODULE : ',', $data['mModules']),
'return' => true, 'return' => true,
'multiple' => true, 'multiple' => true,
'style' => 'min-width: 200px;max-width:200px;', 'style' => 'min-width: 200px;max-width:200px;',
@ -2445,6 +2435,38 @@ function html_print_div(
} }
/**
* Render an <pre> tag for show code.
* For debug purposes, see for `hd()` function.
*
* @param string $content Content of tag.
* @param boolean $return Return the tag string formed.
* @param array $attributes Attributes availables for pre tags.
*
* @return string
*/
function html_print_code(
string $content,
bool $return=true,
array $attributes=[]
) {
$output = '<pre';
if (empty($attributes) === false) {
foreach ($attributes as $attribute => $value) {
$output .= ' '.$attribute.'="'.io_safe_input_html($value).'"';
}
}
$output .= sprintf('>%s</pre>', $content);
if ($return === true) {
return $output;
} else {
echo $output;
}
}
/** /**
* Render an anchor <a> html element. * Render an anchor <a> html element.
* *
@ -2798,7 +2820,7 @@ function html_print_input_number(array $settings):string
global $config; global $config;
$text_color = ''; $text_color = '';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$text_color = 'style="color: white"'; $text_color = 'style="color: white"';
} }
@ -4275,7 +4297,7 @@ function html_print_autocomplete_modules(
$text_color = ''; $text_color = '';
$module_icon = 'images/search_module.png'; $module_icon = 'images/search_module.png';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$text_color = 'color: white'; $text_color = 'color: white';
$module_icon = 'images/brick.menu.png'; $module_icon = 'images/brick.menu.png';
} }
@ -4577,7 +4599,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$style = 'style="color: white"'; $style = 'style="color: white"';
} }
@ -5238,7 +5260,7 @@ function html_print_autocomplete_users_from_integria(
global $config; global $config;
$user_icon = 'images/user_green.png'; $user_icon = 'images/user_green.png';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$user_icon = 'images/header_user.png'; $user_icon = 'images/header_user.png';
} }
@ -5345,7 +5367,7 @@ function html_print_tabs(array $tabs)
$bg_color = ''; $bg_color = '';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$bg_color = 'style="background-color: #222"'; $bg_color = 'style="background-color: #222"';
} }
@ -5447,7 +5469,7 @@ function html_print_select_search(
$select2_css = 'select2.min'; $select2_css = 'select2.min';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$select2_css = 'select2_dark.min'; $select2_css = 'select2_dark.min';
} }

View File

@ -557,11 +557,12 @@ function io_input_password($password)
* Process the given password read from the Pandora FMS Database, * Process the given password read from the Pandora FMS Database,
* decrypting it if necessary. * decrypting it if necessary.
* *
* @param string password Password read from the DB. * @param string $password Password read from the DB.
* @param string $wrappedBy Wrap the password with the informed character.
* *
* @return string The processed password. * @return string The processed password.
*/ */
function io_output_password($password) function io_output_password($password, $wrappedBy='')
{ {
global $config; global $config;
@ -574,11 +575,14 @@ function io_output_password($password)
] ]
); );
if ($plaintext === ENTERPRISE_NOT_HOOK) { $output = ($plaintext === ENTERPRISE_NOT_HOOK) ? $password : $plaintext;
return io_safe_output($password);
}
return io_safe_output($plaintext); return sprintf(
'%s%s%s',
$wrappedBy,
io_safe_output($output),
$wrappedBy
);
} }

View File

@ -189,7 +189,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
[ [
'nombre' => $module['nombre'], 'nombre' => $module['nombre'],
'disabled' => false, 'disabled' => false,
] ],
true,
true,
false,
false
); );
// The module already exist in the target // The module already exist in the target
@ -203,7 +207,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
[ [
'nombre' => $module['nombre'], 'nombre' => $module['nombre'],
'disabled' => true, 'disabled' => true,
] ],
true,
true,
false,
false
); );
// If the module exist but disabled, we enable it // If the module exist but disabled, we enable it
@ -3231,9 +3239,10 @@ function modules_get_first_date($id_agent_module, $datelimit=0)
{ {
global $config; global $config;
// check datatype string or normal // Check datatype string or normal.
$table = 'tagente_datos'; $table = 'tagente_datos';
$module_type_str = modules_get_agentmodule_type($id_agent_module); $module_type = modules_get_agentmodule_type($id_agent_module);
$module_type_str = modules_get_type_name($module_type);
if (strstr($module_type_str, 'string') !== false) { if (strstr($module_type_str, 'string') !== false) {
$table = 'tagente_datos_string'; $table = 'tagente_datos_string';
} }
@ -3555,7 +3564,7 @@ function modules_get_agentmodule_mininterval_no_async($id_agent)
} }
function get_modules_agents($id_module_group, $id_agents, $selection, $select_mode=true) function get_modules_agents($id_module_group, $id_agents, $selection, $select_mode=true, $useName=false)
{ {
if ((bool) is_metaconsole() === true) { if ((bool) is_metaconsole() === true) {
if ($select_mode === true) { if ($select_mode === true) {
@ -3675,8 +3684,14 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
$modules = array_reduce( $modules = array_reduce(
$modules, $modules,
function ($carry, $item) { function ($carry, $item) use ($useName) {
// Only works in select mode.
if ($useName === true) {
$carry[io_safe_input($item['nombre'])] = $item['nombre'];
} else {
$carry[$item['id_node'].'|'.$item['id_agente_modulo']] = $item['nombre']; $carry[$item['id_node'].'|'.$item['id_agente_modulo']] = $item['nombre'];
}
return $carry; return $carry;
}, },
[] []

View File

@ -8779,6 +8779,8 @@ function reporting_increment($report, $content)
$return['data'] = []; $return['data'] = [];
$search_in_history_db = db_search_in_history_db($return['from']);
if (is_metaconsole()) { if (is_metaconsole()) {
$sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' $sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC'; AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC';
@ -8805,17 +8807,23 @@ function reporting_increment($report, $content)
$connection = false; $connection = false;
} }
$old_data = db_get_value_sql($sql1); $old_data = db_get_value_sql($sql1, false, $search_in_history_db);
$last_data = db_get_value_sql($sql2); $last_data = db_get_value_sql($sql2, false, $search_in_history_db);
} }
} else { } else {
$old_data = db_get_value_sql( $old_data = db_get_value_sql(
'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC' AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC',
false,
$search_in_history_db
); );
$last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC'); $last_data = db_get_value_sql(
'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC',
false,
$search_in_history_db
);
} }
if (!is_metaconsole()) { if (!is_metaconsole()) {
@ -14161,7 +14169,7 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
if (modules_is_disable_agent($content['id_agent_module']) if (modules_is_disable_agent($content['id_agent_module'])
|| modules_is_not_init($content['id_agent_module']) || modules_is_not_init($content['id_agent_module'])
) { ) {
if ($metaconsole_on) { if ($metaconsole_on && $server_name != '') {
// Restore db connection. // Restore db connection.
metaconsole_restore_db(); metaconsole_restore_db();
} }
@ -14185,6 +14193,9 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
if ($modules_is_string === false) { if ($modules_is_string === false) {
if ($agentmodule_info['max_critical'] == 0) { if ($agentmodule_info['max_critical'] == 0) {
$max_value_critical = null; $max_value_critical = null;
if ((bool) $content['dinamic_proc'] === true) {
$max_value_critical = 0.01;
}
} else { } else {
$max_value_critical = $agentmodule_info['max_critical']; $max_value_critical = $agentmodule_info['max_critical'];
} }
@ -14392,6 +14403,7 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
$width_graph = 100; $width_graph = 100;
$height_graph = 80; $height_graph = 80;
if (empty($array_result) === false) {
$return['chart'] = flot_slicesbar_graph( $return['chart'] = flot_slicesbar_graph(
$array_result, $array_result,
$time_total, $time_total,
@ -14410,10 +14422,18 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
true, true,
$ttl, $ttl,
$content['sizeForTicks'], $content['sizeForTicks'],
true true,
$report['datetime']
); );
} else {
$return['chart'] = graph_nodata_image(
$width_graph,
$height_graph,
'area'
);
}
if ($metaconsole_on) { if ($metaconsole_on && $server_name != '') {
// Restore db connection. // Restore db connection.
metaconsole_restore_db(); metaconsole_restore_db();
} }

View File

@ -122,7 +122,7 @@ function html_do_report_info($report)
{ {
global $config; global $config;
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$background_color = '#222'; $background_color = '#222';
} else { } else {
$background_color = '#f5f5f5'; $background_color = '#f5f5f5';

View File

@ -1347,7 +1347,16 @@ function servers_get_server_string_name(int $server)
return __('WUX server'); return __('WUX server');
case SERVER_TYPE_ENTERPRISE_SATELLITE: case SERVER_TYPE_ENTERPRISE_SATELLITE:
return __('Satellite'); return __('Satellite server');
case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL:
return __('Transactional server');
case SERVER_TYPE_ALERT:
return __('Alert server');
case SERVER_TYPE_NCM:
return __('NCM server');
default: default:
return __('N/A'); return __('N/A');

View File

@ -1203,7 +1203,7 @@ function ui_format_alert_row(
$actions = alerts_get_alert_agent_module_actions($alert['id'], false, $alert['server_data']['id']); $actions = alerts_get_alert_agent_module_actions($alert['id'], false, $alert['server_data']['id']);
if (empty($actions) === false) { if (empty($actions) === false || $actionDefault != '') {
$actionText = '<div><ul class="action_list">'; $actionText = '<div><ul class="action_list">';
foreach ($actions as $action) { foreach ($actions as $action) {
$actionText .= '<div class="mrgn_btn_5px" ><span class="action_name"><li>'.$action['name']; $actionText .= '<div class="mrgn_btn_5px" ><span class="action_name"><li>'.$action['name'];
@ -1215,9 +1215,9 @@ function ui_format_alert_row(
} }
$actionText .= '</ul></div>'; $actionText .= '</ul></div>';
} else {
if ($actionDefault != '') { if ($actionDefault != '') {
$actionText = db_get_sql( $actionText .= db_get_sql(
sprintf( sprintf(
'SELECT name FROM talert_actions WHERE id = %d', 'SELECT name FROM talert_actions WHERE id = %d',
$actionDefault $actionDefault
@ -4966,7 +4966,7 @@ function ui_print_agent_autocomplete_input($parameters)
// Default value. // Default value.
$icon_agent = 'images/search_agent.png'; $icon_agent = 'images/search_agent.png';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$text_color = 'style="color: white"'; $text_color = 'style="color: white"';
$icon_agent = 'images/agent_mc.menu.png'; $icon_agent = 'images/agent_mc.menu.png';
} }
@ -5822,7 +5822,7 @@ function ui_print_agent_autocomplete_input($parameters)
$html = ''; $html = '';
$text_color = ''; $text_color = '';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$text_color = 'color: white'; $text_color = 'color: white';
} }

View File

@ -3420,7 +3420,7 @@ function visual_map_get_status_element($layoutData)
break; break;
case GROUP_ITEM: case GROUP_ITEM:
$group_status = groups_get_status($layoutData['id_group']); $group_status = groups_get_status($layoutData['id_group'], true);
switch ($group_status) { switch ($group_status) {
case AGENT_STATUS_ALERT_FIRED: case AGENT_STATUS_ALERT_FIRED:

View File

@ -220,7 +220,7 @@ function vbar_graph(
$options['x']['font']['color'] = '#545454'; $options['x']['font']['color'] = '#545454';
if ($options['pdf'] === true) { if ($options['pdf'] === true) {
$options['x']['font']['color'] = '#000'; $options['x']['font']['color'] = '#000';
} else if ($config['style'] === 'pandora_black') { } else if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$options['x']['font']['color'] = '#fff'; $options['x']['font']['color'] = '#fff';
} }
} }
@ -238,7 +238,7 @@ function vbar_graph(
// Grid color axes x. // Grid color axes x.
if (isset($options['x']['color']) === false) { if (isset($options['x']['color']) === false) {
$options['x']['color'] = '#ffffff'; $options['x']['color'] = '#ffffff';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$options['x']['color'] = '#222'; $options['x']['color'] = '#222';
} }
} }
@ -305,7 +305,7 @@ function vbar_graph(
$options['y']['font']['color'] = '#545454'; $options['y']['font']['color'] = '#545454';
if ($options['pdf'] === true) { if ($options['pdf'] === true) {
$options['y']['font']['color'] = '#000'; $options['y']['font']['color'] = '#000';
} else if ($config['style'] === 'pandora_black') { } else if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$options['y']['font']['color'] = '#fff'; $options['y']['font']['color'] = '#fff';
} }
} }
@ -323,7 +323,7 @@ function vbar_graph(
// Grid color axes y. // Grid color axes y.
if (isset($options['y']['color']) === false) { if (isset($options['y']['color']) === false) {
$options['y']['color'] = '#ffffff'; $options['y']['color'] = '#ffffff';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$options['y']['color'] = '#222'; $options['y']['color'] = '#222';
} }
} }
@ -361,7 +361,7 @@ function vbar_graph(
if (isset($options['grid']['color']) === false) { if (isset($options['grid']['color']) === false) {
$options['grid']['color'] = '#ffffff'; $options['grid']['color'] = '#ffffff';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$options['grid']['color'] = '#111'; $options['grid']['color'] = '#111';
} }
} }
@ -373,7 +373,7 @@ function vbar_graph(
'#ffffff', '#ffffff',
], ],
]; ];
if ($config['style'] === 'pandora_black' && $ttl === 1) { if ($config['style'] === 'pandora_black' && !is_metaconsole() && $ttl === 1) {
$options['grid']['backgroundColor'] = [ $options['grid']['backgroundColor'] = [
'colors' => [ 'colors' => [
'#222', '#222',
@ -746,11 +746,11 @@ function hbar_graph(
return generator_chart_to_pdf('hbar', $params); return generator_chart_to_pdf('hbar', $params);
} }
if ($config['style'] === 'pandora_black' && $ttl === 1) { if ($config['style'] === 'pandora_black' && !is_metaconsole() && $ttl === 1) {
$backgroundColor = '#222'; $backgroundColor = '#222';
} }
if ($config['style'] === 'pandora_black' && $ttl === 1) { if ($config['style'] === 'pandora_black' && !is_metaconsole() && $ttl === 1) {
$tick_color = '#fff'; $tick_color = '#fff';
} }

View File

@ -437,25 +437,23 @@ function pandoraFlotHBars(
var format = new Array(); var format = new Array();
for (var i = 0; i < labels_total.length; i++) { for (var i = 0; i < labels_total.length; i++) {
var label = labels_total[i][1]; var label = labels_total[i][1];
// var shortLabel = reduceText(label, 25);
var title = label;
if (label.length > 30) {
label = reduceText(label, 30);
}
var div_attributes = var div_attributes =
'style="font-size:' + 'style="font-size:' +
font_size + font_size +
"pt !important;" + "pt !important;" +
" margin: 0; max-width: 150px;" + "margin: 0; max-width: 200px;" +
"margin-right:5px"; "margin-right:5px;" +
+"margin-left: -1.5em"; "margin-left: -1.5em" +
+"text-align: right"; "text-align: right" +
"text-overflow: ellipsis;" +
"overflow: hidden;" +
"white-space: pre;";
if (label.indexOf("<br>") != -1) { if (label.indexOf("<br>") != -1) {
div_attributes += "min-height: 2.5em;"; div_attributes += "min-height: 2.5em;";
} }
div_attributes += '" title="' + title + '" style="overflow: hidden;"'; div_attributes += '" title="' + label + '" style="overflow: hidden;"';
format.push([i, "<div " + div_attributes + ">" + label + "</div>"]); format.push([i, "<div " + div_attributes + ">" + label + "</div>"]);
} }
@ -3270,5 +3268,6 @@ function reduceText(text, maxLength) {
if (text.length <= maxLength) return text; if (text.length <= maxLength) return text;
var firstSlideEnd = parseInt((maxLength - 3) / 1.6); var firstSlideEnd = parseInt((maxLength - 3) / 1.6);
var str_cut = text.substr(0, firstSlideEnd); var str_cut = text.substr(0, firstSlideEnd);
return str_cut + "...<br>" + text.substr(-firstSlideEnd - 3); //return str_cut + "...<br>" + text.substr(-firstSlideEnd - 3);
return str_cut + "..." + text.substr(-firstSlideEnd - 3);
} }

View File

@ -202,7 +202,7 @@ function d3_bullet_chart(
$font = array_shift(explode('.', array_pop(explode('/', $font)))); $font = array_shift(explode('.', array_pop(explode('/', $font))));
$invert_color = ''; $invert_color = '';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$invert_color = 'filter: invert(100%);'; $invert_color = 'filter: invert(100%);';
} }

View File

@ -146,7 +146,7 @@ function flot_area_graph(
break; break;
} }
if ($config['style'] === 'pandora_black' && ($params['pdf'] === false || $params['pdf'] === null) && (isset($is_mobile) === false || $is_mobile === false) if (($config['style'] === 'pandora_black' && !is_metaconsole()) && ($params['pdf'] === false || $params['pdf'] === null) && (isset($is_mobile) === false || $is_mobile === false)
) { ) {
$background_style = '#222'; $background_style = '#222';
$params['grid_color'] = '#fff'; $params['grid_color'] = '#fff';
@ -553,11 +553,6 @@ function flot_hcolumn_chart($graph_data, $width, $height, $water_mark, $font='',
{ {
global $config; global $config;
if ($pdf === true) {
$background_color = 'white';
$tick_color = '#000';
}
// Include_javascript_dependencies_flot_graph(). // Include_javascript_dependencies_flot_graph().
$return = ''; $return = '';

View File

@ -683,10 +683,10 @@ function update_link(row_index, id_link) {
temp_link["text_end"] = data["text_end"]; temp_link["text_end"] = data["text_end"];
$.each(graph.nodes, function(k, node) { $.each(graph.nodes, function(k, node) {
if (node["id_agent"] == data["id_db_target"]) { if (node["id_db"] == data["id_db_target"]) {
temp_link["target"] = graph.nodes[k]; temp_link["target"] = graph.nodes[k];
} }
if (node["id_agent"] == data["id_db_source"]) { if (node["id_db"] == data["id_db_source"]) {
temp_link["source"] = graph.nodes[k]; temp_link["source"] = graph.nodes[k];
} }
}); });
@ -703,9 +703,21 @@ function update_link(row_index, id_link) {
.append("g") .append("g")
.attr("id", "layer_graph_nodes_" + networkmap_id); .attr("id", "layer_graph_nodes_" + networkmap_id);
var graph_links_aux = graph.links.filter(function(d, i) {
if (typeof d["source"] === "undefined") {
return false;
}
if (typeof d["target"] === "undefined") {
return false;
}
return d;
});
force force
.nodes(graph.nodes) .nodes(graph.nodes)
.links(graph.links) .links(graph_links_aux)
.start(); .start();
window.node = layer_graph_nodes.selectAll(".node"); window.node = layer_graph_nodes.selectAll(".node");
@ -2353,9 +2365,21 @@ function refresh_holding_area() {
.append("g") .append("g")
.attr("id", "layer_graph_nodes_" + networkmap_id); .attr("id", "layer_graph_nodes_" + networkmap_id);
var graph_links_aux = graph.links.filter(function(d, i) {
if (typeof d["source"] === "undefined") {
return false;
}
if (typeof d["target"] === "undefined") {
return false;
}
return d;
});
force force
.nodes(graph.nodes) .nodes(graph.nodes)
.links(graph.links) .links(graph_links_aux)
.start(); .start();
window.node = layer_graph_nodes.selectAll(".node"); window.node = layer_graph_nodes.selectAll(".node");

View File

@ -211,7 +211,7 @@ function fmAgentChange(uniqId) {
} }
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
function fmModuleChange(uniqId) { function fmModuleChange(uniqId, isMeta) {
var idModuleGroup = $("#filtered-module-module-group-" + uniqId).val(); var idModuleGroup = $("#filtered-module-module-group-" + uniqId).val();
var idAgents = $("#filtered-module-agents-" + uniqId).val(); var idAgents = $("#filtered-module-agents-" + uniqId).val();
var showCommonModules = $( var showCommonModules = $(
@ -230,7 +230,9 @@ function fmModuleChange(uniqId) {
$("#filtered-module-modules-" + uniqId).html(""); $("#filtered-module-modules-" + uniqId).html("");
if (data) { if (data) {
jQuery.each(data, function(id, value) { jQuery.each(data, function(id, value) {
var option = $("<option></option>") var option = $("<option></option>");
if (isMeta === true) {
option
.attr( .attr(
"value", "value",
value["id_node"] value["id_node"]
@ -238,6 +240,10 @@ function fmModuleChange(uniqId) {
: value["id_agente_modulo"] : value["id_agente_modulo"]
) )
.html(value["nombre"]); .html(value["nombre"]);
} else {
option.attr("value", value).html(value);
}
$("#filtered-module-modules-" + uniqId).append(option); $("#filtered-module-modules-" + uniqId).append(option);
}); });
} }

View File

@ -388,8 +388,8 @@ function initialiceLayout(data) {
dashboardId: data.dashboardId, dashboardId: data.dashboardId,
widgetId: widgetId widgetId: widgetId
}, },
width: widgetId == 14 || widgetId == 2 ? 750 : 450, width: widgetId == 14 || widgetId == 2 || widgetId == 23 ? 750 : 450,
maxHeight: 600, maxHeight: 610,
minHeight: 400 minHeight: 400
}, },
onsubmit: { onsubmit: {

View File

@ -990,6 +990,35 @@ var TreeController = {
typeof element.showGraphs != "undefined" && typeof element.showGraphs != "undefined" &&
element.showGraphs != 0 element.showGraphs != 0
) { ) {
// Graph histogram pop-up
if (typeof element.histogramGraph != "undefined") {
var graphImageHistogram = $(
'<img src="' +
(controller.baseURL.length > 0
? controller.baseURL
: "") +
'images/histograma.png" /> '
);
graphImageHistogram
.addClass("module-graph")
.click(function(e) {
e.stopPropagation();
try {
winopeng_var(
element.histogramGraph.url,
element.histogramGraph.handle,
800,
480
);
} catch (error) {
// console.log(error);
}
});
$content.append(graphImageHistogram);
}
// Graph pop-up // Graph pop-up
if (typeof element.moduleGraph != "undefined") { if (typeof element.moduleGraph != "undefined") {
if (element.statusImageHTML.indexOf("data:image") != -1) { if (element.statusImageHTML.indexOf("data:image") != -1) {
@ -1183,6 +1212,7 @@ var TreeController = {
disabled == false disabled == false
) { ) {
if (element.type == "agent" || element.type == "module") { if (element.type == "agent" || element.type == "module") {
if (typeof element.noAcl === "undefined") {
$content $content
.click(function(e) { .click(function(e) {
_getTreeDetailData( _getTreeDetailData(
@ -1203,6 +1233,7 @@ var TreeController = {
.css("cursor", "pointer"); .css("cursor", "pointer");
} }
} }
}
$node $node
.addClass("tree-node") .addClass("tree-node")

View File

@ -512,7 +512,7 @@ class Widget
if (empty($values['background']) === true) { if (empty($values['background']) === true) {
$values['background'] = '#ffffff'; $values['background'] = '#ffffff';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$values['background'] = '#222222'; $values['background'] = '#222222';
} }
} }

View File

@ -35,7 +35,6 @@ use PandoraFMS\Module;
*/ */
class AgentModuleWidget extends Widget class AgentModuleWidget extends Widget
{ {
const MODULE_SEPARATOR = '|-|-|-|';
/** /**
* Name widget. * Name widget.
@ -309,16 +308,12 @@ class AgentModuleWidget extends Widget
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$values['mModules'] = implode( $values['mModules'] = implode(
self::MODULE_SEPARATOR, SEPARATOR_META_MODULE,
array_reduce( array_reduce(
$values['mModules'], $values['mModules'],
function ($carry, $item) { function ($carry, $item) {
$d = explode('|', $item); $d = explode('|', $item);
if (isset($d[1]) === true) { $carry[] = (isset($d[1]) === true) ? $d[1] : $item;
$carry[] = \io_safe_output($d[1]);
} else {
$carry[] = \io_safe_output($item);
}
return $carry; return $carry;
}, },
@ -639,7 +634,7 @@ class AgentModuleWidget extends Widget
$target_modules = $this->values['mModules']; $target_modules = $this->values['mModules'];
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$target_modules = explode( $target_modules = explode(
self::MODULE_SEPARATOR, SEPARATOR_META_MODULE,
$this->values['mModules'] $this->values['mModules']
); );
@ -648,8 +643,17 @@ class AgentModuleWidget extends Widget
if (is_array($target_modules) === true if (is_array($target_modules) === true
|| is_numeric($target_modules) === true || is_numeric($target_modules) === true
) { ) {
$target_modules = array_reduce(
$target_modules,
function ($carry, $item) {
$carry[] = io_safe_output($item);
return $carry;
}
);
$all_modules = Module::search( $all_modules = Module::search(
['id_agente_modulo' => $target_modules] ['nombre' => $target_modules]
); );
} else { } else {
// From previous definitions. // From previous definitions.
@ -660,6 +664,11 @@ class AgentModuleWidget extends Widget
} }
if ($all_modules !== null) { if ($all_modules !== null) {
if (is_metaconsole() === true
&& $this->values['mShowCommonModules'] === '1'
) {
$reduceAllModules = [];
} else {
$reduceAllModules = array_reduce( $reduceAllModules = array_reduce(
$all_modules, $all_modules,
function ($carry, $item) { function ($carry, $item) {
@ -670,19 +679,13 @@ class AgentModuleWidget extends Widget
if (is_object($item) === true) { if (is_object($item) === true) {
$carry[$item->name()] = null; $carry[$item->name()] = null;
} else { } else {
if ((is_metaconsole() === true $carry[io_safe_output($item)] = null;
&& $this->values['mShowCommonModules'] !== '1')
|| is_metaconsole() === false
) {
$carry[$item] = null;
}
} }
return $carry; return $carry;
} }
); );
} else { }
$reduceAllModules = [];
} }
$visualData = []; $visualData = [];
@ -709,14 +712,26 @@ class AgentModuleWidget extends Widget
$visualData[$agent_id]['agent_status'] = $agent->lastStatus(); $visualData[$agent_id]['agent_status'] = $agent->lastStatus();
$visualData[$agent_id]['agent_name'] = $agent->name(); $visualData[$agent_id]['agent_name'] = $agent->name();
$visualData[$agent_id]['agent_alias'] = $agent->alias(); $visualData[$agent_id]['agent_alias'] = $agent->alias();
$visualData[$agent_id]['modules'] = [];
if (is_metaconsole() === true if (is_metaconsole() === true
&& $this->values['mShowCommonModules'] === '1' && $this->values['mShowCommonModules'] === '1'
) { ) {
// MC should connect to nodes and retrieve information // MC should connect to nodes and retrieve information
// from targets. // from targets.
$tmpModules = array_reduce(
$target_modules,
function ($carry, $item) {
// In this case, the modules come with '» ' chain.
$tmpCarry = explode('&raquo;&#x20;', $item);
$carry[trim($tmpCarry[1])] = null;
return $carry;
}
);
$modules = $agent->searchModules( $modules = $agent->searchModules(
['id_agente_modulo' => $target_modules] ['nombre' => array_keys($tmpModules)]
); );
foreach ($modules as $module) { foreach ($modules as $module) {

View File

@ -750,7 +750,7 @@ class EventsListWidget extends Widget
$table->data[$i] = $data; $table->data[$i] = $data;
$bg_color = 'background: #E8E8E8;'; $bg_color = 'background: #E8E8E8;';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$bg_color = 'background: #222;'; $bg_color = 'background: #222;';
} }

View File

@ -378,6 +378,8 @@ class GraphModuleHistogramWidget extends Widget
$size = parent::getSize(); $size = parent::getSize();
$output = '';
// Desactive scroll bars only this item. // Desactive scroll bars only this item.
$id_agent = $this->values['agentId']; $id_agent = $this->values['agentId'];
$id_module = $this->values['moduleId']; $id_module = $this->values['moduleId'];

View File

@ -323,11 +323,22 @@ class MapsStatusWidget extends Widget
$data = []; $data = [];
$url = $config['homeurl']; $url = $config['homeurl'];
$url .= 'index.php?sec=visualc'; if (\is_metaconsole() === true) {
$url .= '&sec2=operation/visual_console/render_view&refr=60'; $url .= sprintf(
'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&refr=%s&id_visualmap=%s',
$config['vc_refr'],
$id_layout
);
} else {
$url .= sprintf(
'index.php?sec=visualc&sec2=operation/visual_console/render_view&refr=%s&id=%s',
$config['vc_refr'],
$id_layout
);
}
// This will give us the group name. // This will give us the group name.
$data[0] = '<a href="'.$url.'&id='.$id_layout.'">'; $data[0] = '<a href="'.$url.'">';
$data[0] .= $user_layouts[$id_layout]['name']; $data[0] .= $user_layouts[$id_layout]['name'];
$data[0] .= '</a>'; $data[0] .= '</a>';

View File

@ -253,6 +253,14 @@ class NetworkMapWidget extends Widget
// Retrieve global - common inputs. // Retrieve global - common inputs.
$inputs = parent::getFormInputs(); $inputs = parent::getFormInputs();
$inputs[] = [
'label' => \ui_print_info_message(
__('It is recommended to have only one such widget in the control panel.'),
'',
true
),
];
// Default values. // Default values.
if (isset($values['xOffset']) === false) { if (isset($values['xOffset']) === false) {
$values['xOffset'] = 0; $values['xOffset'] = 0;

View File

@ -318,7 +318,7 @@ class ServiceViewWidget extends Widget
// Css Files. // Css Files.
\ui_require_css_file('tree', 'include/styles/', true); \ui_require_css_file('tree', 'include/styles/', true);
if ($config['style'] == 'pandora_black') { if ($config['style'] == 'pandora_black' && !is_metaconsole()) {
\ui_require_css_file('pandora_black', 'include/styles/', true); \ui_require_css_file('pandora_black', 'include/styles/', true);
} }

View File

@ -455,6 +455,7 @@ class TopNWidget extends Widget
$data_hbar = []; $data_hbar = [];
foreach ($modules as $module) { foreach ($modules as $module) {
$module['aliasAgent'] = ui_print_truncate_text($module['aliasAgent'], 20);
$item_name = ''; $item_name = '';
$item_name = $module['aliasAgent'].' - '.$module['nameModule']; $item_name = $module['aliasAgent'].' - '.$module['nameModule'];
$data_hbar[$item_name]['g'] = $module[$display]; $data_hbar[$item_name]['g'] = $module[$display];

View File

@ -542,7 +542,7 @@ class TreeViewWidget extends Widget
// Css Files. // Css Files.
\ui_require_css_file('tree', 'include/styles/', true); \ui_require_css_file('tree', 'include/styles/', true);
if ($config['style'] == 'pandora_black') { if ($config['style'] == 'pandora_black' && !is_metaconsole()) {
\ui_require_css_file('pandora_black', 'include/styles/', true); \ui_require_css_file('pandora_black', 'include/styles/', true);
} }

View File

@ -346,9 +346,7 @@ final class Group extends Item
$countStatus = \db_get_row_sql($sql); $countStatus = \db_get_row_sql($sql);
if ($countStatus['fired'] > 0) { if ($countStatus['critical'] > 0) {
$status = AGENT_STATUS_ALERT_FIRED;
} else if ($countStatus['critical'] > 0) {
$status = AGENT_STATUS_CRITICAL; $status = AGENT_STATUS_CRITICAL;
} else if ($countStatus['warning'] > 0) { } else if ($countStatus['warning'] > 0) {
$status = AGENT_STATUS_WARNING; $status = AGENT_STATUS_WARNING;
@ -359,7 +357,7 @@ final class Group extends Item
} }
} else { } else {
// Get the status img src. // Get the status img src.
$status = \groups_get_status($groupId); $status = \groups_get_status($groupId, true);
} }
$imagePath = \visual_map_get_image_status_element($data, $status); $imagePath = \visual_map_get_image_status_element($data, $status);

View File

@ -776,6 +776,10 @@ select:-internal-list-box {
.padding-bottom-4 { .padding-bottom-4 {
padding-bottom: 4em; padding-bottom: 4em;
} }
.padding-bottom-5px {
padding-bottom: 5px;
}
.padding-right-2 { .padding-right-2 {
padding-right: 2em; padding-right: 2em;
} }
@ -8435,6 +8439,22 @@ div.stat-win-spinner img {
font-size: 12px; font-size: 12px;
} }
.stat_win_histogram {
width: 95%;
margin: 0 auto;
margin-top: 18%;
}
#stat-win-module-graph .stat_win_histogram div.nodata_container {
width: 100%;
}
/* For backups dt, can be useful for others */
#backups_list > thead > tr > th:last-child,
#backups_list > tbody > tr > td:last-child {
text-align: center;
}
/* err_msg_centralised */ /* err_msg_centralised */
div#err_msg_centralised div { div#err_msg_centralised div {
margin-top: 1em; margin-top: 1em;

View File

@ -424,6 +424,8 @@ if (! isset($config['id_user'])) {
// Process logout. // Process logout.
include 'general/logoff.php'; include 'general/logoff.php';
} }
$validatedCSRF = true;
} else { } else {
// process_user_login is a virtual function which should be defined in each auth file. // process_user_login is a virtual function which should be defined in each auth file.
// It accepts username and password. The rest should be internal to the auth file. // It accepts username and password. The rest should be internal to the auth file.

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.759'; $version = '7.0NG.759';
$build = '220110'; $build = '220125';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -420,17 +420,17 @@ if ($filter_standby == 'standby_on') {
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
include_once $config['homedir'].'/enterprise/meta/include/functions_alerts_meta.php'; include_once $config['homedir'].'/enterprise/meta/include/functions_alerts_meta.php';
if ($idAgent != 0) { if ($idAgent != 0) {
$alerts['alerts_simple'] = alerts_meta_get_alerts($agents, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user); $alerts['alerts_simple'] = alerts_meta_get_alerts($agents, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter);
$countAlertsSimple = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user); $countAlertsSimple = alerts_meta_get_alerts($agents, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter);
} else { } else {
$id_groups = array_keys( $id_groups = array_keys(
users_get_groups($config['id_user'], 'AR', false) users_get_groups($config['id_user'], 'AR', false)
); );
$alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter); $alerts['alerts_simple'] = alerts_meta_get_group_alerts($id_groups, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup, false, $strict_user, $tag_filter, $action_filter);
$countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter); $countAlertsSimple = alerts_meta_get_group_alerts($id_groups, $filter_alert, false, $whereAlertSimple, false, false, $idGroup, true, $strict_user, $tag_filter, $action_filter);
} }
} else { } else {
if ($idAgent != 0) { if ($idAgent != 0) {

View File

@ -68,7 +68,7 @@ if (file_exists('../../include/languages/'.$user_language.'.mo')) {
} }
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css"/>'; echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css"/>';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
ui_require_css_file('pandora_black', 'include/styles/', true); ui_require_css_file('pandora_black', 'include/styles/', true);
} }

View File

@ -1026,12 +1026,12 @@ if (is_ajax() === true) {
// Source_value is id_agente. // Source_value is id_agente.
$source_text = ''; $source_text = '';
$source_agent = $interface_source; $source_agent = $interface_source;
$source_type = NODE_AGENT; $source_type = ($interface_source == 0) ? NODE_PANDORA : NODE_AGENT;
$source_link_value = $source_agent; $source_link_value = $source_agent;
} }
// Search node id in map. // Search node id in map.
$child_id = db_get_value_filter( $parent_id = db_get_value_filter(
'id', 'id',
'titem', 'titem',
[ [
@ -1073,7 +1073,7 @@ if (is_ajax() === true) {
} }
// Search node id in map. // Search node id in map.
$parent_id = db_get_value_filter( $child_id = db_get_value_filter(
'id', 'id',
'titem', 'titem',
[ [
@ -1089,10 +1089,10 @@ if (is_ajax() === true) {
$link['id_item'] = 0; $link['id_item'] = 0;
$link['deleted'] = 0; $link['deleted'] = 0;
$link['id_map'] = $networkmap_id; $link['id_map'] = $networkmap_id;
$link['parent_type'] = $target_type; $link['parent_type'] = $source_type;
$link['id_parent_source_data'] = $target_link_value; $link['id_parent_source_data'] = $source_link_value;
$link['child_type'] = $source_type; $link['child_type'] = $target_type;
$link['id_child_source_data'] = $source_link_value; $link['id_child_source_data'] = $target_link_value;
$insert_result = db_process_sql_insert('trel_item', $link); $insert_result = db_process_sql_insert('trel_item', $link);
@ -1123,8 +1123,8 @@ if (is_ajax() === true) {
$return['text_start'] = $source_text; $return['text_start'] = $source_text;
$return['text_end'] = $target_text; $return['text_end'] = $target_text;
$return['id_db_link'] = $insert_result; $return['id_db_link'] = $insert_result;
$return['id_db_source'] = $source_agent; $return['id_db_source'] = $parent_id;
$return['id_db_target'] = $target_agent; $return['id_db_target'] = $child_id;
$return['type_source'] = $source_type; $return['type_source'] = $source_type;
$return['type_target'] = $target_type; $return['type_target'] = $target_type;
} else { } else {

View File

@ -64,7 +64,7 @@ if (file_exists('../../include/languages/'.$user_language.'.mo')) {
$l10n->load_tables(); $l10n->load_tables();
} }
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
ui_require_css_file('pandora_black', 'include/styles/', true); ui_require_css_file('pandora_black', 'include/styles/', true);
} }
@ -97,7 +97,7 @@ echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/
?> ?>
</head> </head>
<?php <?php
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
} }
?> ?>
<body bgcolor="#ffffff" class='bg_white'> <body bgcolor="#ffffff" class='bg_white'>

View File

@ -79,7 +79,7 @@ if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR')) {
if ($refresh > 0) { if ($refresh > 0) {
$query = ui_get_url_refresh(false); $query = ui_get_url_refresh(false);
echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />'; echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
echo '<link rel="stylesheet" href="../../include/styles/pandora_black.css" type="text/css"/>'; echo '<link rel="stylesheet" href="../../include/styles/pandora_black.css" type="text/css"/>';
} }
} }

View File

@ -67,7 +67,7 @@ if (file_exists('../../include/languages/'.$user_language.'.mo')) {
global $config; global $config;
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css"/>'; echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css"/>';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
echo '<link rel="stylesheet" href="../../include/styles/pandora_black.css" type="text/css"/>'; echo '<link rel="stylesheet" href="../../include/styles/pandora_black.css" type="text/css"/>';
} }
@ -194,7 +194,28 @@ ui_print_message_dialog(
$time_compare_separated = get_parameter('time_compare_separated', 0); $time_compare_separated = get_parameter('time_compare_separated', 0);
$time_compare_overlapped = get_parameter('time_compare_overlapped', 0); $time_compare_overlapped = get_parameter('time_compare_overlapped', 0);
$unknown_graph = get_parameter_checkbox('unknown_graph', 1); $unknown_graph = get_parameter_checkbox('unknown_graph', 1);
$histogram = (bool) get_parameter('histogram', 0);
// FORM TABLE.
$table = html_get_predefined_table('transparent', 2);
$table->width = '100%';
$table->id = 'stat_win_form_div';
$table->style[0] = 'text-align:left;';
$table->style[1] = 'text-align:left;';
$table->style[2] = 'text-align:left;font-weight: bold;';
$table->style[3] = 'text-align:left;';
$table->class = 'table_modal_alternate';
$table->data = [];
$time_compare = false;
if ($time_compare_separated) {
$time_compare = 'separated';
} else if ($time_compare_overlapped) {
$time_compare = 'overlapped';
}
if ($histogram === false) {
$fullscale_sent = get_parameter('fullscale_sent', 0); $fullscale_sent = get_parameter('fullscale_sent', 0);
if (!$fullscale_sent) { if (!$fullscale_sent) {
if (isset($config['full_scale_option']) === false if (isset($config['full_scale_option']) === false
@ -219,14 +240,6 @@ ui_print_message_dialog(
($fullscale === 1) ? 0 : $config['type_mode_graph'] ($fullscale === 1) ? 0 : $config['type_mode_graph']
); );
$time_compare = false;
if ($time_compare_separated) {
$time_compare = 'separated';
} else if ($time_compare_overlapped) {
$time_compare = 'overlapped';
}
if ($zoom > 1) { if ($zoom > 1) {
$height = ($height * ($zoom / 2.1)); $height = ($height * ($zoom / 2.1));
$width = ($width * ($zoom / 1.4)); $width = ($width * ($zoom / 1.4));
@ -249,17 +262,6 @@ ui_print_message_dialog(
$id $id
); );
// FORM TABLE.
$table = html_get_predefined_table('transparent', 2);
$table->width = '100%';
$table->id = 'stat_win_form_div';
$table->style[0] = 'text-align:left;';
$table->style[1] = 'text-align:left;';
$table->style[2] = 'text-align:left;font-weight: bold;';
$table->style[3] = 'text-align:left;';
$table->class = 'table_modal_alternate';
$table->data = [];
$table->data[0][0] = __('Refresh time'); $table->data[0][0] = __('Refresh time');
$table->data[0][1] = html_print_extended_select_for_time( $table->data[0][1] = html_print_extended_select_for_time(
'refresh', 'refresh',
@ -413,6 +415,46 @@ ui_print_message_dialog(
true, true,
false false
); );
} else {
$table->data[0][0] = __('Begin date');
$table->data[0][1] = html_print_input_text(
'start_date',
$start_date,
'',
10,
20,
true
);
$table->data[0][2] = __('Begin time');
$table->data[0][3] = html_print_input_text(
'start_time',
$start_time,
'',
10,
10,
true
);
$table->data[1][0] = __('Time range');
$table->data[1][1] = html_print_extended_select_for_time(
'period',
$period,
'',
'',
0,
7,
true
);
$table->data[1][2] = __('Time compare (Separated)');
$table->data[1][3] = html_print_checkbox_switch(
'time_compare_separated',
1,
(bool) $time_compare_separated,
true
);
}
$form_table = html_print_table($table, true); $form_table = html_print_table($table, true);
$form_table .= '<div class="w100p right mrgn_top_15px right_align">'; $form_table .= '<div class="w100p right mrgn_top_15px right_align">';
@ -434,6 +476,8 @@ ui_print_message_dialog(
$menu_form .= html_print_input_hidden('server', $server_id, true); $menu_form .= html_print_input_hidden('server', $server_id, true);
} }
$menu_form .= html_print_input_hidden('histogram', $histogram, true);
if (isset($_GET['type']) === true) { if (isset($_GET['type']) === true) {
$type = get_parameter_get('type'); $type = get_parameter_get('type');
$menu_form .= html_print_input_hidden('type', $type, true); $menu_form .= html_print_input_hidden('type', $type, true);
@ -460,7 +504,13 @@ ui_print_message_dialog(
); );
$menu_form .= '</span>'; $menu_form .= '</span>';
$menu_form .= '</div>'; $menu_form .= '</div>';
$menu_form .= '<div class="module_graph_menu_content module_graph_menu_content_closed invisible">';
$class = 'module_graph_menu_content';
if ($histogram === false) {
$class .= ' module_graph_menu_content_closed invisible';
}
$menu_form .= '<div class="'.$class.'">';
$menu_form .= $form_table; $menu_form .= $form_table;
$menu_form .= '</div>'; $menu_form .= '</div>';
$menu_form .= '</div>'; $menu_form .= '</div>';
@ -497,6 +547,8 @@ ui_print_message_dialog(
'zoom' => $zoom, 'zoom' => $zoom,
'height' => 300, 'height' => 300,
'type_mode_graph' => $type_mode_graph, 'type_mode_graph' => $type_mode_graph,
'histogram' => $histogram,
'begin_date' => strtotime($start_date.' '.$start_time),
]; ];
// Graph. // Graph.

View File

@ -1725,6 +1725,17 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
} }
if ($row['history_data'] == 1 && $acl_graphs) { if ($row['history_data'] == 1 && $acl_graphs) {
$tresholds = true;
if (empty((float) $module['min_warning']) === true
&& empty((float) $module['max_warning']) === true
&& empty($module['warning_inverse']) === true
&& empty((float) $module['min_critical']) === true
&& empty((float) $module['max_critical']) === true
&& empty($module['critical_inverse']) === true
) {
$tresholds = false;
}
$graph_type = return_graphtype($row['module_type']); $graph_type = return_graphtype($row['module_type']);
$url = ui_get_full_url('operation/agentes/stat_win.php', false, false, false); $url = ui_get_full_url('operation/agentes/stat_win.php', false, false, false);
@ -1738,6 +1749,10 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
'refresh' => SECONDS_10MINUTES, 'refresh' => SECONDS_10MINUTES,
]; ];
if ($tresholds === true || $graph_type === 'boolean') {
$graph_params['histogram'] = 1;
}
if (is_metaconsole() && isset($row['server_id'])) { if (is_metaconsole() && isset($row['server_id'])) {
// Set the server id. // Set the server id.
$graph_params['server'] = $row['server_id']; $graph_params['server'] = $row['server_id'];
@ -1749,6 +1764,18 @@ $table->data[4][0] .= __('Not condition').'&nbsp;'.ui_print_help_tip(__('If you
$data[8] = get_module_realtime_link_graph($row); $data[8] = get_module_realtime_link_graph($row);
if ($tresholds === true || $graph_type === 'boolean') {
$data[8] .= '<a href="javascript:'.$link.'">'.html_print_image(
'images/histograma.png',
true,
[
'border' => '0',
'alt' => '',
'class' => 'invert_filter',
]
).'</a>';
}
if (!is_snapshot_data($row['datos'])) { if (!is_snapshot_data($row['datos'])) {
$data[8] .= '<a href="javascript:'.$link.'">'.html_print_image('images/chart.png', true, ['border' => '0', 'alt' => '', 'class' => 'invert_filter']).'</a>'; $data[8] .= '<a href="javascript:'.$link.'">'.html_print_image('images/chart.png', true, ['border' => '0', 'alt' => '', 'class' => 'invert_filter']).'</a>';
} }

View File

@ -147,7 +147,7 @@ echo '<td class="tactical_left_column" id="leftcolumn">';
// The status horizontal bars (Global health, Monitor sanity... // The status horizontal bars (Global health, Monitor sanity...
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
$bg_color = 'background-color: #222'; $bg_color = 'background-color: #222';
if ($config['style'] !== 'pandora_black') { if ($config['style'] !== 'pandora_black' && !is_metaconsole()) {
$bg_color = 'background-color: #fff'; $bg_color = 'background-color: #fff';
} }

View File

@ -72,7 +72,7 @@ echo '<title>'.__('Sound Events').'</title>';
</style> </style>
<?php <?php
echo '<link rel="icon" href="../../'.ui_get_favicon().'" type="image/ico" />'; echo '<link rel="icon" href="../../'.ui_get_favicon().'" type="image/ico" />';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
echo '<link rel="stylesheet" href="../../include/styles/pandora_black.css" type="text/css" />'; echo '<link rel="stylesheet" href="../../include/styles/pandora_black.css" type="text/css" />';
} else { } else {
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css" />'; echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css" />';

View File

@ -225,7 +225,7 @@ $table->data[0][0] .= '<div class="label_select_parent">'.html_print_input_text(
).'</div>'; ).'</div>';
$integria_logo = 'images/integria_logo_gray.png'; $integria_logo = 'images/integria_logo_gray.png';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$integria_logo = 'images/integria_logo.svg'; $integria_logo = 'images/integria_logo.svg';
} }

View File

@ -454,12 +454,17 @@ if ($view_graph) {
data['threshold'] = 1; data['threshold'] = 1;
} }
(function (stacked) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
dataType: "html", dataType: "html",
data: data, data: data,
success: function (data) { success: function (data) {
if (stacked === "<?php echo CUSTOM_GRAPH_VBARS; ?>") {
document.getElementById("div-container").classList.add('w100p', 'height_600px');
}
document.getElementById("div-container").innerHTML = ""; document.getElementById("div-container").innerHTML = "";
$("#spinner_loading").hide(); $("#spinner_loading").hide();
$("#div-container").append(data); $("#div-container").append(data);
@ -468,6 +473,7 @@ if ($view_graph) {
console.error("Fatal error") console.error("Fatal error")
} }
}); });
})(data['stacked']);
}); });

View File

@ -65,6 +65,42 @@ if ($enable_init_date) {
$period = ($datetime - $datetime_init); $period = ($datetime - $datetime_init);
} }
// Shchedule report email.
$schedule_report = get_parameter('schbutton', '');
if (empty($schedule_report) === false) {
$id_user_task = 1;
$scheduled = 'no';
$date = date(DATE_FORMAT);
$time = date(TIME_FORMAT);
$parameters[0] = get_parameter('id_schedule_report');
$parameters[1] = get_parameter('schedule_email_address');
$parameters[2] = get_parameter('schedule_subject', '');
$parameters[3] = get_parameter('schedule_email', '');
$parameters[4] = get_parameter('report_type', '');
$parameters['first_execution'] = strtotime($date.' '.$time);
$values = [
'id_usuario' => $config['id_user'],
'id_user_task' => $id_user_task,
'args' => serialize($parameters),
'scheduled' => $scheduled,
'flag_delete' => 1,
];
$result = db_process_sql_insert('tuser_task_scheduled', $values);
$report_type = $parameters[4];
ui_print_result_message(
$result,
__('Your report has been planned, and the system will email you a '.$report_type.' file with the report as soon as its finished'),
__('An error has ocurred')
);
echo '<br>';
}
// ------------------- INIT HEADER -------------------------------------- // ------------------- INIT HEADER --------------------------------------
$url = "index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report&date=$date&time=$time&pure=$pure"; $url = "index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report&date=$date&time=$time&pure=$pure";
@ -249,16 +285,18 @@ if (reporting_get_description($id_report)) {
$table->data[0][1] = '<div class="float-left">'.reporting_get_name($id_report).'</div>'; $table->data[0][1] = '<div class="float-left">'.reporting_get_name($id_report).'</div>';
} }
$table->data[0][1] .= '<div class="right w100p mrgn_right_50px right_align">'.__('Set initial date').html_print_checkbox('enable_init_date', 1, $enable_init_date, true); $table->data[0][1] .= '<div class="flex-content-right">'.__('Set initial date').html_print_checkbox('enable_init_date', 1, $enable_init_date, true).'</br>';
$html_enterprise = enterprise_hook(
'reporting_print_button_PDF', $html_menu_export = enterprise_hook('reporting_print_button_export');
[$id_report] if ($html_menu_export === ENTERPRISE_NOT_HOOK) {
); $html_menu_export = '';
if ($html_enterprise !== ENTERPRISE_NOT_HOOK) {
$table->data[0][1] .= $html_enterprise;
} }
$table->data[0][1] .= '</div>'; $table->data[0][1] .= '</div>';
$table->data[0][1] .= $html_menu_export;
$table->data[1][1] = '<div>'.__('From').': </div>'; $table->data[1][1] = '<div>'.__('From').': </div>';
$table->data[1][1] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' '; $table->data[1][1] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' ';

View File

@ -37,6 +37,7 @@ if (!$agents || !$searchAgents) {
$table->class = 'databox'; $table->class = 'databox';
$table->head = []; $table->head = [];
if ($only_count) { if ($only_count) {
$table->head[0] = __('Agent'); $table->head[0] = __('Agent');
$table->head[1] = __('Description'); $table->head[1] = __('Description');
@ -57,6 +58,18 @@ if (!$agents || !$searchAgents) {
$table->head[8] = __('Last contact').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectLastContactUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectLastContactDown]).'</a>'; $table->head[8] = __('Last contact').' '.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectLastContactUp]).'</a>'.'<a href="index.php?search_category=agents&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectLastContactDown]).'</a>';
$table->head[9] = ''; $table->head[9] = '';
$table->headstyle = [];
$table->headstyle[0] = 'text-align: left';
$table->headstyle[1] = 'text-align: left';
$table->headstyle[2] = 'text-align: left';
$table->headstyle[3] = 'text-align: left';
$table->headstyle[4] = 'text-align: left';
$table->headstyle[5] = 'text-align: left';
$table->headstyle[6] = 'text-align: left';
$table->headstyle[7] = 'text-align: left';
$table->headstyle[8] = 'text-align: left';
$table->headstyle[9] = 'text-align: center';
$table->align = []; $table->align = [];
$table->align[0] = 'left'; $table->align[0] = 'left';
$table->align[1] = 'left'; $table->align[1] = 'left';

View File

@ -42,6 +42,13 @@ if ($alerts === false || $totalAlerts == 0 || !$searchAlerts) {
$table->align[3] = 'left'; $table->align[3] = 'left';
$table->align[4] = 'left'; $table->align[4] = 'left';
$table->headstyle = [];
$table->headstyle[0] = 'text-align: center';
$table->headstyle[1] = 'text-align: left';
$table->headstyle[2] = 'text-align: left';
$table->headstyle[3] = 'text-align: left';
$table->headstyle[4] = 'text-align: left';
$table->valign = []; $table->valign = [];
$table->valign[0] = 'top'; $table->valign[0] = 'top';
$table->valign[1] = 'top'; $table->valign[1] = 'top';

View File

@ -29,6 +29,10 @@ if ($graphs === false || !$searchGraphs) {
$table->head[0] = __('Graph name'); $table->head[0] = __('Graph name');
$table->head[1] = __('Description'); $table->head[1] = __('Description');
$table->headstyle = [];
$table->headstyle[0] = 'text-align: left';
$table->headstyle[1] = 'text-align: left';
$table->data = []; $table->data = [];
foreach ($graphs as $graph) { foreach ($graphs as $graph) {
array_push( array_push(

View File

@ -32,21 +32,21 @@ $table->id = 'summary';
$table->width = '98%'; $table->width = '98%';
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold; text-align: center;'; $table->style[0] = 'font-weight: bold; text-align: left;';
$table->style[1] = 'font-weight: bold; text-align: center;'; $table->style[1] = 'font-weight: bold; text-align: left;';
$table->style[2] = 'font-weight: bold; text-align: center;'; $table->style[2] = 'font-weight: bold; text-align: left;';
$table->style[3] = 'font-weight: bold; text-align: center;'; $table->style[3] = 'font-weight: bold; text-align: left;';
$table->style[4] = 'font-weight: bold; text-align: center;'; $table->style[4] = 'font-weight: bold; text-align: left;';
$table->style[5] = 'font-weight: bold; text-align: center;'; $table->style[5] = 'font-weight: bold; text-align: left;';
$table->style[6] = 'font-weight: bold; text-align: center;'; $table->style[6] = 'font-weight: bold; text-align: left;';
$table->style[7] = 'font-weight: bold; text-align: center;'; $table->style[7] = 'font-weight: bold; text-align: left;';
$table->style[8] = 'font-weight: bold; text-align: center;'; $table->style[8] = 'font-weight: bold; text-align: left;';
$table->style[9] = 'font-weight: bold; text-align: center;'; $table->style[9] = 'font-weight: bold; text-align: left;';
$table->style[10] = 'font-weight: bold; text-align: center;'; $table->style[10] = 'font-weight: bold; text-align: left;';
$table->style[11] = 'font-weight: bold; text-align: center;'; $table->style[11] = 'font-weight: bold; text-align: left;';
$table->style[13] = 'font-weight: bold; text-align: center;'; $table->style[13] = 'font-weight: bold; text-align: left;';
$table->style[14] = 'font-weight: bold; text-align: center;'; $table->style[14] = 'font-weight: bold; text-align: left;';
$table->style[15] = 'font-weight: bold; text-align: center;'; $table->style[15] = 'font-weight: bold; text-align: left;';

View File

@ -32,6 +32,13 @@ if ($maps === false || !$searchMaps) {
$table->align[1] = 'center'; $table->align[1] = 'center';
$table->align[2] = 'center'; $table->align[2] = 'center';
$table->headstyle = [];
$table->headstyle[0] = 'text-align: left';
$table->headstyle[1] = 'text-align: center';
$table->headstyle[1] = 'text-align: center';
$table->data = []; $table->data = [];
foreach ($maps as $map) { foreach ($maps as $map) {
array_push( array_push(

View File

@ -51,6 +51,17 @@ if (!$modules || !$searchModules) {
$table->align[7] = 'left'; $table->align[7] = 'left';
$table->align[8] = 'left'; $table->align[8] = 'left';
$table->headstyle = [];
$table->headstyle[0] = 'text-align: left';
$table->headstyle[1] = 'text-align: left';
$table->headstyle[2] = 'text-align: left';
$table->headstyle[3] = 'text-align: left';
$table->headstyle[4] = 'text-align: left';
$table->headstyle[5] = 'text-align: left';
$table->headstyle[6] = 'text-align: left';
$table->headstyle[7] = 'text-align: left';
$table->headstyle[8] = 'text-align: left';
$table->data = []; $table->data = [];
$id_type_web_content_string = db_get_value( $id_type_web_content_string = db_get_value(

View File

@ -44,6 +44,8 @@ if ($reports === false || !$searchReports) {
$table->head[3] = __('XML'); $table->head[3] = __('XML');
$table->size[0] = '50%'; $table->size[0] = '50%';
$table->size[1] = '20%'; $table->size[1] = '20%';
$table->headstyle[0] = 'text-align: left';
$table->headstyle[1] = 'text-align: left';
$table->size[2] = '2%'; $table->size[2] = '2%';
$table->headstyle[2] = 'min-width: 35px;text-align: left;'; $table->headstyle[2] = 'min-width: 35px;text-align: left;';
$table->size[3] = '2%'; $table->size[3] = '2%';

View File

@ -30,6 +30,14 @@ if (!$users || !$searchUsers) {
$table->align = []; $table->align = [];
$table->align[4] = 'center'; $table->align[4] = 'center';
$table->headstyle = [];
$table->headstyle[0] = 'text-align: left';
$table->headstyle[1] = 'text-align: left';
$table->headstyle[2] = 'text-align: left';
$table->headstyle[3] = 'text-align: left';
$table->headstyle[4] = 'text-align: center';
$table->headstyle[5] = 'text-align: left';
$table->head = []; $table->head = [];
$table->head[0] = __('User ID').' '.'<a href="index.php?search_category=users&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=id_user&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectUserIDUp]).'</a>'.'<a href="index.php?search_category=users&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=id_user&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectUserIDDown]).'</a>'; $table->head[0] = __('User ID').' '.'<a href="index.php?search_category=users&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=id_user&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectUserIDUp]).'</a>'.'<a href="index.php?search_category=users&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=id_user&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectUserIDDown]).'</a>';
$table->head[1] = __('Name').' '.'<a href="index.php?search_category=users&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).'</a>'.'<a href="index.php?search_category=users&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).'</a>'; $table->head[1] = __('Name').' '.'<a href="index.php?search_category=users&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).'</a>'.'<a href="index.php?search_category=users&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).'</a>';
@ -38,6 +46,8 @@ if (!$users || !$searchUsers) {
$table->head[4] = __('Profile').' '.'<a href="index.php?search_category=users&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=profile&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectProfileUp]).'</a>'.'<a href="index.php?search_category=users&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=profile&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectProfileDown]).'</a>'; $table->head[4] = __('Profile').' '.'<a href="index.php?search_category=users&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=profile&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectProfileUp]).'</a>'.'<a href="index.php?search_category=users&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=profile&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectProfileDown]).'</a>';
$table->head[5] = __('Description'); $table->head[5] = __('Description');
$table->data = []; $table->data = [];
foreach ($users as $user) { foreach ($users as $user) {

View File

@ -33,7 +33,6 @@ $headerTitle = __('User detail editor');
require $config['homedir'].'/operation/users/user_edit_header.php'; require $config['homedir'].'/operation/users/user_edit_header.php';
if (is_metaconsole() === false) { if (is_metaconsole() === false) {
date_default_timezone_set('UTC');
include 'include/javascript/timezonepicker/includes/parser.inc'; include 'include/javascript/timezonepicker/includes/parser.inc';
// Read in options for map builder. // Read in options for map builder.
@ -350,7 +349,7 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
$usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group)); $usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group));
$id_usr = $config['id_user']; $id_usr = $config['id_user'];
$skin = '';
if (!$meta) { if (!$meta) {
$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>'; $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 = [ $values = [
@ -396,10 +395,7 @@ if (!$meta) {
$home_screen .= '</div>'; $home_screen .= '</div>';
$home_screen .= html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true, false); $home_screen .= html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true, false);
// User only can change skins if has more than one group. // User only can change skins if has more than one group.
$skin = '';
if (function_exists('skins_print_select')) { if (function_exists('skins_print_select')) {
if (count($usr_groups) > 1) { if (count($usr_groups) > 1) {
$skin = '<div class="label_select"><p class="edit_user_labels">'.__('Skin').': </p>'; $skin = '<div class="label_select"><p class="edit_user_labels">'.__('Skin').': </p>';
@ -408,7 +404,16 @@ if (!$meta) {
} }
} else { } else {
$home_screen = ''; $home_screen = '';
$skin = ''; // User only can change skins if has more than one group.
if (function_exists('skins_print_select')) {
if (count($usr_groups) > 1) {
$skin = '<div class="label_select"><p class="edit_user_labels">'.__('Skin').ui_print_help_tip(
__('This change will only apply to nodes'),
true
).'</p>';
$skin .= skins_print_select($id_usr, 'skin', $user_info['id_skin'], '', __('None'), 0, true).'</div>';
}
}
} }
$timezone = '<div class="label_select"><p class="edit_user_labels">'.__('Timezone').ui_print_help_tip(__('The timezone must be that of the associated server.'), true).'</p>'; $timezone = '<div class="label_select"><p class="edit_user_labels">'.__('Timezone').ui_print_help_tip(__('The timezone must be that of the associated server.'), true).'</p>';

View File

@ -97,7 +97,7 @@ $visualConsoleData = $visualConsole->toArray();
$visualConsoleName = $visualConsoleData['name']; $visualConsoleName = $visualConsoleData['name'];
$bg_color = ''; $bg_color = '';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$bg_color = 'style="background-color: #222"'; $bg_color = 'style="background-color: #222"';
} }

View File

@ -269,7 +269,7 @@ if ($pure === false) {
$class_basic_chart = 'basic_chart_min link-create-item'; $class_basic_chart = 'basic_chart_min link-create-item';
$class_delete = 'delete_item delete_min'; $class_delete = 'delete_item delete_min';
$class_copy = 'copy_item'; $class_copy = 'copy_item';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$class_camera = 'camera_min_white link-create-item'; $class_camera = 'camera_min_white link-create-item';
$class_percentile = 'percentile_item_min_white link-create-item'; $class_percentile = 'percentile_item_min_white link-create-item';
$class_module_graph = 'graph_min_white link-create-item'; $class_module_graph = 'graph_min_white link-create-item';
@ -398,6 +398,17 @@ if ($pure === false) {
echo '</div>'; echo '</div>';
if ($aclWrite === true || $aclManage === true) { if ($aclWrite === true || $aclManage === true) {
if (!is_metaconsole()) {
echo '<a id ="force_check" href="" style="margin-right: 25px;">'.html_print_image(
'images/target.png',
true,
[
'title' => __('Force remote checks'),
'class' => 'invert_filter',
]
).'</a>';
}
echo html_print_checkbox_switch('edit-mode', 1, false, true); echo html_print_checkbox_switch('edit-mode', 1, false, true);
} }
@ -406,7 +417,7 @@ if ($pure === false) {
} }
$bg_color = ''; $bg_color = '';
if ($config['style'] === 'pandora_black') { if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$bg_color = 'style="background-color: #222"'; $bg_color = 'style="background-color: #222"';
} }
@ -671,12 +682,14 @@ if ($edit_capable === true) {
if ($(this).prop('checked')) { if ($(this).prop('checked')) {
visualConsoleManager.visualConsole.enableEditMode(); visualConsoleManager.visualConsole.enableEditMode();
visualConsoleManager.changeUpdateInterval(0); visualConsoleManager.changeUpdateInterval(0);
$('#force_check').hide();
$('#edit-controls').css('visibility', ''); $('#edit-controls').css('visibility', '');
} else { } else {
visualConsoleManager.visualConsole.disableEditMode(); visualConsoleManager.visualConsole.disableEditMode();
visualConsoleManager.visualConsole.unSelectItems(); visualConsoleManager.visualConsole.unSelectItems();
visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>); // To ms. visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>); // To ms.
$('#edit-controls').css('visibility', 'hidden'); $('#edit-controls').css('visibility', 'hidden');
$('#force_check').show();
} }
}); });
<?php <?php
@ -750,6 +763,37 @@ if ($edit_capable === true) {
}); });
$('#force_check').click(function (e) {
e.preventDefault();
visualConsoleManager.changeUpdateInterval(0);
const id_layout = '<?php echo $visualConsoleId; ?>';
$.ajax({
type: "GET",
url: "ajax.php",
dataType: "json",
data: {
page: "include/ajax/visual_console.ajax",
force_remote_check: true,
id_layout: id_layout
},
success: function (data) {
if (data == 1) {
visualConsoleManager.changeUpdateInterval(5000);
setTimeout(resetInterval, 6000);
} else {
resetInterval();
}
},
error: function (data) {
resetInterval();
}
});
});
function resetInterval() {
visualConsoleManager.changeUpdateInterval(<?php echo ($refr * 1000); ?>);
}
/** /**
* Process ajax responses and shows a dialog with results. * Process ajax responses and shows a dialog with results.
*/ */

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.759 %define version 7.0NG.759
%define release 220110 %define release 220125
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.759 %define version 7.0NG.759
%define release 220110 %define release 220125
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.759 %define version 7.0NG.759
%define release 220110 %define release 220125
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -2856,7 +2856,8 @@ CREATE TABLE IF NOT EXISTS `tservice_element` (
`id_service_child` int(10) unsigned NOT NULL default 0, `id_service_child` int(10) unsigned NOT NULL default 0,
`id_server_meta` int(10) unsigned NOT NULL default 0, `id_server_meta` int(10) unsigned NOT NULL default 0,
`rules` text, `rules` text,
PRIMARY KEY (`id`) PRIMARY KEY (`id`),
INDEX `IDX_tservice_element` (`id_service`,`id_agente_modulo`)
) ENGINE=InnoDB ) ENGINE=InnoDB
COMMENT = 'Table to define the modules and the weights of the modules that define a service' COMMENT = 'Table to define the modules and the weights of the modules that define a service'
DEFAULT CHARSET=utf8; DEFAULT CHARSET=utf8;

View File

@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_report_front_logo', 'images/pandora_logo_white.jpg'), ('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''), ('custom_report_front_header', ''),
('custom_report_front_footer', ''), ('custom_report_front_footer', ''),
('MR', 50), ('MR', 51),
('identification_reminder', 1), ('identification_reminder', 1),
('identification_reminder_timestamp', 0), ('identification_reminder_timestamp', 0),
('current_package', 758), ('current_package', 759),
('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.00097656250000":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'), ('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.00097656250000":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'),
('custom_docs_logo', 'default_docs.png'), ('custom_docs_logo', 'default_docs.png'),
('custom_support_logo', 'default_support.png'), ('custom_support_logo', 'default_support.png'),

Some files were not shown because too many files have changed in this diff Show More