@@ -293,7 +314,8 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
'.$text_title.'
';
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 .= ''.html_print_image('images/blade.png', true, false, false, false, true).' ';
}
@@ -330,11 +352,12 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
/**
* Prints an error message.
*
- * @param mixed The string error message or array ('title', 'message', 'icon', 'no_close') to be displayed
- * @param string Any other attributes to be set for the tag.
- * @param bool Whether to output the string or return it
- * @param string What tag to use (you could specify something else than
- * h3 like div or h2)
+ * @param mixed $message The string error 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.
*/
@@ -347,11 +370,12 @@ function ui_print_error_message($message, $attributes='', $return=false, $tag='h
/**
* Prints an operation success message.
*
- * @param mixed The string message or array ('title', 'message', 'icon', 'no_close') to be displayed
- * @param string Any other attributes to be set for the tag.
- * @param bool Whether to output the string or return it
- * @param string What tag to use (you could specify something else than
- * h3 like div or h2)
+ * @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.
*/
@@ -364,11 +388,12 @@ function ui_print_success_message($message, $attributes='', $return=false, $tag=
/**
* Prints an operation info message.
*
- * @param mixed The string message or array ('title', 'message', 'icon', 'no_close') to be displayed
- * @param string Any other attributes to be set for the tag.
- * @param bool Whether to output the string or return it
- * @param string What tag to use (you could specify something else than
- * h3 like div or h2)
+ * @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.
*/
@@ -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')
{
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
*
- * @param mixed The results to evaluate. 0, NULL, false, '' or
- * 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 The string or array ('title', 'message') to be displayed if the result was bad
- * @param string Any other attributes to be set for the h3
- * @param bool Whether to output the string or return it
- * @param string What tag to use (you could specify something else than
- * h3 like div or h2)
+ * @param mixed $result The results to evaluate. 0, NULL, false, '' or
+ * array() is bad, the rest is good.
+ * @param mixed $good The string or array ('title', 'message') to be
+ * displayed if the result was good.
+ * @param mixed $bad The string or array ('title', 'message') to be
+ * displayed if the result was bad.
+ * @param string $attributes Any other attributes to be set for the h3.
+ * @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.
*/
@@ -419,11 +458,12 @@ function ui_print_result_message($result, $good='', $bad='', $attributes='', $re
/**
* Prints an warning message.
*
- * @param mixed The string warning message or array ('title', 'message', 'icon', 'no_close') to be displayed
- * @param string Any other attributes to be set for the tag.
- * @param bool Whether to output the string or return it
- * @param string What tag to use (you could specify something else than
- * h3 like div or h2)
+ * @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.
*/
@@ -438,13 +478,13 @@ function ui_print_warning_message($message, $attributes='', $return=false, $tag=
* with as title the correctly formatted full timestamp and a time comparation
* in the tag
*
- * @param int Any type of timestamp really, but we prefer unixtime
- * @param bool Whether to output the string or return it
- * @param array An array with different options for this function
- * Key html_attr: which html attributes to add (defaults to none)
- * Key tag: Which html tag to use (defaults to span)
- * Key prominent: Overrides user preference and display "comparation" or "timestamp"
- * key units: The type of units.
+ * @param integer $unixtime Any type of timestamp really, but we prefer unixtime.
+ * @param boolean $return Whether to output the string or return it.
+ * @param array $option An array with different options for this function
+ * Key html_attr: which html attributes to add (defaults to none)
+ * Key tag: Which html tag to use (defaults to span)
+ * Key prominent: Overrides user preference and display "comparation" or "timestamp"
+ * key units: The type of units.
*
* @return string HTML code if return parameter is true.
*/
@@ -452,7 +492,8 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
{
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'])) {
$attributes = $option['html_attr'];
} else {
@@ -481,7 +522,7 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
$unixtime = time_w_fixed_tz($unixtime);
}
- // prominent_time is either timestamp or comparation
+ // Prominent_time is either timestamp or comparation.
if ($unixtime <= 0) {
$title = __('Unknown').'/'.__('Never');
$data = __('Unknown');
@@ -507,13 +548,13 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
switch ($tag) {
default:
// 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.'>';
break;
case 'h1':
case 'h2':
case 'h3':
- // Above tags don't have title attributes
+ // Above tags don't have title attributes.
$output .= ' '.$attributes.' '.$style.'>'.$data.''.$tag.'>';
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.
*
- * @param string The username to render
- * @param bool Whether to return or print
+ * @param string $username The username to render.
+ * @param boolean $return Whether to return or print.
*
* @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)
{
$msg = '';
@@ -563,11 +611,14 @@ function ui_print_tags_warning($return=false)
/**
* Print group icon within a link
*
- * @param int Group id
- * @param bool Whether to return or print
- * @param string What path to use (relative to images/). Defaults to groups_small
- * @param string Style for group image
- * @param bool Whether the group have link or not
+ * @param integer $id_group Group id.
+ * @param boolean $return Whether to return or print.
+ * @param string $path What path to use (relative to images/).
+ * Defaults to groups_small.
+ * @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.
*/
@@ -583,7 +634,7 @@ function ui_print_group_icon($id_group, $return=false, $path='groups_small', $st
$output = '';
- // Don't show link in metaconsole
+ // Don't show link in metaconsole.
if (defined('METACONSOLE')) {
$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.
*
- * @param int Group id
- * @param bool Whether to return or print
- * @param string What path to use (relative to images/). Defaults to groups_small
+ * @param integer $id_group Group id.
+ * @param boolean $return Whether to return or print.
+ * @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.
*/
@@ -674,10 +728,15 @@ function ui_print_group_icon_path($id_group, $return=false, $path='images/groups
/**
* Get the icon of an operating system.
*
- * @param int Operating system id
- * @param bool Whether to also append the name of the OS after the icon
- * @param bool Whether to return or echo the result
- * @param bool Whether to apply skin or not
+ * @param integer $id_os Operating system id.
+ * @param boolean $name Whether to also append the name of OS after icon.
+ * @param boolean $return Whether to return or echo the result.
+ * @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
*/
@@ -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(
$id_os=false,
$remote_contact=false,
@@ -753,15 +824,15 @@ function ui_print_type_agent_icon(
$version=''
) {
if ($id_os == 19) {
- // Satellite
+ // Satellite.
$options['title'] = __('Satellite');
$output = html_print_image('images/op_satellite.png', true, $options, false, false, false, true);
} else if ($remote_contact == $contact && $remote == 0 && $version == '') {
- // Network
+ // Network.
$options['title'] = __('Network');
$output = html_print_image('images/network.png', true, $options, false, false, false, true);
} else {
- // Software
+ // Software.
$options['title'] = __('Software');
$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
*
- * @param int Agent id
- * @param bool Whether to return the string or echo it too
- * @param int Now uses styles to accomplish this
- * @param string Style of name in css.
- * @param string server url to concatenate at the begin of the link
- * @param string extra parameters to concatenate in the link
- * @param string name of the agent to avoid the query in some cases
- * @param bool if the agent will provided with link or not
- * @param bool use the agent alias or the name
+ * @param integer $id_agent Agent id.
+ * @param boolean $return Whether to return the string or echo it too.
+ * @param integer $cutoff Now uses styles to accomplish this.
+ * @param string $style Style of name in css.
+ * @param boolean $cutname Cut names.
+ * @param string $server_url Server url to concatenate at the begin of the link.
+ * @param string $extra_params Extra parameters to concatenate in the link.
+ * @param string $known_agent_name Name of the agent to avoid the query in some cases.
+ * @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
*/
-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 ($alias) {
$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) {
- $url = $server_url.'index.php?sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$id_agent.$extra_params;
+ $url = $server_url.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.$extra_params;
- $output = '
'.$agent_name.' ';
+ $output = '
'.$agent_name.' ';
} else {
$output = '
'.$agent_name.' ';
}
- // 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) {
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
*
- * @param array A valid (non empty) row from the alert table
- * @param bool Whether or not this is a combined alert
- * @param bool Whether to print the agent information with the module information
- * @param string Tab where the function was called from (used for urls)
- * @param mixed Style for agent name or default (false)
+ * @param array $alert A valid (non empty) row from the alert table.
+ * @param boolean $agent Whether or not this is a combined alert.
+ * @param string $url Tab where the function was called from (used for urls).
+ * @param mixed $agent_style Style for agent name or default (false).
*
* @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;
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';
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
$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 ($agent) {
$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']);
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']);
metaconsole_restore_db();
}
} else {
- // Get agent id
+ // Get agent id.
$id_agent = modules_get_agentmodule_agent($alert['id_agent_module']);
$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 = [];
- // Validate checkbox
+ // Validate checkbox.
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']] .= html_print_checkbox(
@@ -996,7 +1083,6 @@ function ui_format_alert_row($alert, $agent=true, $url='', $agent_style=false)
// Restore the default connection.
metaconsole_restore_db();
$errors++;
- // break; It does not work in the php7 version remplace for:
return false;
}
}
@@ -1018,14 +1104,14 @@ function ui_format_alert_row($alert, $agent=true, $url='', $agent_style=false)
}
}
- // Standby
+ // Standby.
$data[$index['standby']] = '';
if (isset($alert['standby']) && $alert['standby'] == 1) {
$data[$index['standby']] = html_print_image('images/bell_pause.png', true, ['title' => __('Standby on')]);
}
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 ($alert['force_execution'] == 0) {
$data[$index['force_execution']] = '
'.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force')]).' ';
@@ -1095,7 +1181,12 @@ function ui_format_alert_row($alert, $agent=true, $url='', $agent_style=false)
$actionText .= '
';
} else {
if ($actionDefault != '') {
- $actionText = db_get_sql("SELECT name FROM talert_actions WHERE id = $actionDefault").' ('.__('Default').') ';
+ $actionText = db_get_sql(
+ sprintf(
+ 'SELECT name FROM talert_actions WHERE id = %d',
+ $actionDefault
+ )
+ ).' ('.__('Default').') ';
}
}
@@ -1126,12 +1217,12 @@ function ui_format_alert_row($alert, $agent=true, $url='', $agent_style=false)
/**
* Prints a substracted string, length specified by cutoff, the full string will be in a rollover.
*
- * @param string The string to be cut
- * @param int At how much characters to cut
- * @param bool Whether to return or print it out
- * @param int Size font (fixed) in px, applyed as CSS style (optional)
+ * @param string $string The string to be cut..
+ * @param integer $cutoff At how much characters to cut.
+ * @param boolean $return Whether to return or print it out.
+ * @param integer $fontsize Size font (fixed) in px, applyed as CSS style (optional).
*
- * @return An HTML string
+ * @return string HTML string.
*/
function ui_print_string_substr($string, $cutoff=16, $return=false, $fontsize=0)
{
@@ -1152,7 +1243,8 @@ function ui_print_string_substr($string, $cutoff=16, $return=false, $fontsize=0)
$font_size_mod = "style='font-size: ".$fontsize."pt'";
}
- $string = ''.mb_substr($string2, 0, $cutoff, 'UTF-8').$string3.' ';
+ $string = '';
+ $string .= mb_substr($string2, 0, $cutoff, 'UTF-8').$string3.' ';
if ($return === false) {
echo $string;
@@ -1166,9 +1258,9 @@ function ui_print_string_substr($string, $cutoff=16, $return=false, $fontsize=0)
* Gets a helper text explaining the requirement needs for an alert template
* to get it fired.
*
- * @param int Alert template id.
- * @param bool Wheter to return or print it out.
- * @param bool Wheter to put the values in the string or not.
+ * @param integer $id_alert_template Alert template id.
+ * @param boolean $return Wheter to return or print it out.
+ * @param boolean $print_values Wheter to put the values in the string or not.
*
* @return An HTML string if return was true.
*/
@@ -1182,21 +1274,21 @@ function ui_print_alert_template_example($id_alert_template, $return=false, $pri
switch ($template['type']) {
case 'equal':
- // Do not translate the HTML attributes
+ // Do not translate the HTML attributes.
$output .= __('The alert would fire when the value is ');
break;
case 'not_equal':
- // Do not translate the HTML attributes
+ // Do not translate the HTML attributes.
$output .= __('The alert would fire when the value is not ');
break;
case 'regex':
if ($template['matches_value']) {
- // Do not translate the HTML attributes
+ // Do not translate the HTML attributes.
$output .= __('The alert would fire when the value matches ');
} else {
- // end if
+ // End if.
$output .= __('The alert would fire when the value doesn\'t match ');
}
@@ -1205,42 +1297,46 @@ function ui_print_alert_template_example($id_alert_template, $return=false, $pri
case 'max_min':
if ($template['matches_value']) {
- // Do not translate the HTML attributes
+ // Do not translate the HTML attributes.
$output .= __('The alert would fire when the value is between and ');
} else {
- // end if
+ // End if.
$output .= __('The alert would fire when the value is not between and ');
}
break;
case 'max':
- // Do not translate the HTML attributes
+ // Do not translate the HTML attributes.
$output .= __('The alert would fire when the value is over ');
-
break;
case 'min':
- // Do not translate the HTML attributes
+ // Do not translate the HTML attributes.
$output .= __('The alert would fire when the value is under ');
-
break;
case 'warning':
- // Do not translate the HTML attributes
+ // Do not translate the HTML attributes.
$output .= __('The alert would fire when the module is in warning status');
-
break;
case 'critical':
- // Do not translate the HTML attributes
+ // Do not translate the HTML attributes.
$output .= __('The alert would fire when the module is in critical status');
break;
+
+ default:
+ // Do nothing.
+ $output .= __('Unknown option.');
+ break;
}
if ($print_values) {
/*
- Replace span elements with real values. This is done in such way to avoid
- duplicating strings and make it easily modificable via Javascript. */
+ * Replace span elements with real values. This is done in such way to avoid
+ * duplicating strings and make it easily modificable via Javascript.
+ */
+
$output = str_replace(' ', $template['value'], $output);
$output = str_replace(' ', $template['max_value'], $output);
$output = str_replace(' ', $template['min_value'], $output);
@@ -1258,16 +1354,23 @@ function ui_print_alert_template_example($id_alert_template, $return=false, $pri
/**
* Prints a help tip icon.
*
- * @param string Id of the help article
- * @param bool Whether to return or output the result
- * @param string Home url if its necessary
- * @param string Image path
- * @param bool Route is relative or not
+ * @param string $help_id Id of the help article.
+ * @param boolean $return Whether to return or output the result.
+ * @param string $home_url Home url if its necessary.
+ * @param string $image Image path.
+ * @param boolean $is_relative Route is relative or not.
+ * @param string $id Target id.
*
* @return string The help tip
*/
-function ui_print_help_icon($help_id, $return=false, $home_url='', $image='images/help_green.png', $is_relative=false, $id='')
-{
+function ui_print_help_icon(
+ $help_id,
+ $return=false,
+ $home_url='',
+ $image='images/help_green.png',
+ $is_relative=false,
+ $id=''
+) {
global $config;
// Do not display the help icon if help is disabled.
@@ -1312,12 +1415,13 @@ function ui_print_help_icon($help_id, $return=false, $home_url='', $image='image
* file name should be like "name.css". The "name" would be the value
* needed to pass to this function.
*
- * @param string Script name to add without the "jquery." prefix and the ".js"
+ * @param string $name Script name to add without the "jquery." prefix and the ".js"
* suffix. Example:
*
* ui_require_css_file ('pandora');
* // Would include include/styles/pandora.js
- *
+ * .
+ * @param string $path Path where script is placed.
*
* @return boolean True if the file was added. False if the file doesn't exist.
*/
@@ -1354,13 +1458,14 @@ function ui_require_css_file($name, $path='include/styles/')
* file name should be like "name.js". The "name" would be the value
* needed to pass to this function.
*
- * @param string Script name to add without the "jquery." prefix and the ".js"
- * suffix. Example:
- *
- * ui_require_javascript_file ('pandora');
- * // Would include include/javascript/pandora.js
- *
- * @param bool Just echo the script tag of the file.
+ * @param string $name Script name to add without the "jquery." prefix and the ".js"
+ * suffix. Example:
+ *
+ * ui_require_javascript_file ('pandora');
+ * // Would include include/javascript/pandora.js
+ *
.
+ * @param string $path Path where script is placed.
+ * @param boolean $echo_tag Just echo the script tag of the file.
*
* @return boolean True if the file was added. False if the file doesn't exist.
*/
@@ -1372,7 +1477,7 @@ function ui_require_javascript_file($name, $path='include/javascript/', $echo_ta
if ($echo_tag) {
echo '';
- return;
+ return null;
}
if (! isset($config['js'])) {
@@ -1383,7 +1488,7 @@ function ui_require_javascript_file($name, $path='include/javascript/', $echo_ta
return true;
}
- // We checks two paths because it may fails on enterprise
+ // We checks two paths because it may fails on enterprise.
if (! file_exists($filename) && ! file_exists($config['homedir'].'/'.$filename)) {
return false;
}
@@ -1405,12 +1510,14 @@ function ui_require_javascript_file($name, $path='include/javascript/', $echo_ta
* file name should be like "name.js". The "name" would be the value
* needed to pass to this function.
*
- * @param string Script name to add without the "jquery." prefix and the ".js"
- * suffix. Example:
- *
- * ui_require_javascript_file ('pandora');
- * // Would include include/javascript/pandora.js
- *
+ * @param string $name Script name to add without the "jquery."
+ * prefix and the ".js"
+ * suffix. Example:
+ *
+ * ui_require_javascript_file ('pandora');
+ * // Would include include/javascript/pandora.js
+ *
.
+ * @param boolean $disabled_metaconsole Disabled metaconsole.
*
* @return boolean True if the file was added. False if the file doesn't exist.
*/
@@ -1433,7 +1540,7 @@ function ui_require_javascript_file_enterprise($name, $disabled_metaconsole=fals
return true;
}
- // We checks two paths because it may fails on enterprise
+ // We checks two paths because it may fails on enterprise.
if (!file_exists($filename)
&& !file_exists($config['homedir'].'/'.$filename)
) {
@@ -1454,13 +1561,14 @@ function ui_require_javascript_file_enterprise($name, $disabled_metaconsole=fals
* needed to pass to this function. Notice that this function does not manage
* jQuery denpendencies.
*
- * @param string Script name to add without the "jquery." prefix and the ".js"
- * suffix. Example:
- *
- * ui_require_jquery_file ('form');
- * // Would include include/javascript/jquery.form.js
- *
- * @param bool Just echo the script tag of the file.
+ * @param string $name Script name to add without the "jquery." prefix and the ".js"
+ * suffix. Example:
+ *
+ * ui_require_jquery_file ('form');
+ * // Would include include/javascript/jquery.form.js
+ *
.
+ * @param string $path Path where script is placed.
+ * @param boolean $echo_tag Just echo the script tag of the file.
*
* @return boolean True if the file was added. False if the file doesn't exist.
*/
@@ -1472,7 +1580,7 @@ function ui_require_jquery_file($name, $path='include/javascript/', $echo_tag=fa
if ($echo_tag) {
echo '';
- return;
+ return null;
}
if (! isset($config['jquery'])) {
@@ -1483,8 +1591,10 @@ function ui_require_jquery_file($name, $path='include/javascript/', $echo_tag=fa
return true;
}
- // We checks two paths because it may fails on enterprise
- if (! file_exists($filename) && ! file_exists($config['homedir'].'/'.$filename)) {
+ // We checks two paths because it may fails on enterprise.
+ if (! file_exists($filename)
+ && ! file_exists($config['homedir'].'/'.$filename)
+ ) {
return false;
}
@@ -1503,8 +1613,8 @@ function ui_require_jquery_file($name, $path='include/javascript/', $echo_tag=fa
* To add css just put them in include/styles and then add them to the
* $config['css'] array
*
- * @param string Callback will fill this with the current buffer.
- * @param bitfield Callback will fill this with a bitfield (see ob_start)
+ * @param string $string Callback will fill this with the current buffer.
+ * @param mixed $bitfield Callback will fill this with a bitfield (see ob_start).
*
* @return string String to return to the browser
*/
@@ -1514,7 +1624,7 @@ function ui_process_page_head($string, $bitfield)
global $vc_public_view;
if (isset($config['ignore_callback']) && $config['ignore_callback'] == true) {
- return;
+ return '';
}
$output = '';
@@ -1524,7 +1634,7 @@ function ui_process_page_head($string, $bitfield)
$config_refr = $config['refr'];
}
- // If user is logged or displayed view is the public view of visual console
+ // If user is logged or displayed view is the public view of visual console.
if ($config_refr > 0
&& (isset($config['id_user']) || $vc_public_view == 1)
) {
@@ -1537,8 +1647,13 @@ function ui_process_page_head($string, $bitfield)
|| $_GET['sec2'] == 'enterprise/dashboard/main_dashboard'
) {
$query = ui_get_url_refresh(false, false);
- // $output .= ' ';
+
+ /*
+ * $output .= ' ';
+ */
+
+ // End.
}
}
@@ -1558,7 +1673,8 @@ function ui_process_page_head($string, $bitfield)
';
if ($config['language'] != 'en') {
- // Load translated strings - load them last so they overload all the objects
+ // Load translated strings - load them last so they overload all
+ // the objects.
ui_require_javascript_file('time_'.$config['language']);
ui_require_javascript_file('date'.$config['language']);
ui_require_javascript_file('countdown_'.$config['language']);
@@ -1566,27 +1682,32 @@ function ui_process_page_head($string, $bitfield)
$output .= "\n\t";
- //
- // Load CSS
- //
+ /*
+ * Load CSS
+ */
+
if (empty($config['css'])) {
$config['css'] = [];
}
$login_ok = true;
if (! isset($config['id_user']) && isset($_GET['login'])) {
- if (isset($_POST['nick']) and isset($_POST['pass'])) {
+ if (isset($_POST['nick']) && isset($_POST['pass'])) {
$nick = get_parameter_post('nick');
- // This is the variable with the login
+ // This is the variable with the login.
$pass = get_parameter_post('pass');
- // This is the variable with the password
+ // This is the variable with the password.
$nick = db_escape_string_sql($nick);
$pass = db_escape_string_sql($pass);
- // process_user_login is a virtual function which should be defined in each auth file.
- // It accepts username and password. The rest should be internal to the auth file.
- // The auth file can set $config["auth_error"] to an informative error output or reference their internal error messages to it
- // process_user_login should return false in case of errors or invalid login, the nickname if correct
+ // Process_user_login is a virtual function which should be defined
+ // in each auth file.
+ // It accepts username and password. The rest should be internal to
+ // the auth file.
+ // The auth file can set $config["auth_error"] to an informative
+ // error output or reference their internal error messages to it
+ // process_user_login should return false in case of errors or
+ // invalid login, the nickname if correct.
$nick_in_db = process_user_login($nick, $pass);
if ($nick_in_db === false) {
@@ -1596,7 +1717,7 @@ function ui_process_page_head($string, $bitfield)
}
// First, if user has assigned a skin then try to use css files of
- // skin subdirectory
+ // skin subdirectory.
$isFunctionSkins = enterprise_include_once('include/functions_skins.php');
if (!$login_ok) {
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
@@ -1605,8 +1726,8 @@ function ui_process_page_head($string, $bitfield)
}
$exists_css = false;
- if ($login_ok and $isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
- // Checks if user's skin is available
+ if ($login_ok && $isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
+ // Checks if user's skin is available.
$exists_skin = enterprise_hook('skins_is_path_set');
if ($exists_skin) {
$skin_path = enterprise_hook('skins_get_skin_path');
@@ -1615,23 +1736,22 @@ function ui_process_page_head($string, $bitfield)
}
}
- // Add the jquery UI styles CSS
+ // Add the jquery UI styles CSS.
$config['css']['jquery-UI'] = 'include/styles/js/jquery-ui.min.css';
- // Add the dialog styles CSS
+ // Add the dialog styles CSS.
$config['css']['dialog'] = 'include/styles/dialog.css';
- // Add the dialog styles CSS
+ // Add the dialog styles CSS.
$config['css']['dialog'] = 'include/styles/js/introjs.css';
- // If skin's css files exists then add them
+ // If skin's css files exists then add them.
if ($exists_css) {
foreach ($skin_styles as $filename => $name) {
$style = substr($filename, 0, (strlen($filename) - 4));
$config['css'][$style] = $skin_path.'include/styles/'.$filename;
}
- }
- // Otherwise assign default and user's css
- else {
- // User style should go last so it can rewrite common styles
+ } else {
+ // Otherwise assign default and user's css.
+ // User style should go last so it can rewrite common styles.
$config['css'] = array_merge(
[
'common' => 'include/styles/common.css',
@@ -1642,7 +1762,7 @@ function ui_process_page_head($string, $bitfield)
);
}
- // We can't load empty and we loaded (conditionally) ie
+ // We can't load empty and we loaded (conditionally) ie.
$loaded = [
'',
'ie',
@@ -1659,33 +1779,35 @@ function ui_process_page_head($string, $bitfield)
$output .= ' '."\n\t";
}
- //
- // End load CSS
- //
- //
- // Load JS
- //
+ /*
+ * End load CSS
+ */
+
+ /*
+ * Load JS
+ */
+
if (empty($config['js'])) {
$config['js'] = [];
- // If it's empty, false or not init set array to empty just in case
+ // If it's empty, false or not init set array to empty just in case.
}
- // Pandora specific JavaScript should go first
+ // Pandora specific JavaScript should go first.
$config['js'] = array_merge(['pandora' => 'include/javascript/pandora.js'], $config['js']);
- // Load base64 javascript library
+ // Load base64 javascript library.
$config['js']['base64'] = 'include/javascript/encode_decode_base64.js';
- // Load webchat javascript library
+ // Load webchat javascript library.
$config['js']['webchat'] = 'include/javascript/webchat.js';
- // Load qrcode library
+ // Load qrcode library.
$config['js']['qrcode'] = 'include/javascript/qrcode.js';
- // Load intro.js library (for bubbles and clippy)
+ // Load intro.js library (for bubbles and clippy).
$config['js']['intro'] = 'include/javascript/intro.js';
$config['js']['clippy'] = 'include/javascript/clippy.js';
- // Load Underscore.js library
+ // Load Underscore.js library.
$config['js']['underscore'] = 'include/javascript/underscore-min.js';
- // Load other javascript
- // We can't load empty
+ // Load other javascript.
+ // We can't load empty.
$loaded = [''];
foreach ($config['js'] as $name => $filename) {
if (in_array($name, $loaded)) {
@@ -1698,18 +1820,20 @@ function ui_process_page_head($string, $bitfield)
$output .= ''."\n\t";
}
- //
- // End load JS
- //
- //
- // Load jQuery
- //
+ /*
+ * End load JS
+ */
+
+ /*
+ * Load jQuery
+ */
+
if (empty($config['jquery'])) {
$config['jquery'] = [];
- // If it's empty, false or not init set array to empty just in case
+ // If it's empty, false or not init set array to empty just in case.
}
- // Pandora specific jquery should go first
+ // Pandora specific jquery should go first.
$black_list_pages_old_jquery = ['operation/gis_maps/index'];
if (in_array(get_parameter('sec2'), $black_list_pages_old_jquery)) {
$config['jquery'] = array_merge(
@@ -1732,15 +1856,15 @@ function ui_process_page_head($string, $bitfield)
);
}
- // Include the datapicker language if exists
+ // Include the datapicker language if exists.
if (file_exists('include/languages/datepicker/jquery.ui.datepicker-'.$config['language'].'.js')) {
$config['jquery']['datepicker_language'] = 'include/languages/datepicker/jquery.ui.datepicker-'.$config['language'].'.js';
}
- // Include countdown library
+ // Include countdown library.
$config['jquery']['countdown'] = 'include/javascript/jquery.countdown.js';
- // Then add each script as necessary
+ // Then add each script as necessary.
$loaded = [''];
foreach ($config['jquery'] as $name => $filename) {
if (in_array($name, $loaded)) {
@@ -1753,9 +1877,10 @@ function ui_process_page_head($string, $bitfield)
$output .= ''."\n\t";
}
- //
- // End load JQuery
- //
+ /*
+ * End load JQuery
+ */
+
include_once __DIR__.'/graphs/functions_flot.php';
$output .= include_javascript_dependencies_flot_graph(true);
@@ -1772,8 +1897,8 @@ function ui_process_page_head($string, $bitfield)
/**
* Callback function to add stuff to the body
*
- * @param string Callback will fill this with the current buffer.
- * @param bitfield Callback will fill this with a bitfield (see ob_start)
+ * @param string $string Callback will fill this with the current buffer.
+ * @param mixed $bitfield Callback will fill this with a bitfield (see ob_start).
*
* @return string String to return to the browser
*/
@@ -1784,11 +1909,11 @@ function ui_process_page_body($string, $bitfield)
if (isset($config['ignore_callback'])
&& $config['ignore_callback'] == true
) {
- return;
+ return null;
}
- // Show custom background
- $output = '';
+ // Show custom background.
+ $output = '';
$output .= $string;
@@ -1805,12 +1930,15 @@ function ui_process_page_body($string, $bitfield)
* @param string $url URL of the pagination links. It must include all form
* values as GET form.
* @param integer $offset Current offset for the pagination. Default value would be
- * taken from $_REQUEST['offset']
+ * taken from $_REQUEST['offset'].
* @param integer $pagination Current pagination size. If a user requests a larger
- * pagination than config["block_size"]
- * @param boolean $return Whether to return or print this
+ * pagination than config["block_size"].
+ * @param boolean $return Whether to return or print this.
* @param string $offset_name The name of parameter for the offset.
* @param boolean $print_total_items Show the text with the total items. By default true.
+ * @param mixed $other_class Other_class.
+ * @param mixed $script Script.
+ * @param mixed $parameter_script Parameter_script.
* @param string $set_id Set id of div.
*
* @return string The pagination div or nothing if no pagination needs to be done
@@ -1851,10 +1979,12 @@ function ui_pagination(
}
if (!empty($set_id)) {
- $set_id = " id = '$set_id'";
+ $set_id = " id = '".$set_id."'";
}
- // Pagination links for users include delete, create and other params, now not use these params, and not retry the previous action when go to pagination link.
+ // Pagination links for users include delete, create and other params,
+ // now not use these params, and not retry the previous action when go to
+ // pagination link.
$remove = [
'user_del',
'disable_user',
@@ -1864,7 +1994,10 @@ function ui_pagination(
$finalUrl = [];
foreach ($url as $key => $value) {
- if (strpos($value, $remove[0]) === false && strpos($value, $remove[1]) === false && strpos($value, $remove[2]) === false) {
+ if (strpos($value, $remove[0]) === false
+ && strpos($value, $remove[1]) === false
+ && strpos($value, $remove[2]) === false
+ ) {
array_push($finalUrl, $value);
}
}
@@ -1878,14 +2011,15 @@ function ui_pagination(
Pagination needs $url to build the base URL to render links, its a base url, like
" http://pandora/index.php?sec=godmode&sec2=godmode/admin_access_logs "
*/
+
$block_limit = PAGINATION_BLOCKS_LIMIT;
- // Visualize only $block_limit blocks
+ // Visualize only $block_limit blocks.
if ($count <= $pagination) {
if ($print_total_items) {
- $output = "';
}
- // Actually print the variable given
+ // Actually print the variable given.
echo '';
print_r($var);
echo ' ';
@@ -2253,18 +2415,32 @@ function ui_debug($var, $backtrace=true)
/**
* Prints icon of a module type
*
- * @param int Module Type ID
- * @param bool Whether to return or print
- * @param boolean $relative Whether to use relative path to image or not (i.e. $relative= true : /pandora/).
- * @param boolean $options Whether to use image options like style, border or title on the icon.
+ * @param integer $id_moduletype Module Type ID.
+ * @param boolean $return Whether to return or print.
+ * @param boolean $relative Whether to use relative path to image or not (i.e. $relative= true : /pandora/).
+ * @param boolean $options Whether to use image options like style, border or title on the icon.
+ * @param boolean $src Src.
*
* @return string An HTML string with the icon. Printed if return is false
*/
-function ui_print_moduletype_icon($id_moduletype, $return=false, $relative=false, $options=true, $src=false)
-{
+function ui_print_moduletype_icon(
+ $id_moduletype,
+ $return=false,
+ $relative=false,
+ $options=true,
+ $src=false
+) {
global $config;
- $type = db_get_row('ttipo_modulo', 'id_tipo', (int) $id_moduletype, ['descripcion', 'icon']);
+ $type = db_get_row(
+ 'ttipo_modulo',
+ 'id_tipo',
+ (int) $id_moduletype,
+ [
+ 'descripcion',
+ 'icon',
+ ]
+ );
if ($type === false) {
$type = [];
$type['descripcion'] = __('Unknown type');
@@ -2306,15 +2482,23 @@ function ui_print_moduletype_icon($id_moduletype, $return=false, $relative=false
/**
* Print module max/min values for warning/critical state
*
- * @param float Max value for warning state
- * @param float Min value for warning state
- * @param float Max value for critical state
- * @param float Min value for critical state
+ * @param float $max_warning Max value for warning state.
+ * @param float $min_warning Min value for warning state.
+ * @param string $str_warning String warning state.
+ * @param float $max_critical Max value for critical state.
+ * @param float $min_critical Min value for critical state.
+ * @param string $str_critical String for critical state.
*
* @return string HTML string
*/
-function ui_print_module_warn_value($max_warning, $min_warning, $str_warning, $max_critical, $min_critical, $str_critical)
-{
+function ui_print_module_warn_value(
+ $max_warning,
+ $min_warning,
+ $str_warning,
+ $max_critical,
+ $min_critical,
+ $str_critical
+) {
$data = "";
if ($max_warning != $min_warning) {
@@ -2339,7 +2523,8 @@ function ui_print_module_warn_value($max_warning, $min_warning, $str_warning, $m
/**
* Format a file size from bytes to a human readable meassure.
*
- * @param int File size in bytes
+ * @param integer $bytes File size in bytes.
+ *
* @return string Bytes converted to a human readable meassure.
*/
function ui_format_filesize($bytes)
@@ -2400,16 +2585,52 @@ function ui_get_status_images_path()
/**
* Prints an image representing a status.
*
- * @param string
- * @param string
- * @param bool Whether to return an output string or echo now (optional, echo by default).
- * @param array options to set image attributes: I.E.: style
- * @param Path of the image, if not provided use the status path
+ * @param string $type Type.
+ * @param string $title Title.
+ * @param boolean $return Whether to return an output string or echo now (optional, echo by default).
+ * @param array $options Options to set image attributes: I.E.: style.
+ * @param string $path Path of the image, if not provided use the status path.
+ * @param boolean $rounded_image Round.
*
* @return string HTML code if return parameter is true.
*/
-function ui_print_status_image($type, $title='', $return=false, $options=false, $path=false)
-{
+function ui_print_status_image(
+ $type,
+ $title='',
+ $return=false,
+ $options=false,
+ $path=false,
+ $rounded_image=false
+) {
+ // This is for the List of Modules in Agent View.
+ if ($rounded_image === true) {
+ switch ($type) {
+ case 'module_ok.png':
+ $type = 'module_ok_rounded.png';
+ break;
+
+ case 'module_critical.png':
+ $type = 'module_critical_rounded.png';
+ break;
+
+ case 'module_warning.png':
+ $type = 'module_warning_rounded.png';
+ break;
+
+ case 'module_no_data.png':
+ $type = 'module_no_data_rounded.png';
+ break;
+
+ case 'module_unknown.png':
+ $type = 'module_unknown_rounded.png';
+ break;
+
+ default:
+ $type = $type;
+ break;
+ }
+ }
+
if ($path === false) {
$imagepath_array = ui_get_status_images_path();
$imagepath = $imagepath_array[0];
@@ -2430,46 +2651,327 @@ function ui_print_status_image($type, $title='', $return=false, $options=false,
/**
- * Print a code into a DIV and enable a toggle to show and hide it
+ * Prints an image representing a status.
*
- * @param string html code
- * @param string name of the link
- * @param string title of the link
- * @param bool if the div will be hidden by default (default: true)
- * @param bool Whether to return an output string or echo now (default: true)
+ * @param string $status Module status.
+ * @param string $title Title.
+ * @param boolean $return Whether to return an output string or echo now (optional, echo by default).
+ * @param array $options Options to set image attributes: I.E.: style.
+ * @param boolean $rounded_image Round.
+ *
+ * @return string HTML.
*/
+function ui_print_module_status(
+ $status,
+ $title='',
+ $return=false,
+ $options=false,
+ $rounded_image=false
+) {
+ global $config;
-
-function ui_toggle($code, $name, $title='', $hidden_default=true, $return=false, $toggle_class='')
-{
- // Generate unique Id
- $uniqid = uniqid('');
-
- // Options
- if ($hidden_default) {
- $style = 'display:none';
- $image_a = html_print_image('images/down.png', true, false, true);
- $image_b = html_print_image('images/go.png', true, false, true);
- $original = 'images/go.png';
- } else {
- $style = '';
- $image_a = html_print_image('images/down.png', true, false, true);
- $image_b = html_print_image('images/go.png', true, false, true);
- $original = 'images/down.png';
+ if ($options === false) {
+ $options = [];
}
- // Link to toggle
+ $options['style'] .= 'width: 50px;';
+ $options['style'] .= 'height: 2em;';
+ $options['style'] .= 'display: inline-block;';
+
+ include_once __DIR__.'/functions_modules.php';
+ $options['style'] .= 'background: '.modules_get_color_status($status).';';
+
+ if ($rounded_image === true) {
+ $options['style'] .= 'border-radius: 5px;';
+ }
+
+ $options['title'] = $title;
+ $options['data-title'] = $title;
+ $options['data-use_title_for_force_title'] = 1;
+ $options['class'] = 'forced_title';
+
+ $output = ' $v) {
+ $output .= $k.'="'.$v.'"';
+ }
+
+ $output .= '>';
+ $output .= '
';
+
+ if ($return === false) {
+ echo $output;
+ }
+
+ return $output;
+
+}
+
+
+/**
+ * Generates a progress bar CSS based.
+ * Requires css progress.css
+ *
+ * @param integer $progress Progress.
+ * @param string $width Width.
+ * @param integer $height Height in 'em'.
+ * @param string $color Color.
+ * @param boolean $return Return or paint (if false).
+ * @param boolean $text Text to be displayed,by default progress %.
+ *
+ * @return string HTML code.
+ */
+function ui_progress(
+ $progress,
+ $width='100%',
+ $height='2.5',
+ $color='#80ba27',
+ $return=true,
+ $text=''
+) {
+ if (!$progress) {
+ $progress = 0;
+ }
+
+ if ($progress > 100) {
+ $progress = 100;
+ }
+
+ if ($progress < 0) {
+ $progress = 0;
+ }
+
+ if (empty($text)) {
+ $text = $progress.'%';
+ }
+
+ ui_require_css_file('progress');
+ $output .= '';
+ $output .= '
'.$text.' ';
+ $output .= '
';
+ $output .= '
';
+
+ if (!$return) {
+ echo $output;
+ }
+
+ return $output;
+}
+
+
+/**
+ * Returns a div wich represents the type received.
+ *
+ * Requires ui_require_css_file('events');.
+ *
+ * @param integer $type Event type.
+ * @param boolean $return Or print.
+ * @param boolean $mini Show mini div.
+ *
+ * @return string HTML.
+ */
+function ui_print_event_type(
+ $type,
+ $return=false,
+ $mini=false
+) {
+ global $config;
+
$output = '';
- $output .= ''.html_print_image($original, true, ['title' => $title, 'id' => 'image_'.$uniqid]).' '.$name.' ';
+ switch ($type) {
+ case EVENTS_ALERT_FIRED:
+ case EVENTS_ALERT_RECOVERED:
+ case EVENTS_ALERT_CEASED:
+ case EVENTS_ALERT_MANUAL_VALIDATION:
+ $text = __('ALERT');
+ $color = COL_ALERTFIRED;
+ break;
+
+ case EVENTS_RECON_HOST_DETECTED:
+ case EVENTS_SYSTEM:
+ case EVENTS_ERROR:
+ case EVENTS_NEW_AGENT:
+ case EVENTS_CONFIGURATION_CHANGE:
+ $text = __('SYSTEM');
+ $color = COL_MAINTENANCE;
+ break;
+
+ case EVENTS_GOING_UP_WARNING:
+ case EVENTS_GOING_DOWN_WARNING:
+ $color = COL_WARNING;
+ $text = __('WARNING');
+ break;
+
+ case EVENTS_GOING_DOWN_NORMAL:
+ case EVENTS_GOING_UP_NORMAL:
+ $color = COL_NORMAL;
+ $text = __('NORMAL');
+ break;
+
+ case EVENTS_GOING_DOWN_CRITICAL:
+ case EVENTS_GOING_UP_CRITICAL:
+ $color = COL_CRITICAL;
+ $text = __('CRITICAL');
+ break;
+
+ case EVENTS_UNKNOWN:
+ case EVENTS_GOING_UNKNOWN:
+ default:
+ $color = COL_UNKNOWN;
+ $text = __('UNKNOWN');
+ break;
+ }
+
+ if ($mini === false) {
+ $output = '';
+ $output .= $text;
+ $output .= '
';
+ } else {
+ $output = '';
+ $output .= '
';
+ }
+
+ return $output;
+}
+
+
+/**
+ * Returns a div wich represents the priority received.
+ *
+ * Requires ui_require_css_file('events');.
+ *
+ * @param integer $priority Priority level.
+ * @param boolean $return Or print.
+ * @param boolean $mini Show mini div.
+ *
+ * @return string HTML.
+ */
+function ui_print_event_priority(
+ $priority,
+ $return=false,
+ $mini=false
+) {
+ global $config;
+
+ $output = '';
+ switch ($priority) {
+ case EVENT_CRIT_MAINTENANCE:
+ $color = COL_MAINTENANCE;
+ $criticity = __('MAINTENANCE');
+ break;
+
+ case EVENT_CRIT_INFORMATIONAL:
+ $color = COL_INFORMATIONAL;
+ $criticity = __('INFORMATIONAL');
+ break;
+
+ case EVENT_CRIT_NORMAL:
+ $color = COL_NORMAL;
+ $criticity = __('NORMAL');
+ break;
+
+ case EVENT_CRIT_WARNING:
+ $color = COL_WARNING;
+ $criticity = __('WARNING');
+ break;
+
+ case EVENT_CRIT_CRITICAL:
+ $color = COL_CRITICAL;
+ $criticity = __('CRITICAL');
+ break;
+
+ case EVENT_CRIT_MINOR:
+ $color = COL_MINOR;
+ $criticity = __('MINOR');
+ break;
+
+ case EVENT_CRIT_MAJOR:
+ $color = COL_MAJOR;
+ $criticity = __('MAJOR');
+ break;
+
+ default:
+ $color = COL_UNKNOWN;
+ $criticity = __('UNKNOWN');
+ break;
+ }
+
+ if ($mini === false) {
+ $output = '';
+ $output .= $criticity;
+ $output .= '
';
+ } else {
+ $output = '';
+ $output .= '
';
+ }
+
+ return $output;
+}
+
+
+/**
+ * Print a code into a DIV and enable a toggle to show and hide it.
+ *
+ * @param string $code Html code.
+ * @param string $name Name of the link.
+ * @param string $title Title of the link.
+ * @param boolean $hidden_default If the div will be hidden by default (default: true).
+ * @param boolean $return Whether to return an output string or echo now (default: true).
+ * @param string $toggle_class Toggle class.
+ *
+ * @return string HTML.
+ */
+function ui_toggle(
+ $code,
+ $name,
+ $title='',
+ $hidden_default=true,
+ $return=false,
+ $toggle_class='',
+ $container_class='white-box-content'
+) {
+ // Generate unique Id.
+ $uniqid = uniqid('');
+
+ $image_a = html_print_image('images/arrow_down_green.png', true, false, true);
+ $image_b = html_print_image('images/arrow_right_green.png', true, false, true);
+ // Options.
+ if ($hidden_default) {
+ $style = 'display:none';
+ $original = 'images/arrow_right_green.png';
+ } else {
+ $style = '';
+ $original = 'images/arrow_down_green.png';
+ }
+
+ // Link to toggle.
+ $output = '';
+ $output .= '';
// $output .= '
';
// if (!defined("METACONSOLE"))
// $output .= '
';
// Code into a div
- $output .= "
\n";
+ $output .= "
\n";
+ $output .= '
';
$output .= $code;
$output .= '
';
+ $output .= '
';
- // JQuery Toggle
+ // JQuery Toggle.
$output .= '';
+ $output .= '
';
if (!$return) {
echo $output;
@@ -2501,26 +3004,28 @@ function ui_toggle($code, $name, $title='', $hidden_default=true, $return=false,
/**
* Construct and return the URL to be used in order to refresh the current page correctly.
*
- * @param array Extra parameters to be added to the URL. It has prevalence over
- * GET and POST. False values will be ignored.
- * @param bool Whether to return the relative URL or the absolute URL. Returns
- * relative by default
- * @param bool Whether to add POST values to the URL.
+ * @param array $params Extra parameters to be added to the URL. It has prevalence over
+ * GET and POST. False values will be ignored.
+ * @param boolean $relative Whether to return the relative URL or the absolute URL. Returns
+ * relative by default.
+ * @param boolean $add_post Whether to add POST values to the URL.
+ *
+ * @return string Url.
*/
function ui_get_url_refresh($params=false, $relative=true, $add_post=true)
{
- // Agent selection filters and refresh
+ // Agent selection filters and refresh.
global $config;
- // slerena, 8/Ene/2015 - Need to put index.php on URL which have it.
+ // Slerena, 8/Ene/2015 - Need to put index.php on URL which have it.
if (strpos($_SERVER['REQUEST_URI'], 'index.php') === false) {
$url = '';
} else {
$url = 'index.php';
}
- if (sizeof($_REQUEST)) {
- // Some (old) browsers don't like the ?&key=var
+ if (count($_REQUEST)) {
+ // Some (old) browsers don't like the ?&key=var.
$url .= '?';
}
@@ -2528,12 +3033,12 @@ function ui_get_url_refresh($params=false, $relative=true, $add_post=true)
$params = [];
}
- // Avoid showing login info
+ // Avoid showing login info.
$params['pass'] = false;
$params['nick'] = false;
$params['unnamed'] = false;
- // We don't clean these variables up as they're only being passed along
+ // We don't clean these variables up as they're only being passed along.
foreach ($_GET as $key => $value) {
if (isset($params[$key])) {
continue;
@@ -2610,7 +3115,7 @@ function ui_get_url_refresh($params=false, $relative=true, $add_post=true)
}
}
- // Removes final &
+ // Removes final &.
$pos = strrpos($url, '&', 0);
if ($pos) {
$url = substr_replace($url, '', $pos, 5);
@@ -2631,9 +3136,10 @@ function ui_get_url_refresh($params=false, $relative=true, $add_post=true)
*
* An example of full URL is http:/localhost/pandora_console/index.php?sec=gsetup&sec2=godmode/setup/setup
*
- * @param mixed $url If provided, it will be added after the index.php, but it is false boolean value, put the homeurl in the url.
- * @param boolean $no_proxy To avoid the proxy checks, by default it is false.
- * @param boolean $metaconsole_root Set the root to the metaconsole dir if the metaconsole is enabled, true by default.
+ * @param mixed $url If provided, it will be added after the index.php, but it is false boolean value, put the homeurl in the url.
+ * @param boolean $no_proxy To avoid the proxy checks, by default it is false.
+ * @param boolean $add_name_php_file Something.
+ * @param boolean $metaconsole_root Set the root to the metaconsole dir if the metaconsole is enabled, true by default.
*
* @return string A full URL in Pandora.
*/
@@ -2642,7 +3148,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
global $config;
$port = null;
- // null means 'use the starndard port'
+ // Null means 'use the starndard port'.
$proxy = false;
// By default Pandora FMS doesn't run across proxy.
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
@@ -2660,7 +3166,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
$port = $_SERVER['SERVER_PORT'];
}
} else if ($config['https']) {
- // When $config["https"] is set, enforce https
+ // When $config["https"] is set, enforce https.
$protocol = 'https';
} else {
$protocol = 'http';
@@ -2673,7 +3179,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
if (!$no_proxy) {
// Check if the PandoraFMS runs across the proxy like as
// mod_proxy of Apache
- // and check if public_url is setted
+ // and check if public_url is set.
if (!empty($config['public_url'])
&& (!empty($_SERVER['HTTP_X_FORWARDED_HOST']))
) {
@@ -2686,9 +3192,9 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
$fullurl = $protocol.'://'.$_SERVER['SERVER_NAME'];
}
- // using a different port than the standard
+ // Using a different port than the standard.
if (!$proxy) {
- // using a different port than the standard
+ // Using a different port than the standard.
if ($port != null) {
$fullurl .= ':'.$port;
}
@@ -2704,7 +3210,7 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
if ($proxy) {
$url = '';
} else {
- // Only add the home url
+ // Only add the home url.
$url = $config['homeurl_static'].'/';
}
@@ -2750,16 +3256,21 @@ function ui_get_full_url($url='', $no_proxy=false, $add_name_php_file=false, $me
/**
* Return a standard page header (Pandora FMS 3.1 version)
*
- * @param string Title
- * @param string Icon path
- * @param boolean Return (false will print using a echo)
- * @param boolean help (Help ID to print the Help link)
- * @param boolean Godmode (false = operation mode).
- * @param string Options (HTML code for make tabs or just a brief info string
+ * @param string $title Title.
+ * @param string $icon Icon path.
+ * @param boolean $return Return (false will print using a echo).
+ * @param boolean $help Help (Help ID to print the Help link).
+ * @param boolean $godmode Godmode (false = operation mode).
+ * @param string $options Options (HTML code for make tabs or just a brief
+ * info string.
+ * @param mixed $modal Modal.
+ * @param mixed $message Message.
+ * @param mixed $numChars NumChars.
+ * @param mixed $alias Alias.
+ * @param mixed $breadcrumbs Breadcrumbs.
+ *
* @return string Header HTML
*/
-
-
function ui_print_page_header(
$title,
$icon='',
@@ -2795,6 +3306,7 @@ function ui_print_page_header(
$buffer = '
';
if (!empty($breadcrumbs)) {
+ $buffer .= '';
+ if (!empty($breadcrumbs)) {
+ $buffer .= '
';
+ }
+
if (is_array($options)) {
$buffer .= '
".''.$sub_string.' '."".html_print_image('images/zoom.png', true).' ';
}
}
}
@@ -4180,7 +4715,12 @@ function ui_print_module_string_value(
/**
- * Displays a tag list
+ * Displays a tag list.
+ *
+ * @param string $title Title.
+ * @param array $tags Tags.
+ *
+ * @return void
*/
function ui_print_tags_view($title='', $tags=[])
{
@@ -4209,33 +4749,35 @@ function ui_print_tags_view($title='', $tags=[])
/**
- * @brief Get the link to open a snapshot into a new page
+ * Gets the link to open a snapshot into a new page.
*
- * @param Array Params to build the link (see $default_params)
- * @param bool Flag to choose de return value:
- * true: Get the four params required in the function of pandora.js winopen_var (js use)
- * false: Get an inline winopen_var function call (php user)
+ * @param array $params Params to build the link (see $default_params).
+ * @param boolean $only_params Flag to choose de return value:
+ * true: Get the four params required in the function of pandora.js winopen_var (js use)
+ * false: Get an inline winopen_var function call (php user).
+ *
+ * @return string Link.
*/
function ui_get_snapshot_link($params, $only_params=false)
{
global $config;
$default_params = [
+ // Id_agente_modulo.
'id_module' => 0,
- // id_agente_modulo
'module_name' => '',
'interval' => 300,
'timestamp' => 0,
'id_node' => 0,
];
- // Merge default params with passed params
+ // Merge default params with passed params.
$params = array_merge($default_params, $params);
- // First parameter of js winopeng_var
+ // First parameter of js winopeng_var.
$page = $config['homeurl_static'].'/operation/agentes/snapshot_view.php';
- $url = "$page?".'id='.$params['id_module'].'&label='.rawurlencode(urlencode(io_safe_output($params['module_name']))).'&id_node='.$params['id_node'];
+ $url = $page.'?id='.$params['id_module'].'&label='.rawurlencode(urlencode(io_safe_output($params['module_name']))).'&id_node='.$params['id_node'];
if ($params['timestamp'] != 0) {
$url .= '×tamp='.$params['timestamp'];
@@ -4245,7 +4787,7 @@ function ui_get_snapshot_link($params, $only_params=false)
$url .= '&refr='.$params['interval'];
}
- // Second parameter of js winopeng_var
+ // Second parameter of js winopeng_var.
$win_handle = dechex(crc32('snapshot_'.$params['id_module']));
$link_parts = [
@@ -4255,30 +4797,30 @@ function ui_get_snapshot_link($params, $only_params=false)
480,
];
- // Return only the params to js execution
+ // Return only the params to js execution.
if ($only_params) {
return $link_parts;
}
- // Return the function call to inline js execution
+ // Return the function call to inline js execution.
return "winopeng_var('".implode("', '", $link_parts)."')";
}
/**
- * @brief Get the snapshot image with the link to open a snapshot into a new page
+ * Get the snapshot image with the link to open a snapshot into a new page
*
- * @param string Built link
- * @param bool Picture image or list image
+ * @param string $link Built link.
+ * @param boolean $is_image Picture image or list image.
*
- * @return string HTML anchor link with image
+ * @return string HTML anchor link with image.
*/
function ui_get_snapshot_image($link, $is_image)
{
- $image_name = $is_image ? 'photo.png' : 'default_list.png';
+ $image_name = ($is_image) ? 'photo.png' : 'default_list.png';
$link = '
'.html_print_image(
- "images/$image_name",
+ 'images/'.$image_name,
true,
[
'border' => '0',
@@ -4291,6 +4833,14 @@ function ui_get_snapshot_image($link, $is_image)
}
+/**
+ * Show warning timezone missmatch.
+ *
+ * @param string $tag Tag.
+ * @param boolean $return Return.
+ *
+ * @return string HTML.
+ */
function ui_get_using_system_timezone_warning($tag='h3', $return=true)
{
global $config;
@@ -4302,7 +4852,7 @@ function ui_get_using_system_timezone_warning($tag='h3', $return=true)
__('These controls are using the timezone of the system (%s) instead of yours (%s). The difference with your time zone in hours is %s.'),
$config['timezone'],
date_default_timezone_get(),
- $user_offset > 0 ? '+'.$user_offset : $user_offset
+ ($user_offset > 0) ? '+'.$user_offset : $user_offset
);
return ui_print_info_message($message, '', $return, $tag);
} else {
@@ -4315,13 +4865,13 @@ function ui_get_using_system_timezone_warning($tag='h3', $return=true)
/**
* Get the custom docs logo
*
- * @return string with the path to logo. False if it should not be displayed
+ * @return string with the path to logo. False if it should not be displayed.
*/
function ui_get_docs_logo()
{
global $config;
- // Default logo to open version (enterprise_installed function only works in login status)
+ // Default logo to open version (enterprise_installed function only works in login status).
if (!file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
return 'images/icono_docs.png';
}
@@ -4337,13 +4887,13 @@ function ui_get_docs_logo()
/**
* Get the custom support logo
*
- * @return string with the path to logo. False if it should not be displayed
+ * @return string with the path to logo. False if it should not be displayed.
*/
function ui_get_support_logo()
{
global $config;
- // Default logo to open version (enterprise_installed function only works in login status)
+ // Default logo to open version (enterprise_installed function only works in login status).
if (!file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
return 'images/icono_support.png';
}
@@ -4359,7 +4909,9 @@ function ui_get_support_logo()
/**
* Get the custom header logo
*
- * @return string with the path to logo. If it is not set, return the default value
+ * @param boolean $white_bg Using white bg or not.
+ *
+ * @return string with the path to logo. If it is not set, return the default value.
*/
function ui_get_custom_header_logo($white_bg=false)
{
@@ -4369,7 +4921,7 @@ function ui_get_custom_header_logo($white_bg=false)
return 'images/pandora_tinylogo_open.png';
}
- $stored_logo = is_metaconsole() ? ($white_bg ? $config['meta_custom_logo_white_bg'] : $config['meta_custom_logo']) : ($white_bg ? $config['custom_logo_white_bg'] : $config['custom_logo']);
+ $stored_logo = (is_metaconsole()) ? (($white_bg) ? $config['meta_custom_logo_white_bg'] : $config['meta_custom_logo']) : (($white_bg) ? $config['custom_logo_white_bg'] : $config['custom_logo']);
if (empty($stored_logo)) {
return 'images/pandora_tinylogo.png';
}
@@ -4422,7 +4974,7 @@ function ui_get_favicon()
global $config;
if (empty($config['custom_favicon'])) {
- return !is_metaconsole() ? 'images/pandora.ico' : 'enterprise/meta/images/favicon_meta.ico';
+ return (!is_metaconsole()) ? 'images/pandora.ico' : 'enterprise/meta/images/favicon_meta.ico';
}
return 'images/custom_favicon/'.$config['custom_favicon'];
@@ -4432,6 +4984,11 @@ function ui_get_favicon()
/**
* Show sorting arrows for tables
*
+ * @param string $url_up Url_up.
+ * @param string $url_down Url_down.
+ * @param string $selectUp SelectUp.
+ * @param string $selectDown SelectDown.
+ *
* @return string HTML anchor link with the arrow icon.
*/
function ui_get_sorting_arrows($url_up, $url_down, $selectUp, $selectDown)
@@ -4458,3 +5015,24 @@ function ui_get_sorting_arrows($url_up, $url_down, $selectUp, $selectDown)
'.html_print_image($arrow_down, true, ['alt' => 'down']).'
';
}
+
+
+/**
+ * Show breadcrums in the page titles
+ *
+ * @param string $tab_name Tab name.
+ *
+ * @return string HTML anchor with the name of the section.
+ */
+function ui_print_breadcrums($tab_name)
+{
+ if (is_array($tab_name)) {
+ return join(' / ', $tab_name);
+ } else if ($tab_name != '') {
+ $section = str_replace('_', ' ', $tab_name);
+ $section = ucwords($section);
+ $section = ' / '.___($section);
+ }
+
+ return $section;
+}
diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php
index 2ad669308f..129baaa54e 100644
--- a/pandora_console/include/graphs/functions_d3.php
+++ b/pandora_console/include/graphs/functions_d3.php
@@ -720,3 +720,48 @@ function print_clock_digital_1($time_format, $timezone, $clock_animation, $width
return $output;
}
+
+
+/**
+ * Print dougnhnut.
+ *
+ * @param array $colors Colors.
+ * @param integer $width Width.
+ * @param integer $height Height.
+ * @param array $data Data.
+ * @param mixed $data_total Data_total.
+ *
+ * @return string HTML.
+ */
+function print_donut_narrow_graph(
+ array $colors,
+ $width,
+ $height,
+ array $data,
+ $data_total
+) {
+ if (empty($data)) {
+ return graph_nodata_image($width, $height, 'pie');
+ }
+
+ $series = count($data);
+ if (($series != count($colors)) || ($series == 0)) {
+ return '';
+ }
+
+ $data = json_encode($data);
+ $colors = json_encode($colors);
+
+ $graph_id = uniqid('graph_');
+
+ $out = "
";
+ $out .= include_javascript_d3(true);
+ $out .= "";
+
+ return $out;
+}
diff --git a/pandora_console/include/graphs/functions_gd.php b/pandora_console/include/graphs/functions_gd.php
index 262ed22bb3..10f566185d 100755
--- a/pandora_console/include/graphs/functions_gd.php
+++ b/pandora_console/include/graphs/functions_gd.php
@@ -344,9 +344,9 @@ function drawRating($rating, $width, $height, $font, $out_of_lim_str, $mode, $fo
$image = imagecreate($width, $height);
// colors
- $back = imagecolorallocate($image, 255, 255, 255);
+ $back = imagecolorallocate($image, 241, 241, 241);
- $bordercolor = imagecolorallocate($image, 174, 174, 174);
+ $bordercolor = imagecolorallocate($image, 241, 241, 241);
$text = imagecolorallocate($image, 74, 74, 74);
$red = imagecolorallocate($image, 255, 60, 75);
$green = imagecolorallocate($image, 50, 205, 50);
@@ -483,7 +483,7 @@ function gd_progress_bar($width, $height, $progress, $title, $font, $out_of_lim_
break;
case 1:
- drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 6, $value_text, $color);
+ drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 9, $value_text, $color);
break;
diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js
index 6bc3d72d66..427de827e3 100644
--- a/pandora_console/include/graphs/pandora.d3.js
+++ b/pandora_console/include/graphs/pandora.d3.js
@@ -2113,8 +2113,7 @@ function print_circular_progress_bar(
var progress = startPercent;
- if (transition == 0)
- updateProgress(endPercent);
+ if (transition == 0) updateProgress(endPercent);
else {
(function loops() {
updateProgress(progress);
@@ -2762,3 +2761,224 @@ function valueToBytes(value) {
// This will actually do the rounding and the decimals.
return value.toFixed(2) + shorts[pos] + "B";
}
+
+function donutNarrowGraph(colores, width, height, total) {
+ // Default settings
+ var donutbody = d3.select("body");
+ var data = {};
+ // var showTitle = true;
+
+ if (width == "") {
+ width = 180;
+ }
+
+ if (height == "") {
+ height = 180;
+ }
+
+ var radius = Math.min(width, height) / 2;
+
+ var currentVal;
+ //var color = d3.scale.category20();
+
+ var colores_index = [];
+ var colores_value = [];
+
+ $.each(colores, function(index, value) {
+ colores_index.push(index);
+ colores_value.push(value);
+ });
+
+ var color = d3.scale
+ .ordinal()
+ .domain(colores_index)
+ .range(colores_value);
+
+ var pie = d3.layout
+ .pie()
+ .sort(null)
+ .value(function(d) {
+ return d.value;
+ });
+
+ var svg, g, arc;
+
+ var object = {};
+
+ // Method for render/refresh graph
+ object.render = function() {
+ if (!svg) {
+ // Show normal status by default. This variable must be initialized here, before clearing data.
+ var normal_status = data.Normal;
+
+ // Don't draw 0 or invalid values. console.log(data);
+ var data_map = $.map(data, function(value, index) {
+ if (value == 0 || isNaN(value)) {
+ return index;
+ }
+ });
+
+ $.each(data_map, function(i, val) {
+ delete data[val];
+ });
+ //New data: console.log(data);
+
+ arc = d3.svg
+ .arc()
+ .outerRadius(radius)
+ .innerRadius(radius - radius / 2.5);
+
+ svg = donutbody
+ .append("svg")
+ .attr("width", width)
+ .attr("height", height)
+ .append("g")
+ .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
+
+ g = svg
+ .selectAll(".arc")
+ .data(pie(d3.entries(data)))
+ .enter()
+ .append("g")
+ .attr("class", "arc");
+
+ g.append("path")
+ // Attach current value to g so that we can use it for animation
+ .each(function(d) {
+ this._current = d;
+ })
+ .attr("d", arc)
+ .attr("stroke", "white")
+ .style("stroke-width", 2)
+ .style("fill", function(d) {
+ return color(d.data.key);
+ });
+ // This is to show labels on the graph
+ /* g.append("text")
+ .attr("transform", function(d) {
+ return "translate(" + arc.centroid(d) + ")";
+ })
+ .attr("dy", ".35em")
+ .style("text-anchor", "middle");
+ g.select("text").text(function(d) {
+ return d.data.key;
+ });*/
+
+ // Show normal status by default.
+ var percentage_normal;
+ svg
+ .append("text")
+ .datum(data)
+ .attr("x", 0)
+ .attr("y", 0 + radius / 10)
+ .attr("class", "text-tooltip")
+ .style("text-anchor", "middle")
+ .attr("font-weight", "bold")
+ .style("font-family", "Arial, Verdana")
+ //.attr("fill", "#82b92e")
+ .style("font-size", function(d) {
+ if (normal_status) {
+ percentage_normal = (normal_status * 100) / total;
+ if (Number.isInteger(percentage_normal)) {
+ percentage_normal = percentage_normal.toFixed(0);
+ return radius / 3 + "px";
+ } else {
+ percentage_normal = percentage_normal.toFixed(1);
+ return radius / 3.5 + "px";
+ }
+ }
+ })
+ .text(function(d) {
+ if (normal_status) {
+ return percentage_normal + "%";
+ } else {
+ return "0%";
+ }
+ });
+
+ g.on("mouseover", function(obj) {
+ //console.log(obj);
+ var percentage;
+ svg
+ .select("text.text-tooltip")
+ // This is to paint the text of the corresponding color.
+ /* .attr("fill", function(d) {
+ return color(obj.data.key);
+ })*/
+ .style("font-size", function(d) {
+ percentage = (d[obj.data.key] * 100) / total;
+ if (Number.isInteger(percentage)) {
+ percentage = percentage.toFixed(0);
+ return radius / 3 + "px";
+ } else {
+ percentage = percentage.toFixed(1);
+ return radius / 3.5 + "px";
+ }
+ })
+ .text(percentage + "%");
+ });
+
+ g.on("mouseout", function(obj) {
+ svg.select("text.text-tooltip").text(function(d) {
+ if (normal_status) {
+ return percentage_normal + "%";
+ } else {
+ return "0%";
+ }
+ });
+ // .attr("fill", "#82b92e");
+ });
+ } else {
+ g.data(pie(d3.entries(data)))
+ .exit()
+ .remove();
+
+ g.select("path")
+ .transition()
+ .duration(200)
+ .attrTween("d", function(a) {
+ var i = d3.interpolate(this._current, a);
+ this._current = i(0);
+ return function(t) {
+ return arc(i(t));
+ };
+ });
+
+ g.select("text").attr("transform", function(d) {
+ return "translate(" + arc.centroid(d) + ")";
+ });
+
+ svg.select("text.text-tooltip").datum(data);
+ }
+ return object;
+ };
+
+ // Getter and setter methods
+ object.data = function(value) {
+ if (!arguments.length) return data;
+ data = value;
+ return object;
+ };
+
+ object.donutbody = function(value) {
+ if (!arguments.length) return donutbody;
+ donutbody = value;
+ return object;
+ };
+
+ object.width = function(value) {
+ if (!arguments.length) return width;
+ width = value;
+ radius = Math.min(width, height) / 2;
+ return object;
+ };
+
+ object.height = function(value) {
+ if (!arguments.length) return height;
+ height = value;
+ radius = Math.min(width, height) / 2;
+ return object;
+ };
+
+ return object;
+}
diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js
index d5413e3c09..351531a5e9 100644
--- a/pandora_console/include/javascript/pandora.js
+++ b/pandora_console/include/javascript/pandora.js
@@ -1226,7 +1226,7 @@ function paint_qrcode(text, where, width, height) {
text: text,
width: width,
height: height,
- colorDark: "#3B6941",
+ colorDark: "#343434",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.M
});
diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js
index d6a8e1bfe0..0487923b38 100644
--- a/pandora_console/include/javascript/pandora_modules.js
+++ b/pandora_console/include/javascript/pandora_modules.js
@@ -196,10 +196,10 @@ function configure_modules_form() {
);
$("#text-unit").attr("value", data["unit"] == "" ? "" : data["unit"]);
$("#checkbox-critical_inverse").prop(
- "checked",
+ "uncheck",
data["critical_inverse"]
);
- $("#checkbox-warning_inverse").prop("checked", data["warning_inverse"]);
+ $("#checkbox-warning_inverse").prop("uncheck", data["warning_inverse"]);
$("#component_loading").hide();
$("#id_module_type").change();
if ($("#id_category").is("select")) {
diff --git a/pandora_console/include/styles/agent_manager.css b/pandora_console/include/styles/agent_manager.css
new file mode 100644
index 0000000000..fc648aefba
--- /dev/null
+++ b/pandora_console/include/styles/agent_manager.css
@@ -0,0 +1,158 @@
+/*
+ * ---------------------------------------------------------------------
+ * - Create/Update Agent - agent_manager.php
+ * ---------------------------------------------------------------------
+ */
+.agent_options {
+ width: 100%;
+ margin-right: 0px;
+ display: flex;
+ flex-flow: row wrap;
+ flex-direction: row;
+ justify-content: space-between;
+ box-sizing: border-box;
+}
+
+.agent_options_update {
+ width: 85%;
+ margin-right: 20px;
+}
+
+.agent_options_column_left,
+.agent_options_column_right {
+ width: 50%;
+ box-sizing: border-box;
+}
+
+.agent_options_column_left {
+ padding-right: 50px;
+}
+
+.agent_qr {
+ width: 15%;
+ text-align: center;
+ box-sizing: border-box;
+ padding: 20px 0px;
+ display: flex;
+ justify-content: center;
+ flex-direction: column;
+ min-width: 150px;
+}
+
+a#qr_code_agent_view {
+ margin-top: 5px;
+}
+
+.first_row .agent_options_column_right select,
+.first_row .agent_options_column_right input,
+.first_row .agent_options_column_left select#grupo {
+ width: 95%;
+ box-sizing: border-box;
+}
+
+.first_row .agent_options_column_left .p-switch {
+ margin-right: 5px;
+ margin-left: 10px;
+}
+
+.agent_options_column_left input#text-direccion,
+.agent_options_column_left select#address_list,
+.agent_options_column_left input#text-agente,
+.agent_options_column_left input#text-alias {
+ width: 100%;
+ box-sizing: border-box;
+}
+
+.agent_options_agent_name > * {
+ margin-left: 5px;
+}
+
+.custom_fields_table {
+ border-spacing: 0px;
+}
+
+.custom_fields_table tr.datos {
+ background-color: #f7f7f7;
+ display: none;
+}
+
+.custom_fields_table tr.datos2 {
+ cursor: pointer;
+}
+
+.custom_fields_table tr td {
+ border: 1px solid #e0e0e0;
+}
+
+.custom_fields_table tr.datos2 td div.field_title {
+ padding: 10px;
+}
+
+.custom_fields_table tr.datos2 td {
+ border-radius: 4px;
+ padding: 0px;
+}
+
+.custom_fields_table tr.datos td {
+ padding: 15px 10px;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+}
+
+.custom_fields_table .custom_field_row_opened td {
+ border-bottom-left-radius: 0px !important;
+ border-bottom-right-radius: 0px !important;
+}
+
+.secondary_groups_select {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-bottom: 15px;
+}
+
+.secondary_groups_select .secondary_groups_select_arrows input {
+ display: grid;
+ margin: 0 auto;
+}
+
+.secondary_groups_select .secondary_groups_list_left {
+ text-align: right;
+ width: 50%;
+}
+
+.secondary_groups_select .secondary_groups_list_right {
+ text-align: left;
+ width: 50%;
+}
+
+.secondary_groups_select .secondary_groups_select_arrows {
+ padding: 0 50px;
+}
+
+.secondary_groups_select_arrows a {
+ display: block;
+}
+
+.agent_options_adv .agent_options_column_right .label_select select,
+.agent_options_adv .agent_options_column_right .label_select input[type="text"],
+.agent_options_adv #text-custom_id,
+.agent_options_adv #cps {
+ width: 100%;
+ box-sizing: border-box;
+}
+
+.agent_options_adv .label_select_simple.label_simple_one_item .p-switch {
+ margin-right: 5px;
+}
+
+.agent_description {
+ min-height: 4.8em !important;
+}
+.agent_custom_id {
+ padding-bottom: 0.7em;
+ padding-top: 0.5em;
+ display: inline-block;
+ border-radius: 5px !important;
+ border: 1px solid #ccc;
+}
diff --git a/pandora_console/include/styles/agent_view.css b/pandora_console/include/styles/agent_view.css
new file mode 100644
index 0000000000..fca8aaa4fc
--- /dev/null
+++ b/pandora_console/include/styles/agent_view.css
@@ -0,0 +1,19 @@
+text.text-tooltip {
+ font-family: "lato-bolder", "Open Sans", sans-serif !important;
+}
+
+div#bullets_modules span {
+ font-family: "lato-bolder", "Open Sans", sans-serif !important;
+}
+
+table#agent_interface_info .noresizevc.graph {
+ width: 500px !important;
+}
+
+div.agent_details_agent_alias {
+ flex: 1;
+}
+
+div.agent_details_agent_alias * {
+ font-family: "lato-bolder", "Open Sans", sans-serif !important;
+}
diff --git a/pandora_console/include/styles/discovery.css b/pandora_console/include/styles/discovery.css
index 6df04ae736..0209a43a8e 100644
--- a/pandora_console/include/styles/discovery.css
+++ b/pandora_console/include/styles/discovery.css
@@ -27,6 +27,11 @@ li.discovery > a label {
cursor: pointer;
}
+div.data_container > label {
+ font-family: "lato-bolder", "Open Sans", sans-serif !important;
+ font-weight: lighter;
+}
+
div.data_container {
width: 100%;
height: 100%;
@@ -120,7 +125,6 @@ div.arrow_box:before {
border-top-right-radius: 7px;
border-top-left-radius: 7px;
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1);
- flex-direction: column;
}
#menu_tab_frame_view_bc .breadcrumbs_container {
@@ -160,6 +164,10 @@ span.breadcrumb_link {
* Discovery forms structure
*/
+form.discovery * {
+ font-size: 10pt;
+}
+
.edit_discovery_info {
display: flex;
align-items: flex-start;
@@ -196,7 +204,9 @@ li > input[type="password"],
background-color: transparent !important;
border: none;
border-radius: 0 !important;
- border-bottom: 1px solid #343434;
+ border-bottom: 1px solid #ccc;
+ font-family: "lato-bolder", "Open Sans", sans-serif !important;
+ font-weight: lighter;
padding: 0px 0px 2px 0px;
box-sizing: border-box;
margin-bottom: 4px;
@@ -215,7 +225,7 @@ li > input[type="password"],
}
.discovery_list_input option {
- text-align: center;
+ text-align: left;
}
.discovery_list_input option:checked {
diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css
new file mode 100644
index 0000000000..20b1f59d15
--- /dev/null
+++ b/pandora_console/include/styles/events.css
@@ -0,0 +1,20 @@
+div.criticity {
+ width: 150px;
+ height: 2em;
+ color: #fff;
+ text-align: center;
+ border-radius: 5px;
+ font-size: 0.8em;
+ padding: 3px;
+ margin: 0;
+ display: table-cell;
+ vertical-align: middle;
+}
+
+div.mini-criticity {
+ width: 5px;
+ height: 4em;
+ padding: 0;
+ margin: 0;
+ display: inline-block;
+}
diff --git a/pandora_console/include/styles/js/cluetip.css b/pandora_console/include/styles/js/cluetip.css
index dea766762b..233dbf3cbb 100644
--- a/pandora_console/include/styles/js/cluetip.css
+++ b/pandora_console/include/styles/js/cluetip.css
@@ -13,7 +13,7 @@
width: 43px;
height: 11px;
position: absolute;
- background-image: url(../../images/wait.gif);
+ background-image: url(../../../images/wait.gif);
}
.cluetip-arrows {
display: none;
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index bc0a76d185..b4fa370521 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -278,13 +278,11 @@ select:-webkit-autofill:focus {
}
/* All select type multiple */
-select[multiple] option:checked,
select[multiple] option:checked {
background: #82b92e linear-gradient(0deg, #82b92e 0%, #82b92e 100%);
color: #fff !important;
}
-select option:checked,
select option:checked {
background-color: #82b92e;
color: #fff !important;
@@ -305,7 +303,7 @@ select:-internal-list-box {
}
.DejaVuSerif-Bold {
- font-family: DejaVuSerif-BoldFont;
+ font-family: DejaVuSerif-BoldFont, sans-serif;
}
@font-face {
@@ -314,7 +312,7 @@ select:-internal-list-box {
}
.DejaVuSerif-BoldItalic {
- font-family: DejaVuSerif-BoldItalicFont;
+ font-family: DejaVuSerif-BoldItalicFont, sans-serif;
}
@font-face {
@@ -323,7 +321,7 @@ select:-internal-list-box {
}
.DejaVuSerif-Italic {
- font-family: DejaVuSerif-ItalicFont;
+ font-family: DejaVuSerif-ItalicFont, sans-serif;
}
@font-face {
@@ -332,7 +330,7 @@ select:-internal-list-box {
}
.DejaVuSerif {
- font-family: DejaVuSerifFont;
+ font-family: DejaVuSerifFont, sans-serif;
}
@font-face {
@@ -341,7 +339,7 @@ select:-internal-list-box {
}
.DejaVuSerifCondensed-Bold {
- font-family: DejaVuSerifCondensed-BoldFont;
+ font-family: DejaVuSerifCondensed-BoldFont, sans-serif;
}
@font-face {
@@ -350,7 +348,7 @@ select:-internal-list-box {
}
.DejaVuSerifCondensed-BoldItalic {
- font-family: DejaVuSerifCondensed-BoldItalicFont;
+ font-family: DejaVuSerifCondensed-BoldItalicFont, sans-serif;
}
@font-face {
@@ -359,7 +357,7 @@ select:-internal-list-box {
}
.DejaVuSerifCondensed-Italic {
- font-family: DejaVuSerifCondensed-ItalicFont;
+ font-family: DejaVuSerifCondensed-ItalicFont, sans-serif;
}
@font-face {
@@ -368,7 +366,7 @@ select:-internal-list-box {
}
.DejaVuSerifCondensed {
- font-family: DejaVuSerifCondensedFont;
+ font-family: DejaVuSerifCondensedFont, sans-serif;
}
@font-face {
@@ -377,7 +375,7 @@ select:-internal-list-box {
}
.FreeSans {
- font-family: FreeSansFont;
+ font-family: FreeSansFont, sans-serif;
}
@font-face {
@@ -386,7 +384,7 @@ select:-internal-list-box {
}
.FreeSansBold {
- font-family: FreeSansBoldFont;
+ font-family: FreeSansBoldFont, sans-serif;
}
@font-face {
@@ -395,7 +393,7 @@ select:-internal-list-box {
}
.smallfont {
- font-family: smallfontFont;
+ font-family: smallfontFont, sans-serif;
}
@font-face {
@@ -423,7 +421,7 @@ select:-internal-list-box {
src: url("../../fonts/leaguegothic.woff") format("woff");
}
.unicode {
- font-family: unicodeFont;
+ font-family: unicodeFont, sans-serif;
}
/*
@@ -431,6 +429,52 @@ select:-internal-list-box {
* - GLOBAL STYLES -
* ---------------------------------------------------------------------
*/
+.w10p {
+ max-width: 10%;
+}
+
+.w20p {
+ max-width: 20%;
+}
+
+.w30p {
+ max-width: 30%;
+}
+
+.w40p {
+ max-width: 40%;
+}
+
+.w50p {
+ max-width: 50%;
+}
+
+.w100p {
+ max-width: 100%;
+}
+
+.no-padding {
+ padding: 0;
+}
+.no-padding-imp {
+ padding: 0 !important;
+}
+.no-margin {
+ margin: 0;
+}
+.box-shadow {
+ box-shadow: 0px 0px 15px -4px #dadada;
+}
+.align-top td {
+ vertical-align: top;
+}
+.no-td-borders td {
+ border: none !important;
+}
+.no-td-padding td {
+ padding: 0 !important;
+}
+
div#page {
background: #fbfbfb;
background-image: none;
@@ -523,14 +567,18 @@ input.sub {
font-weight: normal;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
+ height: auto !important;
border-radius: 2px;
- font-size: 8pt;
- background-color: #333 !important;
- background-repeat: no-repeat !important;
- background-position: 92% 3px !important;
- color: white !important;
- padding: 3px 3px 5px 12px;
- border-color: #333;
+ font-size: 1.2em;
+ background-color: #fff;
+ background-repeat: no-repeat;
+ background-position: 92% 10px;
+ color: #000;
+ padding-bottom: 10px;
+ padding-top: 10px;
+ padding-left: 15px;
+ border-color: #888;
+ font-family: "lato", "Open Sans", sans-serif !important;
}
input.sub[disabled] {
@@ -1278,12 +1326,12 @@ div.title_line {
* ---------------------------------------------------------------------
*/
#menu_tab_frame,
-#menu_tab_frame_view {
+#menu_tab_frame_view,
+#menu_tab_frame_view_bc {
display: flex;
align-items: flex-end;
justify-content: space-between;
border-bottom: 2px solid #82b92e;
- max-height: 50px;
min-height: 50px;
width: 100%;
padding-right: 0px;
@@ -1297,8 +1345,43 @@ div.title_line {
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
}
+/* Breadcrum */
+#menu_tab_frame_view_bc {
+ min-height: 55px;
+ align-items: unset;
+}
+
+#menu_tab_frame_view_bc .breadcrumbs_container {
+ align-self: flex-start;
+}
+
+.menu_tab_left_bc {
+ flex-direction: column;
+ display: flex;
+ justify-content: space-between;
+ margin-right: 20px;
+ overflow: hidden;
+}
+
+.breadcrumbs_container {
+ padding-left: 10px;
+ padding-top: 4px;
+ text-indent: 0.25em;
+ color: #848484;
+ font-size: 10pt !important;
+ font-family: "lato-bolder", "Open Sans", sans-serif !important;
+}
+
+.breadcrumb_active {
+ color: #82b92e;
+ font-size: 10pt !important;
+ font-family: "lato-bolder", "Open Sans", sans-serif !important;
+}
+/* End - Breadcrum */
+
#menu_tab {
margin-right: 10px;
+ min-width: 510px;
}
#menu_tab .mn,
@@ -1337,13 +1420,6 @@ div.title_line {
color: #fff;
}
-#menu_tab li.nomn,
-#menu_tab li.nomn_high {
- min-width: 30px;
- height: 29px;
- margin-top: 0;
-}
-
/* --- Tabs Submenu --- */
ul.subsubmenu {
border-bottom-right-radius: 5px;
@@ -1423,9 +1499,9 @@ div#agent_wizard_subtabs {
#menu_tab_left li.view {
margin-left: 0px !important;
- overflow-y: hidden;
padding-left: 10px;
padding-bottom: 4px;
+ white-space: nowrap;
}
#menu_tab_left li.view img.bottom {
@@ -1436,8 +1512,9 @@ div#agent_wizard_subtabs {
#menu_tab_left li a,
#menu_tab_left li span {
color: #343434;
- font-size: 16pt;
- line-height: 16pt;
+ font-family: "lato-bolder", "Open Sans", sans-serif !important;
+ font-size: 18pt;
+ line-height: 18pt;
}
/*
@@ -1742,12 +1819,14 @@ div#main_pure {
/* big_data is used in tactical and logon_ok */
.big_data {
text-decoration: none;
- font: bold 2em Arial, Sans-serif;
+ font-family: "lato", "Open Sans", sans-serif;
+ font-size: 2em;
}
.med_data {
text-decoration: none;
- font: bold 1.5em Arial, Sans-serif;
+ font-family: "lato", "Open Sans", sans-serif;
+ font-size: 1.5em;
}
.notify {
@@ -2294,6 +2373,7 @@ td.cellBig {
tr.group_view_data,
.group_view_data {
color: #3f3f3f;
+ font-family: "lato", "Open Sans", sans-serif;
}
tr.group_view_crit,
@@ -2422,6 +2502,8 @@ select {
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
+ font-family: "lato-bolder", "Open Sans", sans-serif;
+ font-size: 10pt;
}
/* plugins */
@@ -2860,6 +2942,7 @@ a.tip {
a.tip > img {
margin-left: 2px;
margin-right: 2px;
+ margin-top: -3px;
}
.head_tip {
@@ -3222,7 +3305,8 @@ table#policy_modules td * {
color: #fff;
margin: 2px;
padding: 10px 30px;
- font-size: 15px;
+ font-size: 16px;
+ font-family: "lato-bolder", "Open Sans", sans-serif;
font-weight: bold;
border-radius: 2px;
}
@@ -3293,13 +3377,18 @@ div.div_groups_status {
#menu_tab li.nomn_high {
padding-right: 8px;
padding-left: 8px;
- padding-top: 6px;
font-weight: bold;
text-decoration: none;
font-size: 14px;
margin-top: 0;
min-width: 30px;
- height: 40px;
+ min-height: 50px;
+ max-height: 53px;
+}
+
+#menu_tab_frame_view_bc #menu_tab li.nomn,
+#menu_tab_frame_view_bc #menu_tab li.nomn_high {
+ min-height: 53px;
}
#menu_tab li:hover {
@@ -3315,7 +3404,7 @@ div.div_groups_status {
#menu_tab li.nomn img,
#menu_tab li img {
- margin-top: 3px;
+ margin-top: 10px;
margin-left: 3px;
}
@@ -3673,7 +3762,7 @@ ul.events_tabs:after {
ul.events_tabs > li {
margin: 0 !important;
- width: 20%;
+ width: 100%;
text-align: center;
float: none !important;
outline-width: 0;
@@ -3682,7 +3771,7 @@ ul.events_tabs > li {
ul.events_tabs > li.ui-state-default {
background: #fff !important;
border: none !important;
- border-bottom: 2px solid black !important;
+ border-bottom: 2px solid #cacaca !important;
}
ul.events_tabs > li a {
@@ -4852,7 +4941,7 @@ input:checked + .p-slider:before {
/* New white rounded boxes */
.white_box {
background-color: #fff;
- border: 1px solid #f3f3f3;
+ border: 1px solid #e1e1e1;
border-radius: 5px;
padding: 20px 50px;
}
@@ -5043,7 +5132,7 @@ input:checked + .p-slider:before {
#autorefresh_list_out,
#autorefresh_list {
- text-align: center;
+ text-align: left;
}
.autorefresh_select .autorefresh_select_list_out,
@@ -5110,6 +5199,9 @@ table.info_table {
background-color: #fff;
margin-bottom: 10px;
border-spacing: 0;
+ border-collapse: collapse;
+ overflow: hidden;
+ border-radius: 5px;
}
table.info_table > tbody > tr:nth-child(even) {
@@ -5118,7 +5210,6 @@ table.info_table > tbody > tr:nth-child(even) {
table.info_table tr:first-child > th {
background-color: #fff;
- border-top: 1px solid #e2e2e2;
color: #000;
text-align: left;
vertical-align: middle;
@@ -5131,25 +5222,25 @@ table.info_table th {
background-color: #fff;
}
-table.info_table > thead > tr > th:first-child {
- border-left: 1px solid #e2e2e2;
-}
-
-table.info_table > thead > tr > th:last-child {
- border-right: 1px solid #e2e2e2;
-}
-
table.info_table tr th {
border-bottom: 1px solid #e2e2e2;
}
+/* Radius top */
+table.info_table > thead > tr:first-child > th:first-child {
+ border-top-left-radius: 4px;
+}
table.info_table > thead > tr:first-child > th:last-child {
border-top-right-radius: 4px;
}
-table.info_table > thead > tr:first-child > th:first-child {
+/* Radius bottom */
+table.info_table > tbody > tr:last-child > td:first-child {
border-top-left-radius: 4px;
}
+table.info_table > tbody > tr:last-child > td:last-child {
+ border-top-right-radius: 4px;
+}
table.info_table > thead > tr > th,
table.info_table > tbody > tr > th,
@@ -5163,6 +5254,10 @@ table.info_table > thead > tr > th a {
font-size: 8.6pt;
}
+table.info_table > tbody > tr {
+ border-bottom: 1px solid #e2e2e2;
+}
+
table.info_table > tbody > tr > td {
-moz-border-radius: 0px;
-webkit-border-radius: 0px;
@@ -5172,23 +5267,6 @@ table.info_table > tbody > tr > td {
padding-right: 9px;
padding-top: 7px;
padding-bottom: 7px;
- border-bottom: 1px solid #e2e2e2;
-}
-
-table.info_table > tbody > tr:last-child > td:first-child {
- border-bottom-left-radius: 4px;
-}
-
-table.info_table > tbody > tr > td:first-child {
- border-left: 1px solid #e2e2e2;
-}
-
-table.info_table > tbody > tr:last-child > td:last-child {
- border-bottom-right-radius: 4px;
-}
-
-table.info_table > tbody > tr > td:last-child {
- border-right: 1px solid #e2e2e2;
}
table.info_table > tbody > tr > td > img,
@@ -5448,6 +5526,9 @@ table.info_table.policy_sub_table {
.sort_arrow a {
padding: 0 0 0 5px !important;
}
+.sort_arrow img {
+ width: 0.8em;
+}
/*
* ---------------------------------------------------------------------
@@ -5501,9 +5582,6 @@ table.info_table.policy_sub_table {
color: #fff;
}
-.pagination .total_pages {
-}
-
.pagination .total_number {
display: flex;
justify-content: flex-end;
@@ -5591,7 +5669,9 @@ table.info_table.policy_sub_table {
background-color: transparent !important;
border: none;
border-radius: 0 !important;
- border-bottom: 1px solid #343434;
+ border-bottom: 1px solid #ccc;
+ font-family: "lato-bolder", "Open Sans", sans-serif !important;
+ font-size: 10pt;
padding: 2px 5px;
box-sizing: border-box;
background-repeat: no-repeat;
@@ -5599,154 +5679,6 @@ table.info_table.policy_sub_table {
margin-bottom: 4px;
}
-/*
- * ---------------------------------------------------------------------
- * - Create/Update Agent - agent_manager.php
- * ---------------------------------------------------------------------
- */
-.agent_options {
- width: 100%;
- margin-right: 0px;
- display: flex;
- flex-flow: row wrap;
- flex-direction: row;
- justify-content: space-between;
- box-sizing: border-box;
-}
-
-.agent_options_update {
- width: 85%;
- margin-right: 20px;
-}
-
-.agent_options_column_left,
-.agent_options_column_right {
- width: 50%;
- box-sizing: border-box;
-}
-
-.agent_options_column_left {
- padding-right: 50px;
-}
-
-.agent_qr {
- width: 15%;
- text-align: center;
- box-sizing: border-box;
- padding: 20px 0px;
- display: flex;
- justify-content: center;
- flex-direction: column;
- min-width: 150px;
-}
-
-a#qr_code_agent_view {
- margin-top: 5px;
-}
-
-.first_row .agent_options_column_right select,
-.first_row .agent_options_column_right input,
-.first_row .agent_options_column_left select#grupo {
- width: 95%;
- box-sizing: border-box;
-}
-
-.first_row .agent_options_column_left .p-switch {
- margin-right: 5px;
- margin-left: 10px;
-}
-
-.agent_options_column_left input#text-direccion,
-.agent_options_column_left select#address_list,
-.agent_options_column_left input#text-agente,
-.agent_options_column_left input#text-alias {
- width: 100%;
- box-sizing: border-box;
-}
-
-.agent_options_agent_name > * {
- margin-left: 5px;
-}
-
-.custom_fields_table {
- border-spacing: 0px;
-}
-
-.custom_fields_table tr.datos {
- background-color: #f7f7f7;
- display: none;
-}
-
-.custom_fields_table tr.datos2 {
- cursor: pointer;
-}
-
-.custom_fields_table tr td {
- border: 1px solid #e0e0e0;
-}
-
-.custom_fields_table tr.datos2 td div.field_title {
- padding: 10px;
-}
-
-.custom_fields_table tr.datos2 td {
- border-radius: 4px;
- padding: 0px;
-}
-
-.custom_fields_table tr.datos td {
- padding: 15px 10px;
- border-bottom-left-radius: 4px;
- border-bottom-right-radius: 4px;
-}
-
-.custom_fields_table .custom_field_row_opened td {
- border-bottom-left-radius: 0px !important;
- border-bottom-right-radius: 0px !important;
-}
-
-.secondary_groups_select {
- display: flex;
- align-items: center;
- justify-content: center;
- margin-bottom: 15px;
-}
-
-.secondary_groups_select .secondary_groups_select_arrows input {
- display: grid;
- margin: 0 auto;
-}
-
-.secondary_groups_select .secondary_groups_list_left {
- text-align: right;
- width: 50%;
-}
-
-.secondary_groups_select .secondary_groups_list_right {
- text-align: left;
- width: 50%;
-}
-
-.secondary_groups_select .secondary_groups_select_arrows {
- padding: 0 50px;
-}
-
-.secondary_groups_select_arrows a {
- display: block;
-}
-
-.agent_options_adv .agent_options_column_right .label_select select,
-.agent_options_adv .agent_options_column_right .label_select input[type="text"],
-.agent_options_adv #text-custom_id,
-.agent_options_adv #cps {
- width: 100%;
- box-sizing: border-box;
-}
-
-.agent_options_adv .label_select_simple.label_simple_one_item .p-switch {
- margin-right: 5px;
-}
-
/*
* ---------------------------------------------------------------------
* - CLASSES FOR THE NEW TOGGLES -
@@ -5758,9 +5690,10 @@ a#qr_code_agent_view {
.ui_toggle > a:first-child {
background-color: #fff;
- border: 1px solid #f3f3f3;
+ border: 1px solid #e1e1e1;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
+ margin-bottom: -1px;
padding: 5px;
display: block;
}
@@ -5859,3 +5792,307 @@ a#qr_code_agent_view {
padding: 15px;
border-top: none;
}
+
+/*
+ * ---------------------------------------------------------------------
+ * - AGENT VIEW
+ * ---------------------------------------------------------------------
+ */
+
+.bullet_modules {
+ width: 15px;
+ height: 15px;
+ border-radius: 50%;
+ margin-right: 5px;
+ margin-top: -2px;
+}
+
+div#bullets_modules {
+ display: flex;
+ margin-left: 2em;
+}
+
+div#bullets_modules div {
+ display: flex;
+ align-items: center;
+ margin: 0 5px;
+}
+
+.orange_background {
+ background: #ffa631;
+}
+.red_background {
+ background: #fc4444;
+}
+.yellow_background {
+ background: #fad403;
+}
+.grey_background {
+ background: #b2b2b2;
+}
+.blue_background {
+ background: #3ba0ff;
+}
+.green_background {
+ background: #80ba27;
+}
+
+/* First row in agent view */
+#agent_details_first_row {
+ display: flex;
+ margin-bottom: 20px;
+ width: 100%;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: space-between;
+}
+
+.agent_details_col {
+ display: table-cell;
+ background-color: #fff;
+ border: 1px solid #e2e2e2;
+ border-radius: 5px;
+ flex: 0 1 auto;
+}
+
+.agent_details_col_left {
+ width: 40%;
+ min-width: 300px;
+}
+.agent_details_col_right {
+ width: 59%;
+ min-width: 480px;
+}
+
+.agent_access_rate_events {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: space-between;
+}
+
+.white_table_graph#table_access_rate {
+ flex: 1 1 auto;
+ min-width: 450px;
+ margin-right: 1%;
+}
+
+.white_table_graph#table_events {
+ flex: 1 1 auto;
+ min-width: 450px;
+}
+
+@media screen and (max-width: 1150px) {
+ .agent_details_col {
+ flex: 1 1 auto;
+ }
+ .white_table_graph#table_access_rate {
+ margin-right: 0;
+ }
+}
+
+.buttons_agent_view {
+ display: flex;
+ justify-content: flex-end;
+}
+
+.buttons_agent_view a img {
+ border: 1px solid #dcdcdc;
+ border-radius: 4px;
+ padding: 1px;
+ box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
+ max-width: 21px;
+ margin-left: 5px;
+}
+
+/* Agent details in agent view */
+div#status_pie path {
+ stroke-width: 8px !important;
+}
+div#status_pie {
+ margin-bottom: 2em;
+}
+
+.agent_details_header {
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+ border-bottom: 1px solid #e2e2e2;
+ padding: 6px 20px;
+}
+
+.agent_details_content {
+ display: flex;
+ align-items: center;
+ padding: 20px;
+ padding-bottom: 0;
+}
+
+.agent_details_agent_name {
+ display: flex;
+ align-items: center;
+}
+
+.agent_details_remote_cfg {
+ align-self: flex-start;
+}
+
+.agent_details_graph {
+ text-align: center;
+ margin: 0 auto;
+}
+
+.agent_details_info {
+ max-width: 45%;
+ overflow: hidden;
+ min-width: 220px;
+}
+.agent_details_info span {
+ text-overflow: ellipsis;
+}
+
+.agent_details_info p {
+ display: flex;
+ align-items: center;
+}
+
+.agent_details_info img {
+ padding-right: 5px;
+}
+
+.agent_details_bullets #bullets_modules {
+ display: flex;
+ justify-content: flex-start;
+}
+
+.agent_details_bullets #bullets_modules > div {
+ display: flex;
+ align-items: center;
+ padding-bottom: 20px;
+}
+
+#agent_contact_main tr td img {
+ max-width: 100%;
+}
+
+/* White tables to show graphs */
+.white_table_graph {
+ margin-bottom: 20px;
+}
+
+.white_table_graph_header {
+ padding: 10px 20px;
+ background-color: #fff;
+ color: #000;
+ border: 1px solid #e2e2e2;
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+ font-weight: bold;
+}
+
+.white_table_graph_header div#bullets_modules {
+ float: right;
+}
+.white_table_graph_header img,
+.white_table_graph_header span {
+ vertical-align: middle;
+}
+
+.white_table_graph_header span {
+ padding-left: 10px;
+}
+
+.white-box-content {
+ width: 100%;
+ height: 100%;
+ background-color: #fff;
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+}
+
+.white_table_graph_content {
+ border: 1px solid #e2e2e2;
+ border-top: none;
+ background-color: #fff;
+ padding: 20px;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ align-items: center;
+ flex-wrap: wrap;
+}
+
+.white_table_graph_content.no-padding-imp .info_box {
+ margin: 0 !important;
+}
+
+.white_table_graph_content.min-height-100 {
+ min-height: 100px;
+}
+
+.white_table_graph_content.min-height-50 {
+ min-height: 50px;
+}
+
+.white_table_graph_content.min-height-200 {
+ min-height: 200px;
+}
+
+.white_table_graph_content div.pagination {
+ width: 100%;
+ padding: 0 1em;
+}
+.white_table_graph_content div.action-buttons {
+ padding: 10px;
+}
+
+/* White tables */
+.white_table,
+.white_table tr:first-child > th {
+ background-color: #fff;
+ color: #000;
+}
+
+.white_table {
+ border: 1px solid #e2e2e2;
+ border-radius: 4px;
+ margin-bottom: 20px;
+ padding-bottom: 10px;
+}
+
+.white_table thead tr:first-child > th {
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+ border-bottom: 1px solid #e2e2e2;
+}
+
+.white_table tbody tr:first-child > td {
+ padding-top: 25px;
+}
+
+.white_table tr td:first-child,
+.white_table tr th:first-child {
+ padding-left: 50px;
+}
+
+.white_table tr td:last-child,
+.white_table tr th:last-child {
+ padding-right: 50px;
+}
+
+.white_table th,
+.white_table td {
+ padding: 10px 20px;
+}
+
+.white_table_droppable > thead > tr > th > img {
+ vertical-align: middle;
+}
+
+.white_table_droppable tr th:first-child {
+ padding-left: 20px;
+}
+
+.white_table_no_border {
+ border: none !important;
+}
diff --git a/pandora_console/include/styles/progress.css b/pandora_console/include/styles/progress.css
new file mode 100644
index 0000000000..84c3224f27
--- /dev/null
+++ b/pandora_console/include/styles/progress.css
@@ -0,0 +1,20 @@
+span.progress_text {
+ position: absolute;
+ font-family: "lato-bolder", "Open Sans", sans-serif;
+ font-size: 2em;
+ margin-left: -0.5em;
+}
+
+div.progress_main {
+ display: inline-block;
+ text-align: center;
+ height: 2.5em;
+ border: 1px solid #80ba27;
+}
+
+div.progress {
+ width: 0%;
+ background: #80ba27;
+ height: 100%;
+ float: left;
+}
diff --git a/pandora_console/index.php b/pandora_console/index.php
index 730e404a20..06793c1a87 100755
--- a/pandora_console/index.php
+++ b/pandora_console/index.php
@@ -623,10 +623,9 @@ if (! isset($config['id_user'])) {
header('Location: '.$config['homeurl'].'index.php'.$redirect_url);
exit;
- // Always exit after sending location headers
- }
- // Hash login process
- else if (isset($_GET['loginhash'])) {
+ // Always exit after sending location headers.
+ } else if (isset($_GET['loginhash'])) {
+ // Hash login process
$loginhash_data = get_parameter('loginhash_data', '');
$loginhash_user = str_rot13(get_parameter('loginhash_user', ''));
@@ -642,9 +641,8 @@ if (! isset($config['id_user'])) {
exit('');
}
- }
- // There is no user connected
- else {
+ } else {
+ // There is no user connected.
if ($config['enterprise_installed']) {
enterprise_include_once('include/functions_reset_pass.php');
}
@@ -726,64 +724,55 @@ if (! isset($config['id_user'])) {
$show_error = false;
if (!$first) {
- if ($reset) {
- if ($user_reset_pass == '') {
+ if ($user_reset_pass == '') {
+ $reset = false;
+ $error = __('Id user cannot be empty');
+ $show_error = true;
+ } else {
+ $check_user = check_user_id($user_reset_pass);
+
+ if (!$check_user) {
$reset = false;
- $error = __('Id user cannot be empty');
+ register_pass_change_try($user_reset_pass, 0);
+ $error = __('Error in reset password request');
$show_error = true;
} else {
- $check_user = check_user_id($user_reset_pass);
+ $check_mail = check_user_have_mail($user_reset_pass);
- if (!$check_user) {
+ if (!$check_mail) {
$reset = false;
register_pass_change_try($user_reset_pass, 0);
- $error = __('Error in reset password request');
+ $error = __('This user doesn\'t have a valid email address');
$show_error = true;
} else {
- $check_mail = check_user_have_mail($user_reset_pass);
-
- if (!$check_mail) {
- $reset = false;
- register_pass_change_try($user_reset_pass, 0);
- $error = __('This user doesn\'t have a valid email address');
- $show_error = true;
- } else {
- $mail = $check_mail;
- }
+ $mail = $check_mail;
}
}
}
- if (!$reset) {
- if ($config['enterprise_installed']) {
- include_once 'enterprise/include/reset_pass.php';
- }
+ $cod_hash = $user_reset_pass.'::::'.md5(rand(10, 1000000).rand(10, 1000000).rand(10, 1000000));
+
+ $subject = '['.io_safe_output(get_product_name()).'] '.__('Reset password');
+ $body = __('This is an automatically sent message for user ');
+ $body .= ' "
'.$user_reset_pass.'" ';
+ $body .= '
';
+ $body .= __('Please click the link below to reset your password');
+ $body .= '
';
+ $body .= '
'.__('Reset your password').' ';
+ $body .= '
';
+ $body .= get_product_name();
+ $body .= '
';
+ $body .= '
'.__('Please do not reply to this email.').' ';
+
+ $result = send_email_to_user($mail, $body, $subject);
+
+ if (!$result) {
+ $process_error_message = __('Error at sending the email');
} else {
- $cod_hash = $user_reset_pass.'::::'.md5(rand(10, 1000000).rand(10, 1000000).rand(10, 1000000));
-
- $subject = '['.get_product_name().'] '.__('Reset password');
- $body = __('This is an automatically sent message for user ');
- $body .= ' "
'.$user_reset_pass.'" ';
- $body .= '
';
- $body .= __('Please click the link below to reset your password');
- $body .= '
';
- $body .= '
'.__('Reset your password').' ';
- $body .= '
';
- $body .= get_product_name();
- $body .= '
';
- $body .= '
'.__('Please do not reply to this email.').' ';
-
- $result = send_email_to_user($mail, $body, $subject);
-
- $process_error_message = '';
- if (!$result) {
- $process_error_message = __('Error at sending the email');
- } else {
- send_token_to_db($user_reset_pass, $cod_hash);
- }
-
- include_once 'general/login_page.php';
+ send_token_to_db($user_reset_pass, $cod_hash);
}
+
+ include_once 'general/login_page.php';
} else {
include_once 'enterprise/include/reset_pass.php';
}
diff --git a/pandora_console/install.php b/pandora_console/install.php
index fd7e5cceab..074e1e2960 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -129,7 +129,7 @@
".__('Full list of alerts').'';
+ $agent_view_page = true;
}
} else {
$agent_a = check_acl($config['id_user'], 0, 'AR');
@@ -610,7 +612,12 @@ foreach ($alerts['alerts_simple'] as $alert) {
}
if (!empty($table->data)) {
- echo '
';
+ $alerts_defined = true;
} else {
ui_print_info_message(['no_close' => true, 'message' => __('No alerts found') ]);
+ $alerts_defined = false;
}
+$html_content = ob_get_clean();
+
+if ($agent_view_page === true) {
+ // Create controlled toggle content.
+ ui_toggle(
+ $html_content,
+ __('Full list of alerts'),
+ 'status_monitor_agent',
+ !$alerts_defined,
+ false,
+ '',
+ 'white_table_graph_content no-padding-imp'
+ );
+} else {
+ // Dump entire content.
+ echo $html_content;
+}
+
+
// strict user hidden
echo '
';
html_print_input_text('strict_user_hidden', $strict_user);
@@ -716,4 +744,4 @@ ui_require_jquery_file('cluetip');
}
}).change();
-
\ No newline at end of file
+
diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php
index 78b850b241..360a7fd332 100755
--- a/pandora_console/operation/agentes/estado_generalagente.php
+++ b/pandora_console/operation/agentes/estado_generalagente.php
@@ -1,17 +1,32 @@
id = 'agent_details_main';
-$table_agent->width = '95%';
-$table_agent->cellspacing = 0;
-$table_agent->cellpadding = 0;
-$table_agent->class = 'databox filters';
-$table_agent->style[0] = 'width: 16px; text-align:center; padding: 0px;';
-$table_agent->style[5] = 'width: 16px; text-align:center; padding: 0px;';
-$table_agent->styleTable = 'padding:0px;';
-$table_agent->data = [];
-$data = [];
-$agent_name = ui_print_agent_name($agent['id_agente'], true, 500, 'font-size: medium;font-weight:bold', true);
+/*
+ * START: TABLE AGENT BUILD.
+ */
+
+$agent_name = ui_print_agent_name(
+ $agent['id_agente'],
+ true,
+ 500,
+ 'font-size: medium;font-weight:bold',
+ true
+);
$in_planned_downtime = db_get_sql(
'SELECT executed FROM tplanned_downtime
INNER JOIN tplanned_downtime_agents
@@ -80,7 +101,6 @@ $in_planned_downtime = db_get_sql(
WHERE tplanned_downtime_agents.id_agent = '.$agent['id_agente'].' AND tplanned_downtime.executed = 1'
);
-
if ($agent['disabled']) {
if ($in_planned_downtime) {
$agent_name = '
'.$agent_name.ui_print_help_tip(__('Disabled'), true);
@@ -98,24 +118,35 @@ if ($agent['disabled']) {
}
if ($in_planned_downtime && !$agent['disabled'] && !$agent['quiet']) {
- $agent_name .= ''.' '.ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png').' ';
-} else if (($in_planned_downtime && !$agent['disabled']) || ($in_planned_downtime && !$agent['quiet'])) {
- $agent_name .= ' '.ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png').' ';
+ $agent_name .= '
'.ui_print_help_tip(
+ __('Agent in planned downtime'),
+ true,
+ 'images/minireloj-16.png'
+ ).' ';
+} else if (($in_planned_downtime && !$agent['disabled'])
+ || ($in_planned_downtime && !$agent['quiet'])
+) {
+ $agent_name .= ' '.ui_print_help_tip(
+ __('Agent in planned downtime'),
+ true,
+ 'images/minireloj-16.png'
+ ).'';
}
+$table_agent_header = '
';
+$table_agent_header .= $agent_name;
+$table_agent_header .= '
';
+$table_agent_header .= '
';
if (!$config['show_group_name']) {
- $data[0] = ui_print_group_icon($agent['id_grupo'], true);
-} else {
- $data[0] = '';
+ $table_agent_header .= ui_print_group_icon(
+ $agent['id_grupo'],
+ true,
+ 'groups_small',
+ 'padding-right: 6px;'
+ );
}
-$table_agent->cellstyle[count($table_agent->data)][0] = 'width: 16px; text-align:center; padding: 0px;';
-
-$data[2] = $agent_name;
-$table_agent->colspan[count($table_agent->data)][2] = 3;
-
-$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 100px; word-break: break-all;';
-
+$table_agent_header .= '
';
$status_img = agents_detail_view_status_img(
$agent['critical_count'],
@@ -124,39 +155,36 @@ $status_img = agents_detail_view_status_img(
$agent['total_count'],
$agent['notinit_count']
);
-$data[2] .= ' '.$status_img;
-$table_agent->data[] = $data;
-$table_agent->rowclass[] = '';
+$table_agent_header .= '
'.$status_img.'
';
+// Fixed width non interactive charts.
+$status_chart_width = 180;
+$graph_width = 180;
-$data = [];
+$table_agent_graph = '
';
+$table_agent_graph .= graph_agent_status(
+ $id_agente,
+ $graph_width,
+ $graph_width,
+ true,
+ false,
+ false,
+ true
+);
+$table_agent_graph .= '
';
-// $data[0] = reporting_tiny_stats ($agent, true, 'agent', '
');
-// $table_agent->rowspan[count($table_agent->data)][0] = 6;
-// Fixed width non interactive charts
-$status_chart_width = 150;
-$graph_width = 150;
-
-$data[0] = '
';
-$data[0] .= '
';
-$data[0] .= graph_agent_status($id_agente, $graph_width, 120, true);
-$data[0] .= '
';
-$data[0] .= '
'.reporting_tiny_stats($agent, true);
-$data[0] .= ui_print_help_tip(__('Agent statuses are re-calculated by the server, they are not shown in real time.'), true);
-$data[0] .= '
';
-$table_agent->rowspan[count($table_agent->data)][0] = 6;
-$table_agent->colspan[count($table_agent->data)][0] = 2;
-$table_agent->cellstyle[count($table_agent->data)][0] = 'width: 150px; text-align:center; padding: 0px; vertical-align: top;';
-
-
-$data[2] = ui_print_os_icon($agent['id_os'], false, true, true, false, false, false, ['title' => __('OS').': '.get_os_name($agent['id_os'])]);
-$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align: right; padding: 0px;';
-$data[3] = empty($agent['os_version']) ? get_os_name((int) $agent['id_os']) : $agent['os_version'];
-$table_agent->colspan[count($table_agent->data)][3] = 2;
-
-$table_agent->data[] = $data;
-$table_agent->rowclass[] = '';
+$table_agent_os = '
'.ui_print_os_icon(
+ $agent['id_os'],
+ false,
+ true,
+ true,
+ false,
+ false,
+ false,
+ ['title' => __('OS').': '.get_os_name($agent['id_os'])]
+);
+$table_agent_os .= (empty($agent['os_version'])) ? get_os_name((int) $agent['id_os']) : $agent['os_version'].'
';
$addresses = agents_get_addresses($id_agente);
$address = agents_get_address($id_agente);
@@ -168,55 +196,95 @@ foreach ($addresses as $k => $add) {
}
if (!empty($address)) {
- $data = [];
- $data[2] = html_print_image('images/world.png', true, ['title' => __('IP address')]);
- $table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align: right; padding: 0px;';
- $data[3] = '
';
- $data[3] .= empty($address) ? ''.__('N/A').' ' : $address;
- $data[3] .= ' ';
- $table_agent->colspan[count($table_agent->data)][3] = 2;
- $table_agent->data[] = $data;
- $table_agent->rowclass[] = '';
+ $table_agent_ip = '
'.html_print_image('images/world.png', true, ['title' => __('IP address')]);
+ $table_agent_ip .= '';
+ $table_agent_ip .= empty($address) ? ''.__('N/A').' ' : $address;
+ $table_agent_ip .= '
';
}
-$data = [];
-$data[2] = html_print_image('images/version.png', true, ['title' => __('Agent Version')]);
-$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align: right; padding: 0px;';
-$data[3] = '
';
-$data[3] .= empty($agent['agent_version']) ? ''.__('N/A').' ' : $agent['agent_version'];
-$data[3] .= ' ';
-$table_agent->colspan[count($table_agent->data)][3] = 2;
-$table_agent->data[] = $data;
-$table_agent->rowclass[] = '';
+$table_agent_version = '
'.html_print_image('images/version.png', true, ['title' => __('Agent Version')]);
+$table_agent_version .= '';
+$table_agent_version .= empty($agent['agent_version']) ? ''.__('N/A').' ' : $agent['agent_version'];
+$table_agent_version .= '
';
-$data = [];
-$data[2] = html_print_image(
+$table_agent_description = '
'.html_print_image(
'images/default_list.png',
true,
['title' => __('Description')]
);
-$table_agent->cellstyle[count($table_agent->data)][2] = 'width: 16px; text-align: right; padding: 0px;';
-$data[3] = '';
-$data[3] .= empty($agent['comentarios']) ? ''.__('N/A').' ' : $agent['comentarios'];
-$data[3] .= ' ';
-$table_agent->colspan[count($table_agent->data)][3] = 2;
+$table_agent_description .= '';
+$table_agent_description .= empty($agent['comentarios']) ? ''.__('N/A').' ' : $agent['comentarios'];
+$table_agent_description .= '
';
-$table_agent->data[] = $data;
-$table_agent->rowclass[] = '';
+$table_agent_count_modules = reporting_tiny_stats(
+ $agent,
+ true,
+ 'agent',
+ // Useless.
+ ':',
+ true
+);
+
+$has_remote_conf = enterprise_hook(
+ 'config_agents_has_remote_configuration',
+ [$agent['id_agente']]
+);
+
+if ($has_remote_conf) {
+ $remote_cfg = '
'.html_print_image('images/remote_configuration.png', true);
+ $remote_cfg .= __('Remote configuration enabled').'
';
+} else {
+ $remote_cfg = '';
+}
+
+
+
+// $table_agent_count_modules .= ui_print_help_tip(__('Agent statuses are re-calculated by the server, they are not shown in real time.'), true);
+$table_agent = '
+
+
+
+ '.$table_agent_graph.'
+
+ '.$table_agent_count_modules.'
+
+
+
+ '.$table_agent_os.$table_agent_ip.$table_agent_version.$table_agent_description.$remote_cfg.'
+
+
';
+
+/*
+ * END: TABLE AGENT BUILD.
+ */
+
+/*
+ *START: TABLE CONTACT BUILD.
+ */
-// END: TABLE AGENT BUILD
-// START: TABLE CONTACT BUILD
$table_contact = new stdClass();
$table_contact->id = 'agent_contact_main';
$table_contact->width = '100%';
$table_contact->cellspacing = 0;
$table_contact->cellpadding = 0;
-$table_contact->class = 'databox data';
-$table_contact->style[0] = 'width: 30%;height:30px;';
+$table_contact->class = 'white_table white_table_no_border';
+$table_contact->style[0] = 'width: 30%;';
$table_contact->style[1] = 'width: 70%;';
+$table_contact->headstyle[1] = 'padding-top:6px; padding-bottom:6px;padding-right: 10px;';
$table_contact->head[0] = '
'.__('Agent contact').' ';
-$table_contact->head_colspan[0] = 2;
+
+$buttons_refresh_agent_view = '
';
+
+$table_contact->head[1] = $buttons_refresh_agent_view;
$data = [];
$data[0] = '
'.__('Interval').' ';
@@ -236,140 +304,141 @@ if ($agent['ultimo_contacto_remoto'] == '01-01-1970 00:00:00') {
$table_contact->data[] = $data;
+
+$data = [];
$data[0] = '
'.__('Next contact').' ';
$progress = agents_get_next_contact($id_agente);
-$data[1] = progress_bar($progress, 200, 20, '', 1, false, '#666666');
+$data[1] = ui_progress(
+ $progress,
+ '100%',
+ 1.8,
+ '#BBB',
+ true,
+ ($agent['intervalo'] * (100 - $progress) / 100).' s'
+);
if ($progress > 100) {
- $data[1] .= clippy_context_help('agent_out_of_limits');
+ $data[0] .= clippy_context_help('agent_out_of_limits');
}
$table_contact->data[] = $data;
-// END: TABLE CONTACT BUILD
-// START: TABLE DATA BUILD
-$table_data = new stdClass();
-$table_data->id = 'agent_data_main';
-$table_data->width = '100%';
-$table_data->styleTable = 'height:180px';
-$table_data->cellspacing = 0;
-$table_data->cellpadding = 0;
-$table_data->class = 'databox data';
-$table_data->style[0] = 'width: 30%;';
-$table_data->style[1] = 'width: 40%;';
-
-$table_data->head[0] = '
'.__('Agent info').' ';
-$table_data->head_colspan[0] = 3;
-
$data = [];
$data[0] = '
'.__('Group').' ';
$data[1] = '
'.groups_get_name($agent['id_grupo']).' ';
-// ACCESS RATE GRAPH
-$access_agent = db_get_value_sql(
- 'SELECT COUNT(id_agent)
- FROM tagent_access
- WHERE id_agent = '.$id_agente
-);
-if ($config['agentaccess'] && $access_agent > 0) {
- $data[2] = '
- '.__('Agent access rate (24h)').' '.graphic_agentaccess($id_agente, '95%', 100, SECONDS_1DAY, true).' ';
- $table_data->style[0] = 'width: 20%;';
- $table_data->style[1] = 'width: 30%;';
- $table_data->style[2] = 'width: 50%;';
- $table_data->rowspan[0][2] = 5;
-}
-
-$table_data->data[] = $data;
-
-if (!empty($addresses)) {
- $data = [];
- $data[0] = '
'.__('Other IP addresses').' ';
- $data[1] = '
'.implode(' ', $addresses).'
';
- $table_data->data[] = $data;
-}
+$table_contact->data[] = $data;
$data = [];
-$data[0] = '
'.__('Parent').' ';
-if ($agent['id_parent'] == 0) {
+$data[0] = '
'.__('Secondary groups').' ';
+$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
+if (!$secondary_groups) {
$data[1] = '
'.__('N/A').' ';
} else {
- $data[1] = '
'.agents_get_alias($agent['id_parent']).' ';
+ $secondary_links = [];
+ foreach ($secondary_groups['for_select'] as $id => $name) {
+ $secondary_links[] = '
'.$name.' ';
+ }
+
+ $data[1] = implode(', ', $secondary_links);
}
-$table_data->data[] = $data;
-
-$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']]);
+$table_contact->data[] = $data;
if (enterprise_installed()) {
$data = [];
- $data[0] = '
'.__('Remote configuration').' ';
- if (!$has_remote_conf) {
- $data[1] = __('Disabled');
- } else {
- $data[1] = __('Enabled');
- }
-
- $table_data->data[] = $data;
-
- $data = [];
- $data[0] = '
'.__('Secondary groups').' ';
- $secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
- if (!$secondary_groups) {
+ $data[0] = '
'.__('Parent').' ';
+ if ($agent['id_parent'] == 0) {
$data[1] = '
'.__('N/A').' ';
} else {
- $secondary_links = [];
- foreach ($secondary_groups['for_select'] as $id => $name) {
- $secondary_links[] = '
'.$name.' ';
- }
-
- $data[1] = implode(', ', $secondary_links);
+ $data[1] = '
'.agents_get_alias($agent['id_parent']).' ';
}
- $table_data->data[] = $data;
+ $table_contact->data[] = $data;
}
-if ($config['activate_gis'] || $agent['url_address'] != '') {
- $data = [];
- // Position Information
- if ($config['activate_gis']) {
- $dataPositionAgent = gis_get_data_last_position_agent($agent['id_agente']);
+/*
+ * END: TABLE CONTACT BUILD
+ */
- $data[0] = '
'.__('Position (Long, Lat)').' ';
+/*
+ * START: TABLE DATA BUILD
+ */
- if ($dataPositionAgent === false) {
- $data[1] = __('There is no GIS data.');
+$table_data = new stdClass();
+$table_data->id = 'agent_data_main';
+$table_data->width = '100%';
+$table_data->cellspacing = 0;
+$table_data->cellpadding = 0;
+$table_data->class = 'box-shadow white_table white_table_droppable align-top';
+$table_data->style = array_fill(0, 3, 'width: 25%;');
+
+$table_data->head[0] = html_print_image(
+ 'images/arrow_down_green.png',
+ true,
+ $options
+);
+$table_data->head[0] .= '
'.__('Agent info').' ';
+$table_data->head_colspan[0] = 4;
+
+// Gis and url address.
+$data_opcional = [];
+// Position Information.
+if ($config['activate_gis']) {
+ $data_opcional[] = '
'.__('Position (Long, Lat)').' ';
+ $dataPositionAgent = gis_get_data_last_position_agent(
+ $agent['id_agente']
+ );
+
+ if ($dataPositionAgent === false) {
+ $data_opcional[] = __('There is no GIS data.');
+ } else {
+ $data_opcional[] = '
';
+ if ($dataPositionAgent['description'] != '') {
+ $data_opcional[] .= $dataPositionAgent['description'];
} else {
- $data[1] = ' ';
- if ($dataPositionAgent['description'] != '') {
- $data[1] .= $dataPositionAgent['description'];
- } else {
- $data[1] .= $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'];
- }
-
- $data[1] .= ' ';
+ $data_opcional[] .= $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude'];
}
- $table_data->data[] = $data;
+ $data_opcional[] .= '';
}
- // If the url description is setted
+ array_push($data_opcional);
+}
+
+// If the url description is set.
+if ($agent['url_address'] != '') {
+ // $data_opcional = [];
+ $data_opcional[] = '
'.__('Url address').' ';
if ($agent['url_address'] != '') {
- $data = [];
- $data[0] = '
'.__('Url address').' ';
- $data[1] = '
'.$agent['url_address'].' ';
- $table_data->data[] = $data;
+ $data_opcional[] = '
'.$agent['url_address'].' ';
}
}
-// Timezone Offset
-if ($agent['timezone_offset'] != 0) {
- $data = [];
- $data[0] = '
'.__('Timezone Offset').' ';
- $data[1] = $agent['timezone_offset'];
- $table->data[] = $data;
+
+// Other IP address and timezone offset.
+if (!empty($addresses)) {
+ // $data_opcional = [];
+ $data_opcional[] = '
'.__('Other IP addresses').' ';
+ if (!empty($addresses)) {
+ $data_opcional[] = '
'.implode(' ', $addresses).'
';
+ }
}
-// Custom fields
+// Timezone Offset.
+if ($agent['timezone_offset'] != 0) {
+ $data_opcional[] = '
'.__('Timezone Offset').' ';
+ if ($agent['timezone_offset'] != 0) {
+ $data_opcional[] = $agent['timezone_offset'];
+ }
+}
+
+
+$data_opcional = array_chunk($data_opcional, 4);
+foreach ($data_opcional as $key => $value) {
+ $table_data->data[] = $data_opcional[$key];
+}
+
+// Custom fields.
$fields = db_get_all_rows_filter(
'tagent_custom_fields',
['display_on_front' => 1]
@@ -378,6 +447,7 @@ if ($fields === false) {
$fields = [];
}
+$custom_fields = [];
foreach ($fields as $field) {
$data = [];
$data[0] = '
'.$field['name'].ui_print_help_tip(__('Custom field'), true).' ';
@@ -398,17 +468,75 @@ foreach ($fields as $field) {
$data[1] = $custom_value[0]['description'];
}
- $table_data->data[] = $data;
+ $custom_fields[] = $data;
}
-// END: TABLE DATA BUILD
-// START: TABLE INCIDENTS
+$custom_fields_count = count($custom_fields);
+for ($i = 0; $i < $custom_fields_count; $i++) {
+ $first_column = $custom_fields[$i];
+ $j = ($i + 1);
+ $second_column = $custom_fields[$j];
+
+ if (is_array($second_column)) {
+ $columns = array_merge($first_column, $second_column);
+ } else {
+ $columns = $first_column;
+ $filas = count($table_data->data);
+ $table_data->colspan[$filas][1] = 3;
+ }
+
+ $table_data->data[] = $columns;
+
+ $i++;
+}
+
+/*
+ * END: TABLE DATA BUILD
+ */
+
+/*
+ * START: ACCESS RATE GRAPH
+ */
+
+$access_agent = db_get_value_sql(
+ 'SELECT COUNT(id_agent)
+ FROM tagent_access
+ WHERE id_agent = '.$id_agente
+);
+
+if ($config['agentaccess'] && $access_agent > 0) {
+ $table_access_rate = '
+
+
+'.graphic_agentaccess(
+ $id_agente,
+ '95%',
+ 100,
+ SECONDS_1DAY,
+ true
+ ).'
+
';
+}
+
+/*
+ * END: ACCESS RATE GRAPH
+ */
+
+/*
+ * START: TABLE INCIDENTS
+ */
+
$last_incident = db_get_row_sql(
- "
- SELECT * FROM tincidencia
- WHERE estado IN (0,1)
- AND id_agent = $id_agente
- ORDER BY actualizacion DESC"
+ sprintf(
+ 'SELECT * FROM tincidencia
+ WHERE estado IN (0,1)
+ AND id_agent = %d
+ ORDER BY actualizacion DESC',
+ $id_agente
+ )
);
if ($last_incident != false) {
@@ -416,36 +544,35 @@ if ($last_incident != false) {
$table_incident->width = '100%';
$table_incident->cellspacing = 0;
$table_incident->cellpadding = 0;
- $table_incident->class = 'databox';
- $table_incident->style[0] = 'width: 30%;';
- $table_incident->style[1] = 'width: 70%;';
+ $table_incident->class = 'white_table';
+ $table_incident->style = array_fill(0, 3, 'width: 25%;');
- $table_incident->head[0] = '
'.''.__('Active incident on this agent').' '.' ';
- $table_incident->head_colspan[0] = 2;
+ $table_incident->head[0] = '
'.__('Active incident on this agent').' ';
+ $table_incident->head_colspan[0] = 4;
$data = [];
$data[0] = '
'.__('Author').' ';
$data[1] = $last_incident['id_creator'];
+ $data[2] = '
'.__('Timestamp').' ';
+ $data[3] = $last_incident['inicio'];
$table_incident->data[] = $data;
$data = [];
$data[0] = '
'.__('Title').' ';
$data[1] = '
'.$last_incident['titulo'].' ';
- $table_incident->data[] = $data;
-
- $data = [];
- $data[0] = '
'.__('Timestamp').' ';
- $data[1] = $last_incident['inicio'];
- $table_incident->data[] = $data;
-
- $data = [];
- $data[0] = '
'.__('Priority').' ';
- $data[1] = incidents_print_priority_img($last_incident['prioridad'], true);
+ $data[2] = '
'.__('Priority').' ';
+ $data[3] = incidents_print_priority_img($last_incident['prioridad'], true);
$table_incident->data[] = $data;
}
-// END: TABLE INCIDENTS
-// START: TABLE INTERFACES
+/*
+ * END: TABLE INCIDENTS
+ */
+
+/*
+ * START: TABLE INTERFACES
+ */
+
$network_interfaces_by_agents = agents_get_network_interfaces([$agent]);
$network_interfaces = [];
@@ -456,8 +583,8 @@ if (!empty($network_interfaces_by_agents) && !empty($network_interfaces_by_agent
if (!empty($network_interfaces)) {
$table_interface = new stdClass();
$table_interface->id = 'agent_interface_info';
- $table_interface->class = 'databox data';
- $table_interface->width = '98%';
+ $table_interface->class = 'info_table';
+ $table_interface->width = '100%';
$table_interface->style = [];
$table_interface->style['interface_status'] = 'width: 30px;padding-top:0px;padding-bottom:0px;';
$table_interface->style['interface_graph'] = 'width: 20px;padding-top:0px;padding-bottom:0px;';
@@ -476,12 +603,8 @@ if (!empty($network_interfaces)) {
$table_interface->head = [];
$options = [
'class' => 'closed',
- 'style' => 'vertical-align:righ; cursor:pointer;',
+ 'style' => 'cursor:pointer;',
];
- $table_interface->head[0] = html_print_image('images/graphmenu_arrow.png', true, $options).' ';
- $table_interface->head[0] .= '
'.__('Interface information').' (SNMP) ';
- $table_interface->head_colspan = [];
- $table_interface->head_colspan[0] = 8;
$table_interface->data = [];
$event_text_cont = 0;
@@ -499,7 +622,14 @@ if (!empty($network_interfaces)) {
$params_json = json_encode($params);
$params_encoded = base64_encode($params_json);
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
- $graph_link = "
".html_print_image('images/chart_curve.png', true, ['title' => __('Interface traffic')]).' ';
+ $graph_link = "
";
+ $graph_link .= html_print_image(
+ 'images/chart_curve.png',
+ true,
+ ['title' => __('Interface traffic')]
+ ).' ';
} else {
$graph_link = '';
}
@@ -522,9 +652,9 @@ if (!empty($network_interfaces)) {
$status_condition = ' AND (estado = 0 OR estado = 1) ';
$unixtime = (get_system_time() - SECONDS_1DAY);
- // last hour
+ // Last hour.
$time_condition = 'AND (utimestamp > '.$unixtime.')';
- // Tags ACLS
+ // Tags ACLs.
if ($id_group > 0 && in_array(0, $user_groups_ids)) {
$group_array = (array) $id_group;
} else {
@@ -547,18 +677,16 @@ if (!empty($network_interfaces)) {
$id_modules_array[] = $interface['status_module_id'];
$unixtime = (get_system_time() - SECONDS_1DAY);
- // last hour
+ // Last hour.
$time_condition = 'WHERE (te.utimestamp > '.$unixtime.')';
$sqlEvents = sprintf(
- '
- SELECT *
+ 'SELECT *
FROM tevento te
INNER JOIN tagente_estado tae
ON te.id_agentmodule = tae.id_agente_modulo
AND tae.id_agente_modulo IN (%s)
- %s
- ',
+ %s',
implode(',', $id_modules_array),
$time_condition
);
@@ -600,69 +728,112 @@ if (!empty($network_interfaces)) {
$table_interface->data[] = $data;
}
+}
- // This javascript piece of code is used to make expandible the body of the table
- ?>
+/*
+ * END: TABLE INTERFACES
+ */
+
+ // This javascript piece of code is used to make expandible
+ // the body of the table.
+?>
- 0) {
+ $extra_class = 'min-height-100';
+} else {
+ $extra_class = '';
}
-// END: TABLE INTERFACES
-$table = new stdClass();
-$table->id = 'agent_details';
-$table->width = '100%';
-$table->cellspacing = 0;
-$table->cellpadding = 0;
-$table->class = 'agents';
-$table->style = array_fill(0, 3, 'vertical-align: top;');
+$table_events = '
+
+
+
';
-$data = [];
-$data[0][0] = html_print_table($table_agent, true);
-$data[0][0] .= '
- '.__('Events (24h)').' '.' '.graph_graphic_agentevents($id_agente, 100, 45, SECONDS_1DAY, '', true, true).' '.'
';
+/*
+ * EVENTS TABLE END.
+ */
-$table->style[0] = 'width:40%; vertical-align:top;';
-$data[0][1] = html_print_table($table_contact, true);
-$data[0][1] .= empty($table_data->data) ? '' : '
'.html_print_table($table_data, true);
-$data[0][1] .= !isset($table_incident) ? '' : '
'.html_print_table($table_incident, true);
+$agent_contact = html_print_table($table_contact, true);
-$table->rowspan[1][0] = 0;
+$agent_info = empty($table_data->data) ? '' : html_print_table($table_data, true);
-$data[0][2] = '
';
-$data[0][2] .= '
'.html_print_image('images/refresh.png', true, ['border' => '0', 'title' => __('Refresh data'), 'alt' => '']).' ';
-if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
- $data[0][2] .= '
'.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force remote checks'), 'alt' => '']).' ';
+$agent_incidents = !isset($table_incident) ? '' : html_print_table($table_incident, true);
+
+echo '
+
'.$table_agent.'
+
'.$agent_contact.'
+
'.$agent_info;
+
+// Show both graphs, events and access rate.
+if ($table_access_rate) {
+ echo '
'.$table_access_rate.$table_events.'
';
+} else {
+ echo '
'.$table_events.'
';
}
-$data[0][2] .= '
';
-
-$table->data = $data;
-$table->rowclass[] = '';
-
-$table->cellstyle[1][0] = 'text-align:center;';
-
-html_print_table($table);
-$data2[1][0] = !isset($table_interface) ? '' : html_print_table($table_interface, true);
-$table->data = $data2;
-$table->styleTable = '';
-html_print_table($table);
-
-unset($table);
+echo $agent_incidents;
+if (isset($table_interface)) {
+ ui_toggle(
+ html_print_table($table_interface, true),
+ '
'.__('Interface information (SNMP)').' '
+ );
+}
diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php
index b311885acb..7536d294ae 100755
--- a/pandora_console/operation/agentes/estado_monitores.php
+++ b/pandora_console/operation/agentes/estado_monitores.php
@@ -1,17 +1,32 @@
".ui_print_truncate_text(modules_get_agentmodule_name($id_module), 'module_medium', true, true, true, '[…]').'';
+ &id_agente=".$id_agent.'&tab=module&edit_module=1&id_agent_module='.$id_module."'>".ui_print_truncate_text(modules_get_agentmodule_name($id_module), 'module_medium', true, true, true, '[…]').'';
$table_relations->data[] = $data;
}
@@ -132,33 +147,46 @@ $sort_field = get_parameter('sort_field', 'name');
$sort = get_parameter('sort', 'up');
-echo "
";
-
-echo ui_print_help_tip(__('To see the list of modules paginated, enable this option in the Styles Configuration.'), true).__('Full list of monitors').' '.reporting_tiny_stats($agent, true, 'modules');
-
$modules_not_init = agents_monitor_notinit($id_agente);
if (!empty($modules_not_init)) {
- echo clippy_context_help('modules_not_init');
+ $help_not_init = clippy_context_help('modules_not_init');
+} else {
+ $help_not_init = '';
}
-echo ' ';
-
-
ob_start();
-print_form_filter_monitors($id_agente, $status_filter_monitor, $status_text_monitor, $status_hierachy_mode);
+print_form_filter_monitors(
+ $id_agente,
+ $status_filter_monitor,
+ $status_text_monitor,
+ $status_hierachy_mode
+);
-echo "
".html_print_image('images/spinner.gif', true).'
';
-echo "
".'
';
+echo '
';
$html_toggle = ob_get_clean();
+
ui_toggle(
$html_toggle,
- __('List of modules'),
+ __('List of modules').$help_not_init.ui_print_help_tip(
+ __('To see the list of modules paginated, enable this option in the Styles Configuration.'),
+ true
+ ).reporting_tiny_stats(
+ $agent,
+ true,
+ 'modules',
+ ':',
+ true
+ ),
'status_monitor_agent',
- false
+ false,
+ false,
+ '',
+ 'white_table_graph_content no-padding-imp'
);
+
?>
class = 'databox filters';
+ $table->class = 'info_table';
+ $table->styleTable = 'border: 1px solid #ebebeb;border-radius: 0;padding: 0;margin: 0;margin-top: -1px;';
$table->width = '100%';
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;';
$table->style[4] = 'font-weight: bold;';
+ $table->style[6] = 'font-weight: bold;';
+ $table->style[6] = 'min-width: 150px;';
$table->data[0][0] = html_print_input_hidden('filter_monitors', 1, true);
$table->data[0][0] .= html_print_input_hidden('monitors_change_filter', 1, true);
$table->data[0][0] .= __('Status:');
@@ -488,9 +531,26 @@ function print_form_filter_monitors(
true
);
- $table->data[0][3] = html_print_input_text('status_text_monitor', $status_text_monitor, '', 30, 100, true);
+ $table->data[0][3] = html_print_input_text(
+ 'status_text_monitor',
+ $status_text_monitor,
+ '',
+ '',
+ 100,
+ true
+ );
$table->data[0][4] = __('Module group');
- $rows = db_get_all_rows_sql("SELECT * FROM tmodule_group where id_mg in (SELECT id_module_group from tagente_modulo where id_agente = $id_agent ) ORDER BY name");
+ $rows = db_get_all_rows_sql(
+ sprintf(
+ 'SELECT *
+ FROM tmodule_group
+ WHERE id_mg IN (SELECT id_module_group
+ FROM tagente_modulo
+ WHERE id_agente = %d )
+ ORDER BY name',
+ $id_agent
+ )
+ );
$rows_select[-1] = __('All');
if (!empty($rows)) {
@@ -499,11 +559,43 @@ function print_form_filter_monitors(
}
}
- $table->data[0][5] = html_print_select($rows_select, 'status_module_group', $status_module_group, '', '', 0, true);
- $table->data[0][6] = __('Show in hierachy mode');
- $table->data[0][6] .= html_print_checkbox('status_hierachy_mode', '', false, true, false, 'onChange=change_module_filter();');
- $table->data[0][7] = html_print_button(__('Filter'), 'filter', false, 'filter_modules();', 'class="sub search"', true);
- $table->data[0][8] = ' '.html_print_button(__('Reset'), 'filter', false, 'reset_filter_modules();', 'class="sub upd" style="margin-top:0px;"', true);
+ $table->data[0][5] = html_print_select(
+ $rows_select,
+ 'status_module_group',
+ $status_module_group,
+ '',
+ '',
+ 0,
+ true
+ );
+ $table->data[0][6] = '
';
+ $table->data[0][6] .= __('Show in hierachy mode');
+ $table->data[0][6] .= html_print_switch(
+ [
+ 'name' => 'status_hierachy_mode',
+ 'value' => $all_events_24h,
+ 'onchange' => 'change_module_filter()',
+ 'id' => 'checkbox-status_hierachy_mode',
+ 'style' => 'margin-left: 1em;',
+ ]
+ );
+ $table->data[0][6] .= '
';
+ $table->data[0][7] = html_print_button(
+ __('Filter'),
+ 'filter',
+ false,
+ 'filter_modules();',
+ 'class="sub search"',
+ true
+ );
+ $table->data[0][8] = html_print_button(
+ __('Reset'),
+ 'filter',
+ false,
+ 'reset_filter_modules();',
+ 'class="sub upd" style="margin-top:0px;"',
+ true
+ );
$form_text .= html_print_table($table, true);
$filter_hidden = false;
@@ -514,4 +606,3 @@ function print_form_filter_monitors(
echo $form_text;
}
-
diff --git a/pandora_console/operation/agentes/status_events.php b/pandora_console/operation/agentes/status_events.php
index 825a4c2c42..5e6e060f82 100755
--- a/pandora_console/operation/agentes/status_events.php
+++ b/pandora_console/operation/agentes/status_events.php
@@ -20,12 +20,15 @@ if (!isset($id_agente)) {
}
require_once 'include/functions_events.php';
-
+ui_require_css_file('events');
ui_toggle(
- "
".html_print_image('images/spinner.gif', true).'
',
+ "
".html_print_image('images/spinner.gif', true).'
',
__('Latest events for this agent'),
__('Latest events for this agent'),
- false
+ false,
+ false,
+ '',
+ 'white_table_graph_content no-padding-imp'
);
?>
diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php
index 9264cba0b3..10e4ff5736 100755
--- a/pandora_console/operation/agentes/tactical.php
+++ b/pandora_console/operation/agentes/tactical.php
@@ -122,7 +122,7 @@ echo '
';
foreach ($stats as $stat) {
@@ -187,7 +187,12 @@ if (check_acl($config['id_user'], 0, 'ER')) {
}
$events = events_print_event_table($event_filter, 10, '100%', true, false, true);
- ui_toggle($events, __('Latest events'), false, false);
+ ui_toggle(
+ $events,
+ __('Latest events'),
+ false,
+ false
+ );
}
// ---------------------------------------------------------------------
diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php
index 82bb87edcf..9bed24a3db 100644
--- a/pandora_console/operation/agentes/ver_agente.php
+++ b/pandora_console/operation/agentes/ver_agente.php
@@ -37,6 +37,7 @@ require_once $config['homedir'].'/include/functions_users.php';
enterprise_include_once('include/functions_metaconsole.php');
ui_require_javascript_file('openlayers.pandora');
+ui_require_css_file('agent_view');
enterprise_include_once('operation/agentes/ver_agente.php');
@@ -1340,6 +1341,7 @@ if (isset($ehorus_tab) && !empty($ehorus_tab)) {
}
// Tabs for extensions.
+$tab_name_extensions = '';
foreach ($config['extensions'] as $extension) {
if (isset($extension['extension_ope_tab']) && !isset($extension['extension_god_tab'])) {
if (check_acl_one_of_groups($config['id_user'], $all_groups, $extension['extension_ope_tab']['acl'])) {
@@ -1382,6 +1384,7 @@ foreach ($config['extensions'] as $extension) {
$image = $extension['extension_ope_tab']['icon'];
$name = $extension['extension_ope_tab']['name'];
$id = $extension['extension_ope_tab']['id'];
+ $tab_name_extensions = $name;
$id_extension = get_parameter('id_extension', '');
@@ -1404,15 +1407,82 @@ foreach ($config['extensions'] as $extension) {
}
switch ($tab) {
- case 'wux_console_tab':
- $help_header = 'wux_console_tab';
+ case 'custom_fields':
+ $tab_name = 'Custom fields';
+ break;
+
+ case 'gis':
+ $tab_name = 'GIS data';
+ break;
+
+ case 'manage':
+ $tab_name = 'Manage';
break;
case 'main':
+ $tab_name = 'Main';
$help_header = 'agent_'.$tab.'_tab';
break;
+ case 'data_view':
+ $tab_name = '';
+ break;
+
+ case 'alert':
+ $tab_name = 'Alerts';
+ break;
+
+ case 'inventory':
+ $tab_name = 'Inventory';
+ break;
+
+ case 'collection':
+ $tab_name = 'Collection';
+ break;
+
+ case 'policy':
+ $tab_name = 'Policies';
+ break;
+
+ case 'ux_console_tab':
+ $tab_name = 'UX Console';
+ break;
+
+ case 'wux_console_tab':
+ $tab_name = 'WUX Console';
+ $help_header = 'wux_console_tab';
+ break;
+
+ case 'url_route_analyzer_tab':
+ $tab_name = 'URL Route Analyzer';
+ break;
+
+ case 'graphs';
+ $tab_name = 'Graphs';
+ break;
+
+ case 'incident':
+ $tab_name = 'Incidents';
+ break;
+
+ case 'url_address':
+ $tab_name = 'Url address';
+ break;
+
+ case 'log_viewer':
+ $tab_name = 'Log viewer';
+ break;
+
+ case 'ehorus':
+ $tab_name = 'eHorus';
+ break;
+
+ case 'extension':
+ $tab_name = $tab_name_extensions;
+ break;
+
default:
+ $tab_name = '';
$help_header = '';
break;
}
@@ -1426,7 +1496,15 @@ ui_print_page_header(
$onheader,
false,
'',
- $config['item_title_size_text']
+ $config['item_title_size_text'],
+ '',
+ ui_print_breadcrums(
+ [
+ __('Monitoring'),
+ __('View'),
+ ''.$tab_name.' ',
+ ]
+ )
);
@@ -1444,6 +1522,7 @@ switch ($tab) {
break;
case 'main':
+ default:
include 'estado_generalagente.php';
echo " ";
include 'estado_monitores.php';
diff --git a/pandora_console/operation/users/user_edit_header.php b/pandora_console/operation/users/user_edit_header.php
index aac28b76f5..fd3e04188b 100644
--- a/pandora_console/operation/users/user_edit_header.php
+++ b/pandora_console/operation/users/user_edit_header.php
@@ -99,10 +99,12 @@ if (is_metaconsole()) {
).'',
],
];
+ $tab_name = 'User Management';
$helpers = '';
if ($_GET['sec2'] === 'operation/users/user_edit_notifications') {
$helpers = 'user_edit_notifications';
+ $tab_name = 'User Notifications';
}
ui_print_page_header(
@@ -111,6 +113,11 @@ if (is_metaconsole()) {
false,
$helpers,
false,
- $buttons
+ $buttons,
+ false,
+ '',
+ GENERIC_SIZE_TEXT,
+ '',
+ __('Workspace').ui_print_breadcrums($tab_name)
);
}
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index cbc86f89b4..dc34716474 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.735
-%define release 190529
+%define release 190604
# User and Group under which Apache is running
%define httpd_name httpd
diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec
index f5bab7605c..70c2917e1a 100644
--- a/pandora_console/pandora_console.rhel7.spec
+++ b/pandora_console/pandora_console.rhel7.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.735
-%define release 190529
+%define release 190604
# User and Group under which Apache is running
%define httpd_name httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index 73aed51663..f0e6ae655f 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.735
-%define release 190529
+%define release 190604
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index e0881cb7ba..04db8ea473 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-server
-Version: 7.0NG.735-190529
+Version: 7.0NG.735-190604
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 5882dc1df3..68b7711564 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-pandora_version="7.0NG.735-190529"
+pandora_version="7.0NG.735-190604"
package_cpan=0
package_pandora=1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index 68f3ab5333..922831a71d 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.735";
-my $pandora_build = "190529";
+my $pandora_build = "190604";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm
index 296be928a4..0dbc8f963a 100644
--- a/pandora_server/lib/PandoraFMS/Core.pm
+++ b/pandora_server/lib/PandoraFMS/Core.pm
@@ -360,9 +360,12 @@ sub pandora_generate_alerts ($$$$$$$$;$$$) {
my ($pa_config, $data, $status, $agent, $module, $utimestamp, $dbh, $timestamp, $extra_macros, $last_data_value, $alert_type) = @_;
# No alerts when event storm protection is enabled
- if ($EventStormProtection == 1) {
+
+ if ($EventStormProtection == 1) {
+
return;
}
+
# Warmup interval for alerts.
if ($pa_config->{'warmup_alert_on'} == 1) {
diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm
index 1c68096c9b..15600b5cce 100644
--- a/pandora_server/lib/PandoraFMS/PluginTools.pm
+++ b/pandora_server/lib/PandoraFMS/PluginTools.pm
@@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.735";
-my $pandora_build = "190529";
+my $pandora_build = "190604";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index 19f1b806ef..86e0cd9036 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.735
-%define release 190529
+%define release 190604
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 83f672ba23..fa2d8a0fbf 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.735
-%define release 190529
+%define release 190604
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index 49b65e5bdf..c104051082 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.735"
-PI_BUILD="190529"
+PI_BUILD="190604"
MODE=$1
if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index 51e944ff7a..c37bdc6a3e 100644
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
-my $version = "7.0NG.735 PS190529";
+my $version = "7.0NG.735 PS190604";
# Pandora server configuration
my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index da6aab09d5..dc410bc5b6 100644
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
-my $version = "7.0NG.735 PS190529";
+my $version = "7.0NG.735 PS190604";
# save program name for logging
my $progname = basename($0);