resolved conflict

This commit is contained in:
Daniel Maya 2023-10-06 09:15:38 +02:00
commit 030ffc55f9
130 changed files with 10213 additions and 5562 deletions

View File

@ -1,2 +1,3 @@
@at 00:00 /every:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 "%CD%\restart_pandora_agent.bat"
@at 00:00 /every:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 "'%CD%\restart_pandora_agent.bat'"
schtasks /change /tn pandora_agent_restart /tr "'%CD%\restart_pandora_agent.bat'"

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.773.3-230927
Version: 7.0NG.773.3-231006
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230927
%define release 231006
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230927
%define release 231006
Summary: Pandora FMS Linux agent, binary version
Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230927
%define release 231006
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773.3"
PI_BUILD="230927"
PI_BUILD="231006"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230927}
{231006}
ViewReadme
{Yes}

View File

@ -1,2 +1,3 @@
@at 00:00 /every:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 "%CD%\restart_pandora_agent.bat"
@at 00:00 /every:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 "'%CD%\restart_pandora_agent.bat'"
schtasks /change /tn pandora_agent_restart /tr "'%CD%\restart_pandora_agent.bat'"

View File

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

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.773.3(Build 230927))"
VALUE "ProductVersion", "(7.0NG.773.3(Build 231006))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.773.3-230927
Version: 7.0NG.773.3-231006
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -1707,4 +1707,12 @@ enterprise/godmode/wizards/Applications.class.php
enterprise/godmode/wizards/Cloud.class.php
enterprise/images/wizard/applications.png
enterprise/images/wizard/cloud.png
enterprise/images/wizard/consoletasks.png
enterprise/images/wizard/consoletasks.png
operation/incidents/configure_integriaims_incident.php
operation/incidents/dashboard_detail_integriaims_incident.php
operation/incidents/incident_statistics.php
operation/incidents/integriaims_export_csv.php
operation/incidents/list_integriaims_incidents.php
include/functions_incidents.php
include/functions_integriaims.php
include/ajax/integria_incidents.ajax.php

View File

@ -106,6 +106,51 @@ CREATE TABLE IF NOT EXISTS `tgraph_analytics_filter` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
CREATE TABLE IF NOT EXISTS `tconfig_os_version` (
`id_os_version` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`product` TEXT,
`version` TEXT,
`end_of_support` VARCHAR(10) DEFAULT NULL,
PRIMARY KEY (`id_os_version`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
ALTER TABLE `tusuario` MODIFY COLUMN `integria_user_level_pass` TEXT;
DROP TABLE `tincidencia`;
DROP TABLE `tnota`;
DROP TABLE `tattachment`;
ALTER TABLE `talert_commands` ADD CONSTRAINT UNIQUE (`name`);
ALTER TABLE `talert_actions` MODIFY COLUMN `name` VARCHAR(500);
ALTER TABLE `talert_actions` ADD CONSTRAINT UNIQUE (`name`);
SET @command_name = 'Pandora ITSM Ticket';
SET @command_description = 'Create a ticket in Pandora ITSM';
SET @action_name = 'Create Pandora ITSM ticket';
UPDATE `talert_commands` SET `name` = @command_name, `description` = @command_description WHERE `name` = 'Integria IMS Ticket' AND `internal` = 1;
INSERT IGNORE INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES (@command_name,'Internal type',@command_description,1,'["Ticket title","Ticket group ID","Ticket priority","Ticket owner","Ticket type","Ticket status","Ticket description","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_"]','["", "_ITSM_groups_", "_ITSM_priorities_","_ITSM_users_","_ITSM_types_","_ITSM_status_","_html_editor_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_","_custom_field_ITSM_"]');
SELECT @id_alert_command := `id` FROM `talert_commands` WHERE `name` = @command_name;
UPDATE `talert_actions` SET `name` = @action_name WHERE `name` = 'Create Integria IMS ticket' AND `id_alert_command` = @id_alert_command;
INSERT IGNORE INTO `talert_actions` (`name`, `id_alert_command`) VALUES (@action_name,@id_alert_command);
SET @event_response_name = 'Create ticket in Pandora ITSM from event';
SET @event_response_description = 'Create a ticket in Pandora ITSM from an event';
SET @event_response_target = 'index.php?sec=manageTickets&sec2=operation/ITSM/itsm&operation=edit&from_event=_event_id_';
SET @event_response_type = 'url';
SET @event_response_id_group = 0;
SET @event_response_modal_width = 0;
SET @event_response_modal_height = 0;
SET @event_response_new_window = 1;
SET @event_response_params = '';
SET @event_response_server_to_exec = 0;
SET @event_response_command_timeout = 90;
SET @event_response_display_command = 1;
UPDATE `tevent_response` SET `name` = @event_response_name, `description` = @event_response_description, `target` = @event_response_target, `display_command` = @event_response_display_command WHERE `name` = 'Create ticket in IntegriaIMS from event';
INSERT IGNORE INTO `tevent_response` (`name`, `description`, `target`,`type`,`id_group`,`modal_width`,`modal_height`,`new_window`,`params`,`server_to_exec`,`command_timeout`,`display_command`) VALUES (@event_response_name, @event_response_description, @event_response_target, @event_response_type, @event_response_id_group, @event_response_modal_width, @event_response_modal_height, @event_response_new_window, @event_response_params, @event_response_server_to_exec, @event_response_command_timeout, @event_response_display_command);
UPDATE `twelcome_tip`
SET title = 'Scheduled downtimes',
url = 'https://pandorafms.com/manual/en/documentation/04_using/11_managing_and_administration#scheduled_downtimes'
@ -143,6 +188,10 @@ ADD COLUMN `time_init` VARCHAR(45) NULL AFTER `date_init`,
ADD COLUMN `date_end` VARCHAR(45) NULL AFTER `time_init`,
ADD COLUMN `time_end` VARCHAR(45) NULL AFTER `date_end`;
INSERT INTO `tconfig_os_version` (`id_os_version`, `product`, `version`, `end_of_support`) VALUES (1,'Windows.*','7.*','2020/01/14');
INSERT INTO `tconfig_os_version` (`id_os_version`, `product`, `version`, `end_of_support`) VALUES (2,'Cisco.*','IOS 3.4.3','2017/05/12');
INSERT INTO `tconfig_os_version` (`id_os_version`, `product`, `version`, `end_of_support`) VALUES (3,'Linux.*','Centos 7.*','2022/01/01');
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.vmware';
-- Insert new Proxmox APP
@ -160,6 +209,86 @@ INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, ''_exec1_' -g '__taskGroup__' --host '_host_' --port '_port_' --user '_user_' --password '_password_' --vm '_scanVM_' --lxc '_scanLXC_' --backups '_scanBackups_' --nodes '_scanNodes_' --transfer_mode tentacle --tentacle_address '_tentacleIP_' --tentacle_port '_tentaclePort_' --as_discovery_plugin 1');
-- Insert new EC2 APP
SET @short_name = 'pandorafms.aws.ec2';
SET @name = 'Amazon EC2';
SET @section = 'cloud';
SET @description = 'Monitor AWS EC2 instances';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_aws_ec2');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/aws_ec2');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, ''_exec1_' --conf '_tempfileEC2_'');
-- Insert new RDS APP
SET @short_name = 'pandorafms.aws.rds';
SET @name = 'Amazon RDS';
SET @section = 'cloud';
SET @description = 'Monitor AWS RDS instances';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_aws_rds');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/aws_rds');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, ''_exec1_' --conf '_tempfileRDS_'');
-- Insert new S3 APP
SET @short_name = 'pandorafms.aws.s3';
SET @name = 'Amazon S3';
SET @section = 'cloud';
SET @description = 'Monitor AWS S3 buckets';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_aws_s3');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/aws_s3');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, ''_exec1_' --conf '_tempfileS3_'');
-- Insert new Azure APP
SET @short_name = 'pandorafms.azure.mc';
SET @name = 'Azure Microsoft Compute';
SET @section = 'cloud';
SET @description = 'Monitor Azure Microsoft Compute VMs';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_azure_mc');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/azure_vm');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, ''_exec1_' --conf '_tempfileAzureMC_'');
-- Insert new Google APP
SET @short_name = 'pandorafms.gcp.ce';
SET @name = 'Google Cloud Compute Engine';
SET @section = 'cloud';
SET @description = 'Monitor Google Cloud Platform Compute Engine VMs';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_gcp_ce');
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec2_', 'bin/google_instances');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, ''_exec1_' --conf '_tempfileGoogleCE_'');
ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT;

View File

@ -1,31 +1,43 @@
<?php
/**
* ITSM.
*
* @category ITSM view
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
use PandoraFMS\ITSM\ITSM;
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
require_once 'include/functions_incidents.php';
check_login();
if (!$config['integria_enabled']) {
ui_print_error_message(__('In order to access ticket management system, integration with Integria IMS must be enabled and properly configured'));
if (!$config['ITSM_enabled']) {
ui_print_error_message(__('In order to access ticket management system, integration with ITSM must be enabled and properly configured'));
return;
}
$group = $id_grupo;
if (! check_acl($config['id_user'], $group, 'AW', $id_agente)) {
if (! check_acl($config['id_user'], $id_grupo, 'AW', $id_agente)) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access agent manager'
@ -34,104 +46,11 @@ if (! check_acl($config['id_user'], $group, 'AW', $id_agente)) {
return;
}
$offset = (int) get_parameter('offset', 0);
// See if id_agente is set (either POST or GET, otherwise -1
$id_agent = (int) get_parameter('id_agente');
$groups = users_get_groups($config['id_user'], 'AR');
$filter = ' AND id_agent = '.$id_agent;
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agent;
$params = [
'',
'-10',
'1',
'-1',
'0',
'',
'',
'',
agents_get_name($id_agent),
];
$result = integria_api_call(null, null, null, null, 'get_incidents', $params, false, 'json', ',');
$result = json_decode($result, true);
if (empty($result) === true) {
$result = [];
$count = 0;
echo '<div class="nf">'.__('No incidents associated to this agent').'</div><br />';
return;
} else {
$count = count($result);
$result = array_slice($result, $offset, $config['block_size']);
try {
$ITSM = new ITSM();
echo $ITSM->getTableIncidencesForAgent($id_agente);
} catch (Exception $e) {
echo $e->getMessage();
}
// Show pagination.
ui_pagination($count, $url, $offset, 0, false, 'offset');
// ($count + $offset) it's real count of incidents because it's use LIMIT $offset in query.
echo '<br />';
// Show headers.
$table->width = '100%';
$table->class = 'databox';
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->head = [];
$table->data = [];
$table->size = [];
$table->align = [];
$table->head[0] = __('ID');
$table->head[1] = __('Status');
$table->head[2] = __('Incident');
$table->head[3] = __('Priority');
$table->head[4] = __('Group');
$table->head[5] = __('Updated');
$table->size[0] = 43;
$table->size[7] = 50;
$table->align[1] = 'center';
$table->align[3] = 'center';
$table->align[4] = 'center';
$rowPair = true;
$iterator = 0;
foreach ($result as $row) {
if ($rowPair) {
$table->rowclass[$iterator] = 'rowPair';
} else {
$table->rowclass[$iterator] = 'rowOdd';
}
$rowPair = !$rowPair;
$iterator++;
$data = [];
$data[0] = '<a href="index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$row['id_incidencia'].'">'.$row['id_incidencia'].'</a>';
$attach = incidents_get_attach($row['id_incidencia']);
if (!empty($attach)) {
$data[0] .= '&nbsp;&nbsp;'.html_print_image('images/attachment.png', true, ['style' => 'align:middle;']);
}
$data[1] = incidents_print_status_img($row['estado'], true);
$data[2] = '<a href="index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$row['id_incidencia'].'">'.substr(io_safe_output($row['titulo']), 0, 45).'</a>';
$data[3] = incidents_print_priority_img($row['prioridad'], true);
$data[4] = $row['id_grupo'];
$data[5] = ui_print_timestamp($row['actualizacion'], true);
array_push($table->data, $data);
}
html_print_table($table);
echo '</div>';
unset($table);
echo '<br><br>';
echo '<div id="both">&nbsp;</div>';
html_print_action_buttons('');

View File

@ -548,6 +548,21 @@ $tableAgent->data['os'][0] .= html_print_div(
true
);
$tableAgent->data['caption_os_version'][0] = __('OS version');
$tableAgent->rowclass['os_version'] = 'w540px';
$tableAgent->data['os_version'][0] = html_print_input_text(
'os_version',
$os_version,
'',
16,
100,
true,
false,
false,
'',
'w540px'
);
$tableAgent->data['caption_server'][0] = __('Server');
$tableAgent->rowclass['server'] = 'w540px';
$tableAgent->data['server'][0] = html_print_select(

View File

@ -39,6 +39,7 @@ ui_require_javascript_file('encode_decode_base64');
ui_require_css_file('agent_manager');
use PandoraFMS\Event;
use PandoraFMS\ITSM\ITSM;
check_login();
@ -215,6 +216,7 @@ if ($create_agent) {
$id_parent = (int) get_parameter_post('id_agent_parent');
$server_name = (string) get_parameter_post('server_name');
$id_os = (int) get_parameter_post('id_os');
$os_version = (string) get_parameter_post('os_version');
$disabled = (int) get_parameter_post('disabled');
$custom_id_safe_output = strip_tags(io_safe_output(get_parameter('custom_id', '')));
$custom_id = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $custom_id_safe_output)));
@ -283,6 +285,7 @@ if ($create_agent) {
'comentarios' => $comentarios,
'modo' => $modo,
'id_os' => $id_os,
'os_version' => $os_version,
'disabled' => $disabled,
'cascade_protection' => $cascade_protection,
'cascade_protection_module' => $cascade_protection_module,
@ -607,23 +610,6 @@ if ($id_agente) {
$agent_wizard['active'] = false;
}
$total_incidents = agents_get_count_incidents($id_agente);
// Incident tab.
if ($total_incidents > 0) {
$incidenttab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente,
'image' => 'images/logs@svg.svg',
'title' => __('Incidents'),
],
true
);
$incidenttab['active'] = ($tab === 'incident');
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
if ($has_remote_conf !== false) {
$agent_name = agents_get_name($id_agente);
@ -998,6 +984,7 @@ if ($update_agent) {
$modo = (int) get_parameter_post('modo', 0);
// Mode: Learning, Normal or Autodisabled.
$id_os = (int) get_parameter_post('id_os');
$os_version = (string) get_parameter_post('os_version');
$disabled = (bool) get_parameter_post('disabled');
$server_name = (string) get_parameter_post('server_name', '');
$id_parent = (int) get_parameter_post('id_agent_parent');
@ -1123,6 +1110,7 @@ if ($update_agent) {
'disabled' => $disabled,
'id_parent' => $id_parent,
'id_os' => $id_os,
'os_version' => $os_version,
'modo' => $modo,
'alias' => $alias,
'alias_as_name' => $alias_as_name,
@ -1284,6 +1272,7 @@ if ($id_agente) {
$server_name = $agent['server_name'];
$modo = $agent['modo'];
$id_os = $agent['id_os'];
$os_version = $agent['os_version'];
$disabled = $agent['disabled'];
$id_parent = $agent['id_parent'];
$custom_id = $agent['custom_id'];

View File

@ -405,6 +405,12 @@ $actions = array_slice($actions, $offset, $limit);
$rowPair = true;
$iterator = 0;
foreach ($actions as $action) {
if ((isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false)
&& $action['name'] === 'Create&#x20;Pandora&#x20;ITSM&#x20;ticket'
) {
continue;
}
if ($rowPair) {
$table->rowclass[$iterator] = 'rowPair';
} else {

View File

@ -1,16 +1,33 @@
<?php
/**
* Alerts commands.
*
* @category Alerts
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
use PandoraFMS\ITSM\ITSM;
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars.
global $config;
@ -51,9 +68,9 @@ if (is_ajax()) {
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
// Snmp alerts are not in the metaconsole so they cannot be centralized.
$is_management_allowed = false;
$management_is_not_allowed = false;
if ($get_recovery_fields !== 0) {
$is_management_allowed = !is_management_allowed();
$management_is_not_allowed = !is_management_allowed();
}
// If command ID is not provided, check for action id.
@ -135,6 +152,17 @@ if (is_ajax()) {
$style = ((int) $field_hidden === 1) ? '-webkit-text-security: disc; font-family: text-security-disc;' : '';
$recovery_disabled = 0;
if (empty($command) === false && $command['name'] === io_safe_input('Pandora ITSM Ticket')) {
if ($management_is_not_allowed == 0) {
if (preg_match('/^_html_editor_$/i', $field_value) || $field_description === 'Ticket status') {
$recovery_disabled = 0;
} else {
$recovery_disabled = 1;
}
}
}
if (!empty($field_value)) {
$field_value = io_safe_output($field_value);
// HTML type.
@ -150,7 +178,7 @@ if (is_ajax()) {
0,
'',
false,
$is_management_allowed,
$management_is_not_allowed,
"UndefineTinyMCE('#textarea_field".$i."_value')",
'',
true
@ -162,7 +190,7 @@ if (is_ajax()) {
0,
'',
true,
$is_management_allowed,
$management_is_not_allowed,
"defineTinyMCE('#textarea_field".$i."_value')",
'',
true
@ -177,7 +205,7 @@ if (is_ajax()) {
'class="fields w100p"',
true,
'',
$is_management_allowed
$management_is_not_allowed
);
$editor_type_chkbx = '<div id="command_div"><b><small>';
@ -187,7 +215,7 @@ if (is_ajax()) {
0,
'',
false,
$is_management_allowed,
$management_is_not_allowed,
"UndefineTinyMCE('#textarea_field".$i."_recovery_value')",
'',
true
@ -199,7 +227,7 @@ if (is_ajax()) {
0,
'',
true,
$is_management_allowed,
$management_is_not_allowed,
"defineTinyMCE('#textarea_field".$i."_recovery_value')",
'',
true
@ -214,7 +242,7 @@ if (is_ajax()) {
'class="fields_recovery"',
true,
'',
$is_management_allowed
$management_is_not_allowed || $recovery_disabled
);
} else if (preg_match('/^_content_type_$/i', $field_value)) {
$editor_type_chkbx = '<div id="command_div"><b><small>';
@ -228,7 +256,7 @@ if (is_ajax()) {
'text/plain',
'',
'',
$is_management_allowed,
$management_is_not_allowed,
'',
'',
true
@ -240,7 +268,7 @@ if (is_ajax()) {
'text/html',
'',
'text/html',
$is_management_allowed,
$management_is_not_allowed,
'',
'',
true
@ -259,7 +287,7 @@ if (is_ajax()) {
'text/plain',
'',
'',
$is_management_allowed,
$management_is_not_allowed,
'',
'',
true
@ -271,7 +299,7 @@ if (is_ajax()) {
'text/html',
'',
'text/html',
$is_management_allowed,
$management_is_not_allowed,
'',
'',
true
@ -279,78 +307,304 @@ if (is_ajax()) {
$editor_type_chkbx .= '</small></b></div>';
$rfield = $editor_type_chkbx;
// Select type.
} else if (preg_match('/^_integria_type_custom_field_$/i', $field_value)) {
$ffield = '';
$rfield = '';
} else if (preg_match('/^_custom_field_ITSM_$/i', $field_value)) {
$ffield = '';
$rfield = '';
$ffield .= '<div name="field'.$i.'_value_container">'.html_print_switch(
[
'name' => 'field'.$i.'_value[]',
'value' => '',
]
).'</div>';
$rfield .= '<div name="field'.$i.'_recovery_value_container">'.html_print_switch(
[
'name' => 'field'.$i.'_recovery_value[]',
'value' => '',
]
).'</div>';
$ffield .= '<div name="field'.$i.'_value_container">'.html_print_switch(
[
'name' => 'field'.$i.'_value[]',
'value' => '',
]
).'</div>';
$rfield .= '<div name="field'.$i.'_recovery_value_container">'.html_print_switch(
[
'name' => 'field'.$i.'_recovery_value[]',
'value' => '',
'disabled' => $management_is_not_allowed || $recovery_disabled,
]
).'</div>';
$ffield .= html_print_select(
'',
'field'.$i.'_value[]',
$ffield .= html_print_select(
'',
'field'.$i.'_value[]',
'',
'',
__('None'),
'',
true,
false,
false,
'fields',
$management_is_not_allowed,
'width: 100%;',
false,
false,
false,
'',
false,
false,
false,
false,
false
);
$rfield .= html_print_select(
'',
'field'.$i.'_recovery_value[]',
'',
'',
__('None'),
'',
true,
false,
false,
'fields',
$management_is_not_allowed || $recovery_disabled,
'width: 100%;',
false,
false,
false,
'',
false,
false,
false,
false,
false
);
$ffield .= html_print_input_text(
'field'.$i.'_value[]',
'',
'',
50,
50,
true,
false,
false,
'',
'datepicker',
'',
'off',
false,
'',
'',
'',
$management_is_not_allowed
);
$rfield .= html_print_input_text(
'field'.$i.'_recovery_value[]',
'',
'',
50,
50,
true,
false,
false,
'',
'datepicker',
'',
'off',
false,
'',
'',
'',
$management_is_not_allowed || $recovery_disabled
);
$ffield .= html_print_textarea(
'field'.$i.'_value[]',
5,
1,
'',
'style="min-height:40px; '.$style.'" class="fields"',
true,
'',
$management_is_not_allowed
);
$rfield .= html_print_textarea(
'field'.$i.'_recovery_value[]',
5,
1,
'',
'style="min-height:40px; '.$style.'" class="fields_recovery',
true,
'',
$management_is_not_allowed || $recovery_disabled
);
$values_input_number = [
'name' => 'field'.$i.'_value[]',
'value' => 0,
'id' => 'field'.$i.'_value',
'return' => true,
];
if ($management_is_not_allowed === true) {
$values_input_number['disabled'] = true;
}
$ffield .= html_print_input_number($values_input_number);
$values_input_number_recovery = [
'name' => 'field'.$i.'_recovery_value[]',
'value' => 0,
'id' => 'field'.$i.'_recovery_value',
'return' => true,
];
if ($management_is_not_allowed || $recovery_disabled) {
$values_input_number_recovery['disabled'] = true;
}
$rfield .= html_print_input_number($values_input_number_recovery);
$ffield .= html_print_input_text(
'field'.$i.'_value[]',
'',
'',
50,
255,
true,
false,
false,
'',
'normal w98p',
'',
'off',
false,
false,
'',
'',
$management_is_not_allowed
);
$rfield .= html_print_input_text(
'field'.$i.'_recovery_value[]',
'',
'',
50,
255,
true,
false,
false,
'',
'normal w98p',
'',
'off',
false,
false,
'',
'',
$management_is_not_allowed || $recovery_disabled
);
} else if (str_starts_with($field_value, '_ITSM_')) {
$nothing = '';
$nothing_value = 0;
$mode = 'select';
switch ($field_value) {
case '_ITSM_groups_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getGroups();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
break;
case '_ITSM_priorities_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getPriorities();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
break;
case '_ITSM_types_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getObjectypes();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
$nothing = __('None');
$nothing_value = 0;
break;
case '_ITSM_status_':
$fields_array = [];
try {
$ITSM = new ITSM();
$fields_array = $ITSM->getStatus();
} catch (\Throwable $th) {
$error = $th->getMessage();
$fields_array = [];
}
break;
default:
// Nothing.
$mode = '';
break;
}
if ($mode === 'select') {
$ffield = html_print_select(
$fields_array,
'field'.$i.'_value',
'',
'',
__('None'),
'',
$nothing,
$nothing_value,
true,
false,
false,
'fields',
$is_management_allowed,
'width: 100%;'
$management_is_not_allowed
);
$rfield .= html_print_select(
'',
'field'.$i.'_recovery_value[]',
$rfield = html_print_select(
$fields_array,
'field'.$i.'_recovery_value',
'',
'',
__('None'),
'',
$nothing,
$nothing_value,
true,
false,
false,
'fields',
$is_management_allowed,
'width: 100%;'
'fields_recovery',
$management_is_not_allowed || $recovery_disabled
);
$ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker');
$rfield .= html_print_input_text('field'.$i.'_recovery_value[]', '', '', 10, 10, true, false, false, '', 'datepicker');
$ffield .= html_print_textarea(
'field'.$i.'_value[]',
5,
1,
} else {
$ffield = html_print_autocomplete_users_from_pandora_itsm(
'field'.$i.'_value',
'',
'style="min-height:40px; '.$style.'" class="fields"',
true,
'',
$is_management_allowed
0,
$management_is_not_allowed,
false,
'ITSM_users'
);
$rfield .= html_print_textarea(
'field'.$i.'_recovery_value[]',
5,
1,
$rfield = html_print_autocomplete_users_from_pandora_itsm(
'field'.$i.'_recovery_value',
'',
'style="min-height:40px; '.$style.'" class="fields_recovery',
true,
'',
$is_management_allowed
0,
$management_is_not_allowed || $recovery_disabled,
false,
'ITSM_users'
);
}
} else {
$fields_value_select = [];
$force_print_select = false;
@ -468,7 +722,7 @@ if (is_ajax()) {
false,
false,
'fields',
$is_management_allowed
$management_is_not_allowed
);
$rfield = html_print_select(
$fields_value_select,
@ -481,7 +735,7 @@ if (is_ajax()) {
false,
false,
'fields_recovery',
$is_management_allowed
$management_is_not_allowed || $recovery_disabled
);
} else {
$ffield = html_print_textarea(
@ -492,7 +746,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields min-height-40px w100p"',
true,
'',
$is_management_allowed
$management_is_not_allowed
);
$rfield = html_print_textarea(
'field'.$i.'_recovery_value',
@ -502,7 +756,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields_recovery min-height-40px w100p',
true,
'',
$is_management_allowed
$management_is_not_allowed || $recovery_disabled
);
}
}
@ -515,7 +769,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields min-height-40px w100p"',
true,
'',
$is_management_allowed
$management_is_not_allowed
);
$rfield = html_print_textarea(
'field'.$i.'_recovery_value',
@ -525,7 +779,7 @@ if (is_ajax()) {
'style="'.$style.'" class="fields_recovery min-height-40px w100p"',
true,
'',
$is_management_allowed
$management_is_not_allowed || $recovery_disabled
);
}
@ -684,9 +938,7 @@ if ($delete_command) {
$result = alerts_delete_alert_command($id);
$auditMessage = ((bool) $result === true)
? sprintf('Delete alert command #%s', $id)
: sprintf('Fail try to delete alert command #%s', $id);
$auditMessage = ((bool) $result === true) ? sprintf('Delete alert command #%s', $id) : sprintf('Fail try to delete alert command #%s', $id);
db_pandora_audit(
AUDIT_LOG_ALERT_MANAGEMENT,
@ -775,6 +1027,12 @@ $commands = array_slice($commands, $offset, $limit);
foreach ($commands as $command) {
$data = [];
if ((isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false)
&& $command['name'] === 'Pandora&#x20;ITSM&#x20;Ticket'
) {
continue;
}
$data['name'] = '<span>';
// (IMPORTANT, DO NOT CHANGE!) only users with permissions over "All" group have access to edition of commands belonging to "All" group.

View File

@ -105,8 +105,8 @@ $groups_user = users_get_groups($config['id_user']);
if (!empty($groups_user)) {
$groups = implode(',', array_keys($groups_user));
if ($config['integria_enabled'] == 0) {
$integria_command = 'Integria&#x20;IMS&#x20;Ticket';
if ($config['ITSM_enabled'] == 0) {
$integria_command = 'Pandora&#x20;ITSM&#x20;Ticket';
$sql = sprintf('SELECT taa.id, taa.name FROM talert_actions taa INNER JOIN talert_commands tac ON taa.id_alert_command = tac.id WHERE tac.name <> "%s" AND taa.id_group IN (%s)', $integria_command, $groups);
} else {
$sql = "SELECT id, name FROM talert_actions WHERE id_group IN ($groups)";

View File

@ -11,12 +11,12 @@
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
use PandoraFMS\ITSM\ITSM;
// Load global vars.
global $config;
require_once $config['homedir'].'/include/functions_alerts.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_integriaims.php';
enterprise_include_once('meta/include/functions_alerts_meta.php');
check_login();
@ -39,11 +39,19 @@ if (is_ajax()) {
$get_integria_ticket_custom_types = (bool) get_parameter('get_integria_ticket_custom_types');
if ($get_integria_ticket_custom_types) {
$ticket_type_id = get_parameter('ticket_type_id');
$ticket_type_id = (int) get_parameter('ticket_type_id', 0);
if (empty($ticket_type_id) === false) {
$error = '';
try {
$ITSM = new ITSM();
$fields = $ITSM->getObjecTypesFields($ticket_type_id);
} catch (\Throwable $th) {
$error = $th->getMessage();
}
$api_call = integria_api_call(null, null, null, null, 'get_incident_fields', $ticket_type_id, false, 'json');
echo json_encode($fields);
}
echo $api_call;
return;
}
}
@ -150,6 +158,22 @@ if ($id) {
$action = alerts_get_alert_action($id);
$name = $action['name'];
$id_command = $action['id_alert_command'];
$command = alerts_get_alert_command($id_command);
if (empty($command) === false && $command['name'] === io_safe_input('Pandora ITSM Ticket')) {
$action['field1'] = io_safe_output(($action['field1'] ?? $config['incident_title']));
$action['field2'] = io_safe_output(($action['field2'] ?? $config['default_group']));
$action['field3'] = io_safe_output(($action['field3'] ?? $config['default_criticity']));
$action['field4'] = io_safe_output(($action['field4'] ?? $config['default_owner']));
$action['field5'] = io_safe_output(($action['field5'] ?? $config['incident_type']));
$action['field6'] = io_safe_output(($action['field6'] ?? $config['incident_status']));
$action['field7'] = io_safe_output(($action['field7'] ?? $config['incident_content']));
$action['field2_recovery'] = io_safe_output(($action['field2'] ?? $config['default_group']));
$action['field3_recovery'] = io_safe_output(($action['field3'] ?? $config['default_criticity']));
$action['field4_recovery'] = io_safe_output(($action['field4'] ?? $config['default_owner']));
$action['field5_recovery'] = io_safe_output(($action['field5'] ?? $config['incident_type']));
$action['field6_recovery'] = io_safe_output(($action['field6_recovery'] ?? $config['incident_status']));
$action['field7_recovery'] = io_safe_output(($action['field7_recovery'] ?? $config['incident_content']));
}
$group = $action['id_group'];
$action_threshold = $action['action_threshold'];
@ -235,11 +259,11 @@ $table->data[0][1] = html_print_label_input_block(
)
);
$create_ticket_command_id = db_get_value('id', 'talert_commands', 'name', io_safe_input('Integria IMS Ticket'));
$create_ticket_command_id = db_get_value('id', 'talert_commands', 'name', io_safe_input('Pandora ITSM Ticket'));
$sql_exclude_command_id = '';
if (!is_metaconsole() && $config['integria_enabled'] == 0 && $create_ticket_command_id !== false) {
if (!is_metaconsole() && $config['ITSM_enabled'] == 0 && $create_ticket_command_id !== false) {
$sql_exclude_command_id = ' AND id <> '.$create_ticket_command_id;
}
@ -355,24 +379,26 @@ $table_macros->data[1][2] = html_print_label_input_block(
)
);
// Selector will work only with Integria activated.
$integriaIdName = 'integria_wu';
$table_macros->colspan[$integriaIdName][0] = 3;
$table_macros->data[$integriaIdName][0] = html_print_label_input_block(
__('Create workunit on recovery').ui_print_help_tip(
__('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'),
true
),
html_print_checkbox_switch_extended(
'create_wu_integria',
1,
$create_wu_integria,
false,
'',
$disabled_attr,
true
)
);
if (empty($command) === false && $command['name'] === io_safe_input('Pandora ITSM Ticket')) {
// Selector will work only with Integria activated.
$integriaIdName = 'integria_wu';
$table_macros->colspan[$integriaIdName][0] = 3;
$table_macros->data[$integriaIdName][0] = html_print_label_input_block(
__('Create workunit on recovery').ui_print_help_tip(
__('If closed status is set on recovery, a workunit will be added to the ticket in Pandora ITSM rather that closing the ticket.'),
true
),
html_print_checkbox_switch_extended(
'create_wu_integria',
1,
$create_wu_integria,
false,
'',
$disabled_attr,
true
)
);
}
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table_macros->data['field'.$i][0] = html_print_image(
@ -504,7 +530,6 @@ $(document).ready (function () {
},
function(data) {
var max_macro_fields = <?php echo $config['max_macro_fields']; ?>;
data.forEach(function(custom_field, key) {
var custom_field_key = key+8; // Custom fields start from field 8.
@ -523,9 +548,9 @@ $(document).ready (function () {
custom_field_row.html(new_html_content);
switch (custom_field.type) {
case 'checkbox':
var checkbox_selector = $('input:not(.datepicker)[name=field'+custom_field_key+'_value\\[\\]]');
var checkbox_recovery_selector = $('input:not(.datepicker)[name=field'+custom_field_key+'_recovery_value\\[\\]]');
case 'CHECKBOX':
var checkbox_selector = $('input[type="checkbox"][name=field'+custom_field_key+'_value\\[\\]]');
var checkbox_recovery_selector = $('input[type="checkbox"][name=field'+custom_field_key+'_recovery_value\\[\\]]');
checkbox_selector.on('change', function() {
if (checkbox_selector.prop('checked')) {
@ -565,17 +590,17 @@ $(document).ready (function () {
$('[name=field'+custom_field_key+'_value_container]').show();
$('[name=field'+custom_field_key+'_recovery_value_container]').show();
$('input:not(.datepicker)[name=field'+custom_field_key+'_value\\[\\]]').show();
$('input:not(.datepicker)[name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
$('input[type="checkbox"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input[type="checkbox"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
break;
case 'combo':
case 'COMBO':
var combo_input = $('select[name=field'+custom_field_key+'_value\\[\\]]');
var combo_input_recovery = $('select[name=field'+custom_field_key+'_recovery_value\\[\\]]');
combo_input.find('option').remove();
combo_input_recovery.find('option').remove();
var combo_values_array = custom_field.combo_value.split(',');
var combo_values_array = custom_field.comboValue.split(',');
combo_values_array.forEach(function(value) {
combo_input.append($('<option>', {
@ -600,16 +625,15 @@ $(document).ready (function () {
combo_input.show();
combo_input_recovery.show();
break;
case 'date':
case 'DATE':
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').removeClass("hasDatepicker");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').removeClass("hasDatepicker");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker("destroy");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker("destroy");
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$('input.datepicker[type="text"][name=field'+custom_field_key+'_value\\[\\]]').datepicker({dateFormat: "<?php echo 'yy-mm-dd 00:00:00'; ?>"});
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').datepicker({dateFormat: "<?php echo 'yy-mm-dd 00:00:00'; ?>"});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
if (typeof values[key] !== "undefined") {
@ -620,9 +644,32 @@ $(document).ready (function () {
$('input.datepicker[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
}
break;
case 'text':
case 'textarea':
case 'numeric':
case 'NUMERIC':
if (typeof values[key] !== "undefined") {
$('input[type="number"][name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$('input[type="number"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
}
$('input[type="number"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input[type="number"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
break;
case 'TEXT':
if (typeof values[key] !== "undefined") {
$('input.normal[type="text"][name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
}
if (typeof recovery_values[key] !== "undefined") {
$('input.normal[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').val(recovery_values[key]);
}
$('input.normal[type="text"][name=field'+custom_field_key+'_value\\[\\]]').show();
$('input.normal[type="text"][name=field'+custom_field_key+'_recovery_value\\[\\]]').show();
break;
case 'TEXTAREA':
default:
if (typeof values[key] !== "undefined") {
$('textarea[name=field'+custom_field_key+'_value\\[\\]]').val(values[key]);
}
@ -646,13 +693,20 @@ $(document).ready (function () {
// No se envia el valor del commando.
values.push({
name: "page",
value: "godmode/alerts/alert_commands"});
value: "godmode/alerts/alert_commands"
});
values.push({
name: "get_alert_command",
value: "1"});
value: "1"
});
values.push({
name: "id",
value: this.value});
value: this.value
});
values.push({
name: "id_action",
value: "<?php echo (int) $id; ?>"
});
jQuery.post (<?php echo "'".ui_get_full_url('ajax.php', false, false, false)."'"; ?>,
values,
@ -664,14 +718,6 @@ $(document).ready (function () {
render_command_description(command_description);
} else {
render_command_description('');
}
// Allow create workunit if Integria IMS Ticket is selected.
if (data['id'] == '14') {
$("#table_macros-"+integriaWorkUnitName).css('display', 'table-row');
} else {
$("#table_macros-"+integriaWorkUnitName).css('display', 'none');
}
var max_fields = parseInt('<?php echo $config['max_macro_fields']; ?>');
@ -699,12 +745,73 @@ $(document).ready (function () {
old_value = '';
old_recovery_value = '';
// Only keep the value if is provided from hidden (first time)
if (($("[name=field" + i + "_value]").attr('id'))
== ("hidden-field" + i + "_value")) {
if (($("[name=field" + i + "_value]").attr('id')) == ("hidden-field" + i + "_value")) {
old_value = $("[name=field" + i + "_value]").val();
disabled = $("[name=field" + i + "_value]").attr('disabled');
}
if ($("#id_command option:selected").text() === "Pandora ITSM Ticket" && (!old_value || !old_recovery_value) ) {
if (i === 1) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['incident_title']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['incident_title']); ?>';
}
} else if (i === 2) {
if(!old_value || old_value == 0) {
old_value = '<?php echo io_safe_output($config['default_group']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['default_group']); ?>';
}
} else if (i === 3) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['default_criticity']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['default_criticity']); ?>';
}
} else if (i === 4) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['default_owner']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['default_owner']); ?>';
}
} else if (i === 5) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['incident_type']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['incident_type']); ?>';
}
} else if (i === 6) {
if(!old_value) {
old_value = '<?php echo io_safe_output($config['incident_status']); ?>';
}
if(!old_recovery_value) {
old_recovery_value = '<?php echo io_safe_output($config['incident_status']); ?>';
}
} else if (i === 7) {
var text = '<?php echo $config['incident_content']; ?>';
if(!old_value) {
old_value = text;
}
if(!old_recovery_value) {
old_recovery_value = text;
}
}
}
if (($("[name=field" + i + "_recovery_value]").attr('id'))
== ("hidden-field" + i + "_recovery_value")) {
@ -742,17 +849,20 @@ $(document).ready (function () {
}
else {
var is_element_select = $("[name=field" + i + "_value]").is("select");
var is_element_autocomplete_users_itsm = $("[name=field" + i + "_value]").hasClass("ITSM_users");
$("[name=field" + i + "_value]").val(old_value);
if (is_element_select === true) {
$("[name=field" + i + "_value]").trigger('change');
} else if (is_element_autocomplete_users_itsm === true) {
$("[name=field" + i + "_value_hidden]").val(old_value);
}
$("[name=field" + i + "_recovery_value]").val(old_recovery_value);
if (is_element_select === true) {
$("[name=field" + i + "_recovery_value]").trigger('change');
} else if (is_element_autocomplete_users_itsm === true) {
$("[name=field" + i + "_recovery_value_hidden]").val(old_recovery_value);
}
}
}
@ -767,7 +877,7 @@ $(document).ready (function () {
}
}
if ($("#id_command option:selected").text() === "Integria IMS Ticket" && i > 7) {
if ($("#id_command option:selected").text() === "Pandora ITSM Ticket" && i > 7) {
integria_custom_fields_values.push(old_value);
integria_custom_fields_rvalues.push(old_recovery_value);
}
@ -789,9 +899,9 @@ $(document).ready (function () {
$table_macros_field.show();
}
// Ad-hoc solution for Integria IMS command: get Integia IMS Ticket custom fields only when this command is selected and we selected a ticket type to retrieve fields from.
// Ad-hoc solution for Pandora ITSM command: get Integia IMS Ticket custom fields only when this command is selected and we selected a ticket type to retrieve fields from.
// Check command by name since it is unvariable in any case, unlike its ID.
if ($("#id_command option:selected").text() === "Integria IMS Ticket") {
if ($("#id_command option:selected").text() === "Pandora ITSM Ticket") {
var max_macro_fields = <?php echo $config['max_macro_fields']; ?>;
// At start hide all rows and inputs corresponding to custom fields, regardless of what its type is.

View File

@ -75,6 +75,12 @@ foreach ($event_responses as $response) {
continue;
}
if ((isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false)
&& $response['name'] === 'Create&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM&#x20;from&#x20;event'
) {
continue;
}
$data = [];
$data[0] = '<a href="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&id_response='.$response['id'].'&amp;pure='.$config['pure'].'">'.$response['name'].'</a>';
$data[1] = $response['description'];

View File

@ -478,8 +478,8 @@ if ($access_console_node === true) {
$sub2['godmode/setup/setup&section=ehorus']['text'] = __('eHorus');
$sub2['godmode/setup/setup&section=ehorus']['refr'] = 0;
$sub2['godmode/setup/setup&section=integria']['text'] = __('Integria IMS');
$sub2['godmode/setup/setup&section=integria']['refr'] = 0;
$sub2['godmode/setup/setup&section=ITSM']['text'] = __('ITSM');
$sub2['godmode/setup/setup&section=ITSM']['refr'] = 0;
enterprise_hook('module_library_submenu');

View File

@ -880,6 +880,16 @@ switch ($action) {
$idAgentModule = $module;
break;
case 'end_of_life':
$es = json_decode($item['external_source'], true);
$text_os_version = $es['os_version'];
$end_of_life_date = $es['end_of_life_date'];
$os_selector = $es['os_selector'];
$group = $es['group'];
$recursion = $es['recursion'];
break;
case 'alert_report_actions':
$description = $item['description'];
$es = json_decode($item['external_source'], true);
@ -1238,6 +1248,88 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_os_selector" class="datos">
<td class="bolder"><?php echo __('Operating system'); ?></td>
<td>
<?php
$os_list = db_get_all_rows_filter('tconfig_os', [], ['id_os', 'name']);
if ($os === false) {
$os = [];
}
$result_select = [];
foreach ($os as $item) {
$result_select[$item['id_os']] = $item['name'];
}
html_print_select(
$os_list,
'os_selector',
$os_selector,
''
);
?>
</td>
</tr>
<tr id="row_os_version_regexp" class="datos">
<td class="bolder">
<?php
echo __('Operating system version').ui_print_help_tip(
__('Case insensitive regular expression for OS version. For example: Centos.* will match with the following OS versions: Centos 6.4, Centos 7. Important: OS version must be registered in Operating Systems editor.'),
true
);
?>
</td>
<td>
<?php
html_print_input_text(
'text_os_version',
$text_os_version,
'',
30,
100,
false
);
?>
</td>
</tr>
<tr id="row_os_end_of_life" class="datos">
<td class="bolder"><?php echo __('End of life'); ?></td>
<td colspan="6">
<?php
$timeInputs = [];
$timeInputs[] = html_print_div(
[
'id' => 'end_of_life_date',
'style' => '',
'content' => html_print_div(
[
'class' => '',
'content' => html_print_input_text(
'end_of_life_date',
$end_of_life_date,
'',
10,
10,
true
),
],
true
),
],
true
);
echo implode('', $timeInputs);
?>
</td>
</tr>
<tr id="row_agent_regexp" class="datos">
<td class="bolder">
<?php
@ -4282,6 +4374,8 @@ html_print_action_buttons($actionButtons, ['type' => 'form_action']);
echo '</div>';
echo '</form>';
ui_require_css_file('datepicker');
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
ui_include_time_picker();
ui_require_javascript_file('pandora');
@ -5216,6 +5310,8 @@ $(document).ready (function () {
chooseType();
chooseSQLquery();
$("#text-end_of_life_date").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>", showButtonPanel: true});
$("#id_agents").change(agent_changed_by_multiple_agents);
// Load selected modules by default
@ -6529,7 +6625,11 @@ function addGeneralRow() {
function loadGeneralAgents(agent_group) {
var params = [];
var group = <?php echo $group; ?>;
var group = <?php echo ($group ?? -1); ?>;
if (group < 0) {
return;
}
group = agent_group || group;
params.push("get_agents=1");
@ -6796,6 +6896,9 @@ function chooseType() {
$("#row_group_by").hide();
$("#row_type_show").hide();
$("#row_use_prefix_notation").hide();
$("#row_os_selector").hide();
$("#row_os_version_regexp").hide();
$("#row_os_end_of_life").hide();
$("#row_cat_security_hardening").hide();
$("#row_ignore_skipped").hide();
$("#row_status_check").hide();
@ -7379,6 +7482,13 @@ function chooseType() {
});
break;
case 'end_of_life':
$("#row_os_selector").show();
$("#row_os_version_regexp").show();
$("#row_group").show();
$("#row_os_end_of_life").show();
break;
case 'inventory_changes':
$("#row_description").show();
$("#row_period").show();

View File

@ -1759,6 +1759,17 @@ switch ($action) {
$good_format = true;
break;
case 'end_of_life':
$es['end_of_life_date'] = get_parameter('end_of_life_date');
$es['os_selector'] = get_parameter('os_selector');
$es['os_version'] = get_parameter('text_os_version', '');
$es['group'] = get_parameter('combo_group', '');
$es['recursion'] = get_parameter('recursion', 0);
$values['external_source'] = json_encode($es);
$good_format = true;
break;
case 'alert_report_actions':
$alert_templates_to_report = get_parameter('alert_templates');
$alert_actions_to_report = get_parameter('alert_actions');
@ -2747,6 +2758,17 @@ switch ($action) {
$good_format = true;
break;
case 'end_of_life':
$es['end_of_life_date'] = get_parameter('end_of_life_date');
$es['os_selector'] = get_parameter('os_selector');
$es['os_version'] = get_parameter('text_os_version', '');
$es['group'] = get_parameter('combo_group', '');
$es['recursion'] = get_parameter('recursion', 0);
$values['external_source'] = json_encode($es);
$good_format = true;
break;
case 'alert_report_actions':
$alert_templates_to_report = get_parameter('alert_templates');
$alert_actions_to_report = get_parameter('alert_actions');

View File

@ -312,7 +312,7 @@ if ($mapConnectionData != null) {
$mapConnectionDataUrl,
'',
45,
90,
false,
true
).'</td></tr></table>';

View File

@ -40,6 +40,191 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
return;
}
if ($idOS > 0) {
$os = db_get_row_filter('tconfig_os', ['id_os' => $idOS]);
$name = $os['name'];
$description = $os['description'];
$icon = $os['icon_name'];
} else {
$name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0);
}
$icon_upload = get_parameter('icon_upload', null);
$message = '';
if ($is_management_allowed === true) {
switch ($action) {
case 'edit':
if ($idOS > 0) {
$actionHidden = 'update';
$textButton = __('Update');
$classButton = ['icon' => 'wand'];
} else {
$actionHidden = 'save';
$textButton = __('Create');
$classButton = ['icon' => 'next'];
}
break;
case 'save':
if ($icon_upload !== null && $icon_upload['name'] !== '') {
if (isset($_FILES['icon_upload']) === true) {
$file_name = $_FILES['icon_upload']['name'];
$file_tmp = $_FILES['icon_upload']['tmp_name'];
$file_type = $_FILES['icon_upload']['type'];
$file_ext = strtolower(end(explode('.', $_FILES['icon_upload']['name'])));
$allowed_extensions = [
'jpeg',
'jpg',
'png',
'svg',
];
$tab = 'manage_os';
if (in_array($file_ext, $allowed_extensions) === false) {
$message = 9;
} else {
$message = 8;
move_uploaded_file($file_tmp, $config['homedir'].'/images/os_icons/'.$file_name);
}
}
} else {
$values = [];
$values['name'] = $name;
$values['description'] = $description;
if (($icon !== 0) && ($icon != '')) {
$values['icon_name'] = $icon;
}
$resultOrId = false;
if ($name != '') {
$resultOrId = db_process_sql_insert('tconfig_os', $values);
}
if ($resultOrId === false) {
$message = 2;
$tab = 'builder';
$actionHidden = 'save';
$textButton = __('Create');
$classButton = ['icon' => 'wand'];
} else {
$tab = 'manage_os';
$message = 1;
}
}
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2=list&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
case 'update':
if ($icon_upload !== null && $icon_upload['name'] !== '') {
if (isset($_FILES['icon_upload']) === true) {
$file_name = $_FILES['icon_upload']['name'];
$file_tmp = $_FILES['icon_upload']['tmp_name'];
$file_type = $_FILES['icon_upload']['type'];
$file_ext = strtolower(end(explode('.', $_FILES['icon_upload']['name'])));
$allowed_extensions = [
'jpeg',
'jpg',
'png',
'svg',
];
$tab = 'manage_os';
if (in_array($file_ext, $allowed_extensions) === false) {
$message = 9;
} else {
$message = 8;
move_uploaded_file($file_tmp, $config['homedir'].'/images/os_icons/'.$file_name);
}
}
} else {
$name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0);
$values = [];
$values['name'] = $name;
$values['description'] = $description;
// Only for Metaconsole. Save the previous name for synchronizing.
if (is_metaconsole() === true) {
$values['previous_name'] = db_get_value('name', 'tconfig_os', 'id_os', $idOS);
}
if (($icon !== 0) && ($icon != '')) {
$values['icon_name'] = $icon;
}
$result = false;
if ($name != '') {
$result = db_process_sql_update('tconfig_os', $values, ['id_os' => $idOS]);
}
if ($result !== false) {
$message = 3;
$tab = 'manage_os';
} else {
$message = 4;
$tab = 'builder';
$os = db_get_row_filter('tconfig_os', ['id_os' => $idOS]);
$name = $os['name'];
}
$actionHidden = 'update';
$textButton = __('Update');
$classButton = ['icon' => 'wand'];
}
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
case 'delete':
$sql = 'SELECT COUNT(id_os) AS count FROM tagente WHERE id_os = '.$idOS;
$count = db_get_all_rows_sql($sql);
$count = $count[0]['count'];
if ($count > 0) {
$message = 5;
} else {
$result = (bool) db_process_sql_delete('tconfig_os', ['id_os' => $idOS]);
if ($result) {
$message = 6;
} else {
$message = 7;
}
}
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=list&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
default:
case 'new':
$actionHidden = 'save';
$textButton = __('Create');
$classButton = ['icon' => 'next'];
break;
}
}
$icons = get_list_os_icons_dir();
$iconData = [];
@ -62,12 +247,11 @@ $iconData[] = html_print_div(
true
);
echo '<form id="form_setup" method="post">';
echo '<form id="form_setup" method="post" enctype="multipart/form-data">';
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filter-table-adv';
// $table->style[0] = 'width: 15%';
$table->data[0][] = html_print_label_input_block(
__('Name'),
html_print_input_text('name', $name, __('Name'), 20, 30, true, false, false, '', 'w250px')
@ -89,6 +273,11 @@ $table->data[1][] = html_print_label_input_block(
html_print_textarea('description', 5, 20, $description, '', true, 'w250px')
);
$table->data[1][] = html_print_label_input_block(
'',
html_print_input_file('icon_upload', true, ['caption' => __('Upload icon')], 'form_setup')
);
html_print_table($table);
html_print_input_hidden('id_os', $idOS);

View File

@ -45,7 +45,7 @@ if (is_management_allowed() === false) {
$is_management_allowed = false;
if (is_metaconsole() === false) {
$url = '<a target="_blank" href="'.ui_get_meta_url(
'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2=list&pure='.(int) $config['pure']
'index.php?sec=advanced&sec2=advanced/component_management&tab=list&tab2=list&pure='.(int) $config['pure']
).'">'.__('metaconsole').'</a>';
} else {
$url = __('any node');
@ -59,115 +59,71 @@ if (is_management_allowed() === false) {
);
}
$table = new stdClass();
$table->class = 'info_table';
$table->head[0] = __('ID');
$table->head[1] = __('Icon');
$table->head[2] = __('Name');
$table->head[3] = __('Description');
if ($is_management_allowed === true) {
$table->head[4] = __('Actions');
}
// Datatables list.
try {
$columns = [
'id_os',
'icon_img',
'name',
'description',
'options',
];
if ($is_management_allowed === true) {
$table->align[4] = 'center';
}
$column_names = [
[
'text' => __('ID'),
'class' => 'w50px table_action_buttons',
],
[
'text' => __('Icon'),
'class' => 'w10px table_action_buttons',
],
__('Name'),
__('Description'),
[
'text' => __('Options'),
'class' => 'w20px table_action_buttons',
],
];
$table->size[0] = '5%';
if ($is_management_allowed === true) {
$table->size[4] = '20px';
}
// Prepare pagination.
$offset = (int) get_parameter('offset');
$limit = $config['block_size'];
$count_osList = db_get_value('count(*)', 'tconfig_os');
$osList = db_get_all_rows_filter(
'tconfig_os',
[
'offset' => $offset,
'limit' => $limit,
]
);
if ($osList === false) {
$osList = [];
}
$table->data = [];
foreach ($osList as $os) {
$data = [];
$data[] = $os['id_os'];
$data[] = ui_print_os_icon($os['id_os'], false, true);
if ($is_management_allowed === true) {
if (is_metaconsole() === true) {
$osNameUrl = 'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=edit&tab2=builder&id_os='.$os['id_os'];
} else {
$osNameUrl = 'index.php?sec=gsetup&sec2=godmode/setup/os&action=edit&tab=builder&id_os='.$os['id_os'];
}
$data[] = html_print_anchor(
[
'href' => $osNameUrl,
'content' => io_safe_output($os['name']),
$tableId = 'os_table';
// Load datatables user interface.
ui_print_datatable(
[
'id' => $tableId,
'class' => 'info_table',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/os',
'ajax_data' => ['method' => 'drawOSTable'],
'ajax_postprocess' => 'process_datatables_item(item)',
'no_sortable_columns' => [
-1,
1,
],
true
);
} else {
$data[] = io_safe_output($os['name']);
}
$data[] = ui_print_truncate_text(io_safe_output($os['description']), 'description', true, true);
if ($is_management_allowed === true) {
$table->cellclass[][4] = 'table_action_buttons';
if ($os['id_os'] > 16) {
if (is_metaconsole() === true) {
$hrefDelete = 'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=delete&tab2=list&id_os='.$os['id_os'];
} else {
$hrefDelete = 'index.php?sec=gsetup&sec2=godmode/setup/os&action=delete&tab=list&id_os='.$os['id_os'];
}
$data[] = html_print_anchor(
[
'href' => $hrefDelete,
'content' => html_print_image(
'images/delete.svg',
true,
[
'alt' => __('Delete'),
'title' => __('Delete'),
'class' => 'main_menu_icon invert_filter',
]
),
'order' => [
'field' => 'id',
'direction' => 'asc',
],
'search_button_class' => 'sub filter float-right',
'form' => [
'inputs' => [
[
'label' => __('Free search'),
'type' => 'text',
'class' => 'w25p',
'id' => 'free_search',
'name' => 'free_search',
],
],
true
);
} else {
// The original icons of pandora don't delete.
$data[] = '';
}
}
$table->data[] = $data;
}
$tablePagination = '';
if (isset($data) === true) {
html_print_table($table);
$tablePagination = ui_pagination(
$count_osList,
ui_get_url_refresh(['message' => false]),
$offset,
0,
true,
'offset',
false,
''
],
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar',
'dom_elements' => 'lftpB',
]
);
} else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined operating systems') ]);
} catch (Exception $e) {
echo $e->getMessage();
}
$buttons = '';
@ -191,3 +147,76 @@ html_print_action_buttons(
'right_content' => $tablePagination,
]
);
echo '<div id="aux" class="invisible"></div>';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_os&action=edit">';
html_print_action_buttons(
html_print_submit_button(__('Create OS'), 'update_button', false, ['icon' => 'next'], true),
['type' => 'form_action']
);
echo '</form>';
?>
<script language="javascript" type="text/javascript">
function process_datatables_item(item) {
item.options = '<div class="table_action_buttons">';
if (item.enable_delete === true) {
var delete_id = item.id_os;
item.options += '<a href="javascript:" onclick="delete_os(\'';
item.options += delete_id;
item.options += '\')" ><?php echo html_print_image('images/delete.svg', true, ['title' => __('Delete'), 'class' => 'main_menu_icon invert_filter']); ?></a>';
}
item.options += '</div>';
}
/**
* Delete selected OS
*/
function delete_os(id) {
$('#aux').empty();
$('#aux').text('<?php echo __('Are you sure?'); ?>');
$('#aux').dialog({
title: '<?php echo __('Delete'); ?> ' + id,
buttons: [
{
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
text: '<?php echo __('Cancel'); ?>',
click: function(e) {
$(this).dialog('close');
}
},
{
text: 'Delete',
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
click: function(e) {
$.ajax({
method: 'post',
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
data: {
page: 'include/ajax/os',
method: 'deleteOS',
id_os: id
},
datatype: "json",
success: function (data) {
var r = JSON.parse(data);
if (r.deleted === false) {
$('#aux').text('<?php echo __('Not deleted. Error deleting data'); ?>');
} else {
$('#aux').dialog('close');
location.reload();
}
},
error: function(e) {
$('#aux').text('<?php echo __('Not deleted. Error deleting data'); ?>');
}
});
}
}
]
});
}
</script>

View File

@ -40,24 +40,13 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
return;
}
$action = get_parameter('action', 'new');
$action = get_parameter('action', '');
$idOS = get_parameter('id_os', 0);
$id_message = get_parameter('message', 0);
if (is_metaconsole() === true) {
$tab = get_parameter('tab2', 'list');
} else {
$tab = get_parameter('tab', 'list');
}
if ($idOS) {
$os = db_get_row_filter('tconfig_os', ['id_os' => $idOS]);
$name = $os['name'];
$description = $os['description'];
$icon = $os['icon_name'];
} else {
$name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0);
$tab = get_parameter('tab', 'manage_os');
}
$is_management_allowed = true;
@ -65,150 +54,60 @@ if (is_management_allowed() === false) {
$is_management_allowed = false;
}
$message = '';
if ($is_management_allowed === true) {
switch ($action) {
case 'edit':
$actionHidden = 'update';
$textButton = __('Update');
$classButton = ['icon' => 'wand'];
break;
case 'save':
$values = [];
$values['name'] = $name;
$values['description'] = $description;
if (($icon !== 0) && ($icon != '')) {
$values['icon_name'] = $icon;
}
$resultOrId = false;
if ($name != '') {
$resultOrId = db_process_sql_insert('tconfig_os', $values);
}
if ($resultOrId === false) {
$message = 2;
$tab = 'builder';
$actionHidden = 'save';
$textButton = __('Create');
$classButton = ['icon' => 'wand'];
} else {
$tab = 'list';
$message = 1;
}
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
case 'update':
$name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0);
$values = [];
$values['name'] = $name;
$values['description'] = $description;
// Only for Metaconsole. Save the previous name for synchronizing.
if (is_metaconsole() === true) {
$values['previous_name'] = db_get_value('name', 'tconfig_os', 'id_os', $idOS);
}
if (($icon !== 0) && ($icon != '')) {
$values['icon_name'] = $icon;
}
$result = false;
if ($name != '') {
$result = db_process_sql_update('tconfig_os', $values, ['id_os' => $idOS]);
}
if ($result !== false) {
$message = 3;
$tab = 'list';
} else {
$message = 4;
$tab = 'builder';
$os = db_get_row_filter('tconfig_os', ['id_os' => $idOS]);
$name = $os['name'];
}
$actionHidden = 'update';
$textButton = __('Update');
$classButton = ['icon' => 'wand'];
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
case 'delete':
$sql = 'SELECT COUNT(id_os) AS count FROM tagente WHERE id_os = '.$idOS;
$count = db_get_all_rows_sql($sql);
$count = $count[0]['count'];
if ($count > 0) {
$message = 5;
} else {
$result = (bool) db_process_sql_delete('tconfig_os', ['id_os' => $idOS]);
if ($result) {
$message = 6;
} else {
$message = 7;
}
}
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
default:
case 'new':
$actionHidden = 'save';
$textButton = __('Create');
$classButton = ['icon' => 'next'];
break;
}
}
$buttons = [];
$buttons['list'] = [
$buttons['manage_os'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=list">'.html_print_image(
'images/logs@svg.svg',
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=manage_os">'.html_print_image(
'images/os@svg.svg',
true,
[
'title' => __('List OS'),
'title' => __('Manage OS types'),
'class' => 'invert_filter main_menu_icon',
]
).'</a>',
];
$buttons['manage_version'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=manage_version">'.html_print_image(
'images/os_version@svg.svg',
true,
[
'title' => __('Manage version expiration dates'),
'class' => 'invert_filter main_menu_icon',
]
).'</a>',
];
if ($is_management_allowed === true) {
$buttons['builder'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=builder">'.html_print_image(
'images/edit.svg',
true,
[
'title' => __('Builder OS'),
'class' => 'invert_filter main_menu_icon',
]
).'</a>',
];
}
$buttons[$tab]['active'] = true;
$headerTitle = ($tab === 'builder') ? __('Edit OS') : __('List of Operating Systems');
switch ($tab) {
case 'builder':
$headerTitle = __('Edit OS');
break;
case 'manage_os':
case 'list':
if ($action === 'edit') {
$headerTitle = __('Edit OS');
} else {
$headerTitle = __('List of Operating Systems');
}
break;
case 'manage_version':
if ($action === 'edit') {
$headerTitle = __('Edit OS version expiration date');
} else {
$headerTitle = __('List of version expiration dates');
}
break;
default:
// Default.
break;
}
if (is_metaconsole() === false) {
// Header.
@ -262,6 +161,14 @@ if (empty($id_message) === false) {
echo ui_print_error_message(__('Error deleting'), '', true);
break;
case 8:
echo ui_print_success_message(__('Icon successfuly uploaded'), '', true);
break;
case 9:
echo ui_print_error_message(__('File must be of type JPG, JPEG, PNG or SVG'), '', true);
break;
default:
// Default.
break;
@ -269,12 +176,21 @@ if (empty($id_message) === false) {
}
switch ($tab) {
case 'manage_os':
case 'list':
include_once $config['homedir'].'/godmode/setup/os.list.php';
if (in_array($action, ['edit', 'save', 'update']) && is_management_allowed() === true) {
include_once $config['homedir'].'/godmode/setup/os.builder.php';
} else {
include_once $config['homedir'].'/godmode/setup/os.list.php';
}
break;
case 'builder':
include_once $config['homedir'].'/godmode/setup/os.builder.php';
case 'manage_version':
if (in_array($action, ['edit', 'save', 'update']) && is_management_allowed() === true) {
include_once $config['homedir'].'/godmode/setup/os_version.builder.php';
} else {
include_once $config['homedir'].'/godmode/setup/os_version.list.php';
}
break;
default:

View File

@ -0,0 +1,211 @@
<?php
/**
* OS Builder
*
* @category Os
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Load global vars.
global $config;
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
}
ui_require_css_file('datepicker');
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
ui_include_time_picker();
ui_require_javascript_file('pandora');
if ($idOS > 0) {
$os_version = db_get_row_filter('tconfig_os_version', ['id_os_version' => $idOS]);
$product = $os_version['product'];
$version = $os_version['version'];
$end_of_life_date = $os_version['end_of_support'];
} else {
$product = io_safe_input(strip_tags(io_safe_output((string) get_parameter('product'))));
$version = io_safe_input(strip_tags(io_safe_output((string) get_parameter('version'))));
$end_of_life_date = get_parameter('end_of_life_date', date('Y/m/d'));
}
$message = '';
if ($is_management_allowed === true) {
switch ($action) {
case 'edit':
if ($idOS > 0) {
$actionHidden = 'update';
$textButton = __('Update');
$classButton = ['icon' => 'wand'];
} else {
$actionHidden = 'save';
$textButton = __('Create');
$classButton = ['icon' => 'next'];
}
break;
case 'save':
$values = [];
// Product and version must be stored with no entities to be able to use REGEXP in queries.
// CAREFUL! output of these fields must be encoded to avoid scripting vulnerabilities.
$values['product'] = io_safe_output($product);
$values['version'] = io_safe_output($version);
$values['end_of_support'] = $end_of_life_date;
$result = db_process_sql_insert('tconfig_os_version', $values);
if ($result === false) {
$message = 2;
} else {
$message = 1;
}
$tab = 'manage_version';
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
break;
case 'update':
$product = io_safe_output(get_parameter('product'));
$version = io_safe_output(get_parameter('version'));
$end_of_life_date = get_parameter('end_of_life_date', 0);
$values = [];
$values['product'] = $product;
$values['version'] = $version;
$values['end_of_support'] = $end_of_life_date;
$result = db_process_sql_update('tconfig_os_version', $values, ['id_os_version' => $idOS]);
if ($result === false) {
$message = 4;
} else {
$message = 3;
}
$tab = 'manage_version';
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
break;
case 'delete':
$sql = 'SELECT COUNT(id_os) AS count FROM tagente WHERE id_os = '.$idOS;
$count = db_get_all_rows_sql($sql);
$count = $count[0]['count'];
if ($count > 0) {
$message = 5;
} else {
$result = (bool) db_process_sql_delete('tconfig_os', ['id_os' => $idOS]);
if ($result) {
$message = 6;
} else {
$message = 7;
}
}
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=list&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
default:
case 'new':
$actionHidden = 'save';
$textButton = __('Create');
$classButton = ['icon' => 'next'];
break;
}
}
echo '<form id="form_setup" method="post">';
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filter-table-adv';
// $table->style[0] = 'width: 15%';
$table->data[0][] = html_print_label_input_block(
__('Product'),
html_print_input_text('product', io_safe_input($product), __('Product'), 20, 300, true, false, false, '', 'w250px')
);
$table->data[0][] = html_print_label_input_block(
__('Version'),
html_print_input_text('version', io_safe_input($version), __('Version'), 20, 300, true, false, false, '', 'w250px')
);
$timeInputs = [];
$timeInputs[] = html_print_div(
[
'id' => 'end_of_life_date',
'style' => '',
'content' => html_print_div(
[
'class' => '',
'content' => html_print_input_text(
'end_of_life_date',
$end_of_life_date,
'',
10,
10,
true
),
],
true
),
],
true
);
$table->data[1][] = html_print_label_input_block(
__('End of life date'),
implode('', $timeInputs)
);
html_print_table($table);
html_print_input_hidden('id_os', $idOS);
html_print_input_hidden('action', $actionHidden);
html_print_action_buttons(
html_print_submit_button($textButton, 'update_button', false, $classButton, true),
['type' => 'form_action']
);
echo '</form>';
?>
<script language="javascript" type="text/javascript">
$(document).ready (function () {
$("#text-end_of_life_date").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>", showButtonPanel: true});
});
</script>

View File

@ -0,0 +1,198 @@
<?php
/**
* Version expiration date editor
*
* @category Os
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Load global vars.
global $config;
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
}
// Datatables list.
try {
$columns = [
'product',
'version',
'end_of_support',
'options',
];
$column_names = [
__('Product'),
__('Version'),
__('End of support date'),
[
'text' => __('Options'),
'class' => 'w100px table_action_buttons',
],
];
$tableId = 'os_version_table';
// Load datatables user interface.
ui_print_datatable(
[
'id' => $tableId,
'class' => 'info_table',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/os',
'ajax_data' => ['method' => 'drawOSVersionTable'],
'ajax_postprocess' => 'process_datatables_item(item)',
'no_sortable_columns' => [-1],
'order' => [
'field' => 'id',
'direction' => 'asc',
],
'search_button_class' => 'sub filter float-right',
'form' => [
'inputs' => [
[
'label' => __('Free search'),
'type' => 'text',
'class' => 'w25p',
'id' => 'free_search',
'name' => 'free_search',
],
],
],
'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar',
'dom_elements' => 'lftpB',
]
);
} catch (Exception $e) {
echo $e->getMessage();
}
echo '<div id="aux" class="invisible"></div>';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_version&action=edit">';
html_print_action_buttons(
html_print_submit_button(__('Create OS version'), 'update_button', false, ['icon' => 'next'], true),
['type' => 'form_action']
);
echo '</form>';
echo '<form id="redirect-form" method="post" action="index.php?sec=view&sec2=operation/agentes/estado_agente">';
html_print_input_hidden('os_type_regex', '');
html_print_input_hidden('os_version_regex', '');
echo '</form>';
?>
<script language="javascript" type="text/javascript">
function process_datatables_item(item) {
id = item.id_os_version;
idrow = '<b><a href="javascript:" onclick="show_form(\'';
idrow += item.id_os_version;
idrow += '\')" >'+item.id_os_version+'</a></b>';
item.id_os_version = idrow;
item.options = '<div class="table_action_buttons">';
item.options += '<a href="index.php?sec=gagente&amp;sec2=godmode/setup/os&amp;tab=manage_version&amp;action=edit&amp;id_os=';
item.options += id;
item.options += '" ><?php echo html_print_image('images/edit.svg', true, ['title' => __('Edit'), 'class' => 'main_menu_icon invert_filter']); ?></a>';
item.options += '<a href="javascript:" onclick="redirect_to_agents_by_version(\'';
item.options += item.product;
item.options += '\',\'';
item.options += item.version;
item.options += '\')" ><?php echo html_print_image('images/agents.svg', true, ['title' => __('Show agents'), 'class' => 'main_menu_icon invert_filter']); ?></a>';
item.options += '<a href="javascript:" onclick="delete_os_version(\'';
item.options += id;
item.options += '\')" ><?php echo html_print_image('images/delete.svg', true, ['title' => __('Delete'), 'class' => 'main_menu_icon invert_filter']); ?></a>';
item.options += '</div>';
item.options += '<form method="post" action="?sec=view&sec2=operation/agentes/estado_agente"></form>';
}
function redirect_to_agents_by_version(product, version) {
$('#hidden-os_type_regex').val(product);
$('#hidden-os_version_regex').val(version);
$('#redirect-form').submit();
}
/**
* Delete selected OS version
*/
function delete_os_version(id) {
$('#aux').empty();
$('#aux').text('<?php echo __('Are you sure?'); ?>');
$('#aux').dialog({
title: '<?php echo __('Delete'); ?> ' + id,
buttons: [
{
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
text: '<?php echo __('Cancel'); ?>',
click: function(e) {
$(this).dialog('close');
}
},
{
text: 'Delete',
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
click: function(e) {
$.ajax({
method: 'post',
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
data: {
page: 'include/ajax/os',
method: 'deleteOSVersion',
id_os_version: id
},
datatype: "json",
success: function (data) {
var r = JSON.parse(data);
if (r.deleted === false) {
$('#aux').text('<?php echo __('Not deleted. Error deleting data'); ?>');
} else {
$('#aux').dialog('close');
location.reload();
}
},
error: function(e) {
$('#aux').text('<?php echo __('Not deleted. Error deleting data'); ?>');
}
});
}
}
]
});
}
</script>

View File

@ -0,0 +1,285 @@
<?php
/**
* Os version.
*
* @category Os version
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Load global vars.
global $config;
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
}
$action = get_parameter('action', 'new');
$id_os_version = get_parameter('id_os_version', 0);
if (is_metaconsole() === true) {
$tab = get_parameter('tab2', 'list');
} else {
$tab = get_parameter('tab', 'list');
}
if ($id_os_version) {
$os_version = db_get_row_filter('tconfig_os_version', ['id_os_version' => $id_os_version]);
$product = $os_version['product'];
$version = $os_version['version'];
$end_of_life_date = $os_version['end_of_life_date'];
} else {
$product = io_safe_input(strip_tags(io_safe_output((string) get_parameter('product'))));
$version = io_safe_input(strip_tags(io_safe_output((string) get_parameter('version'))));
$end_of_life_date = get_parameter('end_of_life_date', 0);
}
$is_management_allowed = true;
if (is_management_allowed() === false) {
$is_management_allowed = false;
}
$message = '';
if ($is_management_allowed === true) {
switch ($action) {
case 'edit':
$action_hidden = 'update';
$text_button = __('Update');
$class_button = ['icon' => 'wand'];
break;
case 'save':
$values = [];
$values['product'] = $product;
$values['version'] = $version;
$values['end_of_life_date'] = $end_of_life_date;
$result_or_id = false;
if ($product !== '') {
$result_or_id = db_process_sql_insert('tconfig_os_version', $values);
}
if ($result_or_id === false) {
$message = 2;
$tab = 'builder';
$actionHidden = 'save';
$textButton = __('Create');
$classButton = ['icon' => 'wand'];
} else {
$tab = 'list';
$message = 1;
}
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
case 'update':
$product = io_safe_input(strip_tags(io_safe_output((string) get_parameter('product'))));
$version = io_safe_input(strip_tags(io_safe_output((string) get_parameter('version'))));
$end_of_life_date = get_parameter('end_of_life_date', 0);
$values = [];
$values['product'] = $product;
$values['version'] = $version;
$result = false;
$result = db_process_sql_update('tconfig_os_version', $values, ['id_os' => $id_os_version]);
if ($result !== false) {
$message = 3;
$tab = 'list';
} else {
$message = 4;
$tab = 'builder';
$os = db_get_row_filter('tconfig_os', ['id_os' => $idOS]);
$name = $os['name'];
}
$actionHidden = 'update';
$textButton = __('Update');
$classButton = ['icon' => 'wand'];
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os_version&tab='.$tab.'&message='.$message);
}
break;
case 'delete':
$sql = 'SELECT COUNT(id_os) AS count FROM tagente WHERE id_os = '.$idOS;
$count = db_get_all_rows_sql($sql);
$count = $count[0]['count'];
if ($count > 0) {
$message = 5;
} else {
$result = (bool) db_process_sql_delete('tconfig_os', ['id_os' => $idOS]);
if ($result) {
$message = 6;
} else {
$message = 7;
}
}
if (is_metaconsole() === true) {
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
} else {
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
}
break;
default:
case 'new':
$actionHidden = 'save';
$textButton = __('Create');
$classButton = ['icon' => 'next'];
break;
}
}
$buttons = [];
$buttons['list'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=list">'.html_print_image(
'images/logs@svg.svg',
true,
[
'title' => __('List OS'),
'class' => 'invert_filter main_menu_icon',
]
).'</a>',
];
if ($is_management_allowed === true) {
$buttons['builder'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=builder">'.html_print_image(
'images/edit.svg',
true,
[
'title' => __('Builder OS'),
'class' => 'invert_filter main_menu_icon',
]
).'</a>',
];
$buttons['version_exp_date_editor'] = [
'active' => false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/os&tab=manage_version">'.html_print_image(
'images/edit.svg',
true,
[
'title' => __('Version expiration date editor'),
'class' => 'invert_filter main_menu_icon',
]
).'</a>',
];
}
$buttons[$tab]['active'] = true;
switch ($tab) {
case 'builder':
$headerTitle = __('Edit OS');
break;
case 'manage_version':
$headerTitle = __('Version expiration date editor');
break;
case 'list':
$headerTitle = __('List of Operating Systems');
break;
default:
// Default.
break;
}
if (is_metaconsole() === false) {
// Header.
ui_print_standard_header(
$headerTitle,
'',
false,
'',
true,
$buttons,
[
[
'link' => '',
'label' => __('Servers'),
],
[
'link' => '',
'label' => __('Edit OS'),
],
]
);
}
if (empty($id_message) === false) {
switch ($id_message) {
case 1:
echo ui_print_success_message(__('Success creating OS'), '', true);
break;
case 2:
echo ui_print_error_message(__('Fail creating OS'), '', true);
break;
case 3:
echo ui_print_success_message(__('Success updating OS'), '', true);
break;
case 4:
echo ui_print_error_message(__('Error updating OS'), '', true);
break;
case 5:
echo ui_print_error_message(__('There are agents with this OS.'), '', true);
break;
case 6:
echo ui_print_success_message(__('Success deleting'), '', true);
break;
case 7:
echo ui_print_error_message(__('Error deleting'), '', true);
break;
default:
// Default.
break;
}
}
require_once $config['homedir'].'/godmode/setup/os_version.list.php';

View File

@ -170,13 +170,13 @@ if (check_acl($config['id_user'], 0, 'AW')) {
}
}
$buttons['integria'] = [
$buttons['ITSM'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=integria').'">'.html_print_image(
'images/integria.png',
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=ITSM').'">'.html_print_image(
'images/itsm.png',
true,
[
'title' => __('Integria IMS'),
'title' => __('ITSM'),
'class' => 'invert_filter',
]
).'</a>',
@ -185,7 +185,7 @@ $buttons['integria'] = [
$buttons['ehorus'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=ehorus').'">'.html_print_image(
'images/ehorus/ehorus.png',
'images/RC.png',
true,
[
'title' => __('eHorus'),
@ -303,10 +303,10 @@ switch ($section) {
$help_header = 'setup_ehorus_tab';
break;
case 'integria':
$buttons['integria']['active'] = true;
$subpage = __('Integria IMS');
$help_header = 'setup_integria_tab';
case 'ITSM':
$buttons['ITSM']['active'] = true;
$subpage = __('Pandora ITSM');
$help_header = 'setup_ITSM_tab';
break;
case 'module_library':
@ -442,8 +442,8 @@ switch ($section) {
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
break;
case 'integria':
include_once $config['homedir'].'/godmode/setup/setup_integria.php';
case 'ITSM':
include_once $config['homedir'].'/godmode/setup/setup_ITSM.php';
break;
case 'gis':

View File

@ -0,0 +1,716 @@
<?php
/**
* ITSM setup.
*
* @category Setup
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
use PandoraFMS\ITSM\ITSM;
// Load globals.
global $config;
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
}
$error = '';
$group_values = [];
$priority_values = [];
$object_types_values = [];
$status_values = [];
$node = [];
try {
$ITSM = new ITSM();
$has_connection = $ITSM->ping();
$group_values = $ITSM->getGroups();
$priority_values = $ITSM->getPriorities();
$status_values = $ITSM->getStatus();
$object_types_values = $ITSM->getObjectypes();
if ((bool) get_parameter('update_config', 0) === true) {
$set_config_inventories = $ITSM->createNode(
[
'serverAuth' => $config['server_unique_identifier'],
'apiPass' => $config['api_password'],
'agentsForExecution' => $config['ITSM_agents_sync'],
'path' => $config['ITSM_public_url'],
'label' => array_keys(servers_get_names())[0],
'nodeId' => $config['metaconsole_node_id'],
]
);
}
try {
$node = $ITSM->getNode($config['server_unique_identifier']);
} catch (\Throwable $th) {
$node = [];
}
} catch (\Throwable $th) {
$error = $th->getMessage();
$has_connection = false;
}
if ($has_connection === false && $config['ITSM_enabled']) {
ui_print_error_message(__('ITSM API is not reachable, %s', $error));
}
$table_enable = new StdClass();
$table_enable->data = [];
$table_enable->width = '100%';
$table_enable->id = 'itsm-enable-setup';
$table_enable->class = 'databox filters';
$table_enable->size['name'] = '30%';
$table_enable->style['name'] = 'font-weight: bold';
// Enable Pandora ITSM.
$row = [];
$row['name'] = __('Enable Pandora ITSM');
$row['control'] = html_print_checkbox_switch('ITSM_enabled', 1, $config['ITSM_enabled'], true);
$table_enable->data['ITSM_enabled'] = $row;
// Remote config table.
$table_remote = new StdClass();
$table_remote->data = [];
$table_remote->width = '100%';
$table_remote->styleTable = 'margin-bottom: 10px;';
$table_remote->id = 'ITSM-remote-setup';
$table_remote->class = 'databox filters filter-table-adv';
$table_remote->size['hostname'] = '50%';
$table_remote->size['api_pass'] = '50%';
// Enable ITSM user configuration.
$row = [];
$row['user_level'] = html_print_label_input_block(
__('Pandora ITSM configuration at user level'),
html_print_checkbox_switch(
'ITSM_user_level_conf',
1,
$config['ITSM_user_level_conf'],
true
)
);
$table_remote->data['ITSM_user_level_conf'] = $row;
// ITSM hostname.
$row = [];
$row['hostname'] = html_print_label_input_block(
__('URL to Pandora ITSM setup').ui_print_help_tip(
__('Full URL to your Pandora ITSM setup (e.g., http://192.168.1.20/integria/api/v1).'),
true
),
html_print_input_text(
'ITSM_hostname',
$config['ITSM_hostname'],
'',
30,
100,
true
),
['div_class' => 'ITSM-remote-setup-ITSM_hostname']
);
// ITSM token.
$row['password'] = html_print_label_input_block(
__('Token'),
html_print_input_password(
'ITSM_token',
io_output_password($config['ITSM_token']),
'',
30,
100,
true
),
['div_class' => 'ITSM-remote-setup-ITSM_token']
);
$table_remote->data['ITSM_token'] = $row;
// Test.
$row = [];
$button_test = html_print_button(
__('Test'),
'ITSM',
false,
'',
[
'icon' => 'cog',
'mode' => 'secondary mini',
],
true
);
$button_test .= '<span id="ITSM-spinner" class="invisible">&nbsp;';
$button_test .= html_print_image(
'images/spinner.gif',
true
);
$button_test .= '</span>';
$button_test .= '<span id="ITSM-success" class="invisible">&nbsp;';
$button_test .= html_print_image(
'images/status_sets/default/severity_normal.png',
true
);
$button_test .= '&nbsp;'.__('Connection its OK').'</span>';
$button_test .= '<span id="ITSM-failure" class="invisible">&nbsp;';
$button_test .= html_print_image(
'images/status_sets/default/severity_critical.png',
true
);
$button_test .= '&nbsp;'.__('Connection failed').'</span>';
$button_test .= '&nbsp;<span id="ITSM-message" class="invisible"></span>';
$row['control'] = html_print_label_input_block(
__('Test connection pandora to ITSM'),
$button_test
);
$table_remote->data['ITSM_test'] = $row;
$row = [];
$itsm_public_url = $config['ITSM_public_url'];
if (empty($itsm_public_url) === true) {
$itsm_public_url = $config['homeurl'];
if (isset($config['public_url']) === true && empty($config['public_url']) === false) {
$itsm_public_url = $config['public_url'];
}
}
$row['publicUrl'] = html_print_label_input_block(
__('URL conect to API %s', get_product_name()).ui_print_help_tip(
__('Full URL to your Pandora (e.g., http://192.168.1.20).'),
true
),
html_print_input_text(
'ITSM_public_url',
$itsm_public_url,
'',
30,
100,
true
)
);
$row['agentsSync'] = html_print_label_input_block(
__('Number Agents to synchronize').ui_print_help_tip(
__('Number of agents that will synchronize at the same time, minimum 10 max 1000'),
true
),
html_print_input_number(
[
'name' => 'ITSM_agents_sync',
'min' => 10,
'max' => 1000,
'value' => ($config['ITSM_agents_sync'] ?? 20),
]
)
);
$table_remote->data['ITSM_sync_inventory'] = $row;
// Test.
$row = [];
$button_test_pandora = html_print_button(
__('Test'),
'ITSM-pandora',
false,
'',
[
'icon' => 'cog',
'mode' => 'secondary mini',
],
true
);
$button_test_pandora .= '<span id="ITSM-spinner-pandora" class="invisible">&nbsp;';
$button_test_pandora .= html_print_image(
'images/spinner.gif',
true
);
$button_test_pandora .= '</span>';
$button_test_pandora .= '<span id="ITSM-success-pandora" class="invisible">&nbsp;';
$button_test_pandora .= html_print_image(
'images/status_sets/default/severity_normal.png',
true
);
$button_test_pandora .= '&nbsp;'.__('Connection its OK').'</span>';
$button_test_pandora .= '<span id="ITSM-failure-pandora" class="invisible">&nbsp;';
$button_test_pandora .= html_print_image(
'images/status_sets/default/severity_critical.png',
true
);
$button_test_pandora .= '&nbsp;'.__('Connection failed').'</span>';
$button_test_pandora .= '&nbsp;<span id="ITSM-message-pandora" class="invisible"></span>';
$row['control-test'] = html_print_label_input_block(
__('Test conection ITSM to pandora'),
$button_test_pandora
);
if (empty($node) === false) {
$progressbar = '';
$progress = 0;
if (empty($node['total']) === false) {
if (empty($node['accumulate']) === true) {
$node['accumulate'] = 0;
}
$progress = round(($node['accumulate'] * 100 / $node['total']));
}
if (empty($node['error']) === false) {
$progressbar = $node['error'];
} else if (empty($node['total']) === false) {
$progressbar = '<div class="flex mrgn_5px">';
$progressbar .= ui_progress($progress, '150px', '1.3', '#14524f', true, '', false, 'margin-right:5px; color:#c0ccdc');
$progressbar .= ' ( '.$node['accumulate'].' / '.$node['total'].' ) '.__('Agents');
$progressbar .= '</div>';
} else {
$progressbar = '--';
}
// $progressbar .= (empty($node['dateStart']) === false) ? human_time_comparation($node['dateStart']) : __('Never');
$row['control-test-pandora'] = html_print_label_input_block(
__('Progress agents to synch'),
$progressbar
);
}
$table_remote->data['ITSM_test_pandora'] = $row;
// Alert settings.
$table_alert_settings = new StdClass();
$table_alert_settings->data = [];
$table_alert_settings->rowspan = [];
$table_alert_settings->width = '100%';
$table_alert_settings->styleTable = 'margin-bottom: 10px;';
$table_alert_settings->id = 'ITSM-settings-setup';
$table_alert_settings->class = 'databox filters filter-table-adv';
$table_alert_settings->size[0] = '50%';
$table_alert_settings->size[1] = '50%';
// Alert incident title.
$table_alert_settings->data[0][0] = html_print_label_input_block(
__('Title'),
html_print_input_text(
'incident_title',
$config['incident_title'],
__('Name'),
50,
100,
true,
false,
false
)
);
// Alert incident description.
$table_alert_settings->rowspan[0][1] = 3;
$table_alert_settings->data[0][1] = html_print_label_input_block(
__('Ticket body'),
html_print_textarea(
'incident_content',
9,
25,
$config['incident_content'],
'',
true
)
);
// Alert default group.
$table_alert_settings->data[1][0] = html_print_label_input_block(
__('Group'),
html_print_select(
$group_values,
'default_group',
$config['default_group'],
'',
'',
0,
true,
false,
true,
'',
false
)
);
// Alert default owner.
$table_alert_settings->data[2][0] = html_print_label_input_block(
__('Owner'),
html_print_autocomplete_users_from_pandora_itsm(
'default_owner',
$config['default_owner'],
true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
);
// Alert default incident status.
$table_alert_settings->data[3][0] = html_print_label_input_block(
__('Status'),
html_print_select(
$status_values,
'incident_status',
$config['incident_status'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Alert default criticity.
$table_alert_settings->data[3][1] = html_print_label_input_block(
__('Priority'),
html_print_select(
$priority_values,
'default_criticity',
$config['default_criticity'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Alert default incident type.
$table_alert_settings->data[4][0] = html_print_label_input_block(
__('Type'),
html_print_select(
$object_types_values,
'incident_type',
$config['incident_type'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Custom response settings.
$table_cr_settings = new StdClass();
$table_cr_settings->data = [];
$table_cr_settings->width = '100%';
$table_cr_settings->styleTable = 'margin-bottom: 10px;';
$table_cr_settings->id = 'ITSM-cr-settings-setup';
$table_cr_settings->class = 'databox filters filter-table-adv';
$table_cr_settings->size[0] = '50%';
$table_cr_settings->size[1] = '50%';
// Custom response incident title.
$table_cr_settings->data[0][0] = html_print_label_input_block(
__('Title'),
html_print_input_text(
'cr_incident_title',
$config['cr_incident_title'],
__('Name'),
50,
100,
true,
false,
false
)
);
// Custom response incident description.
$table_cr_settings->rowspan[0][1] = 3;
$table_cr_settings->data[0][1] = html_print_label_input_block(
__('Ticket body'),
html_print_textarea(
'cr_incident_content',
9,
25,
$config['cr_incident_content'],
'',
true
)
);
// Custom response default group.
$table_cr_settings->data[1][0] = html_print_label_input_block(
__('Group'),
html_print_select(
$group_values,
'cr_default_group',
$config['cr_default_group'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Custom response default owner.
$table_cr_settings->data[2][0] = html_print_label_input_block(
__('Owner'),
html_print_autocomplete_users_from_pandora_itsm(
'cr_default_owner',
$config['cr_default_owner'],
true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
);
// Custom response default incident status.
$row = [];
$table_cr_settings->data[3][0] = html_print_label_input_block(
__('Status'),
html_print_select(
$status_values,
'cr_incident_status',
$config['cr_incident_status'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Custom response default criticity.
$table_cr_settings->data[3][1] = html_print_label_input_block(
__('Priority'),
html_print_select(
$priority_values,
'cr_default_criticity',
$config['cr_default_criticity'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Custom response default incident type.
$table_cr_settings->data[4][0] = html_print_label_input_block(
__('Type'),
html_print_select(
$object_types_values,
'cr_incident_type',
$config['cr_incident_type'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Print.
echo '<div class="center pdd_b_10px mrgn_btn_20px white_box max_floating_element_size">';
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/es/itsm/">';
html_print_image(
'images/pandoraITSM_logo.png',
false,
['class' => 'w600px mrgn_top_15px']
);
echo '</a>';
echo '<br />';
echo '<div class="ITSM_title">';
echo __('Pandora ITSM');
echo '</div>';
echo '<a target="_blank" rel="noopener noreferrer" href="https://pandorafms.com/es/itsm/">';
echo 'https://pandorafms.com/es/itsm/';
echo '</a>';
echo '</div>';
echo "<form method='post' class='max_floating_element_size'>";
html_print_input_hidden('update_config', 1);
// Form enable.
echo '<div id="form_enable">';
html_print_table($table_enable);
echo '</div>';
// Form remote.
echo '<div id="form_remote">';
echo '<fieldset>';
echo '<legend>'.__('Pandora ITSM API settings').'</legend>';
html_print_table($table_remote);
echo '</fieldset>';
echo '</div>';
if ($has_connection !== false) {
// Form alert default settings.
echo '<div id="form_alert_settings">';
echo '<fieldset class="mrgn_top_15px">';
echo '<legend>'.__('Alert default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_alert_settings);
echo '</fieldset>';
echo '</div>';
// Form custom response default settings.
echo '<div id="form_custom_response_settings">';
echo '<fieldset class="mrgn_top_15px">';
echo '<legend>'.__('Event custom response default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_cr_settings);
echo '</fieldset>';
echo '</div>';
$update_button = html_print_submit_button(
__('Update'),
'update_button',
false,
['icon' => 'update'],
true
);
} else {
$update_button = html_print_submit_button(
__('Update and continue'),
'update_button',
false,
['icon' => 'update'],
true
);
}
html_print_action_buttons($update_button);
echo '</form>';
ui_require_javascript_file('ITSM');
?>
<script type="text/javascript">
if($('input:checkbox[name="ITSM_user_level_conf"]').is(':checked'))
{
$('.ITSM-remote-setup-ITSM_token').hide()
}
var handleUserLevel = function(event) {
var is_checked = $('input:checkbox[name="ITSM_enabled"]').is(':checked');
var is_checked_userlevel = $('input:checkbox[name="ITSM_user_level_conf"]').is(':checked');
if (event.target.value == '1' && is_checked && !is_checked_userlevel) {
showUserPass();
$('input:checkbox[name="ITSM_user_level_conf"]').attr('checked', true);
}
else {
hideUserPass();
$('input:checkbox[name="ITSM_user_level_conf"]').attr('checked', false);
};
}
$('input:checkbox[name="ITSM_enabled"]').change(handleEnable);
$('input:checkbox[name="ITSM_user_level_conf"]').change(handleUserLevel);
if(!$('input:checkbox[name="ITSM_enabled"]').is(':checked')) {
$('#form_remote').hide();
$('#form_custom_response_settings').hide();
} else {
$('#form_remote').show();
$('#form_custom_response_settings').show();
}
$('#form_enable').css('margin-bottom','20px');
var showFields = function () {
$('#form_remote').show();
$('#form_custom_response_settings').show();
}
var hideFields = function () {
$('#form_remote').hide();
$('#form_custom_response_settings').hide();
}
var hideUserPass = function () {
$('.ITSM-remote-setup-ITSM_token').hide();
}
var showUserPass = function () {
$('.ITSM-remote-setup-ITSM_token').show();
}
var handleEnable = function (event) {
var is_checked = $('input:checkbox[name="ITSM_enabled"]').is(':checked');
if (event.target.value == '1' && is_checked) {
showFields();
$('input:checkbox[name="ITSM_enabled"]').attr('checked', true);
}
else {
hideFields();
$('input:checkbox[name="ITSM_enabled"]').attr('checked', false);
};
}
$('input:checkbox[name="ITSM_enabled"]').change(handleEnable);
$('#button-ITSM').click(function() {
var pass = $('input#password-ITSM_token').val();
var host = $('input#text-ITSM_hostname').val();
testConectionApi(pass, host);
});
$('#button-ITSM-pandora').click(function() {
var path = $('input#text-ITSM_public_url').val();
testConectionApiItsmToPandora(path);
});
</script>

View File

@ -371,7 +371,7 @@ if (is_ajax() === true) {
case 'pandora':
case 'ad':
case 'saml':
case 'integria':
case 'ITSM':
// Add enterprise authentication options.
if (enterprise_installed() === true) {
add_enterprise_auth_options($table, $type_auth);

View File

@ -1,997 +0,0 @@
<?php
/**
* Integria setup.
*
* @category Setup
* @package Pandora FMS
* @subpackage Opensource
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Load globals.
global $config;
check_login();
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
}
require_once $config['homedir'].'/include/functions_integriaims.php';
if (is_ajax() === true) {
$operation = (string) get_parameter('operation', '');
$integria_user = get_parameter('integria_user', '');
$integria_pass = get_parameter('integria_pass', '');
$integria_api_hostname = get_parameter('api_hostname', '');
$integria_api_pass = get_parameter('api_pass', '');
$user_level_conf = get_parameter('user_level_conf', 0);
$user_level_conf_bool = ((bool) $user_level_conf === true);
$login_result = integria_api_call($integria_api_hostname, $integria_user, $integria_pass, $integria_api_pass, 'get_login', [], false, '', '', $user_level_conf_bool);
echo json_encode(['login' => ($login_result !== false) ? 1 : 0]);
return;
}
$has_connection = integria_api_call(null, null, null, null, 'get_login', []);
if ($has_connection === false && $config['integria_enabled']) {
ui_print_error_message(__('Integria IMS API is not reachable'));
}
if (get_parameter('update_config', 0) == 1) {
// Try to retrieve event response 'Create incident in IntegriaIMS from event' to check if it exists.
$event_response_exists = db_get_row_filter('tevent_response', ['name' => io_safe_input('Create ticket in IntegriaIMS from event')]);
// Try to retrieve command 'Integia IMS Ticket' to check if it exists.
$command_exists = db_get_row_filter('talert_commands', ['name' => io_safe_input('Integria IMS Ticket')]);
if ($config['integria_enabled'] == 1) {
if ($event_response_exists === false) {
// Create 'Create incident in IntegriaIMS from event' event response only when user enables IntegriaIMS integration and it does not exist in database.
db_process_sql_insert(
'tevent_response',
[
'name' => io_safe_input('Create ticket in IntegriaIMS from event'),
'description' => io_safe_input('Create a ticket in Integria IMS from an event'),
'target' => io_safe_input('index.php?sec=incident&sec2=operation/incidents/configure_integriaims_incident&from_event=_event_id_'),
'type' => 'url',
'id_group' => '0',
'modal_width' => '0',
'modal_height' => '0',
'new_window' => '1',
'params' => '',
'server_to_exec' => '0',
]
);
}
$ticket_types = integria_api_call(null, null, null, null, 'get_types', '', false, 'json');
$types_string = '';
if ($ticket_types !== '') {
foreach (json_decode($ticket_types, true) as $key => $value) {
$types_string .= $value['id'].','.$value['name'].';';
}
}
if ($command_exists === false) {
// Create 'Integria IMS Ticket' command only when user enables IntegriaIMS integration and it does not exist in database.
$id_command_inserted = db_process_sql_insert(
'talert_commands',
[
'name' => io_safe_input('Integria IMS Ticket'),
'command' => io_safe_input('Internal type'),
'internal' => 1,
'description' => io_safe_input('Create a ticket in Integria IMS'),
'fields_descriptions' => '["'.io_safe_input('Ticket title').'","'.io_safe_input('Ticket group ID').'","'.io_safe_input('Ticket priority').'","'.io_safe_input('Ticket owner').'","'.io_safe_input('Ticket type').'","'.io_safe_input('Ticket status').'","'.io_safe_input('Ticket description').'","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]',
'fields_values' => '["", "", "","","'.$types_string.'","","","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]',
]
);
// Create 'Create Integria IMS Ticket' action only when user enables IntegriaIMS integration and command exists in database.
$action_values = [
'field1' => io_safe_input($config['incident_title']),
'field1_recovery' => io_safe_input($config['incident_title']),
'field2' => io_safe_input($config['default_group']),
'field2_recovery' => io_safe_input($config['default_group']),
'field3' => io_safe_input($config['default_criticity']),
'field3_recovery' => io_safe_input($config['default_criticity']),
'field4' => io_safe_input($config['default_owner']),
'field4_recovery' => io_safe_input($config['default_owner']),
'field5' => io_safe_input($config['incident_type']),
'field5_recovery' => io_safe_input($config['incident_type']),
'field6' => io_safe_input($config['incident_status']),
'field6_recovery' => io_safe_input($config['incident_status']),
'field7' => io_safe_input($config['incident_content']),
'field7_recovery' => io_safe_input($config['incident_content']),
'id_group' => 0,
'action_threshold' => 0,
];
alerts_create_alert_action(io_safe_input('Create Integria IMS ticket'), $id_command_inserted, $action_values);
} else {
// Update 'Integria IMS Ticket' command with ticket types retrieved from Integria IMS.
$sql_update_command_values = sprintf(
'
UPDATE talert_commands
SET fields_values = \'["","","","","%s","","","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_","_integria_type_custom_field_"]\'
WHERE name="%s"',
$types_string,
io_safe_input('Integria IMS Ticket')
);
db_process_sql($sql_update_command_values);
// Update those actions that make use of 'Integria IMS Ticket' command when setup default fields are updated. Empty fields in actions will be filled in with default values.
$update_action_values = [
$config['incident_title'],
$config['default_group'],
$config['default_criticity'],
$config['default_owner'],
$config['incident_type'],
$config['incident_status'],
$config['incident_content'],
];
foreach ($update_action_values as $key => $value) {
$field_key = ($key + 1);
$sql_update_action_field = sprintf(
'
UPDATE talert_actions taa
INNER JOIN talert_commands tac
ON taa.id_alert_command=tac.id
SET field%s= "%s"
WHERE tac.name="Integria&#x20;IMS&#x20;Ticket"
AND (
taa.field%s IS NULL OR taa.field%s=""
)',
$field_key,
$value,
$field_key,
$field_key,
$field_key
);
db_process_sql($sql_update_action_field);
}
foreach ($update_action_values as $key => $value) {
$field_key = ($key + 1);
$sql_update_action_recovery_field = sprintf(
'
UPDATE talert_actions taa
INNER JOIN talert_commands tac
ON taa.id_alert_command=tac.id
SET field%s_recovery = "%s"
WHERE tac.name="Integria&#x20;IMS&#x20;Ticket"
AND (
taa.field%s_recovery IS NULL OR taa.field%s_recovery=""
)',
$field_key,
$value,
$field_key,
$field_key,
$field_key
);
db_process_sql($sql_update_action_recovery_field);
}
}
} else {
if ($event_response_exists !== false) {
// Delete 'Create incident in IntegriaIMS from event' event response if it does exist and IntegriaIMS integration is disabled.
db_process_sql_delete('tevent_response', ['name' => io_safe_input('Create ticket in IntegriaIMS from event')]);
}
}
}
// Get parameters from Integria IMS API.
$integria_group_values = [];
$integria_criticity_values = [];
$integria_users_values = [];
$integria_types_values = [];
$integria_status_values = [];
$integria_groups_csv = integria_api_call(null, null, null, null, 'get_groups', []);
get_array_from_csv_data_pair($integria_groups_csv, $integria_group_values);
$integria_status_csv = integria_api_call(null, null, null, null, 'get_incidents_status', []);
get_array_from_csv_data_pair($integria_status_csv, $integria_status_values);
$integria_criticity_levels_csv = integria_api_call(null, null, null, null, 'get_incident_priorities', []);
get_array_from_csv_data_pair($integria_criticity_levels_csv, $integria_criticity_values);
$integria_users_csv = integria_api_call(null, null, null, null, 'get_users', []);
$csv_array = explode("\n", $integria_users_csv);
foreach ($csv_array as $csv_line) {
if (empty($csv_line) === false) {
$integria_users_values[$csv_line] = $csv_line;
}
}
$integria_types_csv = integria_api_call(null, null, null, null, 'get_types', []);
get_array_from_csv_data_pair($integria_types_csv, $integria_types_values);
// Enable table.
$table_enable = new StdClass();
$table_enable->data = [];
$table_enable->width = '100%';
$table_enable->id = 'integria-enable-setup';
$table_enable->class = 'databox filters';
$table_enable->size['name'] = '30%';
$table_enable->style['name'] = 'font-weight: bold';
// Enable Integria.
$row = [];
$row['name'] = __('Enable Integria IMS');
$row['control'] = html_print_checkbox_switch('integria_enabled', 1, $config['integria_enabled'], true);
$table_enable->data['integria_enabled'] = $row;
// Remote config table.
$table_remote = new StdClass();
$table_remote->data = [];
$table_remote->width = '100%';
$table_remote->styleTable = 'margin-bottom: 10px;';
$table_remote->id = 'integria-remote-setup';
$table_remote->class = 'databox filters filter-table-adv';
$table_remote->size['hostname'] = '50%';
$table_remote->size['api_pass'] = '50%';
// Enable Integria user configuration.
$row = [];
$row['user_level'] = html_print_label_input_block(
__('Integria configuration at user level'),
html_print_checkbox_switch(
'integria_user_level_conf',
1,
$config['integria_user_level_conf'],
true
)
);
$table_remote->data['integria_user_level_conf'] = $row;
// Integria user.
$row = [];
$row['user'] = html_print_label_input_block(
__('User'),
html_print_input_text(
'integria_user',
$config['integria_user'],
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_user']
);
// Integria password.
$row['password'] = html_print_label_input_block(
__('Password'),
html_print_input_password(
'integria_pass',
io_output_password($config['integria_pass']),
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_pass']
);
$table_remote->data['integria_pass'] = $row;
// Integria hostname.
$row = [];
$row['hostname'] = html_print_label_input_block(
__('URL to Integria IMS setup').ui_print_help_tip(__('Full URL to your Integria IMS setup (e.g., http://192.168.1.20/integria, https://support.mycompany.com).'), true),
html_print_input_text(
'integria_hostname',
$config['integria_hostname'],
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_hostname']
);
// API password.
$row['api_pass'] = html_print_label_input_block(
__('API Password'),
html_print_input_password(
'integria_api_pass',
io_output_password($config['integria_api_pass']),
'',
30,
100,
true
),
['div_class' => 'integria-remote-setup-integria_api_pass']
);
$table_remote->data['integria_api_pass'] = $row;
// Request timeout.
$row = [];
$row['req_timeout'] = html_print_label_input_block(
__('Request timeout'),
html_print_input_text(
'integria_req_timeout',
$config['integria_req_timeout'],
'',
3,
10,
true
),
['div_class' => 'integria-remote-setup-integria_req_timeout']
);
$table_remote->data['integria_req_timeout'] = $row;
$row = [];
$row['control'] = __('Inventory');
$row['control'] .= html_print_button(
__('Sync inventory'),
'sync-inventory',
false,
'',
[
'icon' => 'cog',
'mode' => 'secondary mini',
],
true
);
$row['control'] .= '<span id="test-integria-spinner-sync" style="display:none;">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$row['control'] .= '<span id="test-integria-success-sync" style="display:none;">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
$row['control'] .= '<span id="test-integria-failure-sync" style="display:none;">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
$table_remote->data['integria_sync_inventory'] = $row;
// Alert settings.
$table_alert_settings = new StdClass();
$table_alert_settings->data = [];
$table_alert_settings->width = '100%';
$table_alert_settings->styleTable = 'margin-bottom: 10px;';
$table_alert_settings->id = 'integria-cr-settings-setup';
$table_alert_settings->class = 'databox filters filter-table-adv';
$table_alert_settings->size[0] = '50%';
$table_alert_settings->size[1] = '50%';
// Alert incident title.
$row = [];
$row[0] = html_print_label_input_block(
__('Title'),
html_print_input_text(
'incident_title',
$config['incident_title'],
__('Name'),
50,
100,
true,
false,
false
)
);
// Alert incident description.
$row[1] = html_print_label_input_block(
__('Ticket body'),
html_print_textarea(
'incident_content',
3,
25,
$config['incident_content'],
'',
true
)
);
$table_alert_settings->data[0] = $row;
// Alert default group.
$row = [];
$row[0] = html_print_label_input_block(
__('Group'),
html_print_select(
$integria_group_values,
'default_group',
$config['default_group'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Alert default criticity.
$row[1] = html_print_label_input_block(
__('Priority'),
html_print_select(
$integria_criticity_values,
'default_criticity',
$config['default_criticity'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
$table_alert_settings->data[1] = $row;
// Alert default owner.
$row = [];
$row[0] = html_print_label_input_block(
__('Owner'),
html_print_autocomplete_users_from_integria(
'default_owner',
$config['default_owner'],
true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
);
// Alert default incident type.
$row[1] = html_print_label_input_block(
__('Type'),
html_print_select(
$integria_types_values,
'incident_type',
$config['incident_type'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
$table_alert_settings->data[2] = $row;
// Alert default incident status.
$row = [];
$row[0] = html_print_label_input_block(
__('Status'),
html_print_select(
$integria_status_values,
'incident_status',
$config['incident_status'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
$table_alert_settings->data[3] = $row;
// Custom response settings.
$table_cr_settings = new StdClass();
$table_cr_settings->data = [];
$table_cr_settings->width = '100%';
$table_cr_settings->styleTable = 'margin-bottom: 10px;';
$table_cr_settings->id = 'integria-cr-settings-setup';
$table_cr_settings->class = 'databox filters filter-table-adv';
$table_cr_settings->size[0] = '50%';
$table_cr_settings->size[1] = '50%';
// Custom response incident title.
$row = [];
$row[0] = html_print_label_input_block(
__('Title'),
html_print_input_text(
'cr_incident_title',
$config['cr_incident_title'],
__('Name'),
50,
100,
true,
false,
false
)
);
// Custom response incident description.
$row[1] = html_print_label_input_block(
__('Ticket body'),
html_print_textarea(
'cr_incident_content',
3,
25,
$config['cr_incident_content'],
'',
true
)
);
$table_cr_settings->data[0] = $row;
// Custom response default group.
$row = [];
$row[0] = html_print_label_input_block(
__('Group'),
html_print_select(
$integria_group_values,
'cr_default_group',
$config['cr_default_group'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
// Custom response default criticity.
$row[1] = html_print_label_input_block(
__('Priority'),
html_print_select(
$integria_criticity_values,
'cr_default_criticity',
$config['cr_default_criticity'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
$table_cr_settings->data[1] = $row;
// Custom response default owner.
$row = [];
$row[0] = html_print_label_input_block(
__('Owner'),
html_print_autocomplete_users_from_integria(
'cr_default_owner',
$config['cr_default_owner'],
true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
);
// Custom response default incident type.
$row[1] = html_print_label_input_block(
__('Type'),
html_print_select(
$integria_types_values,
'cr_incident_type',
$config['cr_incident_type'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
$table_cr_settings->data[2] = $row;
// Custom response default incident status.
$row = [];
$row[0] = html_print_label_input_block(
__('Status'),
html_print_select(
$integria_status_values,
'cr_incident_status',
$config['cr_incident_status'],
'',
__('Select'),
0,
true,
false,
true,
'',
false
)
);
$table_cr_settings->data[3] = $row;
// Test.
$row = [];
$row['control'] = __('Test connection');
$row['control'] .= html_print_button(
__('Test'),
'test-integria',
false,
'',
[
'icon' => 'cog',
'mode' => 'secondary mini',
],
true
);
$row['control'] .= '<span id="test-integria-spinner" class="invisible">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$row['control'] .= '<span id="test-integria-success" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'&nbsp;'.__('Connection its OK').'</span>';
$row['control'] .= '<span id="test-integria-failure" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'&nbsp;'.__('Connection failed').'</span>';
$row['control'] .= '&nbsp;<span id="test-integria-message" class="invisible"></span>';
$table_remote->data['integria_test'] = $row;
// Print.
echo '<div class="center pdd_b_10px mrgn_btn_20px white_box max_floating_element_size">';
echo '<a target="_blank" rel="noopener noreferrer" href="http://integriaims.com">';
html_print_image(
'images/integria_logo.svg',
false,
['class' => 'w400px mrgn_top_15px']
);
echo '</a>';
echo '<br />';
echo '<div clsas="integria_title">';
echo __('Integria IMS');
echo '</div>';
echo '<a target="_blank" rel="noopener noreferrer" href="https://integriaims.com">';
echo 'https://integriaims.com';
echo '</a>';
echo '</div>';
echo "<form method='post' class='max_floating_element_size'>";
html_print_input_hidden('update_config', 1);
// Form enable.
echo '<div id="form_enable">';
html_print_table($table_enable);
echo '</div>';
// Form remote.
echo '<div id="form_remote">';
echo '<fieldset>';
echo '<legend>'.__('Integria API settings').'</legend>';
html_print_table($table_remote);
echo '</fieldset>';
echo '</div>';
if ($has_connection != false) {
// Form alert default settings.
echo '<div id="form_alert_settings">';
echo '<fieldset class="mrgn_top_15px">';
echo '<legend>'.__('Alert default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_alert_settings);
echo '</fieldset>';
echo '</div>';
// Form custom response default settings.
echo '<div id="form_custom_response_settings">';
echo '<fieldset class="mrgn_top_15px">';
echo '<legend>'.__('Event custom response default values').'&nbsp'.ui_print_help_icon('alert_macros', true).'</legend>';
html_print_table($table_cr_settings);
echo '</fieldset>';
echo '</div>';
$update_button = html_print_submit_button(
__('Update'),
'update_button',
false,
['icon' => 'update'],
true
);
} else {
$update_button = html_print_submit_button(
__('Update and continue'),
'update_button',
false,
['icon' => 'update'],
true
);
}
html_print_action_buttons($update_button);
echo '</form>';
?>
<script type="text/javascript">
if($('input:checkbox[name="integria_user_level_conf"]').is(':checked'))
{
$('.integria-remote-setup-integria_user').hide();
$('.integria-remote-setup-integria_pass').hide()
}
var handleUserLevel = function(event) {
var is_checked = $('input:checkbox[name="integria_enabled"]').is(':checked');
var is_checked_userlevel = $('input:checkbox[name="integria_user_level_conf"]').is(':checked');
if (event.target.value == '1' && is_checked && !is_checked_userlevel) {
showUserPass();
$('input:checkbox[name="integria_user_level_conf"]').attr('checked', true);
}
else {
hideUserPass();
$('input:checkbox[name="integria_user_level_conf"]').attr('checked', false);
};
}
$('input:checkbox[name="integria_enabled"]').change(handleEnable);
$('input:checkbox[name="integria_user_level_conf"]').change(handleUserLevel);
if(!$('input:checkbox[name="integria_enabled"]').is(':checked')) {
$('#form_remote').hide();
$('#form_custom_response_settings').hide();
} else {
$('#form_remote').show();
$('#form_custom_response_settings').show();
}
$('#form_enable').css('margin-bottom','20px');
var showFields = function () {
$('#form_remote').show();
$('#form_custom_response_settings').show();
}
var hideFields = function () {
$('#form_remote').hide();
$('#form_custom_response_settings').hide();
}
var hideUserPass = function () {
$('.integria-remote-setup-integria_user').hide();
$('.integria-remote-setup-integria_pass').hide();
}
var showUserPass = function () {
$('.integria-remote-setup-integria_user').show();
$('.integria-remote-setup-integria_pass').show();
}
var handleEnable = function (event) {
var is_checked = $('input:checkbox[name="integria_enabled"]').is(':checked');
if (event.target.value == '1' && is_checked) {
showFields();
$('input:checkbox[name="integria_enabled"]').attr('checked', true);
}
else {
hideFields();
$('input:checkbox[name="integria_enabled"]').attr('checked', false);
};
}
$('input:checkbox[name="integria_enabled"]').change(handleEnable);
var handleTest = function (event) {
var user = $('input#text-integria_user').val();
var pass = $('input#password-integria_pass').val();
var host = $('input#text-integria_hostname').val();
var timeout = Number.parseInt($('input#text-integria_req_timeout').val(), 10);
var timeoutMessage = '<?php echo __('Connection timeout'); ?>';
var badRequestMessage = '<?php echo __('Empty user or password'); ?>';
var notFoundMessage = '<?php echo __('User not found'); ?>';
var invalidPassMessage = '<?php echo __('Invalid password'); ?>';
var hideLoadingImage = function () {
$('span#test-integria-spinner').hide();
}
var showLoadingImage = function () {
$('span#test-integria-spinner').show();
}
var hideSuccessImage = function () {
$('span#test-integria-success').hide();
}
var showSuccessImage = function () {
$('span#test-integria-success').show();
}
var hideFailureImage = function () {
$('span#test-integria-failure').hide();
}
var showFailureImage = function () {
$('span#test-integria-failure').show();
}
var hideMessage = function () {
$('span#test-integria-message').hide();
}
var showMessage = function () {
$('span#test-integria-message').show();
}
var changeTestMessage = function (message) {
$('span#test-integria-message').text(message);
}
hideSuccessImage();
hideFailureImage();
hideMessage();
showLoadingImage();
var integria_user = $('input[name=integria_user]').val();
var integria_pass = $('input[name=integria_pass]').val();
var api_hostname = $('input[name=integria_hostname]').val();
var api_pass = $('input[name=integria_api_pass]').val();
var user_level_conf = $('input:checkbox[name="integria_user_level_conf"]').is(':checked');
var data = {
page: 'godmode/setup/setup_integria',
operation: 'check_api_access',
integria_user: integria_user,
integria_pass: integria_pass,
api_hostname: api_hostname,
api_pass: api_pass,
user_level_conf: user_level_conf,
}
// AJAX call to check API connection.
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "json",
timeout: timeout ? timeout * 1000 : 0,
data: data
})
.done(function(data, textStatus, xhr) {
if (data.login == '1') {
showSuccessImage();
} else {
showFailureImage();
showMessage();
}
})
.fail(function(xhr, textStatus, errorThrown) {
showFailureImage();
showMessage();
})
.always(function(xhr, textStatus) {
hideLoadingImage();
});
}
var handleInventorySync = function (event) {
var badRequestMessage = '<?php echo __('Empty user or password'); ?>';
var notFoundMessage = '<?php echo __('User not found'); ?>';
var invalidPassMessage = '<?php echo __('Invalid password'); ?>';
var hideLoadingImage = function () {
$('span#test-integria-spinner-sync').hide();
}
var showLoadingImage = function () {
$('span#test-integria-spinner-sync').show();
}
var hideSuccessImage = function () {
$('span#test-integria-success-sync').hide();
}
var showSuccessImage = function () {
$('span#test-integria-success-sync').show();
}
var hideFailureImage = function () {
$('span#test-integria-failure-sync').hide();
}
var showFailureImage = function () {
$('span#test-integria-failure-sync').show();
}
hideSuccessImage();
hideFailureImage();
showLoadingImage();
var integria_user = $('input[name=integria_user]').val();
var integria_pass = $('input[name=integria_pass]').val();
var api_hostname = $('input[name=integria_hostname]').val();
var api_pass = $('input[name=integria_api_pass]').val();
if (!api_hostname.match(/^[a-zA-Z]+:\/\//))
{
api_hostname = 'http://' + api_hostname;
}
var url = api_hostname + '/integria/include/api.php';
<?php
// Retrieve all agents and codify string in the format that will be sent over in Ajax call.
$agent_fields = [
'nombre',
'alias',
'id_os',
'direccion',
'id_agente',
'id_grupo',
];
$agents = agents_get_agents(false, $agent_fields);
$agents_query_string_array = [];
foreach ($agents as $agent_data) {
$agents_query_string_array[] = implode('|;|', $agent_data);
}
?>
var agents_query_string_array = <?php echo json_encode($agents_query_string_array); ?>;
var data = {
op: 'sync_pandora_agents_inventory',
user: integria_user,
user_pass: integria_pass,
pass: api_pass,
params: agents_query_string_array,
token: '|;|'
}
// AJAX call to check API connection.
$.ajax({
type: "POST",
url: url,
dataType: "json",
data: data
})
.done(function(data, textStatus, xhr) {
showSuccessImage();
})
.fail(function(xhr, textStatus, errorThrown) {
showFailureImage();
})
.always(function(xhr, textStatus) {
hideLoadingImage();
});
}
$('#button-test-integria').click(handleTest);
$('#button-sync-inventory').click(handleInventorySync);
</script>

View File

@ -333,6 +333,7 @@ if ($create_user === true) {
$values['default_custom_view'] = (int) get_parameter('default_custom_view');
$values['time_autorefresh'] = (int) get_parameter('time_autorefresh', 0);
$values['show_tips_startup'] = (int) get_parameter_switch('show_tips_startup');
$values['integria_user_level_pass'] = (string) get_parameter('integria_user_level_pass');
$dashboard = get_parameter('dashboard', '');
$visual_console = get_parameter('visual_console', '');
@ -624,6 +625,7 @@ if ($update_user) {
$values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false);
$values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user');
$values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass');
$values['integria_user_level_pass'] = (string) get_parameter('integria_user_level_pass');
$values['middlename'] = get_parameter('middlename', 0);

View File

@ -789,6 +789,62 @@ $userManagementTable->data['fields_addSettings'][1] .= html_print_div(
true
);
if ($config['ITSM_enabled'] && $config['ITSM_user_level_conf']) {
// Pandora ITSM user remote login.
$table_ITSM = new StdClass();
$table_ITSM->data = [];
$table_ITSM->width = '100%';
$table_ITSM->id = 'ITSM-remote-setup';
$table_ITSM->class = 'white_box';
$table_ITSM->size['name'] = '30%';
$table_ITSM->style['name'] = 'font-weight: bold';
// Pandora ITSM user level authentication.
// Title.
$row = [];
$row['control'] = '<p class="edit_user_labels">'.__('Pandora ITSM user configuration').': </p>';
$table_ITSM->data['ITSM_user_level_conf'] = $row;
// Pandora ITSM pass.
$row = [];
$row['name'] = __('Token');
$row['control'] = html_print_input_password(
'integria_user_level_pass',
io_output_password($user_info['integria_user_level_pass']),
'',
100,
100,
true
);
$table_ITSM->data['integria_user_level_pass'] = $row;
// Test.
$ITSM_host = db_get_value('value', 'tconfig', 'token', 'ITSM_hostname');
$row = [];
$row['name'] = __('Test');
$row['control'] = html_print_button(
__('Start'),
'ITSM',
false,
'',
[
'icon' => 'cog',
'mode' => 'secondary mini',
],
true
);
$row['control'] .= '&nbsp;<span id="ITSM-spinner" class="invisible">&nbsp;'.html_print_image('images/spinner.gif', true).'</span>';
$row['control'] .= '&nbsp;<span id="ITSM-success" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
$row['control'] .= '&nbsp;<span id="ITSM-failure" class="invisible">&nbsp;'.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
$row['control'] .= '<span id="ITSM-message" class="invisible"></span>';
$table_ITSM->data['ITSM_test'] = $row;
$userManagementTable->colspan['pandoraitsm'] = 2;
$userManagementTable->data['pandoraitsm'] = html_print_table($table_ITSM, true);
}
if (isset($CodeQRTable) === true || isset($apiTokenContent) === true) {
// QR Code and API Token advice.
$titleQr = '<span class="font-title-font">'.__('Contact details (QR)').'</span>';
@ -814,16 +870,24 @@ $vcard_data['organization'] = io_safe_output(get_product_name());
$vcard_data['url'] = ui_get_full_url('index.php');
$vcard_json = json_encode($vcard_data);
ui_require_javascript_file('ITSM');
?>
<script type="text/javascript">
$(document).ready(function () {
paint_vcard(
<?php echo $vcard_json; ?>,
"#qr_code_agent_view",
128,
128
);
<?php echo $vcard_json; ?>,
"#qr_code_agent_view",
128,
128
);
$('#button-ITSM').click(function() {
var pass = $('input#password-integria_user_level_pass').val();
var host = '<?php echo $ITSM_host; ?>';
testConectionApi(pass, host);
});
//Hint to change theme.
$('#skin1').on("change", () => {

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="748px" height="142px" viewBox="0 0 748 142" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 61.2 (89653) - https://sketch.com -->
<title>Integria IMS</title>
<desc>Created with Sketch.</desc>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Integria-IMS" fill-rule="nonzero">
<path d="M71.81,-2.81979301e-15 C43.0949491,-0.325771451 17.0111429,16.6781107 5.72147618,43.0827259 C-5.56819051,69.4873411 0.159601761,100.092722 20.23398,120.627561 C40.3083582,141.1624 70.7759943,147.582689 97.4298109,136.894643 C124.083628,126.206596 141.674581,100.515055 142,71.8 C142.444347,32.5906412 111.019353,0.444829018 71.81,-2.81979301e-15 Z" id="Path" fill="#F65803"></path>
<circle id="Oval" fill="#FFFFFF" cx="43.51" cy="49.89" r="13.76"></circle>
<path d="M43.51,71.66 L43.26,71.66 C41.5736669,71.6393594 39.8955597,71.4212055 38.26,71.01 L38,98.36 C37.9839995,99.6878244 38.4968596,100.967474 39.4254669,101.916717 C40.3540742,102.86596 41.6221446,103.406817 42.95,103.42 L43,103.42 C44.3260824,103.42 45.597852,102.893216 46.5355339,101.955534 C47.4732158,101.017852 48,99.7460824 48,98.42 L48.31,71.06 C46.7379912,71.4417108 45.1275989,71.6430099 43.51,71.66 L43.51,71.66 Z" id="Path" fill="#FFFFFF"></path>
<path d="M94.41,48.12 C88.3631135,41.9016532 80.0832535,38.3557132 71.41,38.27 C68.4333361,38.2395201 65.4662912,38.6129237 62.59,39.38 C64.2200628,42.3331841 65.1313519,45.6288987 65.25,49 C67.208565,48.4885287 69.2257979,48.2363746 71.25,48.25 C77.2810939,48.3159047 83.0384799,50.7772152 87.2533639,55.0915157 C91.468248,59.4058163 93.7946914,65.2190086 93.72,71.25 L93.42,99 C93.4039912,100.326111 93.9154828,101.604257 94.841933,102.553212 C95.7683831,103.502167 97.0338871,104.044182 98.36,104.06 L98.42,104.06 C101.181424,104.06 103.42,101.821424 103.42,99.06 L103.74,71.33 C103.850133,62.6586006 100.491174,54.3026057 94.41,48.12 Z" id="Path" fill="#FFFFFF"></path>
<path d="M171.72,67.81 L171.84,21.08 C171.8139,20.1443474 172.175822,19.2395415 172.84,18.58 C173.507689,17.9157505 174.418525,17.5543075 175.36,17.58 L182.36,17.58 C183.315282,17.5557708 184.239991,17.9176872 184.925039,18.583915 C185.610086,19.2501428 185.997615,20.1644142 186,21.12 L185.88,67.77 C185.889979,68.7136623 185.501469,69.6177631 184.81,70.26 C184.132306,70.9151221 183.222463,71.2747439 182.28,71.26 L175.28,71.26 C174.343006,71.2771853 173.438469,70.9168123 172.77,70.26 C172.079224,69.6357031 171.69568,68.7407667 171.72,67.81 L171.72,67.81 Z" id="Path" fill="#282828"></path>
<path d="M196.6,67.79 L196.72,21.15 C196.703942,20.2132116 197.064148,19.3090953 197.72,18.64 C198.367817,17.9706027 199.269041,17.6072059 200.2,17.64 L211.2,17.64 C212.220464,17.6786713 213.201721,18.0431383 214,18.68 C214.954333,19.3581671 215.769164,20.2137401 216.4,21.2 L238.94,56.06 L239,21.18 C238.972558,20.2529263 239.335335,19.3568684 240,18.71 C240.660878,18.0478442 241.564774,17.6862858 242.5,17.71 L249,17.71 C249.930306,17.697074 250.827049,18.0572118 251.49,18.71 C252.168239,19.3808021 252.531442,20.3069699 252.49,21.26 L252.37,67.91 C252.393322,68.8422107 252.031614,69.7428638 251.37,70.4 C250.707806,71.0601595 249.804802,71.4213611 248.87,71.4 L236.43,71.4 C235.352189,71.3759533 234.306677,71.0274494 233.43,70.4 C232.448952,69.7519451 231.61994,68.8990519 231,67.9 L210.36,35.7 L210.28,67.85 C210.302135,68.7819962 209.940608,69.6821976 209.28,70.34 C208.624212,71.0036445 207.722642,71.3657208 206.79,71.34 L200.2,71.34 C199.262799,71.3583203 198.357839,70.9977785 197.69,70.34 C196.973178,69.6889199 196.575278,68.758054 196.6,67.79 Z" id="Path" fill="#282828"></path>
<path d="M258.64,24.83 L258.64,21.31 C258.611761,20.3566005 258.979489,19.4340518 259.655831,18.7614981 C260.332174,18.0889444 261.256774,17.7264056 262.21,17.76 L309.75,17.88 C310.703399,17.8517613 311.625948,18.2194887 312.298502,18.8958315 C312.971056,19.5721742 313.333594,20.4967742 313.3,21.45 L313.3,25 C313.332066,25.9455402 312.969867,26.8619037 312.3,27.53 C311.623087,28.1989008 310.701164,28.5604392 309.75,28.53 L293.04,28.53 L292.93,68.21 C292.958015,69.1313139 292.594703,70.0214284 291.93,70.66 C291.264603,71.3152777 290.363755,71.675617 289.43,71.6604873 L282.35,71.6604873 C281.420522,71.668505 280.52541,71.3090224 279.86,70.66 C279.197933,70.0155113 278.835379,69.1236302 278.86,68.2 L278.96,28.52 L262.25,28.52 C261.299851,28.544612 260.38013,28.1839373 259.7,27.52 C258.965201,26.8249172 258.576895,25.8394983 258.64,24.83 L258.64,24.83 Z" id="Path" fill="#282828"></path>
<path d="M319.3,68 L319.42,21.35 C319.400371,20.4122847 319.78681,19.5118088 320.48,18.88 C321.149716,18.2251023 322.053417,17.8650622 322.99,17.8795531 L366.19,17.99 C367.130438,17.9859488 368.031045,18.3693397 368.68,19.05 C369.337779,19.717839 369.69832,20.6227989 369.68,21.56 L369.68,25.09 C369.677352,26.0235632 369.303953,26.9178376 368.641949,27.5760911 C367.979945,28.2343446 367.083563,28.6026559 366.15,28.6 L333.52,28.51 L333.52,39.42 L361.62,39.49 C362.553563,39.4926484 363.447838,39.8660468 364.106091,40.528051 C364.764345,41.1900553 365.132656,42.0864368 365.13,43.02 L365.13,46.54 C365.156933,47.4728584 364.79467,48.3748937 364.13,49.03 C363.469788,49.6931635 362.565439,50.054903 361.63,50.03 L333.47,50 L333.47,61.06 L366.03,61.14 C366.94651,61.1221856 367.829599,61.4841076 368.47,62.14 C369.129526,62.7903112 369.491355,63.6840288 369.47,64.61 L369.47,68.21 C369.482675,69.150132 369.102026,70.0528141 368.42,70.7 C367.748458,71.3583482 366.840234,71.7187547 365.9,71.7 L322.9,71.59 C321.962384,71.6106136 321.056564,71.2497292 320.39,70.59 C319.672391,69.9226941 319.2755,68.9796223 319.3,68 L319.3,68 Z" id="Path" fill="#282828"></path>
<path d="M380.06,65.38 C375.64,60.9 373.44,54.0566667 373.459865,44.85 C373.48,35.6433333 375.813333,28.83 380.46,24.41 C385.126667,19.99 392.08,17.7933333 401.32,17.82 L409.68,17.82 C414.926078,17.759622 420.087688,19.1434315 424.6,21.82 C429.026667,24.4866667 431.233333,27.7833333 431.22,31.71 C431.335739,32.9177383 430.840442,34.1034513 429.9,34.87 C429.175254,35.4543658 428.280429,35.7877321 427.35,35.82 L422.9,35.82 C420.76,35.82 419.053333,34.59 417.78,32.13 C416.506667,29.67 413.363333,28.44 408.35,28.44 L401.68,28.44 C396.206667,28.44 392.493333,29.6033333 390.54,31.93 C388.54,34.28 387.6,38.59 387.54,44.93 C387.48,51.27 388.38,55.58 390.13,57.99 C391.88,60.4 394.99,61.62 399.48,61.63 L407.17,61.63 C411.17,61.63 414.043333,60.87 415.79,59.35 C417.596876,57.6376908 418.574219,55.2271554 418.47,52.74 L410,52.74 C409.064789,52.7427064 408.167392,52.3710205 407.507977,51.7078475 C406.848561,51.0446746 406.48198,50.1451807 406.49,49.21 L406.49,46.23 C406.472533,45.2988546 406.833351,44.400416 407.49,43.74 C408.146465,43.0773742 409.047574,42.7154829 409.98,42.74 L428.79,42.79 C429.722858,42.763067 430.624894,43.1253302 431.28,43.79 C431.943164,44.4502124 432.304903,45.354561 432.28,46.29 L432.28,50.44 C432.28,57.44 430.17,62.8133333 425.95,66.56 C421.73,70.3066667 415.566667,72.17 407.46,72.1501593 L399.03,72.1501593 C390.803333,72.1233333 384.48,69.8666667 380.06,65.38 Z" id="Path" fill="#282828"></path>
<path d="M495.8,70.48 C495.8,71.55 495.16,72.09 493.89,72.0801364 L484.89,72.0801364 C483.778533,72.0359158 482.700008,71.6902348 481.77,71.08 C480.713597,70.4696085 479.821334,69.6116631 479.17,68.58 L472.83,58.58 C470.223333,54.48 467.056667,52.4233333 463.33,52.41 L454.18,52.41 L454.18,68.52 C454.203322,69.4522107 453.841614,70.3528638 453.18,71.01 C452.517806,71.6701595 451.614802,72.0313611 450.68,72.01 L443.68,72.01 C442.743006,72.0271853 441.838469,71.6668123 441.17,71.01 C440.503774,70.351816 440.141481,69.446082 440.17,68.51 L440.29,21.86 C440.269803,20.9254087 440.630829,20.0228444 441.29,19.36 C441.927395,18.6758743 442.825092,18.2942622 443.76,18.3095318 L474.67,18.39 C480.39,18.39 485.076667,19.94 488.73,23.04 C492.383333,26.14 494.203333,30.29 494.19,35.49 C494.063333,42.7033333 489.3,47.2066667 479.9,49 C481.484067,49.6135252 482.904514,50.5855906 484.05,51.84 C485.674847,53.654962 487.137133,55.6091383 488.42,57.68 L495.21,68.52 C495.577221,69.1093518 495.780866,69.7858671 495.8,70.48 L495.8,70.48 Z M454.21,41.74 L470.21,41.74 C472.559199,41.8094724 474.88989,41.3048899 477,40.27 C478.881403,39.380915 480.044647,37.4487472 479.95,35.37 C480.055656,33.2834473 478.890265,31.3398116 477,30.45 C474.897868,29.3847581 472.566149,28.8524806 470.21,28.9 L454.21,28.9 L454.21,41.74 Z" id="Shape" fill="#282828"></path>
<path d="M502,68.66 L502.12,21.93 C502.106969,20.9868821 502.48745,20.0809738 503.17,19.43 C503.826139,18.7489431 504.734359,18.3690106 505.68,18.3797664 L512.68,18.3797664 C513.640691,18.3689866 514.564824,18.7478276 515.241347,19.4300041 C515.91787,20.1121806 516.289008,21.039434 516.27,22 L516.15,68.65 C516.159979,69.5936623 515.771469,70.4977631 515.08,71.14 C514.402306,71.7951221 513.492463,72.1547439 512.55,72.14 L505.55,72.14 C504.613006,72.1571853 503.708469,71.7968123 503.04,71.14 C502.344797,70.5069922 501.964251,69.5995358 502,68.66 Z" id="Path" fill="#282828"></path>
<path d="M522.48,68.71 L532,33.06 C534.566667,23.3466667 542.87,18.5 556.91,18.5199384 L577.11,18.57 C577.996001,18.5541891 578.841559,18.9402048 579.41,19.62 C580.006346,20.2917863 580.330809,21.1617749 580.320262,22.06 L580.2,68.86 C580.23056,69.7817714 579.866841,70.6728823 579.2,71.31 C578.525984,71.9645342 577.619419,72.3242822 576.68,72.31 L569.68,72.31 C568.735914,72.3337643 567.822711,71.9728143 567.15,71.31 C566.480133,70.6419037 566.117934,69.7255402 566.15,68.78 L566.15,59.33 L539.51,59.27 L536.98,68.7 C536.727496,69.7139708 536.129991,70.6084614 535.29,71.23 C534.499985,71.8626048 533.521963,72.214411 532.51,72.23 L525.13,72.23 C524.459988,72.2878818 523.794912,72.0733836 523.284971,71.6349475 C522.775031,71.1965113 522.463235,70.571116 522.42,69.9 C522.400467,69.5023251 522.420566,69.1036934 522.48,68.71 Z M542.24,48.64 L566.11,48.7 L566.11,29.14 L555.43,29.14 C550.779549,29.0158892 546.663838,32.130706 545.52,36.64 L542.24,48.64 Z" id="Shape" fill="#282828"></path>
<path d="M590.9,68.88 L591,22.16 C590.986969,21.2168821 591.36745,20.3109738 592.05,19.66 C592.709218,18.9774003 593.621131,18.5974368 594.57,18.6096981 L601.57,18.6096981 C602.520183,18.6019547 603.433929,18.9751711 604.106773,19.6461353 C604.779617,20.3170996 605.155387,21.2297986 605.150057,22.18 L605,68.85 C605.028154,69.7830757 604.665702,70.6855811 604,71.34 C603.323524,71.9970099 602.412865,72.3569544 601.47,72.34 L594.47,72.34 C593.533006,72.3571853 592.628469,71.9968123 591.96,71.34 C591.263951,70.7144482 590.876621,69.8155493 590.9,68.88 Z" id="Path" fill="#F65803"></path>
<path d="M615.78,68.8 L615.9,22.3 C615.875203,21.340928 616.235317,20.4118317 616.9,19.72 C617.547817,19.0506027 618.449041,18.6872059 619.38,18.72 L634.63,18.72 C635.64758,18.7359883 636.627509,19.1074416 637.4,19.77 C638.233003,20.4058524 638.845164,21.2873645 639.15,22.29 L650.15,54.29 L661.29,22.29 C661.608719,21.2943995 662.226826,20.4213666 663.06,19.79 C663.836411,19.140258 664.817595,18.7860398 665.83,18.79 L681.08,18.79 C682.009485,18.7723021 682.901791,19.1547191 683.53,19.84 C684.192419,20.5373141 684.551934,21.4684571 684.53,22.43 L684.38,69 C684.412024,69.9543928 684.050454,70.8800124 683.38,71.56 C682.723535,72.2226258 681.822426,72.5845171 680.89,72.56 L674.1,72.56 C673.168855,72.5774675 672.270416,72.2166488 671.61,71.56 C670.941001,70.8749956 670.579921,69.9470191 670.61,68.99 L670.7,32.39 L657.36,69.13 C656.988416,70.0838348 656.349536,70.9102123 655.52,71.51 C654.734577,72.1438986 653.759218,72.4960135 652.75,72.51 L647.39,72.51 C646.387527,72.4923334 645.419667,72.140384 644.64,71.51 C643.818452,70.8953887 643.179069,70.0693751 642.79,69.12 L629.7,32.23 L629.6,68.83 C629.634802,69.787823 629.273023,70.7175951 628.6,71.4 C627.944212,72.0636445 627.042642,72.4257208 626.11,72.4 L619.37,72.4 C618.432799,72.4183203 617.527839,72.0577785 616.86,71.4 C616.143427,70.7285743 615.750037,69.7815254 615.78,68.8 L615.78,68.8 Z" id="Path" fill="#F65803"></path>
<path d="M692.08,58.84 C691.973218,57.6336327 692.466829,56.4519567 693.4,55.68 C694.12014,55.0807712 695.014494,54.7300443 695.95,54.68 L700.41,54.68 C702.663333,54.68 704.373333,55.91 705.54,58.37 C706.7,60.82 709.34,62.05 713.43,62.06 L726.55,62.35 C730.943333,62.35 733.143333,60.92 733.15,58.06 C733.15,55.8933333 730.483333,54.1766667 725.15,52.91 C722.75,52.33 720.15,51.75 717.21,51.18 C714.27,50.61 711.44,49.9 708.58,49.05 C705.87988,48.2547647 703.245348,47.2517704 700.7,46.05 C698.399488,44.9682289 696.403219,43.3327311 694.89,41.29 C693.392835,39.2306421 692.616105,36.7352654 692.68,34.19 C692.68,29.17 694.473333,25.3066667 698.06,22.6 C701.646667,19.8933333 707.796667,18.56 716.51,18.6 L726.02,18.85 C730.924684,18.8052317 735.735418,20.1956173 739.86,22.85 C743.96,25.5166667 746.003333,28.8133333 745.99,32.74 C746.104216,33.9511338 745.614157,35.1407428 744.68,35.92 C743.972856,36.5214361 743.087125,36.8729163 742.16,36.92 L737.7,36.92 C735.46,36.92 733.75,35.68 732.58,33.22 C731.41,30.76 728.78,29.52 724.68,29.51 L713.41,29.25 C709.01,29.25 706.806667,30.68 706.8,33.54 C706.8,35.12 708.19,36.41 710.97,37.41 C714.24125,38.5440576 717.594334,39.426624 721,40.05 C725,40.8233333 729,41.7533333 733,42.84 C736.752403,43.796252 740.228609,45.6182636 743.15,48.16 C745.84998,50.4490644 747.377502,53.8309112 747.31,57.37 C747.31,62.39 745.506667,66.2533333 741.9,68.96 C738.293333,71.6666667 732.153333,73 723.48,72.96 L712.12,72.71 C707.211841,72.7573081 702.397191,71.3667955 698.27,68.71 C694.143333,66.0833333 692.08,62.7933333 692.08,58.84 Z" id="Path" fill="#F65803"></path>
<path d="M176,111.05 L176,123.81 L171.69,123.81 L171.69,92.61 L183.04,92.61 C188.81,92.61 192.68,96.61 192.68,101.85 C192.68,107.09 188.81,111.05 183.04,111.05 L176,111.05 Z M182.25,107.17 C185.99,107.17 188.25,105.1 188.25,101.89 C188.25,98.68 185.96,96.48 182.25,96.48 L176,96.48 L176,107.17 L182.25,107.17 Z" id="Shape" fill="#888888"></path>
<path d="M203.53,111.71 L209.25,110.87 C210.53,110.69 210.88,110.03 210.88,109.28 C210.88,107.22 209.51,105.5 206.3,105.5 C205.094424,105.418003 203.906525,105.824303 203.003696,106.627445 C202.100867,107.430587 201.558975,108.563079 201.5,109.77 L197.5,108.84 C197.94,104.84 201.6,101.98 206.17,101.98 C212.51,101.98 214.98,105.59 214.98,109.72 L214.98,120.33 C214.964645,121.495374 215.051646,122.659846 215.24,123.81 L211.19,123.81 C211.04052,122.881154 210.976918,121.940514 211,121 C209.510823,123.298723 206.916404,124.637778 204.18,124.52 C199.87,124.52 197.09,121.52 197.09,118.18 C197.1,114.35 199.88,112.23 203.53,111.71 Z M210.88,114.71 L210.88,113.71 L204.41,114.71 C202.65,114.98 201.33,115.99 201.33,117.88 C201.363095,118.748086 201.746619,119.565693 202.392987,120.146105 C203.039355,120.726517 203.893369,121.020169 204.76,120.96 C208.15,121 210.88,119.36 210.88,114.74 L210.88,114.71 Z" id="Shape" fill="#888888"></path>
<path d="M227.77,123.81 L223.64,123.81 L223.64,102.64 L227.64,102.64 L227.64,105.64 C228.983384,103.304982 231.507823,101.904226 234.2,102 C239.26,102 241.77,105.66 241.77,110.37 L241.77,123.79 L237.63,123.79 L237.63,111.09 C237.63,108.09 236.4,105.76 232.7,105.76 C229.44,105.76 227.77,108.36 227.77,111.57 L227.77,123.81 Z" id="Path" fill="#888888"></path>
<path d="M265.39,120.59 C264.123446,123.01383 261.57259,124.489821 258.84,124.38 C252.63,124.38 248.84,119.45 248.84,113.16 C248.84,107.16 252.84,102.07 258.84,102.07 C262.58,102.07 264.6,103.92 265.31,105.63 L265.31,92 L269.4,92 L269.4,119.94 C269.393999,121.249913 269.467467,122.558984 269.62,123.86 L265.62,123.86 C265.474248,122.913625 265.400702,121.957533 265.4,121 L265.39,120.59 Z M259.23,120.73 C263.02,120.73 265.35,117.43 265.35,113.07 C265.35,108.71 263.06,105.72 259.28,105.72 C255.5,105.72 253,108.8 253,113.16 C253,117.52 255.27,120.73 259.23,120.73 L259.23,120.73 Z" id="Shape" fill="#888888"></path>
<path d="M298.53,113.2 C298.53,119.67 294.04,124.47 287.7,124.47 C281.36,124.47 276.88,119.67 276.88,113.2 C276.88,106.73 281.36,102 287.7,102 C294.04,102 298.53,106.78 298.53,113.2 Z M294.3,113.2 C294.3,108.32 291.22,105.68 287.7,105.68 C284.18,105.68 281.1,108.32 281.1,113.2 C281.1,118.08 284.18,120.77 287.7,120.77 C291.22,120.77 294.3,118.13 294.3,113.2 L294.3,113.2 Z" id="Shape" fill="#888888"></path>
<path d="M317.75,106.82 C317.153912,106.733389 316.552347,106.689942 315.95,106.69 C312.47,106.69 310.14,108.54 310.14,113.2 L310.14,123.81 L306,123.81 L306,102.64 L310.05,102.64 L310.05,106.34 C311.132122,103.823292 313.652596,102.233087 316.39,102.34 C316.846155,102.34552 317.301059,102.389004 317.75,102.47 L317.75,106.82 Z" id="Path" fill="#888888"></path>
<path d="M329.46,111.71 L335.18,110.87 C336.45,110.69 336.81,110.03 336.81,109.28 C336.81,107.22 335.44,105.5 332.23,105.5 C331.023761,105.415203 329.834309,105.820526 328.930841,106.624236 C328.027373,107.427945 327.486272,108.562094 327.43,109.77 L323.43,108.84 C323.87,104.84 327.52,101.98 332.1,101.98 C338.44,101.98 340.9,105.59 340.9,109.72 L340.9,120.33 C340.886006,121.495732 340.976367,122.660377 341.17,123.81 L337.17,123.81 C337.007383,122.865645 336.933727,121.908116 336.95,120.95 C335.459417,123.247172 332.865953,124.585734 330.13,124.47 C325.81,124.47 323.04,121.47 323.04,118.13 C323,114.35 325.8,112.23 329.46,111.71 Z M336.81,114.71 L336.81,113.71 L330.34,114.71 C328.58,114.98 327.26,115.99 327.26,117.88 C327.293095,118.748086 327.676619,119.565693 328.322987,120.146105 C328.969355,120.726517 329.823369,121.020169 330.69,120.96 C334.08,121 336.81,119.36 336.81,114.74 L336.81,114.71 Z" id="Shape" fill="#888888"></path>
<polygon id="Path" fill="#888888" points="363.2 123.81 363.2 92.61 382.2 92.61 382.2 96.61 367.52 96.61 367.52 106.61 380.81 106.61 380.81 110.61 367.52 110.61 367.52 123.73"></polygon>
<polygon id="Path" fill="#888888" points="419.09 123.81 419.09 99.52 408.44 123.81 404.44 123.81 393.92 99.52 393.92 123.81 389.65 123.81 389.65 92.61 395.5 92.61 406.5 118 417.59 92.61 423.36 92.61 423.36 123.81"></polygon>
<path d="M449.49,101.06 C448.982092,97.8538566 446.131216,95.5515584 442.89,95.73 C439.37,95.73 436.89,98.02 436.89,100.92 C436.89,103.17 438.25,104.92 440.89,105.46 L445.56,106.46 C450.75,107.6 453.66,110.86 453.66,115.22 C453.66,120.06 449.52,124.46 442.87,124.46 C435.35,124.46 431.78,119.62 431.21,115.17 L435.35,113.85 C435.453196,115.729635 436.299659,117.49107 437.702796,118.746015 C439.105932,120.000959 440.950542,120.64638 442.83,120.54 C447.14,120.54 449.26,118.3 449.26,115.54 C449.26,113.29 447.71,111.36 444.59,110.7 L440.15,109.7 C435.7,108.7 432.53,105.83 432.53,101.16 C432.53,96.28 437.07,91.88 442.83,91.88 C449.83,91.88 452.69,96.23 453.39,99.62 L449.49,101.06 Z" id="Path" fill="#888888"></path>
<polygon id="Path" fill="#888888" points="475 123.81 475 92.61 479.4 92.61 479.4 123.81"></polygon>
<polygon id="Path" fill="#888888" points="500.7 96.61 500.7 123.81 496.39 123.81 496.39 96.61 486 96.61 486 92.61 511.17 92.61 511.17 96.61"></polygon>
<path d="M533.75,101.06 C533.242092,97.8538566 530.391216,95.5515584 527.15,95.73 C523.63,95.73 521.15,98.02 521.15,100.92 C521.15,103.17 522.51,104.92 525.15,105.46 L529.82,106.46 C535.01,107.6 537.91,110.86 537.91,115.22 C537.91,120.06 533.78,124.46 527.13,124.46 C519.61,124.46 516.04,119.62 515.47,115.17 L519.61,113.85 C519.713196,115.729635 520.559659,117.49107 521.962796,118.746015 C523.365932,120.000959 525.210542,120.64638 527.09,120.54 C531.4,120.54 533.51,118.3 533.51,115.54 C533.51,113.29 531.97,111.36 528.85,110.7 L524.4,109.7 C519.96,108.7 516.79,105.83 516.79,101.16 C516.79,96.28 521.32,91.88 527.09,91.88 C534.09,91.88 536.95,96.23 537.65,99.62 L533.75,101.06 Z" id="Path" fill="#888888"></path>
<polygon id="Path" fill="#888888" points="575.46 123.81 575.46 99.52 564.81 123.81 560.81 123.81 550.29 99.52 550.29 123.81 546 123.81 546 92.61 551.85 92.61 562.85 118 574 92.61 579.77 92.61 579.77 123.81"></polygon>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 852 B

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ITSM icon</title>
<g id="ITSM-icon" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M13,0 C13.5522847,-1.01453063e-16 14,0.44771525 14,1 L14,6 L9.73239368,5.99992752 C9.90258972,6.29411727 10,6.63568294 10,7 C10,8.1045695 9.1045695,9 8,9 C6.8954305,9 6,8.1045695 6,7 C6,6.63568294 6.09741028,6.29411727 6.26760632,5.99992752 L2,6 L2,3 L2.64668367,2.35331633 C2.7130102,2.2869898 2.78443878,2.21556122 2.86096939,2.13903061 L4.78954082,0.210459184 C4.85841837,0.141581633 4.92857143,0.0714285714 5,0 L13,0 Z M14,10 L14,14 C14,15.1045695 13.1045695,16 12,16 L4,16 C2.8954305,16 2,15.1045695 2,14 L2,10 L6.26790938,9.99940385 C6.09752593,10.2937119 6,10.6354668 6,11 C6,12.1045695 6.8954305,13 8,13 C9.1045695,13 10,12.1045695 10,11 C10,10.6354668 9.90247407,10.2937119 9.73209062,9.99940385 L14,10 Z" id="Path-30" fill="#95A3BF"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>os@svg</title>
<g id="os" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M10,0 C15.5228475,0 20,4.4771525 20,10 C20,15.5228475 15.5228475,20 10,20 C4.4771525,20 0,15.5228475 0,10 C0,4.4771525 4.4771525,0 10,0 Z M6.15259698,6 C4.79331529,6 3.76139537,6.31928651 3.05683722,6.95785953 C2.35227907,7.59643255 2,8.60958751 2,9.99732441 C2,11.3850613 2.35227907,12.3991081 3.05683722,13.0394649 C3.76139537,13.6798216 4.79331529,14 6.15259698,14 C7.51187868,14 8.54208016,13.6807135 9.24320144,13.0421405 C9.94775959,12.4 10.3000387,11.3850613 10.3000387,9.99732441 C10.3000387,8.60958751 9.94861881,7.59643255 9.2457791,6.95785953 C8.54293938,6.31928651 7.51187868,6 6.15259698,6 Z M13.7468746,6.11772575 C12.5474073,6.11772575 11.7019375,6.31125975 11.2104653,6.69832776 C10.718993,7.08539576 10.4732569,7.63745819 10.4732569,8.35451505 C10.4732569,8.74336678 10.5755037,9.08138239 10.7799974,9.36856187 C10.9844911,9.65574136 11.2517077,9.88138239 11.5816471,10.0454849 C11.9115865,10.2095875 12.273317,10.3522854 12.6668385,10.4735786 C13.06036,10.5948718 13.4564592,10.6956522 13.855136,10.7759197 C14.2538128,10.8561873 14.6181209,10.9373467 14.9480603,11.019398 C15.6869872,11.1977703 16.0564506,11.4421405 16.0564506,11.7525084 C16.0564506,12.1627648 15.7540061,12.367893 15.1491172,12.367893 L13.3447609,12.3304348 C12.7811144,12.3304348 12.4185247,12.1556299 12.2569919,11.8060201 C12.095459,11.4564103 11.8600335,11.2816054 11.5507153,11.2816054 L10.9372342,11.2816054 C10.8238175,11.2816054 10.706964,11.3270903 10.5866735,11.4180602 C10.4663831,11.5090301 10.4062379,11.6597547 10.4062379,11.8702341 C10.4062379,12.4338907 10.6897796,12.9039019 11.256863,13.2802676 C11.8239464,13.6566332 12.4597672,13.8448161 13.1643253,13.8448161 L14.7263823,13.8769231 C15.9224127,13.8769231 16.7670232,13.6833891 17.2602139,13.2963211 C17.7534046,12.9092531 18,12.3571906 18,11.6401338 C18,11.1157191 17.8083946,10.6778149 17.4251837,10.3264214 C17.0419728,9.97502787 16.5754178,9.72263099 16.0255188,9.56923077 C15.4756197,9.41583055 14.9282983,9.28472687 14.3835546,9.17591973 C13.8388108,9.0671126 13.3748335,8.94136009 12.9916226,8.79866221 C12.6084117,8.65596433 12.4168063,8.4722408 12.4168063,8.24749164 C12.4168063,7.83723523 12.7192508,7.63210702 13.3241397,7.63210702 L14.8758861,7.66421405 C15.4395326,7.66421405 15.8021223,7.83991081 15.9636551,8.19130435 C16.125188,8.54269788 16.3606135,8.71839465 16.6699317,8.71839465 L17.2834128,8.71839465 C17.3933926,8.71839465 17.5085277,8.67201784 17.6288181,8.57926421 C17.7491086,8.48651059 17.8092538,8.33489409 17.8092538,8.12441472 C17.8092538,7.56075808 17.5265713,7.09074693 16.9612063,6.71438127 C16.3958414,6.33801561 15.7608798,6.14983278 15.0563217,6.14983278 Z M6.15259698,7.44481605 C6.92761095,7.44481605 7.48867981,7.65886288 7.83580358,8.08695652 C8.18292735,8.51505017 8.35648924,9.15273133 8.35648924,10 C8.35648924,10.8472687 8.18292735,11.484058 7.83580358,11.9103679 C7.48867981,12.3366778 6.92761095,12.5498328 6.15259698,12.5498328 C5.37758302,12.5498328 4.81565494,12.3366778 4.46681273,11.9103679 C4.11797053,11.484058 3.94354943,10.8472687 3.94354943,10 C3.94354943,9.15273133 4.11797053,8.51505017 4.46681273,8.08695652 C4.81565494,7.65886288 5.37758302,7.44481605 6.15259698,7.44481605 Z" id="Oval-2" fill="#3F3F3F"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>os version@svg</title>
<g id="os-version" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M10,5 C12.7614237,5 15,7.23857625 15,10 C15,12.7614237 12.7614237,15 10,15 C7.23857625,15 5,12.7614237 5,10 C5,7.23857625 7.23857625,5 10,5 Z M8.00124224,8 C7.34616977,8 6.84886128,8.15964326 6.50931677,8.47892977 C6.16977226,8.79821628 6,9.30479376 6,9.99866221 C6,10.6925307 6.16977226,11.1995541 6.50931677,11.5197324 C6.84886128,11.8399108 7.34616977,12 8.00124224,12 C8.6563147,12 9.15279503,11.8403567 9.49068323,11.5210702 C9.83022774,11.2 10,10.6925307 10,9.99866221 C10,9.30479376 9.83064182,8.79821628 9.49192547,8.47892977 C9.15320911,8.15964326 8.6563147,8 8.00124224,8 Z M11.7596741,8 C11.127857,8 10.6825074,8.09977011 10.4236253,8.29931034 C10.1647432,8.49885057 10.0353021,8.78344828 10.0353021,9.15310345 C10.0353021,9.35356322 10.0891604,9.52781609 10.1968771,9.67586207 C10.3045938,9.82390805 10.4453496,9.94022989 10.6191446,10.0248276 C10.7929396,10.1094253 10.9834804,10.1829885 11.1907671,10.2455172 C11.3980539,10.308046 11.6066983,10.36 11.8167006,10.4013793 C12.0267029,10.4427586 12.2186015,10.4845977 12.3923965,10.5268966 C12.7816248,10.6188506 12.976239,10.7448276 12.976239,10.9048276 C12.976239,11.1163218 12.8169269,11.222069 12.4983028,11.222069 L11.5478615,11.2027586 C11.2509618,11.2027586 11.0599683,11.1126437 10.9748812,10.9324138 C10.8897941,10.7521839 10.7657841,10.662069 10.6028513,10.662069 L10.2797013,10.662069 C10.2199593,10.662069 10.1584069,10.6855172 10.0950441,10.7324138 C10.0316814,10.7793103 10,10.8570115 10,10.9655172 C10,11.256092 10.1493551,11.4983908 10.4480652,11.6924138 C10.7467753,11.8864368 11.0816927,11.9834483 11.4528174,11.9834483 L12.275628,12 C12.9056348,12 13.3505318,11.9002299 13.6103191,11.7006897 C13.8701064,11.5011494 14,11.2165517 14,10.8468966 C14,10.5765517 13.8990722,10.3508046 13.6972166,10.1696552 C13.4953609,9.98850575 13.249604,9.8583908 12.9599457,9.77931034 C12.6702874,9.70022989 12.3819869,9.63264368 12.0950441,9.57655172 C11.8081014,9.52045977 11.5637022,9.45563218 11.3618466,9.38206897 C11.1599909,9.30850575 11.0590631,9.2137931 11.0590631,9.09793103 C11.0590631,8.88643678 11.2183752,8.78068966 11.5369993,8.78068966 L12.3543788,8.79724138 C12.6512786,8.79724138 12.842272,8.88781609 12.9273591,9.06896552 C13.0124463,9.25011494 13.1364562,9.34068966 13.299389,9.34068966 L13.622539,9.34068966 C13.6804707,9.34068966 13.7411179,9.31678161 13.8044807,9.26896552 C13.8678434,9.22114943 13.8995248,9.14298851 13.8995248,9.03448276 C13.8995248,8.74390805 13.7506223,8.5016092 13.4528174,8.30758621 C13.1550124,8.11356322 12.8205476,8.01655172 12.4494229,8.01655172 Z M8.00124224,8.72240803 C8.3747412,8.72240803 8.64513458,8.82943144 8.81242236,9.04347826 C8.97971014,9.25752508 9.06335404,9.57636566 9.06335404,10 C9.06335404,10.4236343 8.97971014,10.742029 8.81242236,10.9551839 C8.64513458,11.1683389 8.3747412,11.2749164 8.00124224,11.2749164 C7.62774327,11.2749164 7.35693582,11.1683389 7.18881988,10.9551839 C7.02070393,10.742029 6.93664596,10.4236343 6.93664596,10 C6.93664596,9.57636566 7.02070393,9.25752508 7.18881988,9.04347826 C7.35693582,8.82943144 7.62774327,8.72240803 8.00124224,8.72240803 Z" id="Oval-2" fill="#3F3F3F"></path>
<g id="Group" transform="translate(10, 0.9972)" fill="#3F3F3F" fill-rule="nonzero">
<path d="M0.239098823,-0.999498516 C0.367920916,-1.0006481 0.46086938,-1.00001443 0.545625818,-0.996148978 C5.85594931,-0.753608542 10,3.63723482 10,9.00280962 C10,11.7312591 8.9006895,14.287461 6.98753217,16.1564431 C5.94922318,17.1707773 5.2256829,17.9806061 4.82608058,18.5663616 C4.51483939,19.0225933 3.89267968,19.1401314 3.43644798,18.8288902 C2.98021627,18.517649 2.86267824,17.8954893 3.17391942,17.4392576 C3.66277305,16.7226734 4.46505413,15.8247132 5.5899319,14.7258091 C7.12171888,13.2293915 8,11.1871442 8,9.00280962 C8,4.70099732 4.69132984,1.19528432 0.454374182,1.00176822 C0.441581214,1.00118392 0.425875842,1.0007459 0.407122626,1.00045278 L0.204431552,1.00096401 L0.173047576,1.00133321 C0.143860257,1.00169127 0.124402045,1.00192997 0.10826377,1.00210401 L0,1.00280962 C-0.55228475,1.00280962 -1,0.555094372 -1,0.00280962244 C-1,-0.549475127 -0.55228475,-0.997190378 0,-0.997190378 L0.0986592653,-0.99792167 L0.14911528,-0.998523592 C0.192941176,-0.999044088 0.192941176,-0.999044088 0.239098823,-0.999498516 Z" id="Oval"></path>
<path d="M4,14.0028096 C4.55228475,14.0028096 5,14.4505249 5,15.0028096 L5,17.0028096 L7,17.0028096 C7.51283584,17.0028096 7.93550716,17.3888498 7.99327227,17.8861885 L8,18.0028096 C8,18.5550944 7.55228475,19.0028096 7,19.0028096 L4,19.0028096 C3.44771525,19.0028096 3,18.5550944 3,18.0028096 L3,15.0028096 C3,14.4505249 3.44771525,14.0028096 4,14.0028096 Z" id="Path-87"></path>
</g>
<g id="Group" transform="translate(5.5, 9.9986) scale(-1, -1) translate(-5.5, -9.9986)translate(1, 0.9972)" fill="#3F3F3F" fill-rule="nonzero">
<path d="M5.93830089,14.3635692 C6.30852501,13.9537491 6.94087583,13.9216502 7.35069596,14.2918743 C7.7605161,14.6620984 7.79261501,15.2944492 7.42239089,15.7042693 C7.28217928,15.8594768 7.13715,16.01028 6.98753217,16.1564431 C5.94922318,17.1707773 5.2256829,17.9806061 4.82608058,18.5663616 C4.51483939,19.0225933 3.89267968,19.1401314 3.43644798,18.8288902 C2.98021627,18.517649 2.86267824,17.8954893 3.17391942,17.4392576 C3.66277305,16.7226734 4.46505413,15.8247132 5.5899319,14.7258091 C5.7097935,14.6087152 5.82597871,14.4879044 5.93830089,14.3635692 Z M8.943119,7.56724451 C9.49480124,7.54145411 9.96293532,7.96777368 9.98872572,8.51945593 C9.99623585,8.68010519 10,8.84125436 10,9.00293537 C10,10.3523848 9.73199051,11.6661445 9.21843823,12.8844407 C9.00391256,13.3933584 8.41744587,13.6320103 7.90852821,13.4174846 C7.39961056,13.2029589 7.1609587,12.6164922 7.37548437,12.1075746 C7.78585079,11.1340654 7.99998666,10.0843244 8,9.00292303 C8,8.87239659 7.99696323,8.74238768 7.99090758,8.61285123 C7.96511718,8.06116899 8.39143675,7.59303491 8.943119,7.56724451 Z M5.35650642,1.65292436 C5.7304364,1.24648271 6.3630526,1.2201268 6.76949425,1.59405678 C7.86955054,2.60611849 8.7319506,3.85799548 9.28762134,5.25683726 C9.4915113,5.77010846 9.24070825,6.35148245 8.72743704,6.55537241 C8.21416584,6.75926237 7.63279185,6.50845932 7.42890189,5.99518811 C6.98434699,4.87606861 6.29458082,3.8747904 5.41537399,3.06591219 C5.00893235,2.6919822 4.98257643,2.05936601 5.35650642,1.65292436 Z M0.239098823,-0.999498516 C0.367920916,-1.0006481 0.46086938,-1.00001443 0.545625818,-0.996148978 C1.70508629,-0.943192496 2.82882174,-0.691139109 3.87925052,-0.254949612 C4.38930817,-0.0431486814 4.63109302,0.542033323 4.41929209,1.05209098 C4.20749116,1.56214863 3.62230915,1.80393348 3.1122515,1.59213255 C2.27594636,1.24485768 1.38082518,1.04408237 0.454374182,1.00176822 C0.441581214,1.00118392 0.425875842,1.0007459 0.407122626,1.00045278 L0.204431552,1.00096401 L0.173047576,1.00133321 C0.143860257,1.00169127 0.124402045,1.00192997 0.10826377,1.00210401 L0,1.00280962 C-0.55228475,1.00280962 -1,0.555094372 -1,0.00280962244 C-1,-0.549475127 -0.55228475,-0.997190378 0,-0.997190378 L0.0986592653,-0.99792167 L0.14911528,-0.998523592 C0.192941176,-0.999044088 0.192941176,-0.999044088 0.239098823,-0.999498516 Z" id="Oval"></path>
<path d="M4,14.0028096 C4.55228475,14.0028096 5,14.4505249 5,15.0028096 L5,17.0028096 L7,17.0028096 C7.51283584,17.0028096 7.93550716,17.3888498 7.99327227,17.8861885 L8,18.0028096 C8,18.5550944 7.55228475,19.0028096 7,19.0028096 L4,19.0028096 C3.44771525,19.0028096 3,18.5550944 3,18.0028096 L3,15.0028096 C3,14.4505249 3.44771525,14.0028096 4,14.0028096 Z" id="Path-87"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -2059,7 +2059,7 @@ if ($table_events) {
include_once 'include/functions_graph.php';
$id_agente = (int) get_parameter('id_agente');
$all_events_24h = (int) get_parameter('all_events_24h');
$all_events_24h = (int) get_parameter('all_events_24h', 0);
// Fix: for tag functionality groups have to be all user_groups
// (propagate ACL funct!).

View File

@ -1,60 +0,0 @@
<?php
/**
* Integria incidents management.
*
* @category Ajax library.
* @package Pandora FMS
* @subpackage Modules.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
if (check_login()) {
global $config;
include_once $config['homedir'].'/include/functions_integriaims.php';
$get_users = get_parameter('get_users');
$search_term = get_parameter('search_term', '');
if ($get_users) {
$integria_users_csv = integria_api_call(null, null, null, null, 'get_users', []);
$csv_array = explode("\n", $integria_users_csv);
foreach ($csv_array as $csv_line) {
if (!empty($csv_line)) {
$integria_users_values[$csv_line] = $csv_line;
}
}
$integria_users_filtered_values = array_filter(
$integria_users_values,
function ($item) use ($search_term) {
if (strpos($item, $search_term) !== false) {
return true;
}
}
);
echo json_encode($integria_users_filtered_values);
return;
}
}

View File

@ -0,0 +1,376 @@
<?php
/**
* Update manager client historical updates backend.
*
* @category Update Manager
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
check_login();
if ((bool) check_acl($config['id_user'], 0, 'PM') === false
&& (bool) is_user_admin($config['id_user']) === false
) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
'Trying to access Setup Management'
);
include 'general/noaccess.php';
return;
}
$method = get_parameter('method', null);
if ($method === 'deleteOS') {
global $config;
$id_os = get_parameter('id_os', null);
if (empty($id_os) === true || $id_os < 16) {
echo json_encode(['deleted' => false]);
return;
}
if (db_process_sql_delete(
'tconfig_os',
['id_os' => $id_os]
) === false
) {
echo json_encode(['deleted' => false]);
} else {
echo json_encode(['deleted' => true]);
}
}
if ($method === 'deleteOSVersion') {
global $config;
$id_os_version = get_parameter('id_os_version', null);
if (empty($id_os_version) === true || $id_os_version < 1) {
echo json_encode(['deleted' => false]);
}
if (db_process_sql_delete(
'tconfig_os_version',
['id_os_version' => $id_os_version]
) === false
) {
echo json_encode(['deleted' => false]);
} else {
echo json_encode(['deleted' => true]);
}
}
if ($method === 'drawOSTable') {
// Datatables offset, limit and order.
$filter = get_parameter('filter', []);
$start = get_parameter('start', 0);
$length = get_parameter('length', $config['block_size']);
$orderBy = get_datatable_order(true);
$sort_field = $orderBy['field'];
$order = $orderBy['direction'];
$pagination = '';
$pagination = sprintf(
' LIMIT %d OFFSET %d ',
$length,
$start
);
try {
ob_start();
$fields = ['*'];
$sql_filters = [];
if (isset($filter['free_search']) === true
&& empty($filter['free_search']) === false
) {
$sql_filters[] = sprintf(
' AND (`name` like "%%%s%%" OR `description` like "%%%s%%") ',
$filter['free_search'],
$filter['free_search']
);
}
if (isset($order) === true) {
$dir = 'asc';
if ($order == 'desc') {
$dir = 'desc';
};
if (in_array(
$sort_field,
[
'id_os',
'name',
'description',
]
) === true
) {
$order_by = sprintf(
'ORDER BY `%s` %s',
$sort_field,
$dir
);
}
}
// Retrieve data.
$sql = sprintf(
'SELECT %s
FROM tconfig_os
WHERE 1=1
%s
%s
%s',
join(',', $fields),
join(' ', $sql_filters),
$order_by,
$pagination
);
$count_sql = sprintf(
'SELECT id_os
FROM tconfig_os
WHERE 1=1
%s',
join(' ', $sql_filters)
);
$return = db_get_all_rows_sql($sql);
if ($return === false) {
$data = [];
} else {
$data = $return;
}
$data = array_map(
function ($item) {
$item['icon_img'] = ui_print_os_icon($item['id_os'], false, true);
if (is_management_allowed() === true) {
if (is_metaconsole() === true) {
$osNameUrl = 'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=edit&tab2=list&id_os='.$item['id_os'];
} else {
$osNameUrl = 'index.php?sec=gsetup&sec2=godmode/setup/os&action=edit&tab=manage_os&id_os='.$item['id_os'];
}
$item['name'] = html_print_anchor(
[
'href' => $osNameUrl,
'content' => $item['name'],
],
true
);
} else {
$item['name'] = $item['name'];
}
$item['description'] = ui_print_truncate_text(
$item['description'],
'description',
true,
true
);
if (is_management_allowed() === true) {
$item['enable_delete'] = false;
if ($item['id_os'] > 16) {
$item['enable_delete'] = true;
}
}
return $item;
},
$data
);
// Retrieve counter.
$count = db_get_value('count(*)', '('.$count_sql.') t');
// Datatables format: RecordsTotal && recordsfiltered.
echo json_encode(
[
'data' => $data,
'recordsTotal' => $count,
'recordsFiltered' => $count,
]
);
// Capture output.
$response = ob_get_clean();
} catch (Exception $e) {
echo json_encode(['error' => $e->getMessage()]);
exit;
}
// If not valid, show error with issue.
json_decode($response);
if (json_last_error() == JSON_ERROR_NONE) {
// If valid dump.
echo $response;
} else {
echo json_encode(
['error' => $response]
);
}
exit;
}
if ($method === 'drawOSVersionTable') {
// Datatables offset, limit and order.
$filter = get_parameter('filter', []);
$start = get_parameter('start', 0);
$length = get_parameter('length', $config['block_size']);
$orderBy = get_datatable_order(true);
$sort_field = $orderBy['field'];
$order = $orderBy['direction'];
$pagination = '';
$pagination = sprintf(
' LIMIT %d OFFSET %d ',
$length,
$start
);
try {
ob_start();
$fields = ['*'];
$sql_filters = [];
if (isset($filter['free_search']) === true
&& empty($filter['free_search']) === false
) {
$sql_filters[] = sprintf(
' AND (`product` like "%%%s%%" OR `version` like "%%%s%%") ',
$filter['free_search'],
$filter['free_search']
);
}
if (isset($order) === true) {
$dir = 'asc';
if ($order == 'desc') {
$dir = 'desc';
};
if (in_array(
$sort_field,
[
'product',
'version',
'end_of_support',
]
) === true
) {
$order_by = sprintf(
'ORDER BY `%s` %s',
$sort_field,
$dir
);
}
}
// Retrieve data.
$sql = sprintf(
'SELECT %s
FROM tconfig_os_version
WHERE 1=1
%s
%s
%s',
join(',', $fields),
join(' ', $sql_filters),
$order_by,
$pagination
);
$count_sql = sprintf(
'SELECT id_os_version
FROM tconfig_os_version
WHERE 1=1
%s',
join(' ', $sql_filters)
);
$return = db_get_all_rows_sql($sql);
if ($return === false) {
$data = [];
} else {
// Format end of life date.
$return = array_map(
function ($item) {
$date_string = date_w_fixed_tz($item['end_of_support']);
$timestamp = strtotime($date_string);
$date_without_time = date('F j, Y', $timestamp);
$item['end_of_support'] = $date_without_time;
return $item;
},
$return
);
$data = $return;
}
// Retrieve counter.
$count = db_get_value('count(*)', '('.$count_sql.') t');
// Datatables format: RecordsTotal && recordsfiltered.
echo json_encode(
[
'data' => $data,
'recordsTotal' => $count,
'recordsFiltered' => $count,
]
);
// Capture output.
$response = ob_get_clean();
} catch (Exception $e) {
echo json_encode(['error' => $e->getMessage()]);
exit;
}
// If not valid, show error with issue.
json_decode($response);
if (json_last_error() == JSON_ERROR_NONE) {
// If valid dump.
echo $response;
} else {
echo json_encode(
['error' => $response]
);
}
exit;
}

View File

@ -256,14 +256,6 @@ function process_user_login_remote($login, $pass, $api=false)
}
break;
// Remote Integria.
case 'integria':
if (enterprise_hook('remote_integria_process_user_login', [$login, $pass]) === false) {
$config['auth_error'] = 'User not found in database or incorrect password';
return false;
}
break;
// Unknown authentication method.
default:
$config['auth_error'] = 'User not found in database or incorrect password';

View File

@ -1277,6 +1277,7 @@ class Heatmap
$scale = ($this->width / $this->height);
$Yaxis = $this->getYAxis($count_result, $scale);
$Yaxis_font_scale = $Yaxis;
if ($count_result <= 3) {
$Xaxis = $count_result;
$Yaxis = 1;
@ -1381,22 +1382,22 @@ class Heatmap
if (count($groups) > 1 && $this->group === 1 && $this->dashboard === false) {
$x_back = 0;
$y_back = 0;
$x_text_correction = 0.25;
$x_text_correction = 0.08;
if ($count_result <= 10) {
$fontSize = 'small-size';
$fontSize = 0.2;
$stroke = 'small-stroke';
} else if ($count_result > 10 && $count_result <= 100) {
$fontSize = 'tiny-size';
$fontSize = 0.18;
$stroke = 'tiny-stroke';
} else if ($count_result > 100 && $count_result <= 1000) {
$fontSize = 'medium-size';
$fontSize = 0.16;
$stroke = 'medium-stroke';
} else if ($count_result > 1000 && $count_result <= 10000) {
$fontSize = 'big-size';
$fontSize = 0.14;
$stroke = 'big-stroke';
} else {
$fontSize = 'huge-size';
$fontSize = 0.12;
$stroke = 'huge-stroke';
}
@ -1452,7 +1453,7 @@ class Heatmap
// Name.
echo '<text x="'.((($x_position - $x_back) / 2) + $x_back - $x_text_correction).'" y="'.($y_position + 1 - 0.01).'"
class="'.$fontSize.'">'.$name.'</text>';
style="font-size: '.($fontSize * $Yaxis_font_scale).'%">'.$name.'</text>';
$x_back = $x_position;
if ($x_position === $Xaxis) {
@ -1503,7 +1504,7 @@ class Heatmap
// Name.
echo '<text x="'.(($x_position) / 2 - $x_text_correction).'" y="'.($y_position + 1 - 0.01).'"
class="'.$fontSize.'">'.$name.'</text>';
style="font-size: '.($fontSize * $Yaxis_font_scale).'%">'.$name.'</text>';
// Bottom-right of last line.
$points = sprintf(
@ -1560,7 +1561,7 @@ class Heatmap
// Name.
echo '<text x="'.(($x_position) / 2 - $x_text_correction).'" y="'.($y_position + 1 - 0.02).'"
class="'.$fontSize.'">'.$name.'</text>';
style="font-size: '.($fontSize * $Yaxis_font_scale).'%">'.$name.'</text>';
// Bottom-top of last line.
$points = sprintf(

View File

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

View File

@ -80,8 +80,13 @@ function mysql_connect_db(
// If you want persistent connections change it to mysql_pconnect().
if ($config['mysqli']) {
if (empty($ssl)) {
$connect_id = mysqli_connect($host, $user, $pass, $db, $port);
if (mysqli_connect_errno() > 0) {
try {
$connect_id = mysqli_connect($host, $user, $pass, $db, $port);
if (mysqli_connect_errno() > 0) {
include 'general/mysqlerr.php';
return false;
}
} catch (\mysqli_sql_exception $e) {
include 'general/mysqlerr.php';
return false;
}

View File

@ -5834,7 +5834,7 @@ function get_help_info($section_name)
}
break;
case 'setup_integria_tab':
case 'setup_ITSM_tab':
if ($es) {
$result .= '04_using/14_incidence_management';
} else {
@ -5842,7 +5842,7 @@ function get_help_info($section_name)
}
break;
case 'integria_tab':
case 'ITSM_tab':
if ($es) {
$result .= '04_using/14_incidence_management#visualizacion_de_tickets';
} else {

View File

@ -497,7 +497,8 @@ function agents_get_agents(
],
$return=false,
$disabled_agent=0,
$use_meta_table=false
$use_meta_table=false,
$join_os_table=false
) {
global $config;
@ -710,6 +711,18 @@ function agents_get_agents(
ON tpolicy_agents.id_agent=tagente.id_agente';
}
if ($join_os_table === true) {
$os_version_join = '
INNER JOIN tconfig_os
ON tagente.id_os = tconfig_os.id_os
INNER JOIN tconfig_os_version
ON tconfig_os.name REGEXP tconfig_os_version.product
';
unset($filter['os_version_end_of_life']);
} else {
$os_version_join = '';
}
if ($extra) {
$where = sprintf(
'(%s OR (%s)) AND (%s) AND (%s) %s AND %s %s %s %s',
@ -744,11 +757,12 @@ function agents_get_agents(
FROM `%s` tagente
LEFT JOIN tagent_secondary_group
ON tagent_secondary_group.id_agent=tagente.id_agente
%s
%s %s
WHERE %s %s',
implode(',', $fields),
$table_name,
$policy_join,
$os_version_join,
$where,
$order
);
@ -2817,28 +2831,6 @@ function agents_get_agent_group($id_agent, $force_meta=false)
}
/**
* This function gets the count of incidents attached to the agent
*
* @param int The agent id
*
* @return mixed The incidents attached or false
*/
function agents_get_count_incidents($id_agent)
{
if (empty($id_agent)) {
return false;
}
return db_get_value(
'count(*)',
'tincidencia',
'id_agent',
$id_agent
);
}
/**
* Get critical monitors by using the status code in modules.
*

View File

@ -2739,6 +2739,11 @@ function alerts_ui_update_or_create_actions($update=true)
$values = [];
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$field_value = get_parameter('field'.$i.'_value');
if (empty(get_parameter('field'.$i.'_value_hidden')) === false) {
$field_value = get_parameter('field'.$i.'_value_hidden');
} else {
$field_value = get_parameter('field'.$i.'_value');
}
if (is_array($field_value)) {
$field_value = reset(array_filter($field_value));
@ -2751,7 +2756,11 @@ function alerts_ui_update_or_create_actions($update=true)
$values['field'.$i] = (string) $field_value;
$info_fields .= ' Field'.$i.': '.$values['field'.$i];
$field_recovery_value = get_parameter('field'.$i.'_recovery_value');
if (empty(get_parameter('field'.$i.'_recovery_value_hidden')) === false) {
$field_recovery_value = get_parameter('field'.$i.'_recovery_value_hidden');
} else {
$field_recovery_value = get_parameter('field'.$i.'_recovery_value');
}
if (is_array($field_recovery_value)) {
$field_recovery_value = reset(array_filter($field_recovery_value));

View File

@ -1528,6 +1528,7 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
$learningMode = $other['data'][10];
$disabled = $other['data'][11];
$description = $other['data'][12];
$osVersion = $other['data'][13];
// Check parameters.
if ($idGroup == 0) {
@ -1623,6 +1624,7 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3)
'server_name' => $nameServer,
'id_parent' => $idParent,
'custom_id' => $customId,
'os_version' => $osVersion,
],
['id_agente' => $id_agent]
);
@ -17783,3 +17785,117 @@ function api_token_check(string $token)
return db_get_value('id_user', 'tusuario', 'api_token', $token);
}
}
/**
* Extract info Agents for inventories ITSM.
*
* @return string Json output.
*/
function api_get_itsm_agents($thrash1, $thrash2, $other)
{
$custom_fields = db_get_all_fields_in_table('tagent_custom_fields');
if ($custom_fields === false) {
$custom_fields = [];
}
$count_custom_fields = count($custom_fields);
$custom_field_sql = '';
$index_name_custom_fields = [];
foreach ($custom_fields as $key => $field) {
$index_name_custom_fields[$field['name']] = $field;
if ($key !== $count_custom_fields) {
$custom_field_sql .= ', ';
}
$custom_field_sql .= sprintf(
'MAX(CASE WHEN tagent_custom_fields.name = "%s" THEN tagent_custom_data.description END) AS "%s"',
$field['name'],
$field['name']
);
}
$where = '1=1';
$limit = '';
if (empty($other['data']) === false) {
// Current idAgent.
if (isset($other['data'][0]) === true && empty($other['data'][0]) === false) {
$where = sprintf(' tagente.id_agente > %d', $other['data'][0]);
}
// Offset
if (isset($other['data'][1]) === true && empty($other['data'][1]) === false) {
$limit = sprintf(' LIMIT %d OFFSET %d', $other['data'][1], 0);
}
}
$sql = sprintf(
'SELECT tagente.alias,
tagente.id_agente AS "ID Agent",
tagente.os_version AS "OS Version",
tagente.direccion AS "IP Address",
tagente.url_address AS "URL Address",
tgrupo.nombre AS "Group",
tconfig_os.name AS "OS"
%s
FROM tagente
LEFT JOIN tagent_custom_data
ON tagent_custom_data.id_agent = tagente.id_agente
LEFT JOIN tagent_custom_fields
ON tagent_custom_data.id_field = tagent_custom_fields.id_field
INNER JOIN tgrupo
ON tgrupo.id_grupo = tagente.id_grupo
INNER JOIN tconfig_os
ON tconfig_os.id_os = tagente.id_os
WHERE %s
GROUP BY tagente.id_agente
ORDER BY tagente.id_agente
%s',
$custom_field_sql,
$where,
$limit
);
$data = db_get_all_rows_sql($sql);
if ($data === false) {
$data = [];
}
$result = [];
foreach ($data as $key => $agent_fields) {
foreach ($agent_fields as $name_field => $value_field) {
$type = 'text';
if (isset($index_name_custom_fields[$name_field]) === true) {
if ($index_name_custom_fields[$name_field]['is_password_type']) {
$type = 'password';
} else if ($index_name_custom_fields[$name_field]['is_link_enabled']) {
$type = 'link';
}
}
$result[$agent_fields['ID Agent']][$name_field] = [
'data' => $value_field,
'type' => $type,
];
}
}
returnData('json', $result);
}
/**
* Extract info Agents for inventories ITSM.
*
* @return string Json output.
*/
function api_get_itsm_count_agents()
{
$sql = 'SELECT COUNT(tagente.id_agente) FROM tagente';
$result = db_get_value_sql($sql);
if ($result === false) {
$result = 0;
}
returnData('json', (int) $result);
}

View File

@ -34,6 +34,7 @@ enterprise_include_once('include/functions_config.php');
use PandoraFMS\Core\DBMaintainer;
use PandoraFMS\Core\Config;
use PandoraFMS\ITSM\ITSM;
/**
@ -244,18 +245,6 @@ function config_update_config()
$error_update[] = __('Enable GIS features');
}
if (config_update_value('integria_inventory', get_parameter('integria_inventory'), true) === false) {
$error_update[] = __('Integria inventory');
}
if (config_update_value('integria_api_password', io_input_password(get_parameter('integria_api_password')), true) === false) {
$error_update[] = __('Integria API password');
}
if (config_update_value('integria_url', get_parameter('integria_url'), true) === false) {
$error_update[] = __('Integria URL');
}
if (config_update_value('activate_netflow', (bool) get_parameter('activate_netflow'), true) === false) {
$error_update[] = __('Enable Netflow');
}
@ -783,26 +772,6 @@ function config_update_config()
$error_update[] = __('Password');
}
if (config_update_value('rintegria_server', get_parameter('rintegria_server'), true) === false) {
$error_update[] = __('Integria host');
}
if (config_update_value('rintegria_port', get_parameter('rintegria_port'), true) === false) {
$error_update[] = __('MySQL port');
}
if (config_update_value('rintegria_dbname', get_parameter('rintegria_dbname'), true) === false) {
$error_update[] = __('Database name');
}
if (config_update_value('rintegria_user', get_parameter('rintegria_user'), true) === false) {
$error_update[] = __('User');
}
if (config_update_value('rintegria_pass', io_input_password(get_parameter('rintegria_pass')), true) === false) {
$error_update[] = __('Password');
}
if (config_update_value('saml_path', get_parameter('saml_path'), true) === false) {
$error_update[] = __('Saml path');
}
@ -1921,103 +1890,137 @@ function config_update_config()
}
break;
case 'integria':
if (config_update_value('integria_user_level_conf', (int) get_parameter('integria_user_level_conf', 0), true) === false) {
$error_update[] = __('Integria user login');
case 'ITSM':
if (config_update_value('ITSM_user_level_conf', (int) get_parameter('ITSM_user_level_conf', 0), true) === false) {
$error_update[] = __('Pandora ITSM user login');
}
if (config_update_value('integria_enabled', (int) get_parameter('integria_enabled', 0), true) === false) {
$error_update[] = __('Enable Integria IMS');
if (config_update_value('ITSM_enabled', (int) get_parameter('ITSM_enabled', 0), true) === false) {
$error_update[] = __('Enable Pandora ITSM');
}
if (config_update_value('integria_user', (string) get_parameter('integria_user', $config['integria_user']), true) === false) {
$error_update[] = __('Integria user');
if (config_update_value('ITSM_token', io_input_password((string) get_parameter('ITSM_token', $config['ITSM_token'])), true) === false) {
$error_update[] = __('Pandora ITSM token');
}
if (config_update_value('integria_pass', io_input_password((string) get_parameter('integria_pass', $config['integria_pass'])), true) === false) {
$error_update[] = __('Integria password');
}
$ITSM_hostname = (string) get_parameter('ITSM_hostname', $config['ITSM_hostname']);
$integria_hostname = (string) get_parameter('integria_hostname', $config['integria_hostname']);
if (parse_url($integria_hostname, PHP_URL_SCHEME) === null) {
if (parse_url($ITSM_hostname, PHP_URL_SCHEME) === null) {
if (empty($_SERVER['HTTPS']) === false) {
$integria_hostname = 'https://'.$integria_hostname;
$ITSM_hostname = 'https://'.$ITSM_hostname;
} else {
$integria_hostname = 'http://'.$integria_hostname;
$ITSM_hostname = 'http://'.$ITSM_hostname;
}
}
if (config_update_value('integria_hostname', $integria_hostname, true) === false) {
$error_update[] = __('integria API hostname');
if (config_update_value('ITSM_hostname', $ITSM_hostname, true) === false) {
$error_update[] = __('Pandora ITSM API hostname');
}
if (config_update_value('integria_api_pass', io_input_password((string) get_parameter('integria_api_pass', $config['integria_api_pass'])), true) === false) {
$error_update[] = __('Integria API password');
$ITSM_public_url = (string) get_parameter('ITSM_public_url', $config['ITSM_public_url']);
if (config_update_value('ITSM_public_url', $ITSM_public_url, true) === false) {
$error_update[] = __('Pandora ITSM API public url');
}
if (config_update_value('integria_req_timeout', (int) get_parameter('integria_req_timeout', $config['integria_req_timeout']), true) === false) {
$error_update[] = __('Integria request timeout');
$ITSM_agents_sync = (int) get_parameter('ITSM_agents_sync', $config['ITSM_agents_sync']);
if (config_update_value('ITSM_agents_sync', $ITSM_agents_sync, true) === false) {
$error_update[] = __('Pandora ITSM API agents sync');
}
if (config_update_value('default_group', (int) get_parameter('default_group', $config['default_group']), true) === false) {
$error_update[] = __('Integria default group');
$incident_default_group = (int) get_parameter('default_group', $config['default_group']);
if (empty($incident_default_group) === true) {
try {
$ITSM = new ITSM();
$incident_default_group = array_keys($ITSM->getGroups())[0];
} catch (\Throwable $th) {
$error = $th->getMessage();
}
}
if (config_update_value('cr_default_group', (int) get_parameter('cr_default_group', $config['cr_default_group']), true) === false) {
$error_update[] = __('Integria custom response default group');
if (config_update_value('default_group', $incident_default_group, true) === false) {
$error_update[] = __('Pandora ITSM default group');
}
if (config_update_value('default_criticity', (int) get_parameter('default_criticity', $config['default_criticity']), true) === false) {
$error_update[] = __('Integria default priority');
$incident_cr_default_group = (int) get_parameter('cr_default_group', $config['cr_default_group']);
if (empty($incident_cr_default_group) === true) {
try {
$ITSM = new ITSM();
$incident_cr_default_group = array_keys($ITSM->getGroups())[0];
} catch (\Throwable $th) {
$error = $th->getMessage();
}
}
if (config_update_value('cr_default_criticity', (int) get_parameter('cr_default_criticity', $config['cr_default_criticity']), true) === false) {
$error_update[] = __('Integria custom response default priority');
if (config_update_value('cr_default_group', $incident_cr_default_group, true) === false) {
$error_update[] = __('Pandora ITSM custom response default group');
}
if (config_update_value('default_criticity', (string) get_parameter('default_criticity', $config['default_criticity']), true) === false) {
$error_update[] = __('Pandora ITSM default priority');
}
if (config_update_value('cr_default_criticity', (string) get_parameter('cr_default_criticity', $config['cr_default_criticity']), true) === false) {
$error_update[] = __('Pandora ITSM custom response default priority');
}
if (config_update_value('default_creator', (string) get_parameter('default_creator', $config['default_creator']), true) === false) {
$error_update[] = __('Integria default creator');
$error_update[] = __('Pandora ITSM default creator');
}
if (config_update_value('default_owner', (string) get_parameter('default_owner', $config['default_owner']), true) === false) {
$error_update[] = __('Integria default owner');
if (config_update_value('default_owner', (string) get_parameter('default_owner_hidden', $config['default_owner']), true) === false) {
$error_update[] = __('Pandora ITSM default owner');
}
if (config_update_value('cr_default_owner', (string) get_parameter('cr_default_owner', $config['cr_default_owner']), true) === false) {
$error_update[] = __('Integria custom response default owner');
if (config_update_value('cr_default_owner', (string) get_parameter('cr_default_owner_hidden', $config['cr_default_owner']), true) === false) {
$error_update[] = __('Pandora ITSM custom response default owner');
}
if (config_update_value('incident_type', (int) get_parameter('incident_type', $config['incident_type']), true) === false) {
$error_update[] = __('Integria default ticket type');
$error_update[] = __('Pandora ITSM default ticket type');
}
if (config_update_value('cr_incident_type', (int) get_parameter('cr_incident_type', $config['cr_incident_type']), true) === false) {
$error_update[] = __('Integria custom response default ticket type');
$error_update[] = __('Pandora ITSM custom response default ticket type');
}
if (config_update_value('incident_status', (int) get_parameter('incident_status', $config['incident_status']), true) === false) {
$error_update[] = __('Integria default ticket status');
if (config_update_value('incident_status', (string) get_parameter('incident_status', $config['incident_status']), true) === false) {
$error_update[] = __('Pandora ITSM default ticket status');
}
if (config_update_value('cr_incident_status', (int) get_parameter('cr_incident_status', $config['cr_incident_status']), true) === false) {
$error_update[] = __('Integria custom response default ticket status');
if (config_update_value('cr_incident_status', (string) get_parameter('cr_incident_status', $config['cr_incident_status']), true) === false) {
$error_update[] = __('Pandora ITSM custom response default ticket status');
}
if (config_update_value('incident_title', (string) get_parameter('incident_title', $config['incident_title']), true) === false) {
$error_update[] = __('Integria default ticket title');
$error_update[] = __('Pandora ITSM default ticket title');
}
if (config_update_value('cr_incident_title', (string) get_parameter('cr_incident_title', $config['cr_incident_title']), true) === false) {
$error_update[] = __('Integria custom response default ticket title');
$error_update[] = __('Pandora ITSM custom response default ticket title');
}
if (config_update_value('incident_content', (string) get_parameter('incident_content', $config['incident_content']), true) === false) {
$error_update[] = __('Integria default ticket content');
$text_incident_content = (string) get_parameter('incident_content', $config['incident_content']);
if (empty($text_incident_content) === true) {
$text_incident_content = sprintf(
'Hello, %s %s A new ticket has been created due a problem in monitoring. %s %s Agent : _agent_ %s Module: _module_ %s %s Regards, %s Your %s server.',
PHP_EOL,
PHP_EOL,
PHP_EOL,
PHP_EOL,
PHP_EOL,
PHP_EOL,
PHP_EOL,
PHP_EOL,
get_product_name()
);
}
if (config_update_value('incident_content', $text_incident_content, true) === false) {
$error_update[] = __('Pandora ITSM default ticket content');
}
if (config_update_value('cr_incident_content', (string) get_parameter('cr_incident_content', $config['cr_incident_content']), true) === false) {
$error_update[] = __('Integria custom response default ticket content');
$error_update[] = __('Pandora ITSM custom response default ticket content');
}
break;
@ -3384,26 +3387,6 @@ function config_process_config()
config_update_value('rpandora_pass', '');
}
if (!isset($config['rintegria_server'])) {
config_update_value('rintegria_server', 'localhost');
}
if (!isset($config['rintegria_port'])) {
config_update_value('rintegria_port', 3306);
}
if (!isset($config['rintegria_dbname'])) {
config_update_value('rintegria_dbname', 'integria');
}
if (!isset($config['rintegria_user'])) {
config_update_value('rintegria_user', 'integria');
}
if (!isset($config['rintegria_pass'])) {
config_update_value('rintegria_pass', '');
}
if (!isset($config['saml_path'])) {
config_update_value('saml_path', '/opt/');
}
@ -3853,21 +3836,25 @@ function config_process_config()
config_update_value('ehorus_req_timeout', 5);
}
// Integria.
if (!isset($config['integria_user_level_conf'])) {
config_update_value('integria_user_level_conf', 0);
// ITSM.
if (!isset($config['ITSM_user_level_conf'])) {
config_update_value('ITSM_user_level_conf', 0);
}
if (!isset($config['integria_enabled'])) {
config_update_value('integria_enabled', 0);
if (!isset($config['ITSM_enabled'])) {
config_update_value('ITSM_enabled', 0);
}
if (!isset($config['integria_req_timeout'])) {
config_update_value('integria_req_timeout', 5);
if (!isset($config['ITSM_hostname'])) {
config_update_value('ITSM_hostname', '');
}
if (!isset($config['integria_hostname'])) {
config_update_value('integria_hostname', '');
if (!isset($config['ITSM_public_url'])) {
config_update_value('ITSM_public_url', '');
}
if (!isset($config['ITSM_agents_sync'])) {
config_update_value('ITSM_agents_sync', 20);
}
// Module Library.

View File

@ -2404,14 +2404,11 @@ function events_print_event_table(
$filter = '1 = 1';
}
$secondary_join = 'LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent';
$sql = sprintf(
'SELECT DISTINCT tevento.*
FROM tevento %s
FROM tevento
WHERE %s %s
ORDER BY utimestamp DESC LIMIT %d',
$secondary_join,
$agent_condition,
$filter,
$limit
@ -3650,6 +3647,12 @@ function events_page_responses($event)
} else {
$responses = [];
foreach ($event_responses as $v) {
if ((isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false)
&& $v['name'] === 'Create&#x20;ticket&#x20;in&#x20;Pandora&#x20;ITSM&#x20;from&#x20;event'
) {
continue;
}
$responses[$v['id']] = $v['name'];
}

View File

@ -32,7 +32,6 @@ require_once $config['homedir'].'/include/functions_reporting.php';
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_integriaims.php';
/**
@ -2917,223 +2916,6 @@ function graph_sla_slicebar(
}
/**
* Print a pie graph with priodity incident
*/
function grafico_incidente_prioridad()
{
global $config;
$integria_ticket_count_by_priority_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['prioridad', 30], false, '', '|;|');
$integria_priorities_map_json = integria_api_call(null, null, null, null, 'get_incident_priorities', '', false, 'json');
$integria_ticket_count_by_priority = json_decode($integria_ticket_count_by_priority_json, true);
$integria_priorities_map = json_decode($integria_priorities_map_json, true);
$integria_priorities_map_ids = array_column($integria_priorities_map, 'id');
$integria_priorities_map_names = array_column($integria_priorities_map, 'name');
$integria_priorities_map_indexed_by_id = array_combine($integria_priorities_map_ids, $integria_priorities_map_names);
$data = [];
$labels = [];
foreach ($integria_ticket_count_by_priority as $item) {
$priority_name = $integria_priorities_map_indexed_by_id[$item['prioridad']];
$labels[] = io_safe_output($priority_name);
$data[] = $item['n_incidents'];
}
if ($config['fixed_graph'] == false) {
$water_mark = [
'file' => $config['homedir'].'/images/logo_vertical_water.png',
'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
];
}
$options = [
'width' => 320,
'height' => 200,
'waterMark' => $water_mark,
'legend' => [
'display' => true,
'position' => 'right',
'align' => 'center',
],
'labels' => $labels,
];
$output = '<div style="width:inherit;margin: 0 auto;">';
$output .= pie_graph(
$data,
$options
);
$output .= '</div>';
return $output;
}
/**
* Print a pie graph with incidents data
*/
function graph_incidents_status()
{
global $config;
$integria_ticket_count_by_status_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['estado', 30], false, '', '|;|');
$integria_status_map_json = integria_api_call(null, null, null, null, 'get_incidents_status', '', false, 'json');
$integria_ticket_count_by_status = json_decode($integria_ticket_count_by_status_json, true);
$integria_status_map = json_decode($integria_status_map_json, true);
$integria_status_map_ids = array_column($integria_status_map, 'id');
$integria_status_map_names = array_column($integria_status_map, 'name');
$integria_status_map_indexed_by_id = array_combine($integria_status_map_ids, $integria_status_map_names);
$data = [];
$labels = [];
foreach ($integria_ticket_count_by_status as $item) {
$status_name = $integria_status_map_indexed_by_id[$item['estado']];
$labels[] = io_safe_output($status_name);
$data[] = $item['n_incidents'];
}
if ($config['fixed_graph'] == false) {
$water_mark = [
'file' => $config['homedir'].'/images/logo_vertical_water.png',
'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
];
}
$options = [
'width' => 320,
'height' => 200,
'waterMark' => $water_mark,
'legend' => [
'display' => true,
'position' => 'right',
'align' => 'center',
],
'labels' => $labels,
];
$output = '<div style="width:inherit;margin: 0 auto;">';
$output .= pie_graph(
$data,
$options
);
$output .= '</div>';
return $output;
}
/**
* Print a pie graph with incident data by group
*/
function graphic_incident_group()
{
global $config;
$integria_ticket_count_by_group_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['id_grupo', 30], false, '', '|;|');
$integria_group_map_json = integria_api_call(null, null, null, null, 'get_groups', '', false, 'json');
$integria_ticket_count_by_group = json_decode($integria_ticket_count_by_group_json, true);
$integria_group_map = json_decode($integria_group_map_json, true);
$data = [];
$labels = [];
foreach ($integria_ticket_count_by_group as $item) {
$group_name = $integria_group_map[$item['id_grupo']];
$labels[] = io_safe_output($group_name);
$data[] = $item['n_incidents'];
}
if ($config['fixed_graph'] == false) {
$water_mark = [
'file' => $config['homedir'].'/images/logo_vertical_water.png',
'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
];
}
$options = [
'width' => 320,
'height' => 200,
'waterMark' => $water_mark,
'legend' => [
'display' => true,
'position' => 'right',
'align' => 'center',
],
'labels' => $labels,
];
$output = '<div style="width:inherit;margin: 0 auto;">';
$output .= pie_graph(
$data,
$options
);
$output .= '</div>';
return $output;
}
/**
* Print a graph with access data of agents
*
* @param integer id_agent Agent ID
* @param integer width pie graph width
* @param integer height pie graph height
* @param integer period time period
*/
function graphic_incident_user()
{
global $config;
$integria_ticket_count_by_user_json = integria_api_call(null, null, null, null, 'get_tickets_count', ['id_usuario', 30], false, '', '|;|');
$integria_ticket_count_by_user = json_decode($integria_ticket_count_by_user_json, true);
$data = [];
$labels = [];
foreach ($integria_ticket_count_by_user as $item) {
$labels[] = (empty($item['id_usuario']) === false) ? io_safe_output($item['id_usuario']) : '--';
$data[] = $item['n_incidents'];
}
if ($config['fixed_graph'] == false) {
$water_mark = [
'file' => $config['homedir'].'/images/logo_vertical_water.png',
'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
];
}
$options = [
'width' => 320,
'height' => 200,
'waterMark' => $water_mark,
'legend' => [
'display' => true,
'position' => 'right',
'align' => 'center',
],
'labels' => $labels,
];
$output = '<div style="width:inherit;margin: 0 auto;">';
$output .= pie_graph(
$data,
$options
);
$output .= '</div>';
return $output;
}
function series_suffix_leyend($series_name, $series_suffix, $id_agent, $data_module_graph, $array_data)
{
global $config;

View File

@ -4867,7 +4867,7 @@ function html_print_header_logo_image(bool $menuCollapsed, bool $return=false)
* Key disabled: Whether to disable the input or not.
* Key class: HTML class
*/
function html_print_input_file($name, $return=false, $options=false)
function html_print_input_file($name, $return=false, $options=false, $inline_upload_anchor_to_form='')
{
$output = '';
// Start to build the input.
@ -4914,11 +4914,45 @@ function html_print_input_file($name, $return=false, $options=false)
$output .= ($options['caption'] ?? __('Select a file'));
$output .= '</label>';
if ($inline_upload_anchor_to_form !== '') {
// Add script to submit targeted form.
$output .= '<script>';
$output .= 'function submitForm(formID) {
var form = $("#"+formID);
form.submit();
}';
$output .= '</script>';
$output .= '<div style="display: inherit;">';
}
$output .= '<span class="inputFileSpan" id="span-'.$name.'">&nbsp;</span>';
if ($inline_upload_anchor_to_form !== '') {
$output .= '<div id="span-'.$name.'-anchor" class="hidden_block">';
$output .= html_print_button(
__('Upload'),
'upload-icon-btn',
false,
sprintf(
'javascript:submitForm("%s")',
$inline_upload_anchor_to_form
),
[
'mode' => 'link',
'style' => 'min-width: initial;',
],
true,
);
$output .= '</div>';
$output .= '</div>';
}
// Add script.
$output .= '<script>';
$output .= 'let inputElement = document.getElementById("file-'.$name.'");
let inputFilename = document.getElementById("span-'.$name.'");
let inputFilenameAnchor = document.getElementById("span-'.$name.'-anchor");
inputElement.addEventListener("change", ()=>{
let inputImage = document.querySelector("input[type=file]").files[0];
if (inputImage.name.length >= 45) {
@ -4926,6 +4960,7 @@ function html_print_input_file($name, $return=false, $options=false)
inputFilename.innerText = name;
} else {
inputFilename.innerText = inputImage.name;
inputFilenameAnchor.classList.remove("hidden_block");
}
});';
$output .= '</script>';
@ -6280,6 +6315,20 @@ function html_print_input($data, $wrapper='div', $input_only=false)
);
break;
case 'date_range':
$output .= html_print_select_date_range(
$data['name'],
true,
(isset($data['selected']) === true) ? $data['selected'] : SECONDS_1DAY,
(isset($data['date_init']) === true) ? $data['date_init'] : '',
(isset($data['time_init']) === true) ? $data['time_init'] : '',
(isset($data['date_end']) === true) ? $data['date_end'] : '',
(isset($data['time_end']) === true) ? $data['time_end'] : '',
(isset($data['date_text']) === true) ? $data['date_text'] : SECONDS_1DAY,
(isset($data['class']) === true) ? $data['class'] : 'w100p',
);
break;
default:
// Ignore.
break;
@ -6328,7 +6377,7 @@ function html_print_input_multicheck(array $data):string
/**
* Print an autocomplete input filled out with Integria IMS users.
* Print an autocomplete input filled out with Pandora ITSM users.
*
* @param string $name The name of ajax control, by default is "users".
* @param string $default The default value to show in the ajax control.
@ -6340,7 +6389,7 @@ function html_print_input_multicheck(array $data):string
*
* @return mixed If the $return is true, return the output as string.
*/
function html_print_autocomplete_users_from_integria(
function html_print_autocomplete_users_from_pandora_itsm(
$name='users',
$default='',
$return=false,
@ -6368,8 +6417,6 @@ function html_print_autocomplete_users_from_integria(
$attrs['class'] = $class;
}
ui_print_help_tip(__('Type at least two characters to search the user.'), false);
html_print_input_text_extended(
$name,
$default,
@ -6381,7 +6428,7 @@ function html_print_autocomplete_users_from_integria(
'',
$attrs
);
html_print_input_hidden($name.'_hidden', $id_agent_module);
html_print_input_hidden($name.'_hidden', $default);
$javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false, false);
?>
@ -6395,52 +6442,72 @@ function html_print_autocomplete_users_from_integria(
}
$(document).ready (function () {
$("#text-<?php echo $name; ?>").autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
data_params = {
page: "include/ajax/integria_incidents.ajax",
search_term: term,
get_users: 1,
};
jQuery.ajax ({
data: data_params,
async: false,
type: "POST",
url: action="<?php echo $javascript_ajax_page; ?>",
timeout: 10000,
dataType: "json",
success: function (data) {
temp = [];
$.each(data, function (id, module) {
temp.push({
'value' : id,
'label' : module});
});
response(temp);
}
});
},
change: function( event, ui ) {
if (!ui.item)
$("input[name='<?php echo $name; ?>_hidden']")
.val(0);
return false;
},
select: function( event, ui ) {
$("input[name='<?php echo $name; ?>_hidden']")
.val(ui.item.value);
$("#text-<?php echo $name; ?>").val( ui.item.label );
return false;
$("#text-<?php echo $name; ?>").autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term; //Word to search
var data_params = {
page: "operation/ITSM/itsm",
search_term: term,
method: "getUserSelect",
};
jQuery.ajax ({
data: data_params,
async: false,
type: "POST",
url: action="<?php echo $javascript_ajax_page; ?>",
timeout: 10000,
dataType: "json",
success: function (data) {
temp = [];
$.each(data, function (id, module) {
temp.push({
'value' : id,
'label' : module});
});
response(temp);
}
});
},
change: function( event, ui ) {
if (!ui.item) {
$("input[name='<?php echo $name; ?>_hidden']")
.val(0);
}
);
return false;
},
select: function( event, ui ) {
$("input[name='<?php echo $name; ?>_hidden']")
.val(ui.item.value);
$("#text-<?php echo $name; ?>").val( ui.item.label );
return false;
}
});
if($("input[name='<?php echo $name; ?>_hidden']").val() !== ''){
var data_params_initial = {
page: "operation/ITSM/itsm",
search_term: $("input[name='<?php echo $name; ?>_hidden']").val(),
method: "getUserSelect",
};
jQuery.ajax ({
data: data_params_initial,
async: false,
type: "POST",
url: action="<?php echo $javascript_ajax_page; ?>",
timeout: 10000,
dataType: "json",
success: function (data) {
$("#text-<?php echo $name; ?>").val(Object.entries(data)[0][1])
}
});
}
});
</script>
<?php
$output = ob_get_clean();
@ -7286,6 +7353,7 @@ function html_print_select_date_range(
$fields[SECONDS_1MONTH] = __('Last 30 days');
$fields['custom'] = __('Custom');
$fields['chose_range'] = __('Chose start/end date period');
$fields['none'] = __('None');
$output = html_print_input_hidden('custom_date', $custom_date, true);
$output .= '<div id="'.$name.'_default" class="wauto inline_flex" '.$display_default.'>';
@ -7579,5 +7647,4 @@ function html_print_wizard_diagnosis(
} else {
echo $output;
}
}
}

View File

@ -1,477 +0,0 @@
<?php
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage Incidents
*/
/**
* Gets all the possible priorities for incidents in an array
*
* @return array The several priorities with their values
*/
function incidents_get_priorities($priority=false)
{
$fields = [];
$fields[0] = __('Informative');
$fields[1] = __('Low');
$fields[2] = __('Medium');
$fields[3] = __('Serious');
$fields[4] = __('Very serious');
$fields[10] = __('Maintenance');
if ($priority === false) {
return $fields;
} else {
return $fields[$priority];
}
}
/**
* Prints the image tag for passed status
*
* @param integer $id_status Which status to return the image to
*
* @return string The string with the image tag
*/
function incidents_print_priority_img($id_priority, $return=false)
{
switch ($id_priority) {
case 0:
$img = html_print_image('images/dot_green.png', true, ['title' => __('Informative')]).html_print_image('images/dot_green.png', true, ['title' => __('Informative')]).html_print_image('images/dot_yellow.png', true, ['title' => __('Informative')]);
break;
case 1:
$img = html_print_image('images/dot_green.png', true, ['title' => __('Low')]).html_print_image('images/dot_yellow.png', true, ['title' => __('Low')]).html_print_image('images/dot_yellow.png', true, ['title' => __('Low')]);
break;
case 2:
$img = html_print_image('images/dot_yellow.png', true, ['title' => __('Medium')]).html_print_image('images/dot_yellow.png', true, ['title' => __('Medium')]).html_print_image('images/dot_red.png', true, ['title' => __('Medium')]);
break;
case 3:
$img = html_print_image('images/dot_yellow.png', true, ['title' => __('Serious')]).html_print_image('images/dot_red.png', true, ['title' => __('Serious')]).html_print_image('images/dot_red.png', true, ['title' => __('Serious')]);
break;
case 4:
$img = html_print_image('images/dot_red.png', true, ['title' => __('Very serious')]).html_print_image('images/dot_red.png', true, ['title' => __('Very serious')]).html_print_image('images/dot_red.png', true, ['title' => __('Very serious')]);
break;
case 10:
$img = html_print_image('images/dot_green.png', true, ['title' => __('Maintenance')]).html_print_image('images/dot_green.png', true, ['title' => __('Maintenance')]).html_print_image('images/dot_green.png', true, ['title' => __('Maintenance')]);
break;
}
if ($return === false) {
echo $img;
}
return $img;
}
/**
* Gets all the possible status for incidents in an array
*
* @return array The several status with their values
*/
function incidents_get_status()
{
$fields = [];
$fields[0] = __('Active incidents');
$fields[1] = __('Active incidents, with comments');
$fields[2] = __('Rejected incidents');
$fields[3] = __('Expired incidents');
$fields[13] = __('Closed incidents');
return $fields;
}
/**
* Prints the image tag for passed status
*
* @param integer $id_status: Which status to return the image to
*
* @return string The string with the image tag
*/
function incidents_print_status_img($id_status, $return=false)
{
switch ($id_status) {
case 0:
$img = html_print_image('images/dot_red.png', true, ['title' => __('Active incidents')]);
break;
case 1:
$img = html_print_image('images/dot_yellow.png', true, ['title' => __('Active incidents, with comments')]);
break;
case 2:
$img = html_print_image('images/dot_blue.png', true, ['title' => __('Rejected incidents')]);
break;
case 3:
$img = html_print_image('images/dot_green.png', true, ['title' => __('Expired incidents')]);
break;
case 13:
$img = html_print_image('images/dot_white.png', true, ['title' => __('Closed incidents')]);
break;
}
if ($return === false) {
echo $img;
}
return $img;
}
/**
* Updates the last user (either by adding an attachment, note or the incident itself)
* Named after the UNIX touch utility
*
* @param integer $id_incident: A single incident or an array of incidents
*
* @return boolean True if it was done, false if it wasn't
*/
function incidents_process_touch($id_incident)
{
global $config;
$id_incident = (array) safe_int($id_incident, 1);
// Make sure we have all positive int's
if (empty($id_incident)) {
return false;
}
if (empty($id_incident)) {
return false;
}
return db_process_sql_update('tincidencia', ['id_lastupdate' => $config['id_user']], ['id_incidencia' => $id_incident]);
}
/**
* Updates the owner (named after the UNIX utility chown)
*
* @param integer $id_incident: A single incident or an array of incidents
*
* @return boolean True if it was done, false if it wasn't
*/
function incidents_process_chown($id_incident, $owner=false)
{
if ($owner === false) {
global $config;
$owner = $config['id_user'];
}
$id_incident = (array) safe_int($id_incident, 1);
// Make sure we have all positive int's
if (empty($id_incident)) {
return false;
}
$id_incident = implode(',', $id_incident);
$sql = sprintf("UPDATE tincidencia SET id_usuario = '%s' WHERE id_incidencia IN (%s)", $owner, $id_incident);
return db_process_sql($sql);
}
/**
* Get the author of an incident.
*
* @param integer $id_incident Incident id.
*
* @return string The author of an incident
*/
function incidents_get_author($id_incident)
{
if ($id_incident < 1) {
return '';
}
return (string) db_get_value('id_creator', 'tincidencia', 'id_incidencia', (int) $id_incident);
}
/**
* Get the owner of an incident.
*
* @param integer $id_incident Incident id.
*
* @return string The last updater of an incident
*/
function incidents_get_owner($id_incident)
{
if ($id_incident < 1) {
return '';
}
return (string) db_get_value('id_usuario', 'tincidencia', 'id_incidencia', (int) $id_incident);
}
/**
* Get the last updater of an incident.
*
* @param integer $id_incident Incident id.
*
* @return string The last updater of an incident
*/
function incidents_get_lastupdate($id_incident)
{
if ($id_incident < 1) {
return '';
}
return (string) db_get_value('id_lastupdate', 'tincidencia', 'id_incidencia', (int) $id_incident);
}
/**
* Get the group id of an incident.
*
* @param integer $id_incident Incident id.
*
* @return integer The group id of an incident
*/
function incidents_get_group($id_incident)
{
if ($id_incident < 1) {
return 0;
}
return (int) db_get_value('id_grupo', 'tincidencia', 'id_incidencia', (int) $id_incident);
}
/**
* Delete an incident out the database.
*
* @param mixed $id_inc An int or an array of ints to be deleted
*
* @return boolean True if incident was succesfully deleted, false if not
*/
function incidents_delete_incident($id_incident)
{
global $config;
$ids = (array) safe_int($id_incident, 1);
// Make the input an array
$notes = [];
$attachments = [];
$errors = 0;
foreach ($ids as $id_inc) {
// Delete incident
$ret = db_process_sql_delete('tincidencia', ['id_incidencia' => $id_inc]);
if ($ret === false) {
$errors++;
}
// We only need the ID's
$notes = array_merge($notes, array_keys(incidents_get_notes($id_inc)));
$attachments = array_merge($attachments, array_keys(incidents_get_attach($id_inc)));
db_pandora_audit(
AUDIT_LOG_INCIDENT_MANAGEMENT,
$config['id_user'].' deleted incident #'.$id_inc
);
}
// Delete notes
$note_err = incidents_delete_note($notes, false);
$attach_err = incidents_delete_attach($attachments, false);
if ($note_err === false || $attach_err === false) {
$errors++;
}
if ($errors > 0) {
return false;
}
return true;
}
/**
* Delete notes out the database.
*
* @param mixed $id_note An int or an array of ints to be deleted
* @param boolean $transact true if a transaction should be started, false if not
*
* @return boolean True if note was succesfully deleted, false if not
*/
function incidents_delete_note($id_note, $transact=true)
{
$id_note = (array) safe_int($id_note, 1);
// cast as array
$errors = 0;
// Delete notes
foreach ($id_note as $id) {
$ret = db_process_sql_delete('tnota', ['id_nota' => $id]);
if ($ret === false) {
$errors++;
}
}
if ($errors > 0) {
return false;
} else {
return true;
}
}
/**
* Delete attachments out the database and from the machine.
*
* @param mixed $id_attach An int or an array of ints to be deleted
* @param boolean $transact true if a transaction should be started, false if not
*
* @return boolean True if attachment was succesfully deleted, false if not
*/
function incidents_delete_attach($id_attach, $transact=true)
{
global $config;
$id_attach = (array) safe_int($id_attach, 1);
// cast as array
$errors = 0;
// Delete attachment
foreach ($id_attach as $id) {
$filename = db_get_value('filename', 'tattachment', 'id_attachment', $id);
$ret = db_process_sql_delete('tattachment', ['id_attachment' => $id]);
if ($ret === false) {
$errors++;
}
unlink($config['attachment_store'].'/pand'.$id.'_'.$filename);
}
if ($errors > 0) {
return false;
} else {
return true;
}
}
/**
* Get notes based on the incident id.
*
* @param integer $id_incident An int with the incident id
*
* @return array An array of all the notes for that incident
*/
function incidents_get_notes($id_incident)
{
$return = db_get_all_rows_field_filter('tnota', 'id_incident', (int) $id_incident);
if ($return === false) {
$return = [];
}
$notes = [];
foreach ($return as $row) {
$notes[$row['id_nota']] = $row;
}
return $notes;
}
/**
* Get attachments based on the incident id.
*
* @param integer $id_incident An int with the incident id
*
* @return array An array of all the notes for that incident
*/
function incidents_get_attach($id_incident)
{
$return = db_get_all_rows_field_filter('tattachment', 'id_incidencia', (int) $id_incident);
if ($return === false) {
$return = [];
}
$attach = [];
foreach ($return as $row) {
$attach[$row['id_attachment']] = $row;
}
return $attach;
}
/**
* Get user id of a note.
*
* @param integer $id_note Note id.
*
* @return string User id of the given note.
*/
function incidents_get_notes_author($id_note)
{
return (string) db_get_value('id_usuario', 'tnota', 'id_nota', (int) $id_note);
}
/**
* Interface to Integria API functionality.
*
* @param string $url Url to Integria API with user, password and option (function to use).
* @param string $postparameters Additional parameters to pass.
*
* @return variant The function result called in the API.
*/
function incidents_call_api($url, $postparameters=false)
{
$curlObj = curl_init();
curl_setopt($curlObj, CURLOPT_URL, $url);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
if ($postparameters !== false) {
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $postparameters);
}
$result = curl_exec($curlObj);
curl_close($curlObj);
return $result;
}
/**
* Converts Xml format file to an array datatype.
*
* @param string $xml Xml file to convert.
*
* @return array A Json encoded array with xml content.
*/
function incidents_xml_to_array($xml)
{
$xmlObj = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
return json_decode(json_encode($xmlObj), true);
}

View File

@ -1,564 +0,0 @@
<?php
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage Incidents
*/
global $config;
require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_html.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions.php';
/**
* Show header tabs.
*
* @param string $active_tab Current tab or false for View page.
* @param number $view Id of incident. Show View tab.
*
* @return array HTML code. Print tabs in header.
*/
function integriaims_tabs($active_tab, $view=false)
{
global $config;
$url_tabs = ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/');
$setup_tab['text'] = '<a href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=integria').'">'.html_print_image('images/configuration@svg.svg', true, ['title' => __('Configure Integria IMS'), 'class' => 'main_menu_icon invert_filter']).'</a>';
$list_tab['text'] = '<a href="'.$url_tabs.'list_integriaims_incidents">'.html_print_image('images/logs@svg.svg', true, ['title' => __('Ticket list'), 'class' => 'main_menu_icon invert_filter']).'</a>';
$create_tab['text'] = '<a href="'.$url_tabs.'configure_integriaims_incident">'.html_print_image('images/edit.svg', true, ['title' => __('New ticket'), 'class' => 'main_menu_icon invert_filter']).'</a>';
switch ($active_tab) {
case 'setup_tab':
$setup_tab['active'] = true;
$list_tab['active'] = false;
$create_tab['active'] = false;
break;
case 'list_tab':
$setup_tab['active'] = false;
$list_tab['active'] = true;
$create_tab['active'] = false;
break;
case 'create_tab':
$setup_tab['active'] = false;
$list_tab['active'] = false;
$create_tab['active'] = true;
break;
default:
$setup_tab['active'] = false;
$list_tab['active'] = false;
$create_tab['active'] = false;
break;
}
if ($view) {
$create_tab['text'] = '<a href="'.$url_tabs.'configure_integriaims_incident&incident_id='.$view.'">'.html_print_image('images/edit.svg', true, ['title' => __('Edit ticket'), 'class' => 'main_menu_icon invert_filter']).'</a>';
$view_tab['text'] = '<a href="'.$url_tabs.'dashboard_detail_integriaims_incident&incident_id='.$view.'">'.html_print_image('images/details.svg', true, ['title' => __('View ticket'), 'class' => 'main_menu_icon invert_filter']).'</a>';
// When the current page is the View page.
if (!$active_tab) {
$view_tab['active'] = true;
}
}
$onheader = [];
$onheader['view'] = $view_tab;
$onheader['configure'] = $setup_tab;
$onheader['list'] = $list_tab;
$onheader['create'] = $create_tab;
return $onheader;
}
/**
* Gets all the details of Integria IMS API
*
* @param string $details Type of API call.
* @param number $detail_index Send index if you want return the text.
*
* @return string or array with result of API call.
*/
function integriaims_get_details($details, $detail_index=false)
{
global $config;
switch ($details) {
case 'status':
$operation = 'get_incidents_status';
break;
case 'group':
$operation = 'get_groups';
break;
case 'priority':
$operation = 'get_incident_priorities';
break;
case 'resolution':
$operation = 'get_incidents_resolutions';
break;
case 'type':
$operation = 'get_types';
break;
default:
// code...
break;
}
$api_call = integria_api_call(null, null, null, null, $operation);
$result = [];
get_array_from_csv_data_pair($api_call, $result);
if ($detail_index !== false) {
if ($result[$detail_index] == '' || $result[$detail_index] === null) {
return __('None');
} else {
return $result[$detail_index];
}
} else {
return $result;
}
}
/**
* Perform an API call to Integria IMS.
*
* @param string|null $api_hostname API host URL.
* @param string|null $user User name.
* @param string|null $user_pass User password.
* @param string|null $api_pass API password.
* @param string|null $operation API Operation.
* @param mixed $params String or array with parameters required by the API function.
* @param mixed $show_credentials_error_msg Show_credentials_error_msg.
* @param mixed $return_type Return_type.
* @param mixed $token Token.
* @param mixed $user_level_conf User_level_conf.
*
* @return boolean True if API request succeeded, false if API request failed.
*/
function integria_api_call(
$api_hostname=null,
$user=null,
$user_pass=null,
$api_pass=null,
$operation=null,
$params='',
$show_credentials_error_msg=false,
$return_type='',
$token='',
$user_level_conf=null
) {
global $config;
if (is_metaconsole()) {
$servers = metaconsole_get_connection_names();
foreach ($servers as $key => $server) {
$connection = metaconsole_get_connection($server);
if (metaconsole_connect($connection) != NOERR) {
continue;
}
$integria_enabled = db_get_sql(
'SELECT `value` FROM tconfig WHERE `token` = "integria_enabled"'
);
if (!$integria_enabled) {
metaconsole_restore_db();
continue;
}
// integria_user_level_conf, integria_hostname, integria_api_pass, integria_user, integria_user_level_user, integria_pass, integria_user_level_pass
$config_aux = db_get_all_rows_sql('SELECT `token`, `value` FROM `tconfig` WHERE `token` IN ("integria_user_level_conf", "integria_hostname", "integria_api_pass", "integria_user", "integria_user_level_user", "integria_pass", "integria_user_level_pass")');
$user_info = users_get_user_by_id($config['id_user']);
foreach ($config_aux as $key => $conf) {
if ($conf['token'] === 'integria_user_level_conf') {
$user_level_conf = $conf['value'];
}
if ($conf['token'] === 'integria_hostname') {
$api_hostname = $conf['value'];
}
if ($conf['token'] === 'integria_api_pass') {
$api_pass = $conf['value'];
}
if ($conf['token'] === 'integria_user') {
$user = $conf['value'];
}
if ($conf['token'] === 'integria_pass') {
$user_pass = $conf['value'];
}
}
if ($user_level_conf == true) {
$user = $user_info['integria_user_level_user'];
$user_pass = $user_info['integria_user_level_pass'];
}
metaconsole_restore_db();
}
} else {
if ($user_level_conf === null) {
$user_level_conf = (bool) $config['integria_user_level_conf'];
}
$user_info = users_get_user_by_id($config['id_user']);
// API access data.
if ($api_hostname === null) {
$api_hostname = $config['integria_hostname'];
}
if ($api_pass === null) {
$api_pass = $config['integria_api_pass'];
}
// Integria user and password.
if ($user === null || $user_level_conf === true) {
$user = $config['integria_user'];
if ($user_level_conf === true) {
$user = $user_info['integria_user_level_user'];
}
}
if ($user_pass === null || $user_level_conf === true) {
$user_pass = $config['integria_pass'];
if ($user_level_conf === true) {
$user_pass = $user_info['integria_user_level_pass'];
}
}
}
if (is_array($params)) {
$params = implode($token, $params);
}
$url_data = [
'user' => $user,
'user_pass' => $user_pass,
'pass' => $api_pass,
'op' => $operation,
'params' => io_safe_output($params),
];
if ($return_type !== '') {
$url_data['return_type'] = $return_type;
}
if ($token !== '') {
$url_data['token'] = $token;
}
// Build URL for API request.
$url = $api_hostname.'/include/api.php';
// ob_start();
// $out = fopen('php://output', 'w');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $url_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, $out);
$result = curl_exec($ch);
// fclose($out);
// $debug = ob_get_clean();
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = false;
if ($result === false) {
$error = curl_error($ch);
}
curl_close($ch);
if ($error === true || $http_status !== 200) {
if ($show_credentials_error_msg === true) {
ui_print_error_message(__('API request failed. Please check Integria IMS\' access credentials in Pandora setup.'));
}
return false;
} else {
return $result;
}
}
// Parse CSV consisting of one or more lines of the form key-value pair into an array.
function get_array_from_csv_data_pair($csv_data, &$array_values)
{
$csv_array = explode("\n", $csv_data);
foreach ($csv_array as $csv_value) {
if (empty($csv_value)) {
continue;
}
$new_csv_value = str_getcsv($csv_value);
$array_values[$new_csv_value[0]] = $new_csv_value[1];
}
}
/**
* Parse CSV consisting of all lines into an array.
*
* @param string $csv_data Data returned of csv api call.
* @param string $array_values Returned array.
* @param array $index Array to create an associative index (opcional).
*/
function get_array_from_csv_data_all($csv_data, &$array_values, $index=false)
{
$csv_array = explode("\n", $csv_data);
foreach ($csv_array as $csv_value) {
if (empty($csv_value)) {
continue;
}
$new_csv_value = str_getcsv($csv_value);
if ($index !== false) {
foreach ($new_csv_value as $key => $value) {
$new_csv_value_index[$index[$key]] = str_replace(':::', ',', $value);
;
}
$array_values[$new_csv_value[0]] = $new_csv_value_index;
} else {
$new_csv_value_comma = array_map(
function ($item) {
return str_replace(':::', ',', $item);
},
$new_csv_value
);
$array_values[$new_csv_value[0]] = $new_csv_value_comma;
}
}
}
/**
* Print priority for Integria IMS with colors.
*
* @param string $priority value of priority in Integria IMS.
* @param string $priority_label text shown in color box.
*
* @return string HTML code. code to print the color box.
*/
function ui_print_integria_incident_priority($priority, $priority_label)
{
global $config;
$output = '';
switch ($priority) {
case 0:
$color = COL_UNKNOWN;
break;
case 1:
$color = COL_NORMAL;
break;
case 10:
$color = COL_NOTINIT;
break;
case 2:
$color = COL_WARNING;
break;
case 3:
$color = COL_ALERTFIRED;
break;
case 4:
$color = COL_CRITICAL;
break;
}
$output = '<div class="priority" style="background: '.$color.'">';
$output .= $priority_label;
$output .= '</div>';
return $output;
}
/**
* Get tickets from Integria IMS.
*
* @param array $tickets_filters Filters to send to API.
*
* @return array Tickets returned by API call.
*/
function get_tickets_integriaims($tickets_filters)
{
global $config;
// Filters.
$incident_text = $tickets_filters['incident_text'];
$incident_status = $tickets_filters['incident_status'];
$incident_group = $tickets_filters['incident_group'];
$incident_owner = $tickets_filters['incident_owner'];
$incident_creator = $tickets_filters['incident_creator'];
$incident_priority = $tickets_filters['incident_priority'];
$incident_resolution = $tickets_filters['incident_resolution'];
$created_from = $tickets_filters['created_from'];
$created_to = $tickets_filters['created_to'];
// API call.
$result_api_call_list = integria_api_call(
null,
null,
null,
null,
'get_incidents',
[
$incident_text,
$incident_status,
$incident_group,
$incident_priority,
'0',
$incident_owner,
$incident_creator,
],
false,
'',
','
);
// Return array of api call 'get_incidents'.
$array_get_incidents = [];
get_array_from_csv_data_all($result_api_call_list, $array_get_incidents);
// Modify $array_get_incidents if filter for resolution exists.
$filter_resolution = [];
foreach ($array_get_incidents as $key => $value) {
if ($incident_resolution !== '' && ($array_get_incidents[$key][12] == $incident_resolution)) {
$filter_resolution[$key] = $array_get_incidents[$key];
continue;
}
}
if ($incident_resolution !== '') {
$array_get_incidents = $filter_resolution;
}
// Modify $array_get_incidents if filter for date is selected.
if ($created_from !== '' && $created_to !== '') {
$date = [];
$date_utimestamp = [];
foreach ($array_get_incidents as $key => $value) {
// Change format date / to -.
$date[$key] = date('Y-m-d', strtotime($array_get_incidents[$key][9]));
// Covert date to utimestamp.
$date_utimestamp[$key] = strtotime($date[$key]);
}
// Change format date / to -.
$created_from_date = date('Y-m-d', strtotime($created_from));
$created_to_date = date('Y-m-d', strtotime($created_to));
// Covert date to utimestamp.
$created_from_timestamp = strtotime($created_from_date);
$created_to_timestamp = strtotime($created_to_date);
// Dates within the selected period.
$selected_period = array_filter(
$date_utimestamp,
function ($value) use ($created_from_timestamp, $created_to_timestamp) {
return ($value >= $created_from_timestamp && $value <= $created_to_timestamp);
}
);
// Return incidents with the correct dates.
$filter_date = [];
foreach ($array_get_incidents as $key => $value) {
foreach ($selected_period as $index => $value) {
if ($array_get_incidents[$key][0] == $index) {
$filter_date[$key] = $array_get_incidents[$key];
continue;
}
}
}
$array_get_incidents = $filter_date;
}
return $array_get_incidents;
}
function integriaims_upload_file($filename, $incident_id, $file_description)
{
if ($_FILES[$filename]['name'] != '') {
$filename = io_safe_input($_FILES[$filename]['name']);
$filesize = io_safe_input($_FILES[$filename]['size']);
$extension = pathinfo($filename, PATHINFO_EXTENSION);
$invalid_extensions = '/^(bat|exe|cmd|sh|php|php1|php2|php3|php4|php5|pl|cgi|386|dll|com|torrent|js|app|jar|iso|
pif|vb|vbscript|wsf|asp|cer|csr|jsp|drv|sys|ade|adp|bas|chm|cpl|crt|csh|fxp|hlp|hta|inf|ins|isp|jse|htaccess|
htpasswd|ksh|lnk|mdb|mde|mdt|mdw|msc|msi|msp|mst|ops|pcd|prg|reg|scr|sct|shb|shs|url|vbe|vbs|wsc|wsf|wsh)$/i';
if (!preg_match($invalid_extensions, $extension)) {
// The following is if you have clamavlib installed.
// (php5-clamavlib) and enabled in php.ini
// http://www.howtoforge.com/scan_viruses_with_php_clamavlib
if (extension_loaded('clamav')) {
cl_setlimits(5, 1000, 200, 0, 10485760);
$malware = cl_scanfile($_FILES['file']['tmp_name']);
if ($malware) {
$error = 'Malware detected: '.$malware.'<br>ClamAV version: '.clam_get_version();
die($error);
}
}
$filecontent = base64_encode(file_get_contents($_FILES[$filename]['tmp_name']));
$result_api_call = integria_api_call(null, null, null, null, 'attach_file', [$incident_id, $filename, $filesize, $file_description, $filecontent], false, '', '|;|');
// API method returns '0' string if success.
$file_added = ($result_api_call === '0') ? true : false;
ui_print_result_message(
$file_added,
__('File successfully added'),
__('File could not be added')
);
} else {
ui_print_error_message(__('File has an invalid extension'));
}
}
}

View File

@ -147,6 +147,12 @@ function menu_print_menu(&$menu)
|| $sec2 === 'enterprise/godmode/servers/manage_credential_boxes'
) {
$sec2 = 'enterprise/godmode/servers/list_satellite';
} else if ($sec2 === 'operation/ITSM/itsm') {
$sec2 = (string) get_parameter('sec2');
$operation = (string) get_parameter('operation', '');
if (empty($operation) === false) {
$sec2 = $sec2.'&operation='.$operation;
}
} else {
$sec2 = (string) get_parameter('sec2');
}
@ -287,7 +293,7 @@ function menu_print_menu(&$menu)
}
}
// Set class.
// Set class.;
if (($sec2 == $subsec2 || $allsec2 == $subsec2
|| $selected_submenu2) && isset($sub[$subsec2]['options'])
&& (get_parameter_get($sub[$subsec2]['options']['name']) == $sub[$subsec2]['options']['value'])

View File

@ -778,6 +778,13 @@ function reporting_make_reporting_data(
);
break;
case 'end_of_life':
$report['contents'][] = reporting_end_of_life(
$report,
$content
);
break;
case 'alert_report_actions':
$report['contents'][] = reporting_alert_report_actions(
$report,
@ -3618,6 +3625,112 @@ function reporting_agent_module_status($report, $content)
}
/**
* OS Version End of Life
*
* @param array $report Info Report.
* @param array $content Info content.
*
* @return array
*/
function reporting_end_of_life($report, $content)
{
global $config;
$return['type'] = 'end_of_life';
if (empty($content['name'])) {
$content['name'] = __('End of life');
}
$return['title'] = io_safe_output($content['name']);
$return['landscape'] = $content['landscape'];
$return['pagebreak'] = $content['pagebreak'];
$return['subtitle'] = __('End of life report');
$return['description'] = io_safe_output($content['description']);
$return['date'] = reporting_get_date_text($report, $content);
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
$return['data'] = [];
$external_source = json_decode(
$content['external_source'],
true
);
$servers_ids = [0];
if (is_metaconsole() === true) {
$servers_ids = array_column(metaconsole_get_servers(), 'id');
}
foreach ($servers_ids as $server_id) {
if (is_metaconsole() === true) {
$connection = metaconsole_get_connection_by_id($server_id);
if (metaconsole_connect($connection) != NOERR) {
continue;
}
}
$agents = agents_get_agents(
[],
[
'alias',
'direccion',
'name',
'os_version',
],
'AR',
[
'field' => 'nombre',
'order' => 'ASC',
],
false,
0,
false,
true
);
$es_os_version = $external_source['os_version'];
$es_limit_eol_datetime = DateTime::createFromFormat('Y/m/d', $external_source['end_of_life_date']);
// Post-process returned agents to filter agents using correctly formatted fields.
foreach ($agents as $idx => $agent) {
// Must perform this query and subsequent operations in each iteration (note this is costly) since OS version field may contain HTML entities in BD and decoding can't be fully handled with mysql methods when doing a REGEXP.
$result_end_of_life = db_get_value_sql('SELECT end_of_support FROM tconfig_os_version WHERE "'.io_safe_output($agent['os_version']).'" REGEXP version AND "'.io_safe_output($agent['name']).'" REGEXP product');
$agent_eol_datetime = DateTime::createFromFormat('Y/m/d', $result_end_of_life);
if ((preg_match('/'.$es_os_version.'/i', $agent['os_version']) || $es_os_version === '') && $result_end_of_life !== false && ($es_limit_eol_datetime === false || $es_limit_eol_datetime >= $agent_eol_datetime)) {
// Agent matches an existing OS version.
$agents[$idx]['end_of_life'] = $result_end_of_life;
} else {
// Set agent to be filtered out.
$agents[$idx] = null;
}
}
if ($agents !== false) {
$agents = array_filter($agents);
}
if (is_metaconsole() === true) {
$res[$connection['server_name']] = $agents;
metaconsole_restore_db();
}
}
if (is_metaconsole() === true) {
$return['data'] = $res;
} else {
$return['data'] = $agents;
}
return reporting_check_structure_content($return);
}
function reporting_exception(
$report,
$content,

View File

@ -403,6 +403,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
reporting_html_agent_module_status($table, $item);
break;
case 'end_of_life':
reporting_html_end_of_life($table, $item);
break;
case 'alert_report_actions':
reporting_html_alert_report_actions($table, $item);
break;
@ -2754,6 +2758,123 @@ function reporting_html_agent_module_status($table, $item, $pdf=0)
}
/**
* Html report end of life.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param integer $pdf Pdf output.
*
* @return mixed
*/
function reporting_html_end_of_life($table, $item, $pdf=0)
{
global $config;
$return_pdf = '';
if (empty($item['data']) === true) {
if ($pdf !== 0) {
$return_pdf .= __('No items');
} else {
$table->colspan['group_report']['cell'] = 3;
$table->cellstyle['group_report']['cell'] = 'text-align: center;';
$table->data['group_report']['cell'] = __('No items');
}
} else {
$table_info = new stdClass();
$table_info->width = '99%';
$table_info->align = [];
if (is_metaconsole() === true) {
$table_info->align['server'] = 'left';
}
$table_info->align['agent_alias'] = 'left';
$table_info->align['ip'] = 'left';
$table_info->align['os_type'] = 'left';
$table_info->align['os_version'] = 'left';
$table_info->align['end_of_life'] = 'left';
$table_info->headstyle = [];
if (is_metaconsole() === true) {
$table_info->headstyle['server'] = 'text-align: left';
}
$table_info->headstyle['agent_alias'] = 'text-align: left';
$table_info->headstyle['ip'] = 'text-align: left';
$table_info->headstyle['os_type'] = 'text-align: left';
$table_info->headstyle['os_version'] = 'text-align: left';
$table_info->headstyle['end_of_life'] = 'text-align: left';
$table_info->head = [];
if (is_metaconsole() === true) {
$table_info->head['server'] = __('Server');
}
$table_info->head['agent_alias'] = __('Agent alias');
$table_info->head['ip'] = __('IP');
$table_info->head['os_type'] = __('OS Type');
$table_info->head['os_version'] = __('OS Version');
$table_info->head['end_of_life'] = __('End of life');
$table_info->data = [];
if (is_metaconsole() === true) {
foreach ($item['data'] as $server_name => $agents_per_server) {
foreach ($agents_per_server as $agent) {
$row = [];
$row['server'] = $server_name;
$row['agent_alias'] = $agent['alias'];
$row['ip'] = $agent['direccion'];
$row['os_type'] = $agent['name'];
$row['os_version'] = $agent['os_version'];
$date_string = date_w_fixed_tz($agent['end_of_life']);
$timestamp = strtotime($date_string);
$date_without_time = date('F j, Y', $timestamp);
$row['end_of_life'] = $date_without_time;
$table_info->data[] = $row;
}
}
} else {
foreach ($item['data'] as $data) {
$row = [];
$row['agent_alias'] = $data['alias'];
$row['ip'] = $data['direccion'];
$row['os_type'] = $data['name'];
$row['os_version'] = $data['os_version'];
$date_string = date_w_fixed_tz($data['end_of_life']);
$timestamp = strtotime($date_string);
$date_without_time = date('F j, Y', $timestamp);
$row['end_of_life'] = $date_without_time;
$table_info->data[] = $row;
}
}
if ($pdf !== 0) {
$table_info->title = $item['title'];
$table_info->titleclass = 'title_table_pdf';
$table_info->titlestyle = 'text-align:left;';
$return_pdf .= html_print_table($table_info, true);
} else {
$table->colspan['data']['cell'] = 3;
$table->cellstyle['data']['cell'] = 'text-align: center;';
$table->data['data']['cell'] = html_print_table($table_info, true);
}
}
if ($pdf !== 0) {
return $return_pdf;
}
}
/**
* Function to print to HTML Exception report.
*

View File

@ -814,6 +814,11 @@ function reports_get_report_types($template=false, $not_editor=false)
'name' => __('Agents/Modules status'),
];
$types['end_of_life'] = [
'optgroup' => __('Grouped'),
'name' => __('End of life'),
];
// Only pandora managers have access to the whole database.
if (check_acl($config['id_user'], 0, 'PM')) {
$types['sql'] = [

View File

@ -4171,13 +4171,13 @@ function ui_print_datatable(array $parameters)
foreach ($names as $column) {
if (is_array($column)) {
$table .= '<th id="'.$column['id'].'" class="'.$column['class'].'" ';
$table .= '<th id="'.($column['id'] ?? '').'" class="'.($column['class'] ?? '').'" ';
if (isset($column['title']) === true) {
$table .= 'title="'.__($column['title']).'" ';
}
$table .= ' style="'.$column['style'].'">'.__($column['text']);
$table .= $column['extra'];
$table .= ' style="'.($column['style'] ?? '').'">'.__($column['text']);
$table .= ($column['extra'] ?? '');
$table .= '</th>';
} else {
$table .= '<th>'.__($column).'</th>';

View File

@ -0,0 +1,191 @@
/* global $ jQuery */
/* Function get custom fields incidences */
// eslint-disable-next-line no-unused-vars
function getInputFieldsIncidenceType(idIncidenceType, fieldsData, ajaxUrl) {
// Failed request handler.
var handleFail = function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
};
// Function which handle success case.
var handleSuccess = function(data) {
$(".object-type-fields").empty();
$(".object-type-fields").append(data);
};
// Visual Console container request.
jQuery
.post(
ajaxUrl,
{
page: "operation/ITSM/itsm",
method: "getInputFieldsIncidenceType",
idIncidenceType: idIncidenceType,
fieldsData: fieldsData
},
"html"
)
.done(handleSuccess)
.fail(handleFail);
}
/* Function get custom fields incidences */
// eslint-disable-next-line no-unused-vars
function downloadIncidenceAttachment(
idIncidence,
idAttachment,
ajaxUrl,
filename
) {
$.ajax({
type: "POST",
url: ajaxUrl,
data: {
page: "operation/ITSM/itsm",
method: "getDownloadIncidenceAttachment",
idIncidence: idIncidence,
idAttachment: idAttachment
},
dataType: "binary",
xhrFields: {
responseType: "arraybuffer"
},
success: function(data) {
var blob = new Blob([data], { type: "application/octetstream" });
var link = document.createElement("a");
link.href = window.URL.createObjectURL(blob);
link.download = filename;
document.body.appendChild(link);
link.click();
},
error: function(jqXHR, textStatus, message) {
console.error(textStatus, message);
}
});
}
/* Function check API */
// eslint-disable-next-line no-unused-vars
function testConectionApi(pass, host) {
var hideLoadingImage = function() {
$("span#ITSM-spinner").hide();
};
var showLoadingImage = function() {
$("span#ITSM-spinner").show();
};
var hideSuccessImage = function() {
$("span#ITSM-success").hide();
};
var showSuccessImage = function() {
$("span#ITSM-success").show();
};
var hideFailureImage = function() {
$("span#ITSM-failure").hide();
};
var showFailureImage = function() {
$("span#ITSM-failure").show();
};
var hideMessage = function() {
$("span#ITSM-message").hide();
};
var showMessage = function() {
$("span#ITSM-message").show();
};
hideSuccessImage();
hideFailureImage();
hideMessage();
showLoadingImage();
var data = {
page: "operation/ITSM/itsm",
method: "checkConnectionApi",
pass: pass,
host: host
};
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "json",
data: data
})
.done(function(data) {
if (data.valid == 1) {
showSuccessImage();
} else {
showFailureImage();
showMessage();
}
})
.fail(function() {
showFailureImage();
showMessage();
})
.always(function() {
hideLoadingImage();
});
}
/* Function check API */
// eslint-disable-next-line no-unused-vars
function testConectionApiItsmToPandora(path) {
var hideLoadingImage = function() {
$("span#ITSM-spinner-pandora").hide();
};
var showLoadingImage = function() {
$("span#ITSM-spinner-pandora").show();
};
var hideSuccessImage = function() {
$("span#ITSM-success-pandora").hide();
};
var showSuccessImage = function() {
$("span#ITSM-success-pandora").show();
};
var hideFailureImage = function() {
$("span#ITSM-failure-pandora").hide();
};
var showFailureImage = function() {
$("span#ITSM-failure-pandora").show();
};
var hideMessage = function() {
$("span#ITSM-message-pandora").hide();
};
var showMessage = function() {
$("span#ITSM-message-pandora").show();
};
hideSuccessImage();
hideFailureImage();
hideMessage();
showLoadingImage();
var data = {
page: "operation/ITSM/itsm",
method: "checkConnectionApiITSMToPandora",
path: path
};
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "json",
data: data
})
.done(function(data) {
if (data.valid == 1) {
showSuccessImage();
} else {
showFailureImage();
showMessage();
}
})
.fail(function() {
showFailureImage();
showMessage();
})
.always(function() {
hideLoadingImage();
});
}

View File

@ -52,7 +52,7 @@ function show_event_dialog(event, dialog_page) {
.empty()
.append(data)
.dialog({
title: event.evento,
title: event.event_title,
resizable: true,
draggable: true,
modal: false,

View File

@ -440,10 +440,26 @@ class Widget
$className .= '\\'.$name;
break;
case 'ITSMIncidences':
if (isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false) {
$not_installed = true;
}
$className .= '\\'.$name;
break;
case 'heatmap':
$className .= '\HeatmapWidget';
break;
case 'security_hardening':
if (\enterprise_installed() === false) {
$not_installed = true;
}
$className .= '\SecurityHardening';
break;
default:
$className = false;
break;

View File

@ -0,0 +1,453 @@
<?php
/**
* Widget Simple graph Pandora FMS Console
*
* @category Console Class
* @package Pandora FMS
* @subpackage Widget
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Pandora FMS
* Please see https://pandorafms.com/community/ for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
namespace PandoraFMS\Dashboard;
use PandoraFMS\Enterprise\Metaconsole\Node;
use PandoraFMS\ITSM\ITSM;
global $config;
/**
* URL Widgets
*/
class ITSMIncidences extends Widget
{
/**
* Name widget.
*
* @var string
*/
protected $name;
/**
* Title widget.
*
* @var string
*/
protected $title;
/**
* Page widget;
*
* @var string
*/
protected $page;
/**
* Class name widget.
*
* @var [type]
*/
protected $className;
/**
* Values options for each widget.
*
* @var [type]
*/
protected $values;
/**
* Configuration required.
*
* @var boolean
*/
protected $configurationRequired;
/**
* Error load widget.
*
* @var boolean
*/
protected $loadError;
/**
* Width.
*
* @var integer
*/
protected $width;
/**
* Heigth.
*
* @var integer
*/
protected $height;
/**
* Grid Width.
*
* @var integer
*/
protected $gridWidth;
/**
* Cell ID.
*
* @var integer
*/
protected $cellId;
/**
* Construct.
*
* @param integer $cellId Cell ID.
* @param integer $dashboardId Dashboard ID.
* @param integer $widgetId Widget ID.
* @param integer|null $width New width.
* @param integer|null $height New height.
* @param integer|null $gridWidth Grid width.
*/
public function __construct(
int $cellId,
int $dashboardId=0,
int $widgetId=0,
?int $width=0,
?int $height=0,
?int $gridWidth=0
) {
global $config;
// WARNING: Do not edit. This chunk must be in the constructor.
parent::__construct(
$cellId,
$dashboardId,
$widgetId
);
// Width.
$this->width = $width;
// Height.
$this->height = $height;
// Grid Width.
$this->gridWidth = $gridWidth;
// Cell Id.
$this->cellId = $cellId;
// Options.
$this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
// Page.
$this->page = basename(__FILE__);
// ClassName.
$class = new \ReflectionClass($this);
$this->className = $class->getShortName();
// Title.
$this->title = __('Pandora ITSM tickets');
// Name.
if (empty($this->name) === true) {
$this->name = 'ITSMIncidences';
}
// This forces at least a first configuration.
$this->configurationRequired = false;
if (isset($config['ITSM_enabled']) === false || (bool) $config['ITSM_enabled'] === false) {
$this->configurationRequired = true;
} else {
if (empty($this->values['customSearch']) === true || empty($this->values['fields']) === true) {
$this->configurationRequired = true;
}
}
$this->overflow_scrollbars = false;
}
/**
* Decoders hack for retrocompability.
*
* @param array $decoder Values.
*
* @return array Returns the values with the correct key.
*/
public function decoders(array $decoder): array
{
$values = [];
// Retrieve global - common inputs.
$values = parent::decoders($decoder);
if (isset($decoder['show_full_legend']) === true) {
$values['showLegend'] = $decoder['show_full_legend'];
}
if (isset($decoder['fields']) === true) {
if (is_array($decoder['fields']) === true) {
$decoder['fields'] = implode(',', $decoder['fields']);
}
$values['fields'] = $decoder['fields'];
}
if (isset($decoder['limit']) === true) {
$values['limit'] = $decoder['limit'];
}
if (isset($decoder['customSearch']) === true) {
$values['customSearch'] = $decoder['customSearch'];
}
return $values;
}
/**
* Generates inputs for form (specific).
*
* @return array Of inputs.
*
* @throws Exception On error.
*/
public function getFormInputs(): array
{
global $config;
$values = $this->values;
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
// Default values.
if (isset($values['fields']) === false) {
$values['fields'] = implode(
',',
[
'idIncidence',
'title',
'priority',
'idCreator',
]
);
}
if (isset($values['limit']) === false) {
$values['limit'] = $config['block_size'];
}
$inputs[] = [
'label' => __('Limit'),
'arguments' => [
'type' => 'number',
'name' => 'limit',
'value' => $values['limit'],
'return' => true,
'max' => 100,
'min' => 0,
],
];
$customSearches = [];
if (isset($config['ITSM_enabled']) === true && (bool) $config['ITSM_enabled'] === true) {
try {
$ITSM = new ITSM();
$customSearches = $ITSM->listCustomSearch();
} catch (\Throwable $th) {
$error = $th->getMessage();
}
}
$inputs[] = [
'label' => __('Custom search'),
'arguments' => [
'type' => 'select',
'fields' => $customSearches,
'name' => 'customSearch',
'selected' => $values['customSearch'],
'return' => true,
'sort' => false,
],
];
$fields = [
'idIncidence' => __('ID'),
'title' => __('Title'),
'groupCompany' => __('Group').'/'.__('Company'),
'statusResolution' => __('Status').'/'.__('Resolution'),
'priority' => __('Priority'),
'updateDate' => __('Updated'),
'startDate' => __('Started'),
'idCreator' => __('Creator'),
'owner' => __('Owner'),
];
$inputs[] = [
'label' => __('Fields to show'),
'arguments' => [
'type' => 'select',
'fields' => $fields,
'name' => 'fields[]',
'selected' => explode(',', $values['fields']),
'return' => true,
'multiple' => true,
'sort' => false,
],
];
return $inputs;
}
/**
* Get Post for widget.
*
* @return array
*/
public function getPost():array
{
// Retrieve global - common inputs.
$values = parent::getPost();
$values['fields'] = \get_parameter('fields', []);
$values['limit'] = \get_parameter('limit', 20);
$values['customSearch'] = \get_parameter('customSearch', 20);
return $values;
}
/**
* Draw widget.
*
* @return string;
*/
public function load()
{
global $config;
\ui_require_css_file('pandoraitsm', 'include/styles/', true);
$fields = [
'idIncidence' => __('ID'),
'title' => __('Title'),
'groupCompany' => __('Group').'/'.__('Company'),
'statusResolution' => __('Status').'/'.__('Resolution'),
'priority' => __('Priority'),
'updateDate' => __('Updated'),
'startDate' => __('Started'),
'idCreator' => __('Creator'),
'owner' => __('Owner'),
];
$fields_selected = explode(',', $this->values['fields']);
if (is_array($fields_selected) === false && empty($fields_selected) === true) {
$output = '';
$output .= '<div class="container-center">';
$output .= \ui_print_info_message(
__('Not found fields selected'),
'',
true
);
$output .= '</div>';
return $output;
}
$columns = $fields_selected;
$column_names = [];
foreach ($fields_selected as $field) {
$column_names[] = $fields[$field];
}
$tableId = 'ITSMIncidence_'.$this->dashboardId.'_'.$this->cellId;
try {
ui_print_datatable(
[
'id' => $tableId,
'class' => 'info_table table-widget-itsm',
'style' => 'width: 99%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'operation/ITSM/itsm',
'ajax_data' => [
'method' => 'getListTickets',
'customSearch' => $this->values['customSearch'],
],
'order' => [
'field' => 'updateDate',
'direction' => 'desc',
],
'csv' => 0,
'dom_elements' => 'frtip',
'default_pagination' => $this->values['limit'],
]
);
} catch (\Exception $e) {
echo $e->getMessage();
}
}
/**
* Get description.
*
* @return string.
*/
public static function getDescription()
{
return __('Pandora ITSM tickets');
}
/**
* Get Name.
*
* @return string.
*/
public static function getName()
{
return 'ITSMIncidences';
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 450,
'height' => 430,
];
return $size;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,612 @@
<?php
namespace PandoraFMS\ITSM;
/**
* Dashboard manager.
*/
class ITSM
{
/**
* User level conf.
*
* @var boolean
*/
private ?bool $userLevelConf;
/**
* User level conf.
*
* @var string
*/
private string $url;
/**
* Bearer.
*
* @var string
*/
private ?string $userBearer;
/**
* ITSM.
*
* @param string|null $host Host url.
* @param string|null $token Token.
*/
public function __construct(?string $host=null, ?string $token=null)
{
global $config;
$user_info = \users_get_user_by_id($config['id_user']);
$this->userLevelConf = (bool) $config['ITSM_user_level_conf'];
$this->url = ($host ?? $config['ITSM_hostname']);
$this->userBearer = ($token ?? $config['ITSM_token']);
if ($this->userLevelConf === true) {
$this->userBearer = ($token ?? $user_info['integria_user_level_pass']);
}
}
/**
* Call api ITSM.
*
* @param string $action Endpoint.
* @param array $queryParams Params send get.
* @param array $postFields Params send post.
* @param mixed $id Specific id for path.
* @param string|null $method Request method.
* @param array|null $file Upload file.
* @param boolean $download Download file.
*
* @return array Array result.
* @throws \Exception On error.
*/
public function callApi(
string $action,
?array $queryParams=null,
?array $postFields=null,
mixed $id=null,
?string $method='POST',
?array $file=null,
?bool $download=false
) {
$headers = [
'accept: application/json',
'Content-Type: application/json',
'Authorization: Bearer '.$this->userBearer,
];
$path = $this->pathAction($action, $queryParams, $id);
$url = $this->url.$path;
$data = [];
// Clean safe_input forms.
if (empty($postFields) === false) {
foreach ($postFields as $key => $field) {
if ($field !== null) {
$field = io_safe_output($field);
}
$data[$key] = $field;
}
}
if ($file !== null && file_exists($file['tmp_name']) === true) {
$data['attachment'] = curl_file_create(
$file['tmp_name'],
$file['type'],
$file['name']
);
$headers = [
'Content-Type: multipart/form-data',
'Authorization: Bearer '.$this->userBearer,
];
} else {
$data = json_encode($data);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$response = curl_exec($ch);
if ($download === true) {
return $response;
}
$result = json_decode($response, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \Exception(__('Invalid response').', '.$response);
}
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_status !== 200) {
throw new \Exception($result['error']);
}
return $result;
}
/**
* Convert path to endpoint ITSM.
*
* @param string $action EndPoint.
* @param array|null $queryParams Params to url.
* @param mixed $id Specific id for path.
*
* @return string Return path to Endpoint.
*/
private function pathAction(string $action, ?array $queryParams=null, mixed $id=null): string
{
$path = '';
switch ($action) {
case 'ping':
$path = '/ping';
break;
case 'listTickets':
$path = '/incidence/list';
break;
case 'listObjectTypes':
$path = '/incidencetype/list';
break;
case 'listGroups':
$path = '/group/list';
break;
case 'listResolutions':
$path = '/incidence/resolution/list';
break;
case 'listStatus':
$path = '/incidence/status/list';
break;
case 'listPriorities':
$path = '/incidence/priority/list';
break;
case 'listUsers':
$path = '/user/list';
break;
case 'listCompanies':
$path = '/company/list';
break;
case 'createIncidence':
$path = '/incidence';
break;
case 'updateIncidence':
$path = '/incidence/'.$id;
break;
case 'incidenceTypeFields':
$path = '/incidencetype/'.$id.'/field/list';
break;
case 'incidence':
$path = '/incidence/'.$id;
break;
case 'deleteIncidence':
$path = '/incidence/'.$id;
break;
case 'incidenceWus':
$path = '/incidence/'.$id.'/workunit/list';
break;
case 'incidenceFiles':
$path = '/incidence/'.$id.'/attachment/list';
break;
case 'createIncidenceAttachment':
$path = '/incidence/'.$id.'/attachment';
break;
case 'createIncidenceWu':
$path = '/incidence/'.$id.'/workunit';
break;
case 'deleteIncidenceAttachment':
$path = '/incidence/'.$id['idIncidence'].'/attachment/'.$id['idAttachment'];
break;
case 'downloadIncidenceAttachment':
$path = '/incidence/'.$id['idIncidence'].'/attachment/'.$id['idAttachment'].'/download';
break;
case 'getIncidencesGroupedByStatus':
$path = '/incidence/statistic/groupedByStatus';
break;
case 'getIncidencesGroupedByPriorities':
$path = '/incidence/statistic/groupedByPriorities';
break;
case 'getIncidencesGroupedByGroups':
$path = '/incidence/statistic/groupedByGroups';
break;
case 'getIncidencesGroupedByOwners':
$path = '/incidence/statistic/groupedByOwners';
break;
case 'listCustomSearch':
$path = '/customSearch/list';
break;
case 'customSearch':
$path = '/customSearch/'.$id;
break;
case 'inventory':
$path = '/inventory/'.$id;
break;
case 'createNode':
$path = '/pandorafms/nodes';
break;
case 'getNode':
$path = '/pandorafms/node/'.$id;
break;
case 'pingItsmToPandora':
$path = '/pandorafms/node/ping';
break;
default:
// Not posible.
break;
}
if (empty($queryParams) === false) {
if (isset($queryParams['field']) === true) {
$queryParams['sortField'] = $queryParams['field'];
unset($queryParams['field']);
}
if (isset($queryParams['direction']) === true) {
$queryParams['sortDirection'] = $queryParams['direction'];
unset($queryParams['direction']);
}
$path .= '?';
$path .= http_build_query($queryParams);
}
return $path;
}
/**
* Ping API.
*
* @return boolean Data incidence
*/
public function ping(): bool
{
$result = $this->callApi(
'ping',
[],
[],
null,
'GET'
);
return $result['valid'];
}
/**
* Get Groups.
*
* @return array Return mode select.
*/
public function getGroups(): array
{
$listGroups = $this->callApi('listGroups');
$result = [];
foreach ($listGroups['data'] as $group) {
if ($group['idGroup'] > 1) {
$result[$group['idGroup']] = $group['name'];
}
}
return $result;
}
/**
* Get Priorities.
*
* @return array Return mode select.
*/
public function getPriorities(): array
{
$listPriorities = $this->callApi('listPriorities');
return $listPriorities;
}
/**
* Get Status.
*
* @return array Return mode select.
*/
public function getStatus(): array
{
$listStatus = $this->callApi('listStatus');
$result = [];
foreach ($listStatus['data'] as $status) {
$result[$status['idIncidenceStatus']] = $status['name'];
}
return $result;
}
/**
* Get Incidences types.
*
* @return array Return mode select.
*/
public function getObjectypes(): array
{
$listObjectTypes = $this->callApi('listObjectTypes');
$result = [];
foreach ($listObjectTypes['data'] as $objectType) {
$result[$objectType['idIncidenceType']] = $objectType['name'];
}
return $result;
}
/**
* Get fields incidence type.
*
* @param integer $idIncidenceType Incidence Type ID.
*
* @return array Fields array.
*/
public function getObjecTypesFields(int $idIncidenceType): array
{
$result = $this->callApi(
'incidenceTypeFields',
[
'page' => 0,
'sizePage' => 0,
'field' => 'idIncidenceTypeField',
'direction' => 'ascending',
],
[],
$idIncidenceType
);
return $result['data'];
}
/**
* List custom search.
*
* @return array Result.
*/
public function listCustomSearch(): array
{
$listCustomSearch = $this->callApi(
'listCustomSearch',
[
'page' => 0,
'sizePage' => 0,
],
['section' => 'incidences']
);
$result = [];
foreach ($listCustomSearch['data'] as $customSearch) {
$result[$customSearch['idCustomSearch']] = $customSearch['name'];
}
return $result;
}
/**
* Get Custom search.
*
* @param integer $idCustomSearch Custom search ID.
*
* @return array Data custom search.
*/
public function getCustomSearch(int $idCustomSearch): array
{
$result = $this->callApi(
'customSearch',
[],
[],
$idCustomSearch,
'GET'
);
return $result;
}
/**
* List incidences.
*
* @param integer $idAgent Agent id.
*
* @return array list Incidences.
*/
public function listIncidenceAgents(int $idAgent, ?bool $blocked=null): array
{
global $config;
$listIncidences = $this->callApi(
'listTickets',
[
'page' => 0,
'sizePage' => 0,
],
[
'externalIdLike' => $config['metaconsole_node_id'].'-'.$idAgent,
'blocked' => $blocked,
]
);
return $listIncidences['data'];
}
/**
* Get table incicidences for agent.
*
* @param integer $idAgent Id agent.
* @param boolean|null $mini Visual mode mini.
* @param integer|null $blocked Blocked.
*
* @return string Html output.
*/
public function getTableIncidencesForAgent(int $idAgent, ?bool $mini=false, ?int $blocked=null)
{
\ui_require_css_file('pandoraitsm');
\ui_require_javascript_file('ITSM');
global $config;
$columns = [
'idIncidence',
'title',
'groupCompany',
'statusResolution',
'priority',
'updateDate',
'startDate',
'idCreator',
'owner',
];
$column_names = [
__('ID'),
__('Title'),
__('Group').'/'.__('Company'),
__('Status').'/'.__('Resolution'),
__('Priority'),
__('Updated'),
__('Started'),
__('Creator'),
__('Owner'),
];
$options = [
'id' => 'itms_list_tickets',
'class' => 'info_table',
'style' => 'width: 99%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'operation/ITSM/itsm',
'ajax_data' => [
'method' => 'getListTickets',
'externalIdLike' => $config['metaconsole_node_id'].'-'.$idAgent,
'blocked' => $blocked,
],
'no_sortable_columns' => [
2,
3,
-1,
],
'order' => [
'field' => 'updateDate',
'direction' => 'desc',
],
'return' => true,
];
if ($mini === true) {
$options['csv'] = 0;
$options['dom_elements'] = 'frtip';
}
return ui_print_datatable($options);
}
/**
* Create Node in pandora ITSM.
*
* @param array $data Info connect to node from ITSM.
*
* @return boolean
*/
public function createNode(array $data): array
{
return $this->callApi('createNode', null, $data);
}
/**
* Get info node sincronization.
*
* @param string $serverAuth Server Auth.
*
* @return array Array.
*/
public function getNode(string $serverAuth): array
{
$result = $this->callApi(
'getNode',
[],
[],
$serverAuth,
'GET'
);
return $result;
}
/**
* Ping Itsm to pandora node.
*
* @param string $path Path.
*
* @return boolean
*/
public function pingItsmtoPandora(string $path): bool
{
global $config;
$result = $this->callApi(
'pingItsmToPandora',
[],
[
'path' => $path,
'apiPass' => $config['api_password'],
'serverAuth' => $config['server_unique_identifier'],
]
);
return (bool) $result['valid'];
}
}

File diff suppressed because it is too large Load Diff

View File

@ -289,26 +289,6 @@ div#heatmap-controls div.heatmap-refr > div {
stroke-width: 0.04;
}
.small-size {
font-size: 1%;
}
.tiny-size {
font-size: 2%;
}
.medium-size {
font-size: 4%;
}
.big-size {
font-size: 6%;
}
.huge-size {
font-size: 8%;
}
.progress_main {
height: 2.5em;
border: 2px solid #82b92e;

View File

@ -264,6 +264,12 @@
background-size: 18px;
}
/* ITSM */
.icon_oper-itsm {
background: url(../../images/menu/itsm.svg) no-repeat 50% 50%;
background-size: 18px;
}
/* trap console */
.icon_oper-snmpc,
.icon_god-snmpc {

View File

@ -8612,7 +8612,7 @@ div.graph div.legend table {
padding: 5px;
}
.integria_title .ehorus_title {
.ITSM_title .ehorus_title {
color: #515151;
}
@ -12636,6 +12636,10 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input {
background-color: #81b92e3b !important;
}
.ui-datepicker-title > span {
color: #82b92e !important;
}
.div-report_export_filter {
left: 0em;
top: 0em;

View File

@ -1013,7 +1013,7 @@ div#dashboard-controls {
color: #fff;
}
.integria_details_shadow {
.ITSM_details_shadow {
background-color: #222;
border-bottom: 1px solid #e2e2e2;
border-left: 1px solid #e2e2e2;
@ -1022,7 +1022,7 @@ div#dashboard-controls {
border-top-right-radius: 5px;
}
div.integria_details_description textarea {
div.ITSM_details_description textarea {
width: 100%;
background-color: #111;
color: #fff;

View File

@ -1,31 +1,30 @@
/* --- Integria IMS --- */
div.priority {
width: 80px;
color: #fff;
text-align: center;
border-radius: 5px;
padding: 5px;
padding: 0px;
display: table-cell;
vertical-align: middle;
}
/* Details view */
div.integria_details {
div.ITSM_details {
display: grid;
grid-column-gap: 10px;
grid-template-columns: repeat(3, minmax(min-content, auto));
grid-auto-rows: 1fr;
}
div.integria_details div.box-shadow.white_table_graph {
div.ITSM_details div.box-shadow.white_table_graph {
box-shadow: none;
}
div.integria_details div.priority {
div.ITSM_details div.priority {
display: inline-block;
}
div.integriaims_details_row {
div.pandoraitsm_details_row {
display: grid;
grid-gap: 10px;
text-align: center;
@ -33,30 +32,25 @@ div.integriaims_details_row {
margin-bottom: 8px;
}
div.integriaims_details_titles {
div.pandoraitsm_details_titles {
font-weight: bold;
}
div.integria_details_row_five {
div.ITSM_details_row_five {
grid-template-columns: repeat(5, 1fr);
}
div.integria_details_row_three {
div.ITSM_details_row_three {
grid-template-columns: repeat(3, 1fr);
}
div.integria_details_description {
div.ITSM_details_description {
width: 100%;
overflow: auto;
padding: 0px 10px;
}
div.integria_details_description textarea {
width: 100%;
background-color: #fbfbfb;
resize: vertical;
color: #000;
}
.integriaims_details_box {
.pandoraitsm_details_box {
display: grid;
grid-column-gap: 10px;
grid-row-gap: 5px;
@ -65,18 +59,18 @@ div.integria_details_description textarea {
text-align: center;
}
.integriaims_details_box_five {
.pandoraitsm_details_box_five {
grid-template-rows: repeat(3, 1fr);
grid-template-columns: repeat(5, 1fr);
}
.integriaims_details_box_three {
.pandoraitsm_details_box_three {
grid-template-rows: repeat(3, 1fr);
grid-template-columns: repeat(3, 1fr);
}
/* ui_toggles */
.integria_details_shadow {
.ITSM_details_shadow {
background-color: #fff;
border-bottom: 1px solid #e2e2e2;
border-left: 1px solid #e2e2e2;
@ -85,35 +79,17 @@ div.integria_details_description textarea {
border-top-right-radius: 5px;
}
.integria_details_shadow .white_table_graph_header {
.ITSM_details_shadow .white_table_graph_header {
border-left: none;
border-right: none;
}
.integria_details_content {
.ITSM_details_content {
border-bottom: none;
border-left: none;
border-right: none;
}
/* Inputs type text shown as a black line */
.integria_incidents_options input[type="text"] {
background-color: transparent;
border: none;
border-radius: 0;
border-bottom: 1px solid #ccc;
font-size: 10pt;
padding: 2px 5px;
box-sizing: border-box;
background-repeat: no-repeat;
background-position: left bottom 2px;
margin-bottom: 4px;
}
.integria_incident_options input[readonly] {
color: #848484;
}
.comment_title {
padding: 5px 10px 5px 20px;
background-color: rgba(130, 185, 46, 0.16);
@ -123,3 +99,46 @@ div.integria_details_description textarea {
.comment_body {
padding: 15px 20px 15px 20px;
}
/*---*/
div.incidence-type-custom-fields {
display: flex;
flex-direction: row;
justify-content: center;
align-items: baseline;
flex-wrap: wrap;
}
.incidence-type-custom-fields > div {
flex: 1 1 45%;
display: flex;
margin: 0px 20px;
flex-direction: column;
}
.incidence-type-custom-fields > div.incidence-type-custom-fields-textarea {
flex: 1 1 100%;
}
.label_select,
.label_select_simple {
display: flex;
flex-direction: column;
margin: 0;
}
div.container-statistics {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
div.container-statistics > div {
flex: 1 1 45%;
max-width: 46%;
margin: 1%;
}
table.table-widget-itsm tr > td {
text-align: left;
}

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'>
<?php
$version = '7.0NG.773.3';
$build = '230927';
$build = '231006';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -0,0 +1,73 @@
<?php
/**
* ITSM.
*
* @category ITSM
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
require $config['homedir'].'/vendor/autoload.php';
use PandoraFMS\ITSM\Manager;
if ((bool) is_metaconsole() === true) {
ui_require_css_file('meta_dashboards');
}
$ajaxPage = 'operation/ITSM/itsm';
// Control call flow.
try {
// User access and validation is being processed on class constructor.
$cs = new Manager($ajaxPage);
} catch (Exception $e) {
if (is_ajax() === true) {
echo json_encode(['error' => '[ITSM]'.$e->getMessage() ]);
} else {
echo '[ITSM]'.$e->getMessage();
}
// Stop this execution, but continue 'globally'.
return;
}
// AJAX controller.
if (is_ajax() === true) {
$method = get_parameter('method');
if (method_exists($cs, $method) === true) {
if ($cs->ajaxMethod($method) === true) {
$cs->{$method}();
} else {
$cs->error('Unavailable method.');
}
} else {
$cs->error('Method not found. ['.$method.']');
}
} else {
// Run.
$cs->run();
}

View File

@ -169,6 +169,8 @@ $refr = get_parameter('refr', 0);
$recursion = get_parameter('recursion', 0);
$status = (int) get_parameter('status', -1);
$os = (int) get_parameter('os', 0);
$os_version_regex = trim(get_parameter('os_version_regex', ''));
$os_type_regex = trim(get_parameter('os_type_regex', ''));
$policies = (array) get_parameter('policies', []);
$ag_custom_fields = (array) get_parameter('ag_custom_fields', []);
@ -181,6 +183,10 @@ $onheader = [];
$load_filter_id = (int) get_parameter('filter_id', 0);
if (empty($os_type_regex) !== true) {
$os = (int) db_get_value_sql('SELECT id_os FROM tconfig_os WHERE `name` REGEXP "'.$os_type_regex.'"');
}
if ($load_filter_id > 0) {
$user_groups_fl = users_get_groups(
$config['id_user'],
@ -402,6 +408,18 @@ $table->data[1][0] = html_print_label_input_block(
html_print_select($fields, 'os', $os, '', 'All', 0, true)
);
$table->data[1][1] = html_print_label_input_block(
__('Operating System version').ui_print_help_tip(__('Case insensitive regular expression, e.g. Rocky.* will match the following OS version: Rocky Linux 8.7'), true),
html_print_input_text(
'os_version_regex',
$os_version_regex,
'',
35,
255,
true
)
);
if (function_exists('policies_get_policies') === true) {
$pre_fields = policies_get_policies(false, ['id', 'name']);
$fields = [];
@ -410,7 +428,7 @@ if (function_exists('policies_get_policies') === true) {
}
}
$table->data[1][1] = html_print_label_input_block(
$table->data[2][0] = html_print_label_input_block(
__('Policies'),
html_print_select($fields, 'policies[]', $policies, '', 'All', 0, true, true)
);
@ -452,8 +470,8 @@ foreach ($custom_fields as $custom_field) {
$div_custom_fields .= '</div></div>';
}
$table->colspan[2][0] = 2;
$table->data[2][0] = ui_toggle(
$table->colspan[3][0] = 2;
$table->data[3][0] = ui_toggle(
$div_custom_fields,
__('Agent custom fields'),
'',
@ -881,6 +899,10 @@ if ($os > 0) {
$id_os_sql = ' AND id_os = '.$os;
}
if ($os_version_regex !== '') {
$id_os_sql .= ' AND os_version REGEXP \''.$os_version_regex.'\'';
}
if ($all_policies === false && is_array($policies) && count($policies) > 0) {
$policies_sql = ' AND tpolicy_agents.id_policy IN ('.implode(',', $policies).')';
}

View File

@ -26,15 +26,15 @@
* ============================================================================
*/
use PandoraFMS\ITSM\ITSM;
// Begin.
global $config;
require_once 'include/functions_agents.php';
require_once $config['homedir'].'/include/functions_graph.php';
require_once $config['homedir'].'/include/functions_groups.php';
require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_incidents.php';
require_once $config['homedir'].'/include/functions_reporting_html.php';
require_once $config['homedir'].'/include/functions_clippy.php';
@ -361,44 +361,6 @@ if ((bool) $config['agentaccess'] === true && $access_agent > 0) {
* END: ACCESS RATE GRAPH
*/
/*
* START: TABLE INCIDENTS
*/
$last_incident = db_get_row_sql(
sprintf(
'SELECT * FROM tincidencia
WHERE estado IN (0,1)
AND id_agent = %d
ORDER BY actualizacion DESC',
$id_agente
)
);
if ($last_incident != false) {
$table_incident = new stdClass();
$table_incident->id = 'agent_incident_main';
$table_incident->width = '100%';
$table_incident->cellspacing = 0;
$table_incident->cellpadding = 0;
$table_incident->class = 'info_table tactical_table';
$table_incident->head[0] = '<span>'.__('Author').'</span>';
$table_incident->head[1] = '<span>'.__('Title').'</span>';
$table_incident->head[2] = '<span>'.__('Timestamp').'</span>';
$table_incident->head[3] = '<span>'.__('Priority').'</span>';
$data = [];
$data[0] = $last_incident['id_creator'];
$data[1] = '<a href="index.php?sec=incidencias&amp;sec2=operation/incidents/incident_detail&amp;id='.$last_incident['id_incidencia'].'">'.$last_incident['titulo'].'</a>';
$data[2] = $last_incident['inicio'];
$data[3] = incidents_print_priority_img($last_incident['prioridad'], true);
$table_incident->data[] = $data;
}
/*
* END: TABLE INCIDENTS
*/
/*
* START: TABLE INTERFACES
@ -649,6 +611,46 @@ if (empty($agentAdditionalInfo) === false) {
);
}
if ((bool) $config['ITSM_enabled'] === true) {
$show_tab_issue = false;
try {
$ITSM = new ITSM();
$list = $ITSM->listIncidenceAgents($id_agente, false);
if (empty($list) === false) {
$show_tab_issue = true;
}
} catch (\Throwable $th) {
$show_tab_issue = false;
}
if ($show_tab_issue === true) {
try {
$table_itsm = $ITSM->getTableIncidencesForAgent($id_agente, true, 0);
} catch (Exception $e) {
$table_itsm = $e->getMessage();
}
$itsmInfo = ui_toggle(
$table_itsm,
'<span class="subsection_header_title">'.__('Incidences').'</span>',
'status_monitor_agent',
false,
false,
true,
'',
'white-box-content',
'box-flat white_table_graph w100p'
);
html_print_div(
[
'class' => 'agent_details_line',
'content' => $itsmInfo,
]
);
}
}
if (empty($agentIncidents) === false) {
html_print_div(
[
@ -668,19 +670,6 @@ if (empty($agentIncidents) === false) {
);
}
/*
// Show both graphs, events and access rate.
if ($table_access_rate) {
echo '<div class="agent_access_rate_events agent_details_line">'.$table_access_rate.$table_events.'</div>';
} else {
echo '<div class="w100p">'.$table_events.'</div>';
}
echo $agent_incidents;
*/
if (isset($table_interface) === true) {
ui_toggle(
html_print_table($table_interface, true),

View File

@ -27,6 +27,7 @@
*/
use PandoraFMS\Enterprise\Metaconsole\Node;
use PandoraFMS\ITSM\ITSM;
global $config;
@ -1655,18 +1656,30 @@ if ((bool) $config['activate_gis'] === true) {
}
// Incident tab.
$total_incidents = agents_get_count_incidents($id_agente);
if ($total_incidents > 0) {
$incidenttab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&tab=incident&id_agente='.$id_agente,
'image' => 'images/logs@svg.svg',
'title' => __('Incidents'),
],
true
);
if ((bool) $config['ITSM_enabled'] === true) {
$show_tab_issue = false;
try {
$ITSM = new ITSM();
$list = $ITSM->listIncidenceAgents($id_agente);
if (empty($list) === false) {
$show_tab_issue = true;
}
} catch (\Throwable $th) {
$show_tab_issue = false;
}
$incidenttab['active'] = ($tab === 'incident');
if ($show_tab_issue === true) {
$incidenttab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&tab=incident&id_agente='.$id_agente,
'image' => 'images/logs@svg.svg',
'title' => __('Incidents'),
],
true
);
$incidenttab['active'] = ($tab === 'incident');
}
}
// Url address tab.
@ -1743,7 +1756,7 @@ if ((bool) $config['ehorus_enabled'] === true && empty($config['ehorus_custom_fi
if (empty($ehorus_agent_id) === false) {
$tab_url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=ehorus&id_agente='.$id_agente;
$ehorus_tab['text'] = '<a href="'.$tab_url.'" class="ehorus_tab">'.html_print_image(
'images/ehorus/ehorus.png',
'images/RC.png',
true,
[
'title' => __('eHorus'),

View File

@ -511,12 +511,14 @@ if (is_ajax() === true) {
);
}
$tmp->evento = str_replace('"', '', io_safe_output($tmp->evento));
$event_text = $tmp->evento;
$output_event_name = str_replace('"', '', io_safe_output($tmp->evento));
$tmp->event_title = $output_event_name;
$tmp->b64 = base64_encode(json_encode($tmp));
$tmp->evento = $output_event_name;
$tmp->evento = ui_print_truncate_text(
$tmp->evento,
$config['item_title_size_text'],
'description',
false,
true,
false,
@ -623,7 +625,7 @@ if (is_ajax() === true) {
$total_sec = strtotime($tmp->timestamp);
$total_sec += $dif;
$last_contact = date($confb64ig['date_format'], $total_sec);
$last_contact = date($config['date_format'], $total_sec);
$last_contact_value = ui_print_timestamp($last_contact, true);
} else {
$title = date($config['date_format'], strtotime($tmp->timestamp));
@ -662,11 +664,6 @@ if (is_ajax() === true) {
);
}
$aux_event = $tmp->evento;
$tmp->evento = $event_text;
$tmp->b64 = base64_encode(json_encode($tmp));
$tmp->evento = $aux_event;
$tmp->user_comment = ui_print_comments(
event_get_last_comment(
$item,

View File

@ -1,454 +0,0 @@
<?php
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login();
require_once $config['homedir'].'/include/functions_integriaims.php';
$update = (isset($_GET['incident_id']) === true);
// Header tabs.
$onheader = integriaims_tabs('create_tab', $_GET['incident_id']);
if ($update) {
$title_header = __('Update Integria IMS Ticket');
} else {
$title_header = __('Create Integria IMS Ticket');
}
ui_print_standard_header(
$title_header,
'',
false,
'',
false,
$onheader,
[
[
'link' => '',
'label' => __('Issues'),
],
[
'link' => '',
'label' => $title_header,
],
]
);
// Check if Integria integration enabled.
if ($config['integria_enabled'] == 0) {
ui_print_error_message(__('In order to access ticket management system, integration with Integria IMS must be enabled and properly configured'));
return;
}
// Check connection to Integria IMS API.
$has_connection = integria_api_call(null, null, null, null, 'get_login');
if ($has_connection === false) {
ui_print_error_message(__('Integria IMS API is not reachable'));
return;
}
// Styles.
ui_require_css_file('integriaims');
// If everything OK, get parameters from Integria IMS API in order to populate combos.
$integria_group_values = [];
$integria_criticity_values = [];
$integria_users_values = [];
$integria_types_values = [];
$integria_status_values = [];
$integria_groups_csv = integria_api_call(null, null, null, null, 'get_groups');
get_array_from_csv_data_pair($integria_groups_csv, $integria_group_values);
$integria_status_csv = integria_api_call(null, null, null, null, 'get_incidents_status');
get_array_from_csv_data_pair($integria_status_csv, $integria_status_values);
$integria_criticity_levels_csv = integria_api_call(null, null, null, null, 'get_incident_priorities');
get_array_from_csv_data_pair($integria_criticity_levels_csv, $integria_criticity_values);
$integria_users_csv = integria_api_call(null, null, null, null, 'get_users');
$csv_array = explode("\n", $integria_users_csv);
foreach ($csv_array as $csv_line) {
if (!empty($csv_line)) {
$integria_users_values[$csv_line] = $csv_line;
}
}
$integria_types_csv = integria_api_call(null, null, null, null, 'get_types');
get_array_from_csv_data_pair($integria_types_csv, $integria_types_values);
$integria_resolution_csv = integria_api_call(null, null, null, null, 'get_incidents_resolutions');
get_array_from_csv_data_pair($integria_resolution_csv, $integria_resolution_values);
$event_id = (int) get_parameter('from_event');
$incident_id_edit = (int) get_parameter('incident_id');
$create_incident = (bool) get_parameter('create_incident', 0);
$update_incident = (bool) get_parameter('update_incident', 0);
$incident_group_id = (int) get_parameter('group');
$incident_criticity_id = (int) get_parameter('criticity');
$incident_owner = get_parameter('owner');
$incident_type = (int) get_parameter('type');
$incident_creator = get_parameter('creator');
$incident_status = (int) get_parameter('status');
$incident_resolution = (int) get_parameter('resolution');
$incident_title = events_get_field_value_by_event_id($event_id, get_parameter('incident_title'));
$incident_content = events_get_field_value_by_event_id($event_id, get_parameter('incident_content'));
$file_description = get_parameter('file_description');
// Separator conversions.
$incident_title = str_replace(',', ':::', $incident_title);
$incident_content = str_replace(',', ':::', $incident_content);
// Perform action.
if ($create_incident === true) {
// Disregard incident resolution unless status is 'closed'.
if ($incident_status !== 7) {
$incident_resolution = 0;
}
// Call Integria IMS API method to create an incident.
$result_api_call = integria_api_call(null, null, null, null, 'create_incident', [$incident_title, $incident_group_id, $incident_criticity_id, $incident_content, '', $incident_type, '', $incident_owner, '0', $incident_status, '', $incident_resolution], false, '', ',');
if ($userfile !== '' && $result_api_call !== false) {
integriaims_upload_file('userfile', $result_api_call, $file_description);
}
// Necessary to explicitly set true if not false because function returns result of api call in case of success instead of true value.
$incident_created_ok = ($result_api_call != false) ? true : false;
ui_print_result_message(
$incident_created_ok,
__('Successfully created in Integria IMS'),
__('Could not be created in Integria IMS')
);
} else if ($update_incident === true) {
// Disregard incident resolution unless status is 'closed'.
if ($incident_status !== 7) {
$incident_resolution = 0;
}
// Call Integria IMS API method to update an incident.
$result_api_call = integria_api_call(null, null, null, null, 'update_incident', [$incident_id_edit, $incident_title, $incident_content, '', $incident_group_id, $incident_criticity_id, $incident_resolution, $incident_status, $incident_owner, 0, $incident_type], false, '', ',');
if ($userfile !== '') {
integriaims_upload_file('userfile', $incident_id_edit, $file_description);
}
// Necessary to explicitly set true if not false because function returns api call result in case of success instead of true value.
$incident_updated_ok = ($result_api_call != false) ? true : false;
ui_print_result_message(
$incident_updated_ok,
__('Successfully updated in Integria IMS'),
__('Could not be updated in Integria IMS')
);
}
// If incident id is specified, retrieve incident values from api to populate combos with such values.
if ($update) {
// Call Integria IMS API method to get details of an incident given its id.
$result_api_call = integria_api_call(null, null, null, null, 'get_incident_details', [$incident_id_edit], false, '', ',');
// API call does not return indexes, therefore future modifications of API function in Integria IMS may lead to inconsistencies when accessing resulting array in this file.
$incident_details_separator = explode(',', $result_api_call);
$incident_details = array_map(
function ($item) {
return str_replace(':::', ',', $item);
},
$incident_details_separator
);
}
// Main table.
$table = new stdClass();
$table->width = '100%';
$table->id = 'add_alert_table';
$table->class = 'databox filter-table-adv';
$table->head = [];
$table->data = [];
$table->size = [];
$table->size = [];
$table->colspan[0][0] = 2;
$table->colspan[4][0] = 3;
$table->colspan[6][0] = 3;
$help_macros = isset($_GET['from_event']) ? ui_print_help_icon('response_macros', true) : '';
if ($update) {
$input_value_title = $incident_details[3];
$input_value_type = $incident_details[17];
$input_value_status = $incident_details[6];
$input_value_group = $incident_details[8];
$input_value_criticity = $incident_details[7];
$input_value_owner = $incident_details[5];
$input_value_content = $incident_details[4];
$input_value_resolution = $incident_details[12];
} else if (isset($_GET['from_event'])) {
$input_value_title = $config['cr_incident_title'];
$input_value_type = $config['cr_incident_type'];
$input_value_status = $config['cr_incident_status'];
$input_value_group = $config['cr_default_group'];
$input_value_criticity = $config['cr_default_criticity'];
$input_value_owner = $config['cr_default_owner'];
$input_value_content = $config['cr_incident_content'];
$input_value_resolution = 0;
} else {
$input_value_title = '';
$input_value_type = '';
$input_value_status = '';
$input_value_group = '';
$input_value_criticity = '';
$input_value_owner = '';
$input_value_content = '';
$input_value_resolution = 0;
}
$table->data[0][0] = html_print_label_input_block(
__('Title').$help_macros,
html_print_input_text(
'incident_title',
$input_value_title,
__('Name'),
50,
100,
true,
false,
true,
'',
'w100p'
)
);
$integria_logo = 'images/integria_logo_gray.png';
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$integria_logo = 'images/integria_logo.svg';
}
$table->data[0][2] = html_print_image($integria_logo, true, ['style' => 'width: 30%; float: right;'], false);
$table->data[1][0] = html_print_label_input_block(
__('Type'),
html_print_select(
$integria_types_values,
'type',
$input_value_type,
'',
__('Select'),
0,
true,
false,
true,
'',
false,
'width: 100%;'
)
);
$table->data[1][1] = html_print_label_input_block(
__('Group'),
html_print_select(
$integria_group_values,
'group',
$input_value_group,
'',
'',
0,
true,
false,
true,
'',
false,
'width: 100%;'
)
);
$table->data[1][2] = html_print_label_input_block(
__('Priority'),
html_print_select(
$integria_criticity_values,
'criticity',
$input_value_criticity,
'',
__('Select'),
0,
true,
false,
true,
'',
false,
'width: 100%;'
)
);
$table->data[2][0] = html_print_label_input_block(
__('Status'),
html_print_select(
$integria_status_values,
'status',
$input_value_status,
'',
__('Select'),
1,
true,
false,
true,
'',
false,
'width: 100%;'
)
);
$table->data[2][1] = html_print_label_input_block(
__('Creator').ui_print_help_tip(__('This field corresponds to the Integria IMS user specified in Integria IMS setup'), true),
html_print_input_text(
'creator',
$config['integria_user'],
'',
'30',
100,
true,
true,
false,
'',
'w100p'
)
);
$table->data[2][2] = html_print_label_input_block(
__('Owner'),
html_print_autocomplete_users_from_integria(
'owner',
$input_value_owner,
true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
);
$table->data[3][0] = html_print_label_input_block(
__('Resolution'),
html_print_select(
$integria_resolution_values,
'resolution',
$input_value_resolution,
'',
'',
1,
true,
false,
true,
'',
false,
'width: 100%;'
)
);
$table->data[4][0] = html_print_label_input_block(
__('Description').$help_macros,
html_print_textarea(
'incident_content',
3,
20,
$input_value_content,
'',
true
)
);
$table->data[5][0] = html_print_label_input_block(
__('File name'),
html_print_input_file('userfile', true)
);
$table->data[6][0] = html_print_label_input_block(
__('Attachment description'),
html_print_textarea(
'file_description',
3,
20,
'',
'',
true
)
);
// Print forms and stuff.
echo '<form class="max_floating_element_size" id="create_integria_incident_form" name="create_integria_incident_form" method="POST" enctype="multipart/form-data">';
html_print_table($table);
$buttons = '';
if (!$update) {
$buttons .= html_print_input_hidden('create_incident', 1, true);
$buttons .= html_print_submit_button(
__('Create'),
'accion',
false,
[ 'icon' => 'next' ],
true
);
} else {
$buttons .= html_print_input_hidden('update_incident', 1, true);
$buttons .= html_print_submit_button(
__('Update'),
'accion',
false,
[ 'icon' => 'upd' ],
true
);
}
html_print_action_buttons($buttons);
echo '</form>';
?>
<script type="text/javascript">
$(document).ready(function () {
$('#add_alert_table-3').hide();
var input_value_status =
<?php
$status_value = ($input_value_status === '') ? 0 : $input_value_status;
echo $status_value;
?>
;
if (input_value_status === 7) {
$('#add_alert_table-3').show();
} else {
$('#add_alert_table-3').hide();
}
$('#status').on('change', function() {
if ($(this).val() === '7') {
$('#add_alert_table-3').show();
} else {
$('#add_alert_table-3').hide();
}
});
});
</script>

View File

@ -1,451 +0,0 @@
<?php
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
require_once 'include/functions_integriaims.php';
check_login();
// Check if Integria integration enabled.
if ($config['integria_enabled'] == 0) {
ui_print_error_message(__('In order to access ticket management system, integration with Integria IMS must be enabled and properly configured'));
return;
}
// Check connection to Integria IMS API.
$has_connection = integria_api_call(null, null, null, null, 'get_login', []);
if ($has_connection === false) {
ui_print_error_message(__('Integria IMS API is not reachable'));
return;
}
// Styles.
ui_require_css_file('integriaims');
// Get id incident.
$incident_id = (int) get_parameter('incident_id');
// API call.
$result_api_call_list = integria_api_call(
null,
null,
null,
null,
'get_incident_details',
[$incident_id]
);
// Return array of api call 'get_incidents'.
$array_get_incidents = [];
get_array_from_csv_data_all($result_api_call_list, $array_get_incidents);
// Remove index (id).
$array_get_incidents = $array_get_incidents[$incident_id];
// Header tabs.
$onheader = integriaims_tabs(false, $incident_id);
ui_print_standard_header(
$array_get_incidents[3],
'',
false,
'',
false,
$onheader,
[
[
'link' => '',
'label' => __('Issues'),
],
[
'link' => '',
'label' => __('Details'),
],
]
);
// Data.
$status = $array_get_incidents[6];
$resolution = $array_get_incidents[12];
$group = $array_get_incidents[8];
$priority = $array_get_incidents[7];
$type = $array_get_incidents[17];
$description = $array_get_incidents[4];
$creator = $array_get_incidents[10];
$owner = $array_get_incidents[5];
$closed_by = $array_get_incidents[23];
$created_at = $array_get_incidents[1];
$updated_at = $array_get_incidents[9];
$closed_at = $array_get_incidents[2];
if ($closed_at == '0000-00-00 00:00:00') {
$closed_at = __('Not yet');
}
if ($closed_by == '') {
$closed_by = __('Not closed yet');
}
// API calls.
$status_text = integriaims_get_details('status', $status);
$group_text = integriaims_get_details('group', $group);
$priority_text = integriaims_get_details('priority', $priority);
$resolution_text = integriaims_get_details('resolution', $resolution);
$type_text = integriaims_get_details('type', $type);
// Incident file management.
$upload_file = (bool) get_parameter('upload_file');
$delete_file_id = get_parameter('delete_file');
$download_file_id = get_parameter('download_file');
$download_file_name = get_parameter('download_file_name');
// Files section table.
$table_files_section = new stdClass();
$table_files_section->width = '100%';
$table_files_section->id = 'files_section_table';
$table_files_section->class = 'databox filters';
$table_files_section->head = [];
$table_files_section->data = [];
$table_files_section->size = [];
$table_files_section->colspan[2][0] = 3;
// Files list table.
$table_files = new stdClass();
$table_files->width = '100%';
$table_files->class = 'info_table';
$table_files->head = [];
$table_files->head[0] = __('Filename');
$table_files->head[1] = __('Timestamp');
$table_files->head[2] = __('Description');
$table_files->head[3] = __('User');
$table_files->head[4] = __('Size');
$table_files->head[5] = __('Delete');
$table_files->data = [];
$filedescription = get_parameter('file_description', __('No description available'));
if ($upload_file === true) {
integriaims_upload_file('userfile', $incident_id, $filedescription);
}
// Delete file.
if (isset($_GET['delete_file'])) {
$result_api_call = integria_api_call(null, null, null, null, 'delete_file', [$delete_file_id]);
$file_deleted = false;
if ($result_api_call === '0') {
$file_deleted = true;
}
ui_print_result_message(
$file_deleted,
__('File successfully deleted'),
__('File could not be deleted')
);
}
// Download file.
if (isset($_GET['download_file'])) {
$file_base64 = integria_api_call(null, null, null, null, 'download_file', [$download_file_id]);
ob_end_clean();
$decoded = base64_decode($file_base64);
file_put_contents($download_file_name, $decoded);
ob_end_clean();
if (file_exists($download_file_name)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($download_file_name).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: '.filesize($download_file_name));
ob_end_clean();
readfile($download_file_name);
unlink($download_file_name);
exit;
}
header('Location: index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$incident_id);
}
// Retrieve files belonging to incident and create list table.
$result_api_call = integria_api_call(null, null, null, null, 'get_incident_files', [$incident_id]);
if ($result_api_call != false && strlen($result_api_call) > 0) {
$files = [];
$csv_array = explode("\n", $result_api_call);
foreach ($csv_array as $csv_line) {
if (!empty($csv_line)) {
$files[] = explode(',', $csv_line);
}
}
}
$i = 0;
foreach ($files as $key => $value) {
$table_files->data[$i][0] = '<a id="link_delete_file" href="'.ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$incident_id.'&download_file='.$value[0]).'&download_file_name='.$value[11].'">'.$value[11].'</a>';
$table_files->data[$i][1] = $value[14];
$table_files->data[$i][2] = $value[12];
$table_files->data[$i][3] = $value[8];
$table_files->data[$i][4] = $value[13];
$table_files->data[$i][5] .= '<a id="link_delete_file" href="'.ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$incident_id.'&delete_file='.$value[0]).'"
onClick="javascript:if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$table_files->data[$i][5] .= html_print_image('images/delete.svg', true, ['title' => __('Delete'), 'class' => 'invert_filter']);
$table_files->data[$i][5] .= '</a>';
$i++;
}
$table_files_section->data[0][0] = '<div class="label_select"><p class="input_label">'.__('File name').':</p>';
$table_files_section->data[0][0] .= html_print_input_file('userfile', true);
$table_files_section->data[1][0] = '<div class="label_select"><p class="input_label">'.__('Attachment description').':</p>';
$table_files_section->data[1][0] .= html_print_textarea(
'file_description',
3,
20,
'',
'',
true
);
$table_files_section->data[2][0] .= '<div class="w100p right">'.html_print_submit_button(__('Upload'), 'accion', false, ['icon' => 'wand', 'mode' => 'mini secondary'], true).'</div>';
$upload_file_form = '<div class="w100p">';
$upload_file_form .= '<form method="post" id="file_control" enctype="multipart/form-data">'.'<h4>'.__('Add attachment').'</h4>'.html_print_table($table_files_section, true).html_print_input_hidden('upload_file', true, true);
$upload_file_form .= '<h4>'.__('Attached files').'</h4>'.html_print_table($table_files, true).'</form></div>';
// Incident comments management.
$upload_comment = get_parameter('upload_comment');
$comment_description = get_parameter('comment_description');
// Comments section table.
$table_comments_section = new stdClass();
$table_comments_section->width = '100%';
$table_comments_section->id = 'files_section_table';
$table_comments_section->class = 'databox filters';
$table_comments_section->head = [];
$table_comments_section->data = [];
$table_comments_section->size = [];
// Comments list table.
$table_comments = new stdClass();
$table_comments->width = '100%';
$table_comments->class = 'info_table';
$table_comments->head = [];
$table_comments->head[0] = __('Filename');
$table_comments->head[1] = __('Timestamp');
$table_comments->head[2] = __('Description');
$table_comments->head[3] = __('User');
$table_comments->head[4] = __('Size');
$table_comments->head[5] = __('Delete');
$table_comments->data = [];
$comment_disabled = ($array_get_incidents[6] == 7);
if ($comment_disabled === true) {
$attribute = 'disabled=disabled';
}
$table_comments_section->data[0][0] = '<div class="label_select"><p class="input_label">'.__('Description').':</p>';
$table_comments_section->data[0][0] .= html_print_textarea(
'comment_description',
3,
20,
'',
$attribute,
true
);
$table_comments_section->data[1][1] .= '<div class="w100p right">'.html_print_submit_button(__('Add'), 'accion', $comment_disabled, ['icon' => 'wand', 'mode' => 'mini secondary'], true).'</div>';
// Upload comment. If ticket is closed, this action cannot be performed.
if ($upload_comment && $array_get_incidents[6] != 7) {
$result_api_call = integria_api_call(null, null, null, null, 'create_workunit', [$incident_id, $comment_description, '0.00', 0, 1, '0'], false, '', '|;|');
// API method returns id of new comment if success.
$comment_added = ($result_api_call >= '0') ? true : false;
ui_print_result_message(
$comment_added,
__('Comment successfully added'),
__('Comment could not be added')
);
}
// Retrieve comments belonging to incident and create comments table.
$result_api_call = integria_api_call(null, null, null, null, 'get_incident_workunits', [$incident_id]);
if ($result_api_call != false && strlen($result_api_call) > 0) {
$comments = [];
$csv_array = explode("\n", $result_api_call);
foreach ($csv_array as $csv_line) {
if (!empty($csv_line)) {
$comments[] = explode(',', $csv_line);
}
}
}
$comment_table = '';
if (!empty($comments)) {
foreach ($comments as $key => $value) {
$comment_table .= '<div class="comment_title">'.$value[3].'<span>&nbspsaid&nbsp</span>'.$value[1].'<span class="float-right">'.$value[2].'&nbspHours</span></div>';
$comment_table .= '<div class="comment_body">'.$value[4].'</div>';
}
} else {
$comment_table = __('No comments found');
}
$upload_comment_form = '<div class="w100p">';
$upload_comment_form .= '<form method="post" id="comment_form" enctype="multipart/form-data"><h4>'.__('Add comment').'</h4>'.html_print_table($table_comments_section, true).html_print_input_hidden('upload_comment', 1, true).'</form>';
$upload_comment_form .= '<h4>'.__('Comments').'</h4>'.$comment_table.'</div>';
// Details box.
$details_box = '<div class="integriaims_details_box integriaims_details_box_five">';
$details_box .= '
<div class="integriaims_details_titles">'.__('Status').'</div>
<div class="integriaims_details_titles">'.__('Resolution').'</div>
<div class="integriaims_details_titles">'.__('Group').'</div>
<div class="integriaims_details_titles">'.__('Priority').'</div>
<div class="integriaims_details_titles">'.__('Type').'</div>';
$details_box .= '
<div>'.html_print_image('images/heart.png', true, ['class' => 'invert_filter']).'</div>
<div>'.html_print_image('images/builder@svg.svg', true, ['class' => 'invert_filter']).'</div>
<div>'.html_print_image('images/user_green.png', true, ['class' => 'invert_filter']).'</div>
<div>'.ui_print_integria_incident_priority($priority, $priority_text).'</div>
<div>'.html_print_image('images/incidents.png', true, ['class' => 'invert_filter']).'</div>';
$details_box .= '
<div>'.$status_text.'</div>
<div>'.$resolution_text.'</div>
<div>'.$group_text.'</div>
<div>'.$priority_text.'</div>
<div>'.$type_text.'</div>';
$details_box .= '</div>';
// People box.
$people_box = '<div class="integriaims_details_box integriaims_details_box_three">';
$people_box .= '
<div>'.html_print_image('images/header_user_green.png', true, ['width' => '21']).'</div>
<div>'.html_print_image('images/header_user_green.png', true, ['width' => '21']).'</div>
<div>'.html_print_image('images/header_user_green.png', true, ['width' => '21']).'</div>';
$people_box .= '
<div class="integriaims_details_titles">'.__('Created by').':</div>
<div class="integriaims_details_titles">'.__('Owned by').':</div>
<div class="integriaims_details_titles">'.__('Closed by').':</div>';
$people_box .= '
<div>'.$creator.'</div>
<div>'.$owner.'</div>
<div>'.$closed_by.'</div>';
$people_box .= '</div>';
// Dates box.
$dates_box = '<div class="integriaims_details_box integriaims_details_box_three">';
$dates_box .= '
<div>'.html_print_image('images/tick.png', true, ['class' => 'invert_filter']).'</div>
<div>'.html_print_image('images/update.png', true, ['width' => '21', 'class' => 'invert_filter']).'</div>
<div>'.html_print_image('images/mul.png', true, ['class' => 'invert_filter']).'</div>';
$dates_box .= '
<div class="integriaims_details_titles">'.__('Created at').':</div>
<div class="integriaims_details_titles">'.__('Updated at').':</div>
<div class="integriaims_details_titles">'.__('Closed at').':</div>';
$dates_box .= '
<div>'.$created_at.'</div>
<div>'.$updated_at.'</div>
<div>'.$closed_at.'</div>';
$dates_box .= '</div>';
// Show details, people and dates.
echo '<div class="integria_details">';
ui_toggle($details_box, __('Details'), '', 'details_box', false, false, '', 'integria_details_content white-box-content', 'integria_details_shadow box-flat white_table_graph');
ui_toggle($people_box, __('People'), '', 'people_box', false, false, '', 'integria_details_content white-box-content', 'integria_details_shadow box-flat white_table_graph');
ui_toggle($dates_box, __('Dates'), '', 'dates_box', false, false, '', 'integria_details_content white-box-content', 'integria_details_shadow box-flat white_table_graph');
echo '</div>';
// Show description.
$description_box = '<div class="integria_details_description">'.html_print_textarea(
'integria_details_description',
3,
0,
$description,
'disabled="disabled"',
true
).'</div>';
ui_toggle($description_box, __('Description'), '', '', false);
echo '<div class="ui_toggle">';
ui_toggle(
$upload_file_form,
__('Attached files'),
'',
'',
true,
false,
'white-box-content',
'w98p'
);
echo '</div>';
echo '<div class="ui_toggle">';
ui_toggle(
$upload_comment_form,
__('Comments'),
'',
'',
true,
false,
'white-box-content',
'w98p'
);
echo '</div>';
?>
<script type="text/javascript">
$(document).ready (function () {
$('#details_box .white_table_graph_header').click(function(){
$('div#details_box').toggleClass('integria_details_shadow');
});
$('#people_box .white_table_graph_header').click(function(){
$('div#people_box').toggleClass('integria_details_shadow');
});
$('#dates_box .white_table_graph_header').click(function(){
$('div#dates_box').toggleClass('integria_details_shadow');
});
});
</script>

View File

@ -1,60 +0,0 @@
<?php
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
require_once $config['homedir'].'/include/functions_graph.php';
check_login();
ui_print_standard_header(
__('Statistics'),
'images/book_edit.png',
false,
'',
false,
[],
[
[
'link' => '',
'label' => __('Issues'),
],
[
'link' => '',
'label' => __('Statistics'),
],
]
);
if (!$config['integria_enabled']) {
ui_print_error_message(__('In order to access ticket management system, integration with Integria IMS must be enabled and properly configured'));
exit;
}
echo '<div class="info_box">';
echo '<table width="90%">
<tr><td valign="top" style="width:50%;"><h3>'.__('Incidents by status').'</h3>';
echo graph_incidents_status();
echo '<td valign="top" style="width:50%;"><h3>'.__('Incidents by priority').'</h3>';
echo grafico_incidente_prioridad();
echo '<tr><td style="width:50%;"><h3>'.__('Incidents by group').'</h3>';
echo graphic_incident_group();
echo '<td style="width:50%;"><h3>'.__('Incidents by user').'</h3>';
echo graphic_incident_user();
echo '</table>';
echo '</div>';

View File

@ -1,124 +0,0 @@
<?php
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
require_once '../../include/config.php';
require_once '../../include/functions.php';
require_once '../../include/functions_integriaims.php';
check_login();
// API calls.
$status_incident = integriaims_get_details('status');
$group_incident = integriaims_get_details('group');
$priority_incident = integriaims_get_details('priority');
$resolution_incident = integriaims_get_details('resolution');
// Get data to export.
$tickets_filters = json_decode(
base64_decode(
get_parameter('tickets_filters', '')
),
true
);
$tickets_csv_array = get_tickets_integriaims($tickets_filters);
// Build a new array to show only the fields in the table.
$tickets_csv_array_filter = [];
foreach ($tickets_csv_array as $key => $value) {
// Status.
if ($tickets_csv_array[$key][6] == 0) {
$tickets_csv_array[$key][6] = 'None';
} else {
$tickets_csv_array[$key][6] = $status_incident[$tickets_csv_array[$key][6]];
}
// Priority.
$tickets_csv_array[$key][7] = $priority_incident[$tickets_csv_array[$key][7]];
// Group.
$tickets_csv_array[$key][8] = $group_incident[$tickets_csv_array[$key][8]];
// Resolution.
if ($tickets_csv_array[$key][12] == 0) {
$tickets_csv_array[$key][12] = 'None';
} else {
$tickets_csv_array[$key][12] = $resolution_incident[$tickets_csv_array[$key][12]];
}
$tickets_csv_array_filter[$key] = [
'id_incidencia' => $tickets_csv_array[$key][0],
'titulo' => $tickets_csv_array[$key][3],
'id_grupo' => $tickets_csv_array[$key][8],
'estado' => $tickets_csv_array[$key][6],
'resolution' => $tickets_csv_array[$key][12],
'prioridad' => $tickets_csv_array[$key][7],
'actualizacion' => $tickets_csv_array[$key][9],
'inicio' => $tickets_csv_array[$key][1],
'id_creator' => $tickets_csv_array[$key][10],
'owner' => $tickets_csv_array[$key][5],
];
}
// Header for CSV file.
$header = [
__('ID Ticket'),
__('Title'),
__('Group/Company'),
__('Status'),
__('Resolution'),
__('Priority'),
__('Updated'),
__('Started'),
__('Creator'),
__('Owner'),
];
$header_csv = '';
foreach ($header as $key => $value) {
$header_csv .= $value.',';
}
$header_csv = io_safe_output($header_csv).PHP_EOL;
// Join header and content.
$tickets_csv = '';
foreach ($tickets_csv_array_filter as $key => $value) {
$tickets_csv .= implode(',', $tickets_csv_array_filter[$key]).PHP_EOL;
}
$tickets_csv = $header_csv.$tickets_csv;
// Create csv file.
$filename = 'tickets_export-'.date('Ymd').'-'.date('His').'.csv';
ob_clean();
// Set cookie for download control.
setDownloadCookieToken();
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename='.$filename);
// BOM.
echo pack('C*', 0xEF, 0xBB, 0xBF);
// CSV file.
echo io_safe_output($tickets_csv);

View File

@ -1,678 +0,0 @@
<?php
// Pandora FMS - https://pandorafms.com
// ==================================================
// Copyright (c) 2005-2023 Pandora FMS
// Please see https://pandorafms.com/community/ for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
require_once 'include/functions_integriaims.php';
check_login();
// Header tabs.
$onheader = integriaims_tabs('list_tab');
ui_print_standard_header(
__('Integria IMS Tickets'),
'',
false,
'integria_tab',
false,
$onheader,
[
[
'link' => '',
'label' => __('Issues'),
],
[
'link' => '',
'label' => __('Integria IMS Tickets'),
],
]
);
// Check if Integria integration enabled.
if ($config['integria_enabled'] == 0) {
ui_print_error_message(__('In order to access ticket management system, integration with Integria IMS must be enabled and properly configured'));
return;
}
// Check connection to Integria IMS API.
$has_connection = integria_api_call(null, null, null, null, 'get_login', []);
if ($has_connection === false) {
ui_print_error_message(__('Integria IMS API is not reachable'));
return;
}
// Styles.
ui_require_css_file('integriaims');
// Get parameters for filters.
$incident_text = (string) get_parameter('incident_text', '');
$incident_status = (int) get_parameter('incident_status', 0);
$incident_group = (int) get_parameter('incident_group', 1);
$incident_owner = (string) get_parameter('incident_owner', '');
$incident_creator = (string) get_parameter('incident_creator', '');
$incident_priority = (int) get_parameter('incident_priority', -1);
$incident_resolution = (string) get_parameter('incident_resolution', '');
$created_from = (string) get_parameter('created_from', '');
$created_to = (string) get_parameter('created_to', '');
$offset = (int) get_parameter('offset');
$delete_incident = get_parameter('delete_incident');
// Sorting.
$sort_field = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$selected = true;
$select_incident_id_up = false;
$select_incident_id_down = false;
$select_title_up = false;
$select_title_down = false;
$select_group_company_up = false;
$select_group_company_down = false;
$select_status_resolution_up = false;
$select_status_resolution_down = false;
$select_priority_up = false;
$select_priority_down = false;
$select_creator_up = false;
$select_creator_down = false;
$select_owner_up = false;
$select_owner_down = false;
$order[] = [
'field' => 'incident_id',
'order' => 'ASC',
];
switch ($sort_field) {
case 'incident_id':
switch ($sort) {
case 'up':
$select_incident_id_up = $selected;
$order = [
'field' => 0,
'order' => 'ASC',
];
break;
case 'down':
$select_incident_id_down = $selected;
$order = [
'field' => 0,
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
case 'title':
switch ($sort) {
case 'up':
$select_title_up = $selected;
$order = [
'field' => 3,
'order' => 'ASC',
];
break;
case 'down':
$select_title_down = $selected;
$order = [
'field' => 3,
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
case 'group_company':
switch ($sort) {
case 'up':
$select_group_company_up = $selected;
$order = [
'field' => 'group_company',
'order' => 'ASC',
];
break;
case 'down':
$select_group_company_down = $selected;
$order = [
'field' => 'group_company',
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
case 'status_resolution':
switch ($sort) {
case 'up':
$select_status_resolution_up = $selected;
$order = [
'field' => 'status_resolution',
'order' => 'ASC',
];
break;
case 'down':
$select_status_resolution_down = $selected;
$order = [
'field' => 'status_resolution',
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
case 'priority':
switch ($sort) {
case 'up':
$select_priority_up = $selected;
$order = [
'field' => 7,
'order' => 'ASC',
];
break;
case 'down':
$select_priority_down = $selected;
$order = [
'field' => 7,
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
case 'creator':
switch ($sort) {
case 'up':
$select_creator_up = $selected;
$order = [
'field' => 10,
'order' => 'ASC',
];
break;
case 'down':
$select_creator_down = $selected;
$order = [
'field' => 10,
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
case 'owner':
switch ($sort) {
case 'up':
$select_owner_up = $selected;
$order = [
'field' => 5,
'order' => 'ASC',
];
break;
case 'down':
$select_owner_down = $selected;
$order = [
'field' => 5,
'order' => 'DESC',
];
break;
default:
// Nothing to do.
break;
}
break;
default:
$select_incident_id_up = $selected;
$select_incident_id_down = false;
$select_title_up = false;
$select_title_down = false;
$select_group_company_up = false;
$select_group_company_down = false;
$select_status_resolution_up = false;
$select_status_resolution_down = false;
$select_priority_up = false;
$select_priority_down = false;
$select_creator_up = false;
$select_creator_down = false;
$select_owner_up = false;
$select_owner_down = false;
$order = [
'field' => 'id_user',
'order' => 'ASC',
];
break;
}
if ($delete_incident) {
// Call Integria IMS API method to delete an incident.
$result_api_call_delete = integria_api_call(
null,
null,
null,
null,
'delete_incident',
[$delete_incident]
);
$incident_deleted_ok = ($result_api_call_delete !== false) ? true : false;
ui_print_result_message(
$incident_deleted_ok,
__('Successfully deleted'),
__('Could not be deleted')
);
}
// ---- FILTERS ----
// API calls to fill the filters.
$status_incident = integriaims_get_details('status');
$group_incident = integriaims_get_details('group');
$priority_incident = integriaims_get_details('priority');
$resolution_incident = integriaims_get_details('resolution');
// TABLE FILTERS.
$table = new StdClass();
$table->width = '100%';
$table->size = [];
$table->size[0] = '33%';
$table->size[1] = '33%';
$table->size[2] = '33%';
$table->class = 'filter-table-adv';
$table->data = [];
$table->data[0][0] = html_print_label_input_block(
__('Text filter'),
html_print_input_text('incident_text', $incident_text, '', 30, 100, true)
);
$table->data[0][1] = html_print_label_input_block(
__('Status'),
html_print_select(
$status_incident,
'incident_status',
$incident_status,
'',
__('All'),
0,
true
)
);
$table->data[0][2] = html_print_label_input_block(
__('Group'),
html_print_select(
$group_incident,
'incident_group',
$incident_group,
'',
__('All'),
1,
true
)
);
$table->data[1][0] = html_print_label_input_block(
__('Owner'),
html_print_autocomplete_users_from_integria(
'incident_owner',
$incident_owner,
true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
);
$table->data[1][1] = html_print_label_input_block(
__('Creator'),
html_print_autocomplete_users_from_integria(
'incident_creator',
$incident_creator,
true,
'30',
false,
false,
'w100p'
),
['div_class' => 'inline']
);
$table->data[1][2] = html_print_label_input_block(
__('Priority'),
html_print_select(
$priority_incident,
'incident_priority',
$incident_priority,
'',
__('All'),
-1,
true
)
);
$table->data[2][0] = html_print_label_input_block(
__('Resolution'),
html_print_select(
$resolution_incident,
'incident_resolution',
$incident_resolution,
'',
__('All'),
'',
true
)
);
$input_date = '<div>';
$input_date .= html_print_input_text_extended(
'created_from',
$created_from,
'created_from',
'',
12,
50,
false,
'',
'placeholder="'.__('Created from').'"',
true
);
$input_date .= html_print_input_text_extended(
'created_to',
$created_to,
'created_to',
'',
12,
50,
false,
'',
'class="mrgn_lft_5px" placeholder="'.__('Created to').'"',
true
);
$input_date .= '</div>';
$table->data[2][2] = html_print_label_input_block(
__('Date'),
$input_date
);
// Send filters to get_tickets_integriaims().
$tickets_filters = [
'incident_text' => $incident_text,
'incident_status' => $incident_status,
'incident_group' => $incident_group,
'incident_owner' => $incident_owner,
'incident_creator' => $incident_creator,
'incident_priority' => $incident_priority,
'incident_resolution' => $incident_resolution,
'created_from' => $created_from,
'created_to' => $created_to,
];
// Data to export to csv file.
$decode_csv = base64_encode(json_encode($tickets_filters));
// Full url with all filters.
$url = ui_get_full_url(
'index.php?sec=incident&sec2=operation/incidents/list_integriaims_incidents&incident_text='.$incident_text.'&incident_status='.$incident_status.'&incident_group='.$incident_group.'&incident_owner='.$incident_owner.'&incident_creator='.$incident_creator.'&incident_priority='.$incident_priority.'&incident_resolution='.$incident_resolution.'&created_from='.$created_from.'&created_to='.$created_to.'&offset='.$offset.'&sort_field='.$sort_field.'&sort='.$sort
);
// ---- PRINT TABLE FILTERS ----
$integria_incidents_form = '<form method="post" action="'.$url.'" class="pdd_0px">';
$integria_incidents_form .= html_print_table($table, true);
$buttons = html_print_submit_button(
__('Filter'),
'filter_button',
false,
[
'icon' => 'search',
'mode' => 'mini secondary',
],
true
);
$buttons .= html_print_button(
__('Export to CSV'),
'csv_export',
false,
"blockResubmit($(this)); location.href='operation/incidents/integriaims_export_csv.php?tickets_filters=$decode_csv'",
[
'icon' => 'cog',
'mode' => 'mini secondary',
],
true
);
$integria_incidents_form .= html_print_div(
[
'class' => 'action-buttons',
'content' => $buttons,
],
true
);
$integria_incidents_form .= '</form>';
ui_toggle(
$integria_incidents_form,
'<span class="subsection_header_title">'.__('Filters').'</span>',
'filter_form',
'',
true,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
/*
* Order api call 'get_incidents'.
*
* resolution = $array_get_incidents[$key][12]
* id_incidencia = $array_get_incidents[$key][0]
* titulo = $array_get_incidents[$key][3]
* id_grupo = $array_get_incidents[$key][8]
* estado = $array_get_incidents[$key][6]
* prioridad = $array_get_incidents[$key][7]
* actualizacion = $array_get_incidents[$key][9]
* id_creator = $array_get_incidents[$key][10]
*
*/
// ---- LIST OF INCIDENTS ----
// Get list of incidents.
$array_get_incidents = get_tickets_integriaims($tickets_filters);
$props = [
'order' => $order,
'group_incident' => $group_incident,
'status_incident' => $status_incident,
'resolution_incident' => $resolution_incident,
];
usort(
$array_get_incidents,
function ($a, $b) use ($props) {
$order_field = $props['order']['field'];
$item_a = $a[$order_field];
$item_b = $b[$order_field];
if ($order_field === 'group_company') {
$item_a = $props['group_incident'][$a[8]];
$item_b = $props['group_incident'][$b[8]];
} else if ($order_field === 'status_resolution') {
$item_a = $props['status_incident'][$a[6]].' / '.$props['resolution_incident'][$a[12]];
$item_b = $props['status_incident'][$b[6]].' / '.$props['resolution_incident'][$b[12]];
}
if ($props['order']['order'] === 'DESC') {
return $item_a < $item_b;
} else {
return $item_a > $item_b;
}
}
);
// Prepare pagination.
$incidents_limit = $config['block_size'];
$incidents_paginated = array_slice($array_get_incidents, $offset, $incidents_limit, true);
// TABLE INCIDENTS.
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->head = [];
$url_incident_id_up = $url.'&sort_field=incident_id&sort=up';
$url_incident_id_down = $url.'&sort_field=incident_id&sort=down';
$url_title_up = $url.'&sort_field=title&sort=up';
$url_title_down = $url.'&sort_field=title&sort=down';
$url_group_company_up = $url.'&sort_field=group_company&sort=up';
$url_group_company_down = $url.'&sort_field=group_company&sort=down';
$url_status_resolution_up = $url.'&sort_field=status_resolution&sort=up';
$url_status_resolution_down = $url.'&sort_field=status_resolution&sort=down';
$url_priority_up = $url.'&sort_field=priority&sort=up';
$url_priority_down = $url.'&sort_field=priority&sort=down';
$url_creator_up = $url.'&sort_field=creator&sort=up';
$url_creator_down = $url.'&sort_field=creator&sort=down';
$url_owner_up = $url.'&sort_field=owner&sort=up';
$url_owner_down = $url.'&sort_field=owner&sort=down';
$table->head[0] = __('ID').ui_get_sorting_arrows($url_incident_id_up, $url_incident_id_down, $select_incident_id_up, $select_incident_id_down);
$table->head[1] = __('Title').ui_get_sorting_arrows($url_title_up, $url_title_down, $select_title_up, $select_title_down);
$table->head[2] = __('Group/Company').ui_get_sorting_arrows($url_group_company_up, $url_group_company_down, $select_group_company_up, $select_group_company_down);
$table->head[3] = __('Status/Resolution').ui_get_sorting_arrows($url_status_resolution_up, $url_status_resolution_down, $select_status_resolution_up, $select_status_resolution_down);
$table->head[4] = __('Priority').ui_get_sorting_arrows($url_priority_up, $url_priority_down, $select_priority_up, $select_priority_down);
$table->head[5] = __('Updated/Started');
$table->head[6] = __('Creator').ui_get_sorting_arrows($url_creator_up, $url_creator_down, $select_creator_up, $select_creator_down);
$table->head[7] = __('Owner').ui_get_sorting_arrows($url_owner_up, $url_owner_down, $select_owner_up, $select_owner_down);
$table->head[8] = '';
$table->data = [];
$i = 0;
foreach ($incidents_paginated as $key => $value) {
if ($array_get_incidents[$key][6] == 0) {
$status_incident[$array_get_incidents[$key][6]] = __('None');
}
if ($array_get_incidents[$key][12] == 0) {
$resolution_incident[$array_get_incidents[$key][12]] = __('None');
}
$table->data[$i][0] = '#'.$array_get_incidents[$key][0];
$table->data[$i][1] = '<a href="'.ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$array_get_incidents[$key][0]).'">';
$table->data[$i][1] .= ui_print_truncate_text($array_get_incidents[$key][3], 160, false);
$table->data[$i][1] .= '</a>';
$table->data[$i][2] = $group_incident[$array_get_incidents[$key][8]];
$table->data[$i][3] = $status_incident[$array_get_incidents[$key][6]].' / '.$resolution_incident[$array_get_incidents[$key][12]];
$table->data[$i][4] = ui_print_integria_incident_priority($array_get_incidents[$key][7], $priority_incident[$array_get_incidents[$key][7]]);
$table->data[$i][5] = $array_get_incidents[$key][9].' / '.$array_get_incidents[$key][1];
$table->data[$i][6] = $array_get_incidents[$key][10];
$table->data[$i][7] = $array_get_incidents[$key][5];
$table->data[$i][8] = '';
$table->cellclass[$i][8] = 'table_action_buttons';
$table->data[$i][8] .= '<a href="'.ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/configure_integriaims_incident&incident_id='.$array_get_incidents[$key][0]).'">';
$table->data[$i][8] .= html_print_image('images/edit.svg', true, ['title' => __('Edit')]);
$table->data[$i][8] .= '</a>';
$table->data[$i][8] .= '<a id="link_delete_incident" href="'.ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/list_integriaims_incidents&delete_incident='.$array_get_incidents[$key][0]).'"
onClick="javascript:if (!confirm(\''.__('Are you sure?').'\')) return false;">';
$table->data[$i][8] .= html_print_image('images/delete.svg', true, ['title' => __('Delete'), 'class' => 'invert_filter main_menu_icon']);
$table->data[$i][8] .= '</a>';
$i++;
}
$tablePagination = '';
// Show table incidents.
if (empty($table->data) === true) {
ui_print_info_message(['no_close' => true, 'message' => __('No tickets to show').'.' ]);
} else {
html_print_table($table);
$tablePagination = ui_pagination(
count($array_get_incidents),
$url,
$offset,
0,
true,
'offset',
false,
''
);
}
// Show button to create incident.
echo '<form method="POST" action="'.ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/configure_integriaims_incident').'">';
html_print_action_buttons(
html_print_submit_button(
__('Create'),
'create_new_incident',
false,
[ 'icon' => 'next' ],
true
),
[
'type' => 'data_table',
'class' => 'fixed_action_buttons',
'right_content' => $tablePagination,
]
);
echo '</form>';
// Datapicker library for show calendar.
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
?>
<script language="javascript" type="text/javascript">
$(document).ready( function() {
$("#created_from, #created_to").datepicker({
dateFormat: "<?php echo DATE_FORMAT_JS; ?>"
});
});
</script>

View File

@ -681,28 +681,6 @@ $sub['operation/users/user_edit_notifications']['id'] = 'Configure_user_notifica
$sub['operation/users/user_edit_notifications']['refr'] = 0;
if ($access_console_node === true) {
// Incidents.
$temp_sec2 = $sec2;
$sec2 = 'incident';
$sec2sub = 'operation/incidents/incident_statistics';
$sub[$sec2]['text'] = __('Incidents');
$sub[$sec2]['id'] = 'Incidents';
$sub[$sec2]['type'] = 'direct';
$sub[$sec2]['subtype'] = 'nolink';
$sub[$sec2]['refr'] = 0;
$sub[$sec2]['subsecs'] = [
'operation/incidents/incident_detail',
'operation/integria_incidents',
];
$sub2 = [];
$sub2[$sec2sub]['text'] = __('Integria IMS statistics');
$sub2['operation/incidents/list_integriaims_incidents']['text'] = __('Integria IMS ticket list');
$sub[$sec2]['sub2'] = $sub2;
$sec2 = $temp_sec2;
// Messages.
$sub['message_list']['text'] = __('Messages');
$sub['message_list']['id'] = 'Messages';
@ -718,6 +696,39 @@ if ($access_console_node === true) {
$menu_operation['workspace']['sub'] = $sub;
if ($access_console_node === true) {
if ((bool) $config['ITSM_enabled'] === true) {
// ITSM.
$menu_operation['ITSM']['text'] = __('ITSM');
$menu_operation['ITSM']['sec2'] = 'operation/ITSM/itsm';
$menu_operation['ITSM']['id'] = 'oper-itsm';
$sub = [];
// ITSM Tickets.
$sub['manageTickets']['text'] = __('Tickets');
$sub['manageTickets']['id'] = 'itsm-ticket';
$sub['manageTickets']['refr'] = 0;
$sub['manageTickets']['type'] = 'direct';
$sub['manageTickets']['subtype'] = 'nolink';
$sub2 = [];
$sub2['operation/ITSM/itsm&operation=list']['text'] = __('List');
$sub2['operation/ITSM/itsm&operation=list']['id'] = 'itsm-ticket-list';
$sub2['operation/ITSM/itsm&operation=edit']['text'] = __('Edit');
$sub2['operation/ITSM/itsm&operation=edit']['id'] = 'itsm-ticket-edit';
$sub['manageTickets']['sub2'] = $sub2;
// ITSM Dashboard.
$sub['operation/ITSM/itsm']['text'] = __('Dashboard');
$sub['operation/ITSM/itsm']['id'] = 'itsm-dashboard';
$sub['operation/ITSM/itsm']['refr'] = 0;
$menu_operation['ITSM']['sub'] = $sub;
}
}
if ($access_console_node === true) {
// Rest of options, all with AR privilege (or should events be with incidents?)
// ~ if (check_acl ($config['id_user'], 0, "AR")) {
@ -750,9 +761,9 @@ if ($access_console_node === true) {
$extension_menu = $extension['operation_menu'];
if ($extension['operation_menu']['name'] == 'Matrix'
&& ( !check_acl($config['id_user'], 0, 'ER')
&& (!check_acl($config['id_user'], 0, 'ER')
|| !check_acl($config['id_user'], 0, 'EW')
|| !check_acl($config['id_user'], 0, 'EM') )
|| !check_acl($config['id_user'], 0, 'EM'))
) {
continue;
}

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