Flex agent view

This commit is contained in:
fbsanchez 2019-05-28 09:48:09 +02:00
parent 8bfb1e6773
commit bdd7cc1317
4 changed files with 222 additions and 135 deletions

View File

@ -1,23 +1,33 @@
<?php <?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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 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 * Library. User interface functions.
* @subpackage UI *
* @category Library.
* @package Pandora FMS
* @subpackage User interface.
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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.
* ============================================================================
*/ */
// Check to avoid error when load this library in error screen situations // Begin.
// Check to avoid error when load this library in error screen situations.
if (isset($config['homedir'])) { if (isset($config['homedir'])) {
include_once $config['homedir'].'/include/functions_agents.php'; include_once $config['homedir'].'/include/functions_agents.php';
include_once $config['homedir'].'/include/functions_modules.php'; include_once $config['homedir'].'/include/functions_modules.php';
@ -28,6 +38,14 @@ if (isset($config['homedir'])) {
} }
/**
* Transform bbcode to HTML.
*
* @param string $text Text.
* @param array $allowed_tags Allowed_tags.
*
* @return string HTML.
*/
function ui_bbcode_to_html($text, $allowed_tags=['[url]']) function ui_bbcode_to_html($text, $allowed_tags=['[url]'])
{ {
$return = $text; $return = $text;
@ -129,7 +147,7 @@ function ui_print_truncate_text($text, $numChars=GENERIC_SIZE_TEXT, $showTextInA
'UTF-8' 'UTF-8'
); );
// Recover the html entities to avoid XSS attacks // Recover the html entities to avoid XSS attacks.
$truncateText = ($text_has_entities) ? io_safe_input($truncateText).$suffix.io_safe_input($truncateText2) : $truncateText.$suffix.$truncateText2; $truncateText = ($text_has_entities) ? io_safe_input($truncateText).$suffix.io_safe_input($truncateText2) : $truncateText.$suffix.$truncateText2;
if ($showTextInTitle) { if ($showTextInTitle) {
@ -170,6 +188,8 @@ function ui_print_truncate_text($text, $numChars=GENERIC_SIZE_TEXT, $showTextInA
* *
* @param string $string String to be display with a smaller font. * @param string $string String to be display with a smaller font.
* @param boolean $return Flag to return as string or not. * @param boolean $return Flag to return as string or not.
*
* @return string HTML.
*/ */
function printSmallFont($string, $return=true) function printSmallFont($string, $return=true)
{ {
@ -199,12 +219,13 @@ function printSmallFont($string, $return=true)
/** /**
* Prints a generic message between tags. * Prints a generic message between tags.
* *
* @param mixed The string message or array ('title', 'message', 'icon', 'no_close', 'force_style') to be displayed * @param mixed $message The string message or array [
* @param string the class to user * 'title', 'message', 'icon', 'no_close', 'force_style'] to be displayed.
* @param string Any other attributes to be set for the tag. * @param string $class The class to be used.
* @param bool Whether to output the string or return it * @param string $attributes Any other attributes to be set for the tag.
* @param string What tag to use (you could specify something else than * @param boolean $return Whether to output the string or return it.
* h3 like div or h2) * @param string $tag What tag to use (you could specify something else
* than h3 like div or h2).
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -285,7 +306,7 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
$id = 'info_box_'.uniqid(); $id = 'info_box_'.uniqid();
// Use the no_meta parameter because this image is only in the base console // Use the no_meta parameter because this image is only in the base console.
$output = '<table cellspacing="0" cellpadding="0" id="'.$id.'" '.$attributes.' $output = '<table cellspacing="0" cellpadding="0" id="'.$id.'" '.$attributes.'
class="info_box '.$id.' '.$class.' textodialogo" style="'.$force_style.'"> class="info_box '.$id.' '.$class.' textodialogo" style="'.$force_style.'">
<tr> <tr>
@ -293,7 +314,8 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
<td class="title" style="text-transform: uppercase; padding-top: 10px;"><b>'.$text_title.'</b></td> <td class="title" style="text-transform: uppercase; padding-top: 10px;"><b>'.$text_title.'</b></td>
<td class="icon" style="text-align: right; padding-right: 3px;">'; <td class="icon" style="text-align: right; padding-right: 3px;">';
if (!$no_close_bool) { if (!$no_close_bool) {
// Use the no_meta parameter because this image is only in the base console // Use the no_meta parameter because this image is only in
// the base console.
$output .= '<a href="javascript: close_info_box(\''.$id.'\')">'.html_print_image('images/blade.png', true, false, false, false, true).'</a>'; $output .= '<a href="javascript: close_info_box(\''.$id.'\')">'.html_print_image('images/blade.png', true, false, false, false, true).'</a>';
} }
@ -330,11 +352,12 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
/** /**
* Prints an error message. * Prints an error message.
* *
* @param mixed The string error message or array ('title', 'message', 'icon', 'no_close') to be displayed * @param mixed $message The string error message or array
* @param string Any other attributes to be set for the tag. * ('title', 'message', 'icon', 'no_close') to be displayed.
* @param bool Whether to output the string or return it * @param string $attributes Any other attributes to be set for the tag.
* @param string What tag to use (you could specify something else than * @param boolean $return Whether to output the string or return it.
* h3 like div or h2) * @param string $tag What tag to use (you could specify something else
* than h3 like div or h2).
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -347,11 +370,12 @@ function ui_print_error_message($message, $attributes='', $return=false, $tag='h
/** /**
* Prints an operation success message. * Prints an operation success message.
* *
* @param mixed The string message or array ('title', 'message', 'icon', 'no_close') to be displayed * @param mixed $message The string message or array
* @param string Any other attributes to be set for the tag. * ('title', 'message', 'icon', 'no_close') to be displayed.
* @param bool Whether to output the string or return it * @param string $attributes Any other attributes to be set for the tag.
* @param string What tag to use (you could specify something else than * @param boolean $return Whether to output the string or return it.
* h3 like div or h2) * @param string $tag What tag to use (you could specify something else
* than h3 like div or h2).
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -364,11 +388,12 @@ function ui_print_success_message($message, $attributes='', $return=false, $tag=
/** /**
* Prints an operation info message. * Prints an operation info message.
* *
* @param mixed The string message or array ('title', 'message', 'icon', 'no_close') to be displayed * @param mixed $message The string message or array
* @param string Any other attributes to be set for the tag. * ('title', 'message', 'icon', 'no_close') to be displayed.
* @param bool Whether to output the string or return it * @param string $attributes Any other attributes to be set for the tag.
* @param string What tag to use (you could specify something else than * @param boolean $return Whether to output the string or return it.
* h3 like div or h2) * @param string $tag What tag to use (you could specify something else
* than h3 like div or h2).
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -378,6 +403,18 @@ function ui_print_info_message($message, $attributes='', $return=false, $tag='h3
} }
/**
* Prints an operation info message - empty data.
*
* @param mixed $message The string message or array
* ('title', 'message', 'icon', 'no_close') to be displayed.
* @param string $attributes Any other attributes to be set for the tag.
* @param boolean $return Whether to output the string or return it.
* @param string $tag What tag to use (you could specify something else
* than h3 like div or h2).
*
* @return string HTML code if return parameter is true.
*/
function ui_print_empty_data($message, $attributes='', $return=false, $tag='h3') function ui_print_empty_data($message, $attributes='', $return=false, $tag='h3')
{ {
return ui_print_message($message, 'info', $attributes, $return, $tag); return ui_print_message($message, 'info', $attributes, $return, $tag);
@ -387,14 +424,16 @@ function ui_print_empty_data($message, $attributes='', $return=false, $tag='h3')
/** /**
* Evaluates a result using empty() and then prints an error or success message * Evaluates a result using empty() and then prints an error or success message
* *
* @param mixed The results to evaluate. 0, NULL, false, '' or * @param mixed $result The results to evaluate. 0, NULL, false, '' or
* array() is bad, the rest is good * array() is bad, the rest is good.
* @param mixed The string or array ('title', 'message') to be displayed if the result was good * @param mixed $good The string or array ('title', 'message') to be
* @param mixed The string or array ('title', 'message') to be displayed if the result was bad * displayed if the result was good.
* @param string Any other attributes to be set for the h3 * @param mixed $bad The string or array ('title', 'message') to be
* @param bool Whether to output the string or return it * displayed if the result was bad.
* @param string What tag to use (you could specify something else than * @param string $attributes Any other attributes to be set for the h3.
* h3 like div or h2) * @param boolean $return Whether to output the string or return it.
* @param string $tag What tag to use (you could specify something else
* than h3 like div or h2).
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -419,11 +458,12 @@ function ui_print_result_message($result, $good='', $bad='', $attributes='', $re
/** /**
* Prints an warning message. * Prints an warning message.
* *
* @param mixed The string warning message or array ('title', 'message', 'icon', 'no_close') to be displayed * @param mixed $message The string message or array
* @param string Any other attributes to be set for the tag. * ('title', 'message', 'icon', 'no_close') to be displayed.
* @param bool Whether to output the string or return it * @param string $attributes Any other attributes to be set for the tag.
* @param string What tag to use (you could specify something else than * @param boolean $return Whether to output the string or return it.
* h3 like div or h2) * @param string $tag What tag to use (you could specify something else
* than h3 like div or h2).
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -438,9 +478,9 @@ function ui_print_warning_message($message, $attributes='', $return=false, $tag=
* with as title the correctly formatted full timestamp and a time comparation * with as title the correctly formatted full timestamp and a time comparation
* in the tag * in the tag
* *
* @param int Any type of timestamp really, but we prefer unixtime * @param integer $unixtime Any type of timestamp really, but we prefer unixtime.
* @param bool Whether to output the string or return it * @param boolean $return Whether to output the string or return it.
* @param array An array with different options for this function * @param array $option An array with different options for this function
* Key html_attr: which html attributes to add (defaults to none) * Key html_attr: which html attributes to add (defaults to none)
* Key tag: Which html tag to use (defaults to span) * Key tag: Which html tag to use (defaults to span)
* Key prominent: Overrides user preference and display "comparation" or "timestamp" * Key prominent: Overrides user preference and display "comparation" or "timestamp"
@ -452,7 +492,8 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
{ {
global $config; global $config;
// TODO: Add/use a javascript timer for the seconds so it automatically updates as time passes by // TODO: Add/use a javascript timer for the seconds so it automatically
// updates as time passes by.
if (isset($option['html_attr'])) { if (isset($option['html_attr'])) {
$attributes = $option['html_attr']; $attributes = $option['html_attr'];
} else { } else {
@ -481,7 +522,7 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
$unixtime = time_w_fixed_tz($unixtime); $unixtime = time_w_fixed_tz($unixtime);
} }
// prominent_time is either timestamp or comparation // Prominent_time is either timestamp or comparation.
if ($unixtime <= 0) { if ($unixtime <= 0) {
$title = __('Unknown').'/'.__('Never'); $title = __('Unknown').'/'.__('Never');
$data = __('Unknown'); $data = __('Unknown');
@ -507,13 +548,13 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
switch ($tag) { switch ($tag) {
default: default:
// Usually tags have title attributes, so by default we add, // Usually tags have title attributes, so by default we add,
// then fall through to add attributes and data // then fall through to add attributes and data.
$output .= ' title="'.$title.'" '.$style.'>'.$data.'</'.$tag.'>'; $output .= ' title="'.$title.'" '.$style.'>'.$data.'</'.$tag.'>';
break; break;
case 'h1': case 'h1':
case 'h2': case 'h2':
case 'h3': case 'h3':
// Above tags don't have title attributes // Above tags don't have title attributes.
$output .= ' '.$attributes.' '.$style.'>'.$data.'</'.$tag.'>'; $output .= ' '.$attributes.' '.$style.'>'.$data.'</'.$tag.'>';
break; break;
} }
@ -529,8 +570,8 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
/** /**
* Prints a username with real name, link to the user_edit page etc. * Prints a username with real name, link to the user_edit page etc.
* *
* @param string The username to render * @param string $username The username to render.
* @param bool Whether to return or print * @param boolean $return Whether to return or print.
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -546,6 +587,13 @@ function ui_print_username($username, $return=false)
} }
/**
* Show a notification.
*
* @param boolean $return Return or direct echo.
*
* @return string HTML.
*/
function ui_print_tags_warning($return=false) function ui_print_tags_warning($return=false)
{ {
$msg = '<div id="notify_conf" class="notify">'; $msg = '<div id="notify_conf" class="notify">';
@ -563,11 +611,14 @@ function ui_print_tags_warning($return=false)
/** /**
* Print group icon within a link * Print group icon within a link
* *
* @param int Group id * @param integer $id_group Group id.
* @param bool Whether to return or print * @param boolean $return Whether to return or print.
* @param string What path to use (relative to images/). Defaults to groups_small * @param string $path What path to use (relative to images/).
* @param string Style for group image * Defaults to groups_small.
* @param bool Whether the group have link or not * @param string $style Style for group image.
* @param boolean $link Whether the group have link or not.
* @param boolean $force_show_image Force show image.
* @param boolean $show_as_image Show as image.
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -583,7 +634,7 @@ function ui_print_group_icon($id_group, $return=false, $path='groups_small', $st
$output = ''; $output = '';
// Don't show link in metaconsole // Don't show link in metaconsole.
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
$link = false; $link = false;
} }
@ -630,9 +681,12 @@ function ui_print_group_icon($id_group, $return=false, $path='groups_small', $st
/** /**
* Print group icon within a link. Other version. * Print group icon within a link. Other version.
* *
* @param int Group id * @param integer $id_group Group id.
* @param bool Whether to return or print * @param boolean $return Whether to return or print.
* @param string What path to use (relative to images/). Defaults to groups_small * @param string $path What path to use (relative to images/).
* Defaults to groups_small.
* @param string $style Extra styles.
* @param boolean $link Add anchor.
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
@ -674,10 +728,15 @@ function ui_print_group_icon_path($id_group, $return=false, $path='images/groups
/** /**
* Get the icon of an operating system. * Get the icon of an operating system.
* *
* @param int Operating system id * @param integer $id_os Operating system id.
* @param bool Whether to also append the name of the OS after the icon * @param boolean $name Whether to also append the name of OS after icon.
* @param bool Whether to return or echo the result * @param boolean $return Whether to return or echo the result.
* @param bool Whether to apply skin or not * @param boolean $apply_skin Whether to apply skin or not.
* @param boolean $networkmap Networkmap.
* @param boolean $only_src Only_src.
* @param boolean $relative Relative.
* @param boolean $options Options.
* @param boolean $big_icons Big_icons.
* *
* @return string HTML with icon of the OS * @return string HTML with icon of the OS
*/ */
@ -744,6 +803,18 @@ function ui_print_os_icon(
} }
/**
* Print type agent icon.
*
* @param boolean $id_os Id_os.
* @param boolean $remote_contact Remote_contact.
* @param boolean $contact Contact.
* @param boolean $return Return.
* @param integer $remote Remote.
* @param string $version Version.
*
* @return string HTML.
*/
function ui_print_type_agent_icon( function ui_print_type_agent_icon(
$id_os=false, $id_os=false,
$remote_contact=false, $remote_contact=false,
@ -753,15 +824,15 @@ function ui_print_type_agent_icon(
$version='' $version=''
) { ) {
if ($id_os == 19) { if ($id_os == 19) {
// Satellite // Satellite.
$options['title'] = __('Satellite'); $options['title'] = __('Satellite');
$output = html_print_image('images/op_satellite.png', true, $options, false, false, false, true); $output = html_print_image('images/op_satellite.png', true, $options, false, false, false, true);
} else if ($remote_contact == $contact && $remote == 0 && $version == '') { } else if ($remote_contact == $contact && $remote == 0 && $version == '') {
// Network // Network.
$options['title'] = __('Network'); $options['title'] = __('Network');
$output = html_print_image('images/network.png', true, $options, false, false, false, true); $output = html_print_image('images/network.png', true, $options, false, false, false, true);
} else { } else {
// Software // Software.
$options['title'] = __('Software'); $options['title'] = __('Software');
$output = html_print_image('images/data.png', true, $options, false, false, false, true); $output = html_print_image('images/data.png', true, $options, false, false, false, true);
} }
@ -773,20 +844,31 @@ function ui_print_type_agent_icon(
/** /**
* Prints an agent name with the correct link * Prints an agent name with the correct link
* *
* @param int Agent id * @param integer $id_agent Agent id.
* @param bool Whether to return the string or echo it too * @param boolean $return Whether to return the string or echo it too.
* @param int Now uses styles to accomplish this * @param integer $cutoff Now uses styles to accomplish this.
* @param string Style of name in css. * @param string $style Style of name in css.
* @param string server url to concatenate at the begin of the link * @param boolean $cutname Cut names.
* @param string extra parameters to concatenate in the link * @param string $server_url Server url to concatenate at the begin of the link.
* @param string name of the agent to avoid the query in some cases * @param string $extra_params Extra parameters to concatenate in the link.
* @param bool if the agent will provided with link or not * @param string $known_agent_name Name of the agent to avoid the query in some cases.
* @param bool use the agent alias or the name * @param boolean $link If the agent will provided with link or not.
* @param boolean $alias Use the agent alias or the name.
* *
* @return string HTML with agent name and link * @return string HTML with agent name and link
*/ */
function ui_print_agent_name($id_agent, $return=false, $cutoff='agent_medium', $style='', $cutname=false, $server_url='', $extra_params='', $known_agent_name=false, $link=true, $alias=true) function ui_print_agent_name(
{ $id_agent,
$return=false,
$cutoff='agent_medium',
$style='',
$cutname=false,
$server_url='',
$extra_params='',
$known_agent_name=false,
$link=true,
$alias=true
) {
if ($known_agent_name === false) { if ($known_agent_name === false) {
if ($alias) { if ($alias) {
$agent_name = (string) agents_get_alias($id_agent); $agent_name = (string) agents_get_alias($id_agent);
@ -808,14 +890,14 @@ function ui_print_agent_name($id_agent, $return=false, $cutoff='agent_medium', $
} }
if ($link) { if ($link) {
$url = $server_url.'index.php?sec=estado&amp;'.'sec2=operation/agentes/ver_agente&amp;'.'id_agente='.$id_agent.$extra_params; $url = $server_url.'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.$extra_params;
$output = '<a style="'.$style.'"'.' href="'.$url.'"'.' title="'.$agent_name_full.'"><b><span style="'.$style.'">'.$agent_name.'</span></b></a>'; $output = '<a style="'.$style.'" href="'.$url.'" title="'.$agent_name_full.'"><b><span style="'.$style.'">'.$agent_name.'</span></b></a>';
} else { } else {
$output = '<b><span style="'.$style.'">'.$agent_name.'</span></b>'; $output = '<b><span style="'.$style.'">'.$agent_name.'</span></b>';
} }
// TODO: Add a pretty javascript (using jQuery) popup-box with agent details // TODO: Add a pretty javascript (using jQuery) popup-box with agent details.
if ($return) { if ($return) {
return $output; return $output;
} }
@ -827,16 +909,19 @@ function ui_print_agent_name($id_agent, $return=false, $cutoff='agent_medium', $
/** /**
* Formats a row from the alert table and returns an array usable in the table function * Formats a row from the alert table and returns an array usable in the table function
* *
* @param array A valid (non empty) row from the alert table * @param array $alert A valid (non empty) row from the alert table.
* @param bool Whether or not this is a combined alert * @param boolean $agent Whether or not this is a combined alert.
* @param bool Whether to print the agent information with the module information * @param string $url Tab where the function was called from (used for urls).
* @param string Tab where the function was called from (used for urls) * @param mixed $agent_style Style for agent name or default (false).
* @param mixed Style for agent name or default (false)
* *
* @return array A formatted array with proper html for use in $table->data (6 columns) * @return array A formatted array with proper html for use in $table->data (6 columns)
*/ */
function ui_format_alert_row($alert, $agent=true, $url='', $agent_style=false) function ui_format_alert_row(
{ $alert,
$agent=true,
$url='',
$agent_style=false
) {
global $config; global $config;
if (!isset($alert['server_data'])) { if (!isset($alert['server_data'])) {
@ -856,7 +941,7 @@ function ui_format_alert_row($alert, $agent=true, $url='', $agent_style=false)
include_once $config['homedir'].'/include/functions_alerts.php'; include_once $config['homedir'].'/include/functions_alerts.php';
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php'); $isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
$id_group = (int) get_parameter('ag_group', 0); $id_group = (int) get_parameter('ag_group', 0);
// 0 is the All group (selects all groups) // 0 is the All group (selects all groups).
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if ($agent) { if ($agent) {
$index = [ $index = [
@ -956,13 +1041,13 @@ function ui_format_alert_row($alert, $agent=true, $url='', $agent_style=false)
$server = db_get_row('tmetaconsole_setup', 'id', $alert['server_data']['id']); $server = db_get_row('tmetaconsole_setup', 'id', $alert['server_data']['id']);
if (metaconsole_connect($server) == NOERR) { if (metaconsole_connect($server) == NOERR) {
// Get agent data from node // Get agent data from node.
$agente = db_get_row('tagente', 'id_agente', $alert['id_agent']); $agente = db_get_row('tagente', 'id_agente', $alert['id_agent']);
metaconsole_restore_db(); metaconsole_restore_db();
} }
} else { } else {
// Get agent id // Get agent id.
$id_agent = modules_get_agentmodule_agent($alert['id_agent_module']); $id_agent = modules_get_agentmodule_agent($alert['id_agent_module']);
$agente = db_get_row('tagente', 'id_agente', $id_agent); $agente = db_get_row('tagente', 'id_agente', $id_agent);
} }
@ -972,9 +1057,11 @@ function ui_format_alert_row($alert, $agent=true, $url='', $agent_style=false)
$data = []; $data = [];
// Validate checkbox // Validate checkbox.
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) { if (check_acl($config['id_user'], $id_group, 'LW')
|| check_acl($config['id_user'], $id_group, 'LM')
) {
$data[$index['validate']] = ''; $data[$index['validate']] = '';
$data[$index['validate']] .= html_print_checkbox( $data[$index['validate']] .= html_print_checkbox(
@ -996,7 +1083,6 @@ function ui_format_alert_row($alert, $agent=true, $url='', $agent_style=false)
// Restore the default connection. // Restore the default connection.
metaconsole_restore_db(); metaconsole_restore_db();
$errors++; $errors++;
// break; It does not work in the php7 version remplace for:
return false; return false;
} }
} }
@ -1018,14 +1104,14 @@ function ui_format_alert_row($alert, $agent=true, $url='', $agent_style=false)
} }
} }
// Standby // Standby.
$data[$index['standby']] = ''; $data[$index['standby']] = '';
if (isset($alert['standby']) && $alert['standby'] == 1) { if (isset($alert['standby']) && $alert['standby'] == 1) {
$data[$index['standby']] = html_print_image('images/bell_pause.png', true, ['title' => __('Standby on')]); $data[$index['standby']] = html_print_image('images/bell_pause.png', true, ['title' => __('Standby on')]);
} }
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
// Force alert execution // Force alert execution.
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) { if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
if ($alert['force_execution'] == 0) { if ($alert['force_execution'] == 0) {
$data[$index['force_execution']] = '<a href="'.$url.'&amp;id_alert='.$alert['id'].'&amp;force_execution=1&refr=60">'.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force')]).'</a>'; $data[$index['force_execution']] = '<a href="'.$url.'&amp;id_alert='.$alert['id'].'&amp;force_execution=1&refr=60">'.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force')]).'</a>';
@ -2464,7 +2550,7 @@ function ui_print_status_image($type, $title='', $return=false, $options=false,
* *
* @param integer $progress Progress. * @param integer $progress Progress.
* @param string $width Width. * @param string $width Width.
* @param string $height Height. * @param integer $height Height in 'em'.
* @param string $color Color. * @param string $color Color.
* @param boolean $return Return or paint (if false). * @param boolean $return Return or paint (if false).
* *
@ -2473,7 +2559,7 @@ function ui_print_status_image($type, $title='', $return=false, $options=false,
function ui_progress( function ui_progress(
$progress, $progress,
$width='100%', $width='100%',
$height='2.5em', $height='2.5',
$color='#80ba27', $color='#80ba27',
$return=true $return=true
) { ) {
@ -2490,8 +2576,8 @@ function ui_progress(
} }
ui_require_css_file('progress'); ui_require_css_file('progress');
$output .= '<div class="progress_main" style="width: '.$width.'; height: '.$height.';">'; $output .= '<div class="progress_main" style="width: '.$width.'; height: '.$height.'em;">';
$output .= '<span class="progress_text">'.$progress.'%</span>'; $output .= '<span class="progress_text" style="font-size:'.($height - 0.5).'em;">'.$progress.'%</span>';
$output .= '<div class="progress" style="width: '.$progress.'%;"></div>'; $output .= '<div class="progress" style="width: '.$progress.'%;"></div>';
$output .= '</div>'; $output .= '</div>';
@ -4155,7 +4241,7 @@ function ui_get_error($error_code='')
function ui_include_time_picker($echo_tags=false) function ui_include_time_picker($echo_tags=false)
{ {
if (is_ajax() || $echo_tags) { if (is_ajax() || $echo_tags) {
echo '<script type="text/javascript" src="'.ui_get_full_url(false, false, false, false).'include/javascript/jquery.ui-timepicker-addon.js'.'"></script>'; echo '<script type="text/javascript" src="'.ui_get_full_url(false, false, false, false).'include/javascript/jquery.ui-timepicker-addon.js"></script>';
} else { } else {
ui_require_jquery_file('ui-timepicker-addon'); ui_require_jquery_file('ui-timepicker-addon');
} }
@ -4251,8 +4337,8 @@ function ui_print_module_string_value(
$title_dialog = modules_get_agentmodule_agent_alias($id_agente_module).' / '.$module_name; $title_dialog = modules_get_agentmodule_agent_alias($id_agente_module).' / '.$module_name;
$salida = '<div '."id='hidden_value_module_".$id_agente_module."' $salida = '<div '."id='hidden_value_module_".$id_agente_module."'
style='display: none; width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left' title='".$title_dialog."'>".$value.'</div>'.'<span '."id='value_module_".$id_agente_module."' style='display: none; width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left' title='".$title_dialog."'>".$value.'</div><span '."id='value_module_".$id_agente_module."'
style='white-space: nowrap;'>".'<span id="value_module_text_'.$id_agente_module.'">'.$sub_string.'</span> '."<a href='javascript: toggle_full_value(".$id_agente_module.")'>".html_print_image('images/zoom.png', true).'</a>'.'</span>'; style='white-space: nowrap;'>".'<span id="value_module_text_'.$id_agente_module.'">'.$sub_string.'</span> '."<a href='javascript: toggle_full_value(".$id_agente_module.")'>".html_print_image('images/zoom.png', true).'</a></span>';
} }
} }
} }

View File

@ -5987,6 +5987,9 @@ div#bullets_modules div {
display: flex; display: flex;
margin-bottom: 20px; margin-bottom: 20px;
width: 100%; width: 100%;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
} }
.agent_details_col { .agent_details_col {
@ -5994,15 +5997,22 @@ div#bullets_modules div {
background-color: #fff; background-color: #fff;
border: 1px solid #e2e2e2; border: 1px solid #e2e2e2;
border-radius: 5px; border-radius: 5px;
flex: 0 1 auto;
margin: 5px auto;
} }
.agent_details_col_left { .agent_details_col_left {
width: 40%; width: 49.5%;
min-width: 500px; min-width: 455px;
}
.agent_details_col_right {
width: 49.5%;
min-width: 455px;
}
@media screen and (max-width: 1200px) {
.agent_details_col {
flex: 1 1 auto;
} }
.agent_details_col.agent_details_col_left {
width: 50%;
} }
.agent_details_content .agent_details_bullets { .agent_details_content .agent_details_bullets {
@ -6010,16 +6020,6 @@ div#bullets_modules div {
left: -20%; left: -20%;
} }
.agent_details_col_right {
width: 62%;
margin-left: 20px;
min-width: 670px;
}
.agent_details_col.agent_details_col_right {
width: 50%;
}
.buttons_agent_view { .buttons_agent_view {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;

View File

@ -6,6 +6,7 @@ span.progress_text {
} }
div.progress_main { div.progress_main {
display: inline-block;
text-align: center; text-align: center;
height: 2.5em; height: 2.5em;
border: 1px solid #80ba27; border: 1px solid #80ba27;

View File

@ -1,6 +1,6 @@
<?php <?php
/** /**
* Extension to schedule tasks on Pandora FMS Console * Agent status - general overview.
* *
* @category Agent view status. * @category Agent view status.
* @package Pandora FMS * @package Pandora FMS
@ -409,7 +409,7 @@ if (!empty($addresses)) {
// $data_opcional = []; // $data_opcional = [];
$data_opcional[] = '<b>'.__('Other IP addresses').'</b>'; $data_opcional[] = '<b>'.__('Other IP addresses').'</b>';
if (!empty($addresses)) { if (!empty($addresses)) {
$data_opcional[] = '<div style="max-height: 30px; overflow-y: scroll; height:30px;">'.implode('<br>', $addresses).'</div>'; $data_opcional[] = '<div style="overflow-y: scroll;">'.implode('<br>', $addresses).'</div>';
} }
array_push($data_opcional); array_push($data_opcional);