Merge remote-tracking branch 'origin/develop' into new-vc-line-element

Conflicts:
	pandora_console/include/javascript/pandora.js
This commit is contained in:
Daniel Barbero Martin 2020-01-21 08:28:00 +01:00
commit 89e83e38e0
43 changed files with 747 additions and 568 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.742-200120
Version: 7.0NG.742-200121
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.742"
PI_BUILD="200120"
PI_BUILD="200121"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{200120}
{200121}
ViewReadme
{Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.742-200120
Version: 7.0NG.742-200121
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -1,5 +1,6 @@
START TRANSACTION;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}');
ALTER TABLE `tserver` ADD COLUMN `port` int(5) unsigned NOT NULL default 0;
ALTER TABLE `tmap` ADD COLUMN `id_group_map` INT(10) UNSIGNED NOT NULL default 0;
ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL;

View File

@ -1011,6 +1011,7 @@ $row++;
$table_report->class = 'databox filters';
$table_report->style[0] = 'font-weight: bold;';
$table_report->size[0] = '50%';
$table_report->data = [];
$table_report->data[$row][0] = __('Show report info with description').ui_print_help_tip(
@ -1157,7 +1158,6 @@ $row++;
html_print_table($table_report);
echo '</fieldset>';
// ----------------------------------------------------------------------
// OTHER CONFIGURATION
// ----------------------------------------------------------------------
@ -1166,17 +1166,17 @@ $row++;
$table_other->class = 'databox filters';
$table_other->style[0] = 'font-weight: bold;';
$table_other->size[0] = '50%';
$table_other->size[1] = '26%';
$table_other->size[2] = '12%';
$table_other->size[3] = '12%';
$table_other->data = [];
$table_other->data[$row][0] = __('Custom graphviz directory').ui_print_help_tip(__('Custom directory where the graphviz binaries are stored.'), true);
$table_other->data[$row][1] = html_print_input_text(
'graphviz_bin_dir',
$config['graphviz_bin_dir'],
'',
50,
25,
255,
true
);
@ -1194,8 +1194,6 @@ $row++;
);
$row++;
$table_other->data[$row][0] = __('Show only the group name');
$table_other->data[$row][0] .= ui_print_help_tip(
__('Show the group name instead the group icon.'),
@ -1241,16 +1239,15 @@ $row++;
// CUSTOM VALUES POST PROCESS
// ----------------------------------------------------------------------
$table_other->data[$row][0] = __('Custom values post process');
$table_other->data[$row][1] = '<table>';
$table_other->data[$row][1] .= __('Value').':&nbsp;'.html_print_input_text('custom_value', '', '', 25, 50, true);
$table_other->data[$row][1] .= '&nbsp;'.__('Text').':&nbsp;'.html_print_input_text('custom_text', '', '', 25, 50, true);
$table_other->data[$row][1] .= '&nbsp;';
$table_other->data[$row][1] .= html_print_input_hidden(
$table_other->data[$row][1] = __('Value').':&nbsp;'.html_print_input_text('custom_value', '', '', 25, 50, true);
$table_other->data[$row][2] = __('Text').':&nbsp;'.html_print_input_text('custom_text', '', '', 15, 50, true);
$table_other->data[$row][2] .= '&nbsp;';
$table_other->data[$row][2] .= html_print_input_hidden(
'custom_value_add',
'',
true
);
$table_other->data[$row][1] .= html_print_button(
$table_other->data[$row][3] = html_print_button(
__('Add'),
'custom_value_add_btn',
false,
@ -1259,10 +1256,11 @@ $row++;
true
);
$table_other->data[$row][1] .= '<br /><br />';
$row++;
$table_other->data[$row][1] .= __('Delete custom values').': ';
$table_other->data[$row][1] .= html_print_select(
$table_other->data[$row][0] = '';
$table_other->data[$row][1] = __('Delete custom values').': ';
$table_other->data[$row][2] = html_print_select(
post_process_get_custom_values(),
'custom_values',
'',
@ -1272,7 +1270,7 @@ $row++;
true
);
$count_custom_postprocess = post_process_get_custom_values();
$table_other->data[$row][1] .= html_print_button(
$table_other->data[$row][3] = html_print_button(
__('Delete'),
'custom_values_del_btn',
empty($count_custom_postprocess),
@ -1286,7 +1284,8 @@ $row++;
'',
true
);
$table_other->data[$row][1] .= '</table>';
$table_other->data[$row][3] .= '<br><br>';
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// CUSTOM INTERVAL VALUES
@ -1301,22 +1300,52 @@ $row++;
SECONDS_1MONTH => __('months'),
SECONDS_1YEAR => __('years'),
];
$table_other->data[$row][1] = __('Add new custom value to intervals').': ';
$table_other->data[$row][1] = __('Value').': ';
$table_other->data[$row][1] .= html_print_input_text('interval_value', '', '', 5, 5, true);
$table_other->data[$row][1] .= html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false);
$table_other->data[$row][1] .= html_print_button(__('Add'), 'interval_add_btn', false, '', 'class="sub next"', true);
$table_other->data[$row][1] .= '<br><br>';
$table_other->data[$row][2] = html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false);
$table_other->data[$row][3] = html_print_button(__('Add'), 'interval_add_btn', false, '', 'class="sub next"', true);
$table_other->data[$row][1] .= __('Delete interval').': ';
$table_other->data[$row][1] .= html_print_select(get_periods(false, false), 'intervals', '', '', '', '', true);
$table_other->data[$row][1] .= html_print_button(__('Delete'), 'interval_del_btn', empty($config['interval_values']), '', 'class="sub cancel"', true);
$row++;
$table_other->data[$row][0] = '';
$table_other->data[$row][1] = __('Delete interval').': ';
$table_other->data[$row][2] = html_print_select(get_periods(false, false), 'intervals', '', '', '', '', true);
$table_other->data[$row][3] = html_print_button(__('Delete'), 'interval_del_btn', empty($config['interval_values']), '', 'class="sub cancel"', true);
$table_other->data[$row][1] .= html_print_input_hidden('interval_values', $config['interval_values'], true);
// This hidden field will be filled from jQuery before submit
$table_other->data[$row][1] .= html_print_input_hidden('interval_to_delete', '', true);
$table_other->data[$row][3] .= '<br><br>';
// ----------------------------------------------------------------------
$row++;
$table_other->data[$row][0] = __('Module units');
$table_other->data[$row][1] = __('Value').': ';
$table_other->data[$row][1] .= html_print_input_text('custom_module_unit', '', '', 15, 50, true);
$table_other->data[$row][2] = '';
$table_other->data[$row][3] = html_print_button(__('Add'), 'module_unit_add_btn', false, '', 'class="sub next"', true);
$row++;
$table_other->data[$row][0] = '';
$table_other->data[$row][1] = __('Delete custom values').': ';
$table_other->data[$row][2] = html_print_select(get_custom_module_units(), 'module_units', '', '', '', '', true, false, true, 'w100p');
$table_other->data[$row][3] = html_print_button(
__('Delete'),
'custom_module_unit_del_btn',
empty($count_custom_postprocess),
'',
'class="sub cancel"',
true
);
$table_other->data[$row][3] .= html_print_input_hidden(
'custom_module_unit_to_delete',
'',
true
);
$row++;
$common_dividers = [
';' => ';',
',' => ',',
@ -1333,6 +1362,14 @@ $row++;
$row++;
$table_other->data[$row][0] = __('Data multiplier to use in graphs/data');
$options_data_multiplier = [];
$options_data_multiplier[0] = __('Use 1024 when module unit are bytes');
$options_data_multiplier[1] = __('Use always 1000');
$options_data_multiplier[2] = __('Use always 1024');
$table_other->data[$row][1] = html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false);
echo '<fieldset>';
echo '<legend>'.__('Other configuration').' '.ui_print_help_icon('other_conf_tab', true).'</legend>';
@ -1547,7 +1584,20 @@ $(document).ready (function () {
});
//------------------------------------------------------------------
//------------------------------------------------------------------
// CUSTOM MODULE UNITS
//------------------------------------------------------------------
$("#button-custom_module_unit_del_btn").click( function() {
var unit_selected = $('#module_units option:selected').val();
$('#hidden-custom_module_unit_to_delete').val(unit_selected);
$('#submit-update_button').trigger('click');
});
$("#button-module_unit_add_btn").click( function() {
$('#submit-update_button').trigger('click');
});
//------------------------------------------------------------------
// Juanma (06/05/2014) New feature: Custom front page for reports
var custom_report = $('#checkbox-custom_report_front')
.prop('checked');

View File

@ -442,20 +442,16 @@ switch ($action) {
|| ($layoutData['type'] == PERCENTILE_BUBBLE)
) {
if ($value_show == 'value') {
$returnValue = format_for_graph($returnValue, 2);
$unit_text_db = db_get_sql(
'SELECT unit
FROM tagente_modulo
WHERE id_agente_modulo = '.$layoutData['id_agente_modulo']
FROM tagente_modulo
WHERE id_agente_modulo = '.$layoutData['id_agente_modulo']
);
$unit_text_db = trim(io_safe_output($unit_text_db));
if ($value_show == 'value') {
// Set empty string unit at the moment
// and change for old false value
$unit_text = '';
}
$divisor = get_data_multiplier($unit_text_db);
$returnValue = format_for_graph($returnValue, 2, '.', ',', $divisor);
if (!empty($unit_text_db)) {
$unit_text = $unit_text_db;

View File

@ -83,6 +83,7 @@ if (check_login(false) === false) {
<link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" />
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-3.3.1.min.js'></script>
</head>
<body>
@ -140,6 +141,7 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
<link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" />
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-3.3.1.min.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js'></script>

View File

@ -616,7 +616,8 @@ class Tree
&& $statusType !== STATUS_MODULE_NO_DATA_BALL
) {
if (is_numeric($module['value'])) {
$statusTitle .= ' : '.format_for_graph($module['value']);
$divisor = get_data_multiplier($module['unit']);
$statusTitle .= ' : '.format_for_graph($module['value'], 1, '.', ',', $divisor);
} else {
$statusTitle .= ' : '.substr(io_safe_output($module['value']), 0, 42);
}
@ -1061,7 +1062,7 @@ class Tree
$columns = 'DISTINCT(tam.id_agente_modulo) AS id, tam.nombre AS name,
tam.id_tipo_modulo, tam.id_modulo, tae.estado, tae.datos,
tam.parent_module_id AS parent, tatm.id AS alerts';
tam.parent_module_id AS parent, tatm.id AS alerts, tam.unit';
$sql = "SELECT $columns
FROM tagente_modulo tam

View File

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

View File

@ -262,6 +262,11 @@ function format_for_graph(
$divider=1000,
$sufix=''
) {
// Exception to exclude modules whose unit is already formatted as KB (satellite modules)
if (!empty($sufix) && $sufix == 'KB') {
return;
}
$shorts = [
'',
'K',
@ -5509,3 +5514,108 @@ if (!function_exists('getallheaders')) {
}
/**
* Update config token that contains custom module units.
*
* @param string Name of new module unit.
* @return boolean Success or failure.
*/
function add_custom_module_unit($value)
{
global $config;
$custom_module_units = get_custom_module_units();
$custom_module_units[$value] = $value;
$new_conf = json_encode($custom_module_units);
$return = config_update_value(
'custom_module_units',
$new_conf
);
if ($return) {
$config['custom_module_units'] = $new_conf;
return true;
} else {
return false;
}
}
function get_custom_module_units()
{
global $config;
if (!isset($config['custom_module_units'])) {
$custom_module_units = [];
} else {
$custom_module_units = json_decode(
io_safe_output($config['custom_module_units']),
true
);
}
return $custom_module_units;
}
function delete_custom_module_unit($value)
{
global $config;
$custom_units = get_custom_module_units();
unset($custom_units[io_safe_output($value)]);
$new_conf = json_encode($custom_units);
$return = config_update_value(
'custom_module_units',
$new_conf
);
if ($return) {
$config['custom_module_units'] = $new_conf;
return true;
} else {
return false;
}
}
/**
* Get multiplier to be applied on module data in order to represent it properly. Based on setup configuration and module's unit, either 1000 or 1024 will be returned.
*
* @param string Module's unit.
*
* @return integer Multiplier.
*/
function get_data_multiplier($unit)
{
global $config;
switch ($config['use_data_multiplier']) {
case 0:
if (strpos(strtolower($unit), 'yte') !== false) {
$multiplier = 1024;
} else {
$multiplier = 1000;
}
break;
case 2:
$multiplier = 1024;
break;
case 1:
default:
$multiplier = 1000;
break;
}
return $multiplier;
}

View File

@ -1279,6 +1279,28 @@ function config_update_config()
$error_update[] = __('Delete interval');
}
// --------------------------------------------------
// --------------------------------------------------
// MODULE CUSTOM UNITS
// --------------------------------------------------
$custom_unit = get_parameter('custom_module_unit');
$custom_unit_to_delete = get_parameter('custom_module_unit_to_delete', '');
if (!empty($custom_unit)) {
if (!add_custom_module_unit(
$custom_unit
)
) {
$error_update[] = __('Add custom module unit');
}
}
if (!empty($custom_unit_to_delete)) {
if (!delete_custom_module_unit($custom_unit_to_delete)) {
$error_update[] = __('Delete custom module unit');
}
}
// --------------------------------------------------
if (!config_update_value('custom_report_info', get_parameter('custom_report_info'))) {
$error_update[] = __('Custom report info');
@ -1324,6 +1346,10 @@ function config_update_config()
if (!config_update_value('csv_divider', (string) get_parameter('csv_divider', ';'))) {
$error_update[] = __('CSV divider');
}
if (!config_update_value('use_data_multiplier', get_parameter('use_data_multiplier', '1'))) {
$error_update[] = __('Use data multiplier');
}
break;
case 'net':
@ -2820,6 +2846,10 @@ function config_process_config()
config_update_value('csv_divider', ';');
}
if (!isset($config['use_data_multiplier'])) {
config_update_value('use_data_multiplier', '1');
}
if (!isset($config['command_snapshot'])) {
config_update_value('command_snapshot', 1);
}

View File

@ -572,7 +572,7 @@ function grafico_modulo_sparse_data(
/**
* Functions tu create graphs.
* Functions to create graphs.
*
* @param array $params Details builds graphs. For example:
* 'agent_module_id' => $agent_module_id,
@ -856,6 +856,10 @@ function grafico_modulo_sparse($params)
}
}
if (empty($params['divisor'])) {
$params['divisor'] = get_data_multiplier($params['unit']);
}
if (!$params['array_data_create']) {
if ($params['baseline']) {
$array_data = get_baseline_data(
@ -1478,6 +1482,10 @@ function graphic_combined_module(
$data_module_graph['module_id'] = $agent_module_id;
$data_module_graph['unit'] = $module_data['unit'];
$params['unit'] = $module_data['unit'];
$params['divisor'] = get_data_multiplier($params['unit']);
// Stract data.
$array_data_module = grafico_modulo_sparse_data(
$agent_module_id,

View File

@ -798,6 +798,10 @@ function html_print_extended_select_for_unit(
$fields['_timeticks_'] = 'Timeticks';
$fields['none'] = __('none');
$default_module_custom_units = get_custom_module_units();
$fields = array_merge($fields, $default_module_custom_units);
if ($no_change != 0) {
$fields[-1] = __('No change');
}

View File

@ -1582,7 +1582,10 @@ function reporting_event_top_n(
$data['module'] = $module_name[$i];
$data['value'] = $dt;
$data['formated_value'] = format_for_graph($dt, 2).' '.$units[$i];
$divisor = get_data_multiplier($units[$i]);
$data['formated_value'] = format_for_graph($dt, 2, '.', ',', $divisor, $units[$i]);
$data_return[] = $data;
}
@ -1635,12 +1638,15 @@ function reporting_event_top_n(
$data_pie_graph[$item_name] = $data_top[$i];
$data_hbar[$item_name]['g'] = $data_top[$i];
$divisor = get_data_multiplier($units[$i]);
if ($show_graph == 0 || $show_graph == 1) {
$data = [];
$data['agent'] = $an;
$data['module'] = $module_name[$i];
$data['value'] = $data_top[$i];
$data['formated_value'] = format_for_graph($data_top[$i], 2).' '.$units[$i];
$data['formated_value'] = format_for_graph($data_top[$i], 2, '.', ',', $divisor, $units[$i]);
$data_return[] = $data;
}
@ -1716,14 +1722,15 @@ function reporting_event_top_n(
$i++;
}
$unit = $data_top_values['units'][0];
$avg = ($avg / $i);
$return['resume']['min']['value'] = $min;
$return['resume']['min']['formated_value'] = format_for_graph($min, 2);
$return['resume']['min']['formated_value'] = format_for_graph($min, 2, '.', ',', $divisor, $unit);
$return['resume']['avg']['value'] = $avg;
$return['resume']['avg']['formated_value'] = format_for_graph($avg, 2);
$return['resume']['avg']['formated_value'] = format_for_graph($avg, 2, '.', ',', $divisor, $unit);
$return['resume']['max']['value'] = $max;
$return['resume']['max']['formated_value'] = format_for_graph($max, 2);
$return['resume']['max']['formated_value'] = format_for_graph($max, 2, '.', ',', $divisor, $unit);
}
$return['data'] = $data_return;
@ -4897,6 +4904,8 @@ function reporting_value($report, $content, $type, $pdf=false)
case 'max':
case 'min':
case 'avg':
$divisor = get_data_multiplier($unit);
if ($content['lapse_calc'] == 0) {
switch ($type) {
case 'max':
@ -4927,7 +4936,7 @@ function reporting_value($report, $content, $type, $pdf=false)
if (!$config['simple_module_value']) {
$formated_value = $value;
} else {
$formated_value = format_for_graph($value, $config['graph_precision']).' '.$unit;
$formated_value = format_for_graph($value, $config['graph_precision'], '.', ',', $divisor, $unit);
}
} else {
$return['visual_format'] = $content['visual_format'];
@ -4935,17 +4944,17 @@ function reporting_value($report, $content, $type, $pdf=false)
switch ($type) {
case 'max':
$params['force_interval'] = 'max_only';
$value = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit;
$value = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision'], '.', ',', $divisor, $unit);
break;
case 'min':
$params['force_interval'] = 'min_only';
$value = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit;
$value = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision'], '.', ',', $divisor, $unit);
break;
case 'avg':
$params['force_interval'] = 'avg_only';
$value = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision']).' '.$unit;
$value = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['period'], $report['datetime']), $config['graph_precision'], '.', ',', $divisor, $unit);
break;
}
@ -4975,15 +4984,15 @@ function reporting_value($report, $content, $type, $pdf=false)
if ($i > $time_begin['utimestamp']) {
switch ($type) {
case 'max':
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_max($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision'], '.', ',', $divisor, $unit);
break;
case 'min':
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_min($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision'], '.', ',', $divisor, $unit);
break;
case 'avg':
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision']).' '.$unit;
$row[__('Maximun')] = format_for_graph(reporting_get_agentmodule_data_average($content['id_agent_module'], $content['lapse'], ($i + $content['lapse'])), $config['graph_precision'], '.', ',', $divisor, $unit);
break;
}
} else {
@ -5012,7 +5021,9 @@ function reporting_value($report, $content, $type, $pdf=false)
if (!$config['simple_module_value']) {
$formated_value = $value;
} else {
$formated_value = format_for_graph($value, $config['graph_precision']).' '.$unit;
$divisor = get_data_multiplier($unit);
$formated_value = format_for_graph($value, $config['graph_precision'], '.', ',', $divisor, $unit);
}
break;
}
@ -7329,6 +7340,8 @@ function reporting_general($report, $content)
}
}
$divisor = get_data_multiplier($unit);
switch ($content['group_by_agent']) {
case REPORT_GENERAL_NOT_GROUP_BY_AGENT:
$id_agent_module[$index] = $row['id_agent_module'];
@ -7359,7 +7372,7 @@ function reporting_general($report, $content)
if (!is_numeric($data_res[$index])) {
$return['data'][$name_agent][$mod_name] = $data_res[$index];
} else {
$return['data'][$name_agent][$mod_name] = format_for_graph($data_res[$index], 2).' '.$unit;
$return['data'][$name_agent][$mod_name] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, $unit);
}
}
break;
@ -7378,7 +7391,7 @@ function reporting_general($report, $content)
if ($change_min) {
$return['min']['value'] = $data_res[$index];
$return['min']['formated_value'] = format_for_graph($data_res[$index], 2).' '.$unit;
$return['min']['formated_value'] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, $unit);
$return['min']['agent'] = $ag_name;
$return['min']['module'] = $mod_name;
}
@ -7394,7 +7407,7 @@ function reporting_general($report, $content)
if ($change_max) {
$return['max']['value'] = $data_res[$index];
$return['max']['formated_value'] = format_for_graph($data_res[$index], 2).' '.$unit;
$return['max']['formated_value'] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, $unit);
$return['max']['agent'] = $ag_name;
$return['max']['module'] = $mod_name;
}
@ -7512,13 +7525,15 @@ function reporting_general($report, $content)
break;
}
$divisor = get_data_multiplier($units[$i]);
if (!is_numeric($d) || $is_string[$i]) {
$data['value'] = $d;
// to see the chains on the table
$data['formated_value'] = $d;
} else {
$data['value'] = $d;
$data['formated_value'] = format_for_graph($d, 2).' '.$units[$i];
$data['formated_value'] = format_for_graph($d, 2, '.', ',', $divisor, $units[$i]);
}
}

View File

@ -1892,7 +1892,13 @@ function ui_process_page_head($string, $bitfield)
}
// Pandora specific JavaScript should go first.
$config['js'] = array_merge(['pandora' => 'include/javascript/pandora.js'], $config['js']);
$config['js'] = array_merge(
[
'pandora' => 'include/javascript/pandora.js',
'pandora_ui' => 'include/javascript/pandora_ui.js',
],
$config['js']
);
// Load base64 javascript library.
$config['js']['base64'] = 'include/javascript/encode_decode_base64.js';
// Load webchat javascript library.

View File

@ -1037,6 +1037,11 @@ function pandoraFlotArea(
var update_legend = {};
var force_integer = 0;
var title = params.title;
var divisor = params.divisor;
if (typeof divisor === "undefined") {
divisor = 1000;
}
if (typeof type === "undefined" || type == "") {
type = params.type_graph;
@ -2443,11 +2448,6 @@ function pandoraFlotArea(
}
}
var y_array = format_unit_yaxes(y);
y = y_array["y"];
var how_bigger = y_array["unit"];
var data_legend = [];
// The graphs of points type and unknown graphs will dont be updated
@ -2465,10 +2465,7 @@ function pandoraFlotArea(
.html(
label_aux +
" value = " +
(short_data
? number_format(y, 0, "", short_data)
: parseFloat(y)) +
how_bigger +
number_format(y, 0, "", short_data, divisor) +
" " +
unit
);
@ -2516,20 +2513,11 @@ function pandoraFlotArea(
data_legend[index] =
" Min: " +
(short_data
? number_format(min_y, 0, "", short_data)
: parseFloat(min_y)) +
min_bigger +
number_format(value[x].min, 0, unit, short_data, divisor) +
" Max: " +
(short_data
? number_format(max_y, 0, "", short_data)
: parseFloat(max_y)) +
max_bigger +
number_format(value[x].max, 0, unit, short_data, divisor) +
" Avg: " +
(short_data
? number_format(avg_y, 0, "", short_data)
: parseFloat(avg_y)) +
avg_bigger;
number_format(value[x].avg, 0, unit, short_data, divisor);
});
label_aux =
@ -2734,12 +2722,13 @@ function pandoraFlotArea(
function yFormatter(v) {
var formatted = v;
if (short_data) {
formatted = number_format(v, force_integer, "", short_data);
formatted = number_format(v, force_integer, unit, short_data, divisor);
} else {
// It is an integer.
if (v - Math.floor(v) == 0) {
formatted = number_format(v, force_integer, "", 2);
formatted = number_format(v, force_integer, unit, 2, divisor);
}
}
@ -3067,7 +3056,18 @@ function check_adaptions(graph_id) {
});
}
function number_format(number, force_integer, unit, short_data) {
function number_format(number, force_integer, unit, short_data, divisor) {
divisor = typeof divisor !== "undefined" ? divisor : 1000;
if (unit == "KB") {
return number + unit;
}
// Set maximum decimal precision to 99 in case short_data is not set.
if (!short_data) {
short_data = 99;
}
if (force_integer) {
if (Math.round(number) != number) {
return "";
@ -3080,17 +3080,15 @@ function number_format(number, force_integer, unit, short_data) {
var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];
var pos = 0;
while (1) {
if (number >= 1000) {
//as long as the number can be divided by 1000
pos++; //Position in array starting with 0
number = number / 1000;
} else if (number <= -1000) {
pos++;
number = number / 1000;
} else {
break;
}
while (number >= divisor) {
// As long as the number can be divided by 1000 or 1024.
pos++;
number = number / divisor;
}
if (divisor) {
number = Math.round(number * decimals) / decimals;
}
return number + " " + shorts[pos] + unit;

View File

@ -712,7 +712,7 @@ function post_process_select_init_unit(name, selected) {
});
if (select_or_text) {
$("#" + name + "_select option[value=" + selected + "]").attr(
$("#" + name + "_select option[value='" + selected + "']").attr(
"selected",
true
);
@ -728,7 +728,7 @@ function post_process_select_init_unit(name, selected) {
$("#" + name + "_select").change(function() {
var value = $("#" + name + "_select").val();
$("#" + name + "_select option[value=" + value + "]").attr(
$("#" + name + "_select option[value='" + value + "']").attr(
"selected",
true
);
@ -1826,399 +1826,6 @@ function ellipsize(str, max, ellipse) {
return str.trim().length > max ? str.substr(0, max).trim() + ellipse : str;
}
/**
* Display a dialog with an image
*
* @param {string} icon_name The name of the icon you will display
* @param {string} icon_path The path to the icon
* @param {Object} incoming_options All options
* grayed: {bool} True to display the background black
* title {string} 'Logo preview' by default
*/
function logo_preview(icon_name, icon_path, incoming_options) {
// Get the options
options = {
grayed: false,
title: "Logo preview"
};
$.extend(options, incoming_options);
if (icon_name == "") return;
$dialog = $("<div></div>");
$image = $('<img src="' + icon_path + '">');
$image.css("max-width", "500px").css("max-height", "500px");
try {
$dialog
.hide()
.html($image)
.dialog({
title: options.title,
resizable: true,
draggable: true,
modal: true,
dialogClass: options.grayed ? "dialog-grayed" : "",
overlay: {
opacity: 0.5,
background: "black"
},
minHeight: 1,
width: $image.width,
close: function() {
$dialog.empty().remove();
}
})
.show();
} catch (err) {
// console.log(err);
}
}
// Advanced Form control.
function load_modal(settings) {
var AJAX_RUNNING = 0;
var data = new FormData();
if (settings.extradata) {
settings.extradata.forEach(function(item) {
if (item.value != undefined) {
if (item.value instanceof Object || item.value instanceof Array) {
data.append(item.name, JSON.stringify(item.value));
} else {
data.append(item.name, item.value);
}
}
});
}
data.append("page", settings.onshow.page);
data.append("method", settings.onshow.method);
if (settings.onshow.extradata != undefined) {
data.append("extradata", JSON.stringify(settings.onshow.extradata));
}
if (settings.target == undefined) {
var uniq = uniqId();
var div = document.createElement("div");
div.id = "div-modal-" + uniq;
div.style.display = "none";
document.getElementById("main").append(div);
var id_modal_target = "#div-modal-" + uniq;
settings.target = $(id_modal_target);
}
var width = 630;
if (settings.onshow.width) {
width = settings.onshow.width;
}
if (settings.modal.overlay == undefined) {
settings.modal.overlay = {
opacity: 0.5,
background: "black"
};
}
if (settings.beforeClose == undefined) {
settings.beforeClose = function() {};
}
settings.target.html("Loading modal...");
settings.target
.dialog({
title: "Loading",
close: false,
width: 200,
buttons: []
})
.show();
var required_buttons = [];
if (settings.modal.cancel != undefined) {
//The variable contains a function
// that is responsible for executing the method it receives from settings
// which confirms the closure of a modal
var cancelModal = function() {
settings.target.dialog("close");
if (AJAX_RUNNING) return;
AJAX_RUNNING = 1;
var formdata = new FormData();
formdata.append("page", settings.oncancel.page);
formdata.append("method", settings.oncancel.method);
$.ajax({
method: "post",
url: settings.url,
processData: false,
contentType: false,
data: formdata,
success: function(data) {
if (typeof settings.oncancel.callback == "function") {
settings.oncancel.callback(data);
settings.target.dialog("close");
}
AJAX_RUNNING = 0;
},
error: function(data) {
// console.log(data);
AJAX_RUNNING = 0;
}
});
};
required_buttons.push({
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
text: settings.modal.cancel,
click: function() {
if (settings.oncancel != undefined) {
if (typeof settings.oncancel.confirm == "function") {
//receive function
settings.oncancel.confirm(cancelModal);
} else if (settings.oncancel != undefined) {
cancelModal();
}
} else {
$(this).dialog("close");
}
}
});
}
if (settings.modal.ok != undefined) {
required_buttons.push({
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
text: settings.modal.ok,
click: function() {
if (AJAX_RUNNING) return;
if (settings.onsubmit != undefined) {
if (settings.onsubmit.preaction != undefined) {
settings.onsubmit.preaction();
}
AJAX_RUNNING = 1;
if (settings.onsubmit.dataType == undefined) {
settings.onsubmit.dataType = "html";
}
var formdata = new FormData();
if (settings.extradata) {
settings.extradata.forEach(function(item) {
if (item.value != undefined)
formdata.append(item.name, item.value);
});
}
formdata.append("page", settings.onsubmit.page);
formdata.append("method", settings.onsubmit.method);
var flagError = false;
if (Array.isArray(settings.form) === false) {
$("#" + settings.form + " :input").each(function() {
if (this.checkValidity() === false) {
$(this).attr("title", this.validationMessage);
$(this).tooltip({
tooltipClass: "uitooltip",
position: {
my: "right bottom",
at: "right top",
using: function(position, feedback) {
$(this).css(position);
$("<div>")
.addClass("arrow")
.addClass(feedback.vertical)
.addClass(feedback.horizontal)
.appendTo(this);
}
}
});
$(this).tooltip("open");
var element = $(this);
setTimeout(
function(element) {
element.tooltip("destroy");
element.removeAttr("title");
},
3000,
element
);
flagError = true;
}
if (this.type == "file") {
if ($(this).prop("files")[0]) {
formdata.append(this.name, $(this).prop("files")[0]);
}
} else {
if ($(this).attr("type") == "checkbox") {
if (this.checked) {
formdata.append(this.name, "on");
}
} else {
formdata.append(this.name, $(this).val());
}
}
});
} else {
settings.form.forEach(function(element) {
$("#" + element + " :input").each(function() {
// TODO VALIDATE ALL INPUTS.
if (this.type == "file") {
if ($(this).prop("files")[0]) {
formdata.append(this.name, $(this).prop("files")[0]);
}
} else {
if ($(this).attr("type") == "checkbox") {
if (this.checked) {
formdata.append(this.name, "on");
}
} else {
formdata.append(this.name, $(this).val());
}
}
});
});
}
if (flagError === false) {
if (
settings.onsubmitClose != undefined &&
settings.onsubmitClose == 1
) {
$(this).dialog("close");
}
$.ajax({
method: "post",
url: settings.url,
processData: false,
contentType: false,
data: formdata,
dataType: settings.onsubmit.dataType,
success: function(data) {
if (settings.ajax_callback != undefined) {
if (settings.idMsgCallback != undefined) {
settings.ajax_callback(data, settings.idMsgCallback);
} else {
settings.ajax_callback(data);
}
}
AJAX_RUNNING = 0;
}
});
} else {
AJAX_RUNNING = 0;
}
} else {
// No onsumbit configured. Directly close.
$(this).dialog("close");
}
},
error: function(data) {
//console.log(data);
AJAX_RUNNING = 0;
}
});
}
$.ajax({
method: "post",
url: settings.url,
processData: false,
contentType: false,
data: data,
success: function(data) {
settings.target.html(data);
if (settings.onload != undefined) {
settings.onload(data);
}
settings.target.dialog({
resizable: true,
draggable: true,
modal: true,
title: settings.modal.title,
width: width,
minHeight:
settings.onshow.minHeight != undefined
? settings.onshow.minHeight
: "auto",
maxHeight:
settings.onshow.maxHeight != undefined
? settings.onshow.maxHeight
: "auto",
overlay: settings.modal.overlay,
buttons: required_buttons,
closeOnEscape: true,
open: function() {
//$(".ui-dialog-titlebar-close").hide();
},
close: function() {
if (id_modal_target != undefined) {
$(id_modal_target).remove();
}
if (settings.cleanup != undefined) {
settings.cleanup();
}
$(this).dialog("destroy");
},
beforeClose: settings.beforeClose()
});
},
error: function(data) {
// console.log(data);
}
});
}
/**
* Function that shows a dialog box to confirm closures of generic manners.
* The modal id is random
*
* @param {array} settings Settings.
*/
// eslint-disable-next-line no-unused-vars
function confirmDialog(settings) {
var randomStr = uniqId();
$("body").append(
'<div id="confirm_' + randomStr + '">' + settings.message + "</div>"
);
$("#confirm_" + randomStr);
$("#confirm_" + randomStr)
.dialog({
title: settings.title,
close: false,
width: 350,
modal: true,
buttons: [
{
text: "Cancel",
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
click: function() {
$(this).dialog("close");
if (typeof settings.onDeny == "function") settings.onDeny();
}
},
{
text: "Ok",
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
click: function() {
$(this).dialog("close");
if (typeof settings.onAccept == "function") settings.onAccept();
}
}
]
})
.show();
}
function uniqId() {
var randomStr =
Math.random()
@ -2231,58 +1838,6 @@ function uniqId() {
return randomStr;
}
/**
* Function to show modal with message Validation.
*
* @param {json} data Json example:
* $return = [
* 'error' => 0 or 1,
* 'title' => [
* Failed,
* Success,
* ],
* 'text' => [
* Failed,
* Success,
* ],
*];
* @param {string} idMsg ID div charge modal.
*
* @return {void}
*/
function generalShowMsg(data, idMsg) {
var title = data.title[data.error];
var text = data.text[data.error];
var failed = !data.error;
$("#" + idMsg).empty();
$("#" + idMsg).html(text);
$("#" + idMsg).dialog({
width: 450,
position: {
my: "center",
at: "center",
of: window,
collision: "fit"
},
title: title,
buttons: [
{
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
text: "OK",
click: function(e) {
if (!failed) {
$(".ui-dialog-content").dialog("close");
} else {
$(this).dialog("close");
}
}
}
]
});
}
/**
* Function for AJAX request.
*

View File

@ -0,0 +1,399 @@
/* global $ */
/* exported load_modal */
/*JS to Show user modals :
- Confirm dialogs.
- Display dialogs.
- Load modal windows.
- Logo Previews.
- General show messages.
*/
var ENTERPRISE_DIR = "enterprise";
/**
* Display a dialog with an image
*
* @param {string} icon_name The name of the icon you will display
* @param {string} icon_path The path to the icon
* @param {Object} incoming_options All options
* grayed: {bool} True to display the background black
* title {string} 'Logo preview' by default
*/
function logo_preview(icon_name, icon_path, incoming_options) {
// Get the options
options = {
grayed: false,
title: "Logo preview"
};
$.extend(options, incoming_options);
if (icon_name == "") return;
$dialog = $("<div></div>");
$image = $('<img src="' + icon_path + '">');
$image.css("max-width", "500px").css("max-height", "500px");
try {
$dialog
.hide()
.html($image)
.dialog({
title: options.title,
resizable: true,
draggable: true,
modal: true,
dialogClass: options.grayed ? "dialog-grayed" : "",
overlay: {
opacity: 0.5,
background: "black"
},
minHeight: 1,
width: $image.width,
close: function() {
$dialog.empty().remove();
}
})
.show();
} catch (err) {
// console.log(err);
}
}
// Advanced Form control.
function load_modal(settings) {
var AJAX_RUNNING = 0;
var data = new FormData();
if (settings.extradata) {
settings.extradata.forEach(function(item) {
if (item.value != undefined) data.append(item.name, item.value);
});
}
data.append("page", settings.onshow.page);
data.append("method", settings.onshow.method);
if (settings.onshow.extradata != undefined) {
data.append("extradata", JSON.stringify(settings.onshow.extradata));
}
if (settings.target == undefined) {
var uniq = uniqId();
var div = document.createElement("div");
div.id = "div-modal-" + uniq;
div.style.display = "none";
document.getElementById("main").append(div);
var id_modal_target = "#div-modal-" + uniq;
settings.target = $(id_modal_target);
}
var width = 630;
if (settings.onshow.width) {
width = settings.onshow.width;
}
if (settings.modal.overlay == undefined) {
settings.modal.overlay = {
opacity: 0.5,
background: "black"
};
}
settings.target.html("Loading modal...");
settings.target
.dialog({
title: "Loading",
close: false,
width: 200,
buttons: []
})
.show();
var required_buttons = [];
if (settings.modal.cancel != undefined) {
//The variable contains a function
// that is responsible for executing the method it receives from settings
// which confirms the closure of a modal
var cancelModal = function() {
settings.target.dialog("close");
if (AJAX_RUNNING) return;
AJAX_RUNNING = 1;
var formdata = new FormData();
formdata.append("page", settings.oncancel.page);
formdata.append("method", settings.oncancel.method);
$.ajax({
method: "post",
url: settings.url,
processData: false,
contentType: false,
data: formdata,
success: function(data) {
if (typeof settings.oncancel.callback == "function") {
settings.oncancel.callback(data);
settings.target.dialog("close");
}
AJAX_RUNNING = 0;
},
error: function(data) {
// console.log(data);
AJAX_RUNNING = 0;
}
});
};
required_buttons.push({
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
text: settings.modal.cancel,
click: function() {
if (settings.oncancel != undefined) {
if (typeof settings.oncancel.confirm == "function") {
//receive function
settings.oncancel.confirm(cancelModal);
} else if (settings.oncancel != undefined) {
cancelModal();
}
} else {
$(this).dialog("close");
}
}
});
}
if (settings.modal.ok != undefined) {
required_buttons.push({
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
text: settings.modal.ok,
click: function() {
if (AJAX_RUNNING) return;
if (settings.onsubmit != undefined) {
if (settings.onsubmit.preaction != undefined) {
settings.onsubmit.preaction();
}
AJAX_RUNNING = 1;
if (settings.onsubmit.dataType == undefined) {
settings.onsubmit.dataType = "html";
}
var formdata = new FormData();
if (settings.extradata) {
settings.extradata.forEach(function(item) {
if (item.value != undefined)
formdata.append(item.name, item.value);
});
}
formdata.append("page", settings.onsubmit.page);
formdata.append("method", settings.onsubmit.method);
var flagError = false;
$("#" + settings.form + " :input").each(function() {
if (this.checkValidity() === false) {
$(this).attr("title", this.validationMessage);
$(this).tooltip({
tooltipClass: "uitooltip",
position: {
my: "right bottom",
at: "right top",
using: function(position, feedback) {
$(this).css(position);
$("<div>")
.addClass("arrow")
.addClass(feedback.vertical)
.addClass(feedback.horizontal)
.appendTo(this);
}
}
});
$(this).tooltip("open");
var element = $(this);
setTimeout(
function(element) {
element.tooltip("destroy");
element.removeAttr("title");
},
3000,
element
);
flagError = true;
}
if (this.type == "file") {
if ($(this).prop("files")[0]) {
formdata.append(this.name, $(this).prop("files")[0]);
}
} else {
if ($(this).attr("type") == "checkbox") {
if (this.checked) {
formdata.append(this.name, "on");
}
} else {
formdata.append(this.name, $(this).val());
}
}
});
if (flagError === false) {
$.ajax({
method: "post",
url: settings.url,
processData: false,
contentType: false,
data: formdata,
dataType: settings.onsubmit.dataType,
success: function(data) {
if (settings.ajax_callback != undefined) {
if (settings.idMsgCallback != undefined) {
settings.ajax_callback(data, settings.idMsgCallback);
} else {
settings.ajax_callback(data);
}
}
AJAX_RUNNING = 0;
}
});
} else {
AJAX_RUNNING = 0;
}
} else {
// No onsumbit configured. Directly close.
$(this).dialog("close");
}
},
error: function(data) {
// console.log(data);
AJAX_RUNNING = 0;
}
});
}
$.ajax({
method: "post",
url: settings.url,
processData: false,
contentType: false,
data: data,
success: function(data) {
settings.target.html(data);
if (settings.onload != undefined) {
settings.onload(data);
}
settings.target.dialog({
resizable: true,
draggable: true,
modal: true,
title: settings.modal.title,
width: width,
overlay: settings.modal.overlay,
buttons: required_buttons,
closeOnEscape: false,
open: function() {
$(".ui-dialog-titlebar-close").hide();
},
close: function() {
if (id_modal_target != undefined) {
$(id_modal_target).remove();
}
}
});
},
error: function(data) {
// console.log(data);
}
});
}
//Function that shows a dialog box to confirm closures of generic manners. The modal id is random
function confirmDialog(settings) {
var randomStr = uniqId();
$("body").append(
'<div id="confirm_' + randomStr + '">' + settings.message + "</div>"
);
$("#confirm_" + randomStr);
$("#confirm_" + randomStr)
.dialog({
title: settings.title,
close: false,
width: 350,
modal: true,
buttons: [
{
text: "Cancel",
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
click: function() {
$(this).dialog("close");
if (typeof settings.onDeny == "function") settings.onDeny();
}
},
{
text: "Ok",
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
click: function() {
$(this).dialog("close");
if (typeof settings.onAccept == "function") settings.onAccept();
}
}
]
})
.show();
}
/**
* Function to show modal with message Validation.
*
* @param {json} data Json example:
* $return = [
* 'error' => 0 or 1,
* 'title' => [
* Failed,
* Success,
* ],
* 'text' => [
* Failed,
* Success,
* ],
*];
* @param {string} idMsg ID div charge modal.
*
* @return {void}
*/
function generalShowMsg(data, idMsg) {
var title = data.title[data.error];
var text = data.text[data.error];
var failed = !data.error;
$("#" + idMsg).empty();
$("#" + idMsg).html(text);
$("#" + idMsg).dialog({
width: 450,
position: {
my: "center",
at: "center",
of: window,
collision: "fit"
},
title: title,
buttons: [
{
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
text: "OK",
click: function(e) {
if (!failed) {
$(".ui-dialog-content").dialog("close");
} else {
$(this).dialog("close");
}
}
}
]
});
}

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.742';
$build = '200120';
$build = '200121';
$banner = "v$version Build $build";
error_reporting(0);
@ -967,10 +967,10 @@ function install_step4()
$connection,
"CREATE USER pandora@$host IDENTIFIED BY '".$random_password."'"
);
$step5 |= mysqli_query(
$connection,
"GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host"
);
$step5 |= mysqli_query(
$connection,
"GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host"
);
mysqli_query($connection, 'FLUSH PRIVILEGES');
check_generic($step5, "Established privileges for user pandora. A new random password has been generated: <b>$random_password</b><div class='warn'>Please write it down, you will need to setup your Pandora FMS server, editing the </i>/etc/pandora/pandora_server.conf</i> file</div>");

View File

@ -775,6 +775,7 @@ class Ui
echo " <script src='include/javascript/jquery.js'></script>\n";
echo " <script src='include/javascript/jquery.mobile-1.3.1.js'></script>\n";
echo " <script src='../include/javascript/pandora.js'></script>\n";
echo " <script src='../include/javascript/pandora_ui.js'></script>\n";
echo " </head>\n";
echo " <body>\n";

View File

@ -65,6 +65,7 @@ echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/
<link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />
<link rel="stylesheet" href="../../include/styles/js/jquery-ui.min.css" type="text/css" />
<script type='text/javascript' src='../../include/javascript/pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/pandora_ui.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery-3.3.1.min.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script>

View File

@ -73,6 +73,7 @@ $label = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id)
<link rel="stylesheet" href="../../include/styles/js/jquery-ui.min.css" type="text/css" />
<link rel="stylesheet" href="../../include/styles/js/jquery-ui_custom.css" type="text/css" />
<script type='text/javascript' src='../../include/javascript/pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/pandora_ui.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery-3.3.1.min.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script>

View File

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

View File

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

View File

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

View File

@ -140,7 +140,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('cr_incident_title', ''),
('cr_incident_content', ''),
('sample_agent', '0'),
('gotty', '/usr/bin/gotty');
('gotty', '/usr/bin/gotty'),
('custom_module_units', '{"bytes":"bytes","entries":"entries","files":"files","hits":"hits","sessions":"sessions","users":"users","ºC":"ºC","ºF":"ºF"}');
UNLOCK TABLES;
--

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.742-200120
Version: 7.0NG.742-200121
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.742";
my $pandora_build = "200120";
my $pandora_build = "200121";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.742";
my $pandora_build = "200120";
my $pandora_build = "200121";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.742
%define release 200120
%define release 200121
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.742
%define release 200120
%define release 200121
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.742"
PI_BUILD="200120"
PI_BUILD="200121"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.742 PS200120";
my $version = "7.0NG.742 PS200121";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.742 PS200120";
my $version = "7.0NG.742 PS200121";
# save program name for logging
my $progname = basename($0);