Merge branch 'develop' into ent-8533-Mostrar-valores-en-elementos-Agents-modules

This commit is contained in:
Daniel Maya 2022-03-23 12:12:52 +01:00
commit ff60967bdf
66 changed files with 1113 additions and 373 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.760-220317
Version: 7.0NG.760-220323
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.760-220317"
pandora_version="7.0NG.760-220323"
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

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.760';
use constant AGENT_BUILD => '220317';
use constant AGENT_BUILD => '220323';
# 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.760
%define release 220317
%define release 220323
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.760"
PI_BUILD="220317"
PI_BUILD="220323"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{220317}
{220323}
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.760 Build 220317")
#define PANDORA_VERSION ("7.0NG.760 Build 220323")
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.760(Build 220317))"
VALUE "ProductVersion", "(7.0NG.760(Build 220323))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.760-220317
Version: 7.0NG.760-220323
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.760-220317"
pandora_version="7.0NG.760-220323"
package_pear=0
package_pandora=1

View File

@ -1,5 +1,7 @@
START TRANSACTION;
ALTER TABLE `tipam_vlan` ADD COLUMN `custom_id` bigint(20) unsigned DEFAULT NULL;
UPDATE `tuser_task` SET `parameters` = 'a:3:{i:0;a:2:{s:11:"description";s:11:"Description";s:4:"type";s:4:"text";}i:1;a:3:{s:11:"description";s:20:"Save to disk in path";s:4:"type";s:6:"string";s:13:"default_value";s:21:"_%_ATTACHMENT_PATH_%_";}i:2;a:3:{s:11:"description";s:14:"Active backups";s:4:"type";s:6:"number";s:13:"default_value";i:3;}}' WHERE `function_name` = 'cron_task_do_backup';
CREATE TABLE IF NOT EXISTS `tbackup` (
@ -14,4 +16,4 @@ CREATE TABLE IF NOT EXISTS `tbackup` (
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
COMMIT;
COMMIT;

View File

@ -69,8 +69,6 @@ if (is_ajax() === true) {
if ($groups_secondary_selected === true) {
$groups = get_parameter('groups', []);
$groups_selected = get_parameter('groups_selected', []);
hd($groups, true);
hd($groups_selected, true);
$user_groups = users_get_groups($config['user'], 'AR', false);
$ret = [];

View File

@ -27,6 +27,8 @@
* ============================================================================
*/
use PandoraFMS\Enterprise\Metaconsole\Synchronizer;
global $config;
@ -3839,7 +3841,12 @@ function print_SLA_list($width, $action, $idItem=null)
[$item['id_agent_module']]
);
echo '<td class="sla_list_service_col">';
echo printSmallFont($nameService);
if ($meta && $server_name != '') {
echo $server_name.' &raquo; '.$nameService;
} else {
echo $nameService;
}
echo '</th>';
}
@ -3986,8 +3993,8 @@ function print_SLA_list($width, $action, $idItem=null)
<?php
}
if (enterprise_installed()
&& $report_item_type == 'SLA_services'
if (enterprise_installed() === true
&& $report_item_type === 'SLA_services'
) {
enterprise_include_once(
'include/functions_services.php'
@ -4006,8 +4013,9 @@ function print_SLA_list($width, $action, $idItem=null)
],
]
);
if (!empty($services_tmp)
&& $services_tmp != ENTERPRISE_NOT_HOOK
if (empty($services_tmp) === false
&& $services_tmp !== ENTERPRISE_NOT_HOOK
) {
foreach ($services_tmp as $service) {
$check_module_sla = modules_check_agentmodule_exists(
@ -4016,14 +4024,89 @@ function print_SLA_list($width, $action, $idItem=null)
$check_module_sla_value = modules_check_agentmodule_exists(
$service['sla_value_id_module']
);
if ($check_module_sla
&& $check_module_sla_value
if ($check_module_sla === true
&& $check_module_sla_value === true
) {
$services[$service['id']] = $service['name'];
}
}
}
if (is_metaconsole() === true) {
$sc = new Synchronizer();
$node_services = $sc->apply(
function ($node) {
try {
$node->connect();
$services_tmp = enterprise_hook(
'services_get_services',
[
false,
[
'id',
'name',
'description',
'sla_id_module',
'sla_value_id_module',
],
]
);
$all_services = [];
if (empty($services_tmp) === false
&& $services_tmp !== ENTERPRISE_NOT_HOOK
) {
foreach ($services_tmp as $service) {
$check_module_sla = modules_check_agentmodule_exists(
$service['sla_id_module']
);
$check_module_sla_value = modules_check_agentmodule_exists(
$service['sla_value_id_module']
);
if ($check_module_sla === true
&& $check_module_sla_value === true
) {
$all_services[$service['id']] = $service;
}
}
}
$node->disconnect();
} catch (\Exception $e) {
$all_services = false;
}
if ($all_services !== false) {
return array_reduce(
$all_services,
function ($carry, $item) use ($node) {
$carry[] = [
'id' => $node->id().'|'.$item['id'],
'name' => io_safe_output(
$node->server_name().' &raquo; '.$item['name']
),
];
return $carry;
},
[]
);
}
return [];
},
false
);
foreach ($node_services as $ns) {
foreach ($ns as $k => $ser) {
$services[$ser['id']] = $ser['name'];
}
}
}
echo '<td class="sla_list_service_col">';
echo html_print_select(
$services,
@ -5334,6 +5417,11 @@ function addSLARow() {
var slaMax = $("input[name=sla_max]").val();
var slaLimit = $("input[name=sla_limit]").val();
var serviceId = $("select#id_service>option:selected").val();
if(serviceId != '' && serviceId.split('|').length > 1 ) {
var ids = serviceId.split('|');
serverId = ids[0];
serviceId = ids[1];
}
var serviceName = $("select#id_service>option:selected").text();
if ((((idAgent != '') && (idAgent > 0))

View File

@ -170,7 +170,7 @@ $table->data[2][0] = __('Background');
$table->data[2][1] = html_print_select(
$backgrounds_list,
'background',
$background,
io_safe_output($background),
'',
'None',
'None.png',

View File

@ -504,9 +504,9 @@ $table_other->style[0] = 'font-weight: bold';
$table_other->size[0] = '70%';
$table_other->size[1] = '30%';
$table_other->data[1][0] = __('Item limit for realtime reports');
$table_other->data[1][1] = html_print_input_text(
$i = 0;
$table_other->data[$i][0] = __('Item limit for realtime reports');
$table_other->data[$i++][1] = html_print_input_text(
'report_limit',
$config['report_limit'],
'',
@ -515,8 +515,8 @@ $table_other->data[1][1] = html_print_input_text(
true
);
$table_other->data[2][0] = __('Compact interpolation in hours (1 Fine-20 bad)');
$table_other->data[2][1] = html_print_input_text(
$table_other->data[$i][0] = __('Compact interpolation in hours (1 Fine-20 bad)');
$table_other->data[$i++][1] = html_print_input_text(
'step_compact',
$config['step_compact'],
'',
@ -535,8 +535,8 @@ $intervals[SECONDS_1WEEK] = __('Last week');
$intervals[SECONDS_2WEEK] = __('2 weeks');
$intervals[SECONDS_1MONTH] = __('Last month');
$table_other->data[3][0] = __('Default hours for event view');
$table_other->data[3][1] = html_print_input_text(
$table_other->data[$i][0] = __('Default hours for event view');
$table_other->data[$i++][1] = html_print_input_text(
'event_view_hr',
$config['event_view_hr'],
'',
@ -545,16 +545,16 @@ $table_other->data[3][1] = html_print_input_text(
true
);
$table_other->data[5][0] = __('Use realtime statistics');
$table_other->data[5][1] = html_print_checkbox_switch(
$table_other->data[$i][0] = __('Use realtime statistics');
$table_other->data[$i++][1] = html_print_checkbox_switch(
'realtimestats',
1,
$config['realtimestats'],
true
);
$table_other->data[6][0] = __('Batch statistics period (secs)');
$table_other->data[6][1] = html_print_input_text(
$table_other->data[$i][0] = __('Batch statistics period (secs)');
$table_other->data[$i++][1] = html_print_input_text(
'stats_interval',
$config['stats_interval'],
'',
@ -563,11 +563,11 @@ $table_other->data[6][1] = html_print_input_text(
true
);
$table_other->data[7][0] = __('Use agent access graph');
$table_other->data[7][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true);
$table_other->data[$i][0] = __('Use agent access graph');
$table_other->data[$i++][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true);
$table_other->data[8][0] = __('Max. recommended number of files in attachment directory');
$table_other->data[8][1] = html_print_input_text(
$table_other->data[$i][0] = __('Max. recommended number of files in attachment directory');
$table_other->data[$i++][1] = html_print_input_text(
'num_files_attachment',
$config['num_files_attachment'],
'',
@ -576,11 +576,11 @@ $table_other->data[8][1] = html_print_input_text(
true
);
$table_other->data[9][0] = __('Delete not init modules');
$table_other->data[9][1] = html_print_checkbox_switch('delete_notinit', 1, $config['delete_notinit'], true);
$table_other->data[$i][0] = __('Delete not init modules');
$table_other->data[$i++][1] = html_print_checkbox_switch('delete_notinit', 1, $config['delete_notinit'], true);
$table_other->data[10][0] = __('Big Operation Step to purge old data');
$table_other->data[10][1] = html_print_input_text(
$table_other->data[$i][0] = __('Big Operation Step to purge old data');
$table_other->data[$i++][1] = html_print_input_text(
'big_operation_step_datos_purge',
$config['big_operation_step_datos_purge'],
'',
@ -589,8 +589,8 @@ $table_other->data[10][1] = html_print_input_text(
true
);
$table_other->data[11][0] = __('Small Operation Step to purge old data');
$table_other->data[11][1] = html_print_input_text(
$table_other->data[$i][0] = __('Small Operation Step to purge old data');
$table_other->data[$i++][1] = html_print_input_text(
'small_operation_step_datos_purge',
$config['small_operation_step_datos_purge'],
'',
@ -599,8 +599,8 @@ $table_other->data[11][1] = html_print_input_text(
true
);
$table_other->data[12][0] = __('Graph container - Max. Items');
$table_other->data[12][1] = html_print_input_text(
$table_other->data[$i][0] = __('Graph container - Max. Items');
$table_other->data[$i++][1] = html_print_input_text(
'max_graph_container',
$config['max_graph_container'],
'',
@ -609,8 +609,8 @@ $table_other->data[12][1] = html_print_input_text(
true
);
$table_other->data[13][0] = __('Events response max. execution');
$table_other->data[13][1] = html_print_input_text(
$table_other->data[$i][0] = __('Events response max. execution');
$table_other->data[$i++][1] = html_print_input_text(
'max_execution_event_response',
$config['max_execution_event_response'],
'',
@ -619,8 +619,8 @@ $table_other->data[13][1] = html_print_input_text(
true
);
$table_other->data[14][0] = __('Row limit in csv log');
$table_other->data[14][1] = html_print_input_text(
$table_other->data[$i][0] = __('Row limit in csv log');
$table_other->data[$i++][1] = html_print_input_text(
'row_limit_csv',
$config['row_limit_csv'],
'',
@ -629,8 +629,8 @@ $table_other->data[14][1] = html_print_input_text(
true
);
$table_other->data[15][0] = __('SNMP walk binary');
$table_other->data[15][1] = html_print_input_text(
$table_other->data[$i][0] = __('SNMP walk binary');
$table_other->data[$i++][1] = html_print_input_text(
'snmpwalk',
$config['snmpwalk'],
'',
@ -643,8 +643,8 @@ $tip = ui_print_help_tip(
__('SNMP bulk walk is not able to request V1 SNMP, this option will be used instead (by default snmpwalk, slower).'),
true
);
$table_other->data[16][0] = __('SNMP walk binary (fallback)').$tip;
$table_other->data[16][1] = html_print_input_text(
$table_other->data[$i][0] = __('SNMP walk binary (fallback)').$tip;
$table_other->data[$i++][1] = html_print_input_text(
'snmpwalk_fallback',
$config['snmpwalk_fallback'],
'',
@ -653,6 +653,31 @@ $table_other->data[16][1] = html_print_input_text(
true
);
$tip = ui_print_help_tip(
__(
'%s web2image cache system cleanup. It is always cleaned up after perform an upgrade',
get_product_name()
),
true
);
if (enterprise_installed() === true) {
$table_other->data[$i][0] = __('PhantomJS cache cleanup ').$tip;
$table_other->data[$i++][1] = html_print_input(
[
'type' => 'select',
'name' => 'phantomjs_cache_interval',
'return' => true,
'fields' => [
PHANTOM_CACHE_CLEANUP_ONCE => __('No scheduled'),
PHANTOM_CACHE_CLEANUP_WEEKLY => __('Each week'),
PHANTOM_CACHE_CLEANUP_DAILY => __('Each day'),
],
'selected' => ($config['phantomjs_cache_interval'] ?? PHANTOM_CACHE_CLEANUP_ONCE),
]
);
}
echo '<form id="form_setup" method="post">';
echo '<fieldset class="full-column">';

View File

@ -37,6 +37,7 @@ $ajax = true;
$render_map = (bool) get_parameter('render_map', false);
$graph_javascript = (bool) get_parameter('graph_javascript', false);
$force_remote_check = (bool) get_parameter('force_remote_check', false);
$load_css_cv = (bool) get_parameter('load_css_cv', false);
if ($render_map) {
$width = (int) get_parameter('width', '400');
@ -89,3 +90,12 @@ if ($force_remote_check) {
return;
}
if ($load_css_cv === true) {
$uniq = get_parameter('uniq', 0);
$ratio = get_parameter('ratio', 0);
$output = css_label_styles_visual_console($uniq, $ratio);
echo $output;
return;
}

View File

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

View File

@ -108,6 +108,11 @@ define('SECONDS_1YEAR', 31536000);
define('SECONDS_2YEARS', 63072000);
define('SECONDS_3YEARS', 94608000);
// PhantomJS Cache cleanup intervals.
define('PHANTOM_CACHE_CLEANUP_ONCE', 0);
define('PHANTOM_CACHE_CLEANUP_WEEKLY', SECONDS_1WEEK);
define('PHANTOM_CACHE_CLEANUP_DAILY', SECONDS_1DAY);
// Separator constats.

View File

@ -891,6 +891,25 @@ function config_update_config()
if (config_update_value('snmpwalk_fallback', get_parameter('snmpwalk_fallback'), true) === false) {
$error_update[] = __('SNMP walk binary path (fallback for v1)');
}
$pjs = get_parameter('phantomjs_cache_interval');
switch ($pjs) {
case $config['phantomjs_cache_interval']:
default;
// No changes.
break;
case PHANTOM_CACHE_CLEANUP_ONCE:
case PHANTOM_CACHE_CLEANUP_DAILY:
case PHANTOM_CACHE_CLEANUP_WEEKLY:
enterprise_hook('phantomjs_cache_interval_schedule', [$pjs]);
break;
}
if (config_update_value('phantomjs_cache_interval', get_parameter('phantomjs_cache_interval'), true) === false
) {
$error_update[] = __('PhantomJS cache interval');
}
break;
case 'vis':

View File

@ -4166,11 +4166,24 @@ function events_get_response_target(
}
// Parse the event custom data.
if (!empty($event['custom_data'])) {
if (empty($event['custom_data']) === false) {
$custom_data = json_decode(base64_decode($event['custom_data']));
foreach ($custom_data as $key => $value) {
$target = str_replace('_customdata_'.$key.'_', $value, $target);
}
if (strpos($target, '_customdata_json_') !== false) {
$target = str_replace('_customdata_json_', json_encode($custom_data), $target);
}
if (strpos($target, '_customdata_text_') !== false) {
$text = '';
foreach ($custom_data as $key => $value) {
$text .= $key.': '.$value.PHP_EOL;
}
$target = str_replace('_customdata_text_', $text, $target);
}
}
// This will replace the macro with the current logged user.

View File

@ -653,7 +653,8 @@ function reports_get_report_types($template=false, $not_editor=false)
'optgroup' => __('Graphs'),
'name' => __('Custom graph'),
];
// Only pandora managers have access to the whole database
// Only pandora managers have access to the whole database.
if (check_acl($config['id_user'], 0, 'PM')) {
$types['sql_graph_vbar'] = [
'optgroup' => __('Graphs'),
@ -711,7 +712,7 @@ function reports_get_report_types($template=false, $not_editor=false)
'name' => __('Hourly S.L.A.'),
];
if (!$config['metaconsole'] && !$template) {
if ($template === false) {
$types['SLA_services'] = [
'optgroup' => __('SLA'),
'name' => __('Services S.L.A.'),

View File

@ -4640,12 +4640,15 @@ function ui_print_page_header(
}
$buffer .= '<span>';
$buffer .= '<span class="breadcrumbs-title">';
if (empty($alias)) {
$buffer .= ui_print_truncate_text($title, $numChars);
} else {
$buffer .= ui_print_truncate_text($alias, $numChars);
}
$buffer .= '</span>';
if ($modal && !enterprise_installed()) {
$buffer .= "
<div id='".$message."' class='publienterprise right mrgn_top-2px' title='Community version'><img data-title='".__('Enterprise version not installed')."' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>

View File

@ -4139,7 +4139,7 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
if ($critical_percentage >= $status_data['linked_layout_status_as_service_critical'] && $critical_percentage !== 0) {
return VISUAL_MAP_STATUS_CRITICAL_BAD;
} else if ($critical_percentage >= $status_data['linked_layout_status_as_service_warning'] && $warning_percentage !== 0) {
} else if ($warning_percentage >= $status_data['linked_layout_status_as_service_warning'] && $warning_percentage !== 0) {
return VISUAL_MAP_STATUS_WARNING;
} else {
return VISUAL_MAP_STATUS_NORMAL;
@ -4538,3 +4538,53 @@ function visual_map_load_client_resources()
}
}
}
/**
* Labels styles visual console.
*
* @param string $uniq Uniq str.
* @param integer $ratio Ratio.
*
* @return string Css output.
*/
function css_label_styles_visual_console($uniq, $ratio=1)
{
global $config;
$output = '';
// Horrible trick! due to the use of tinyMCE
// it is necessary to modify specific classes of each
// of the visual consoles.
$output .= '.c-'.$uniq.' a {color: #3f3f3f } ';
$output .= '.c-'.$uniq.' .label p strong span {display: inline-block !important; line-height: normal !important} ';
$output .= '.c-'.$uniq.' *:not(.parent_graph p table tr td span) { font-size: '.(8 * $ratio).'pt; line-height:'.(8 * ($ratio)).'pt; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td { padding: 0; margin: 0; }';
$output .= '.c-'.$uniq.' .visual_font_size_4pt, .c-'.$uniq.' .visual_font_size_4pt * { font-size: '.(4 * $ratio).'pt !important; line-height:'.(4 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_6pt, .c-'.$uniq.' .visual_font_size_6pt * { font-size: '.(6 * $ratio).'pt !important; line-height:'.(6 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_8pt, .c-'.$uniq.' .visual_font_size_8pt * { font-size: '.(8 * $ratio).'pt !important; line-height:'.(8 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_10pt, .c-'.$uniq.' .visual_font_size_10pt * { font-size: '.(10 * $ratio).'pt !important; line-height:'.(10 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_12pt, .c-'.$uniq.' .visual_font_size_12pt * { font-size: '.(12 * $ratio).'pt !important; line-height:'.(12 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_14pt, .c-'.$uniq.' .visual_font_size_14pt * { font-size: '.(14 * $ratio).'pt !important; line-height:'.(14 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_18pt, .c-'.$uniq.' .visual_font_size_18pt * { font-size: '.(18 * $ratio).'pt !important; line-height:'.(18 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_24pt, .c-'.$uniq.' .visual_font_size_24pt * { font-size: '.(24 * $ratio).'pt !important; line-height:'.(24 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_28pt, .c-'.$uniq.' .visual_font_size_28pt * { font-size: '.(28 * $ratio).'pt !important; line-height:'.(28 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_36pt, .c-'.$uniq.' .visual_font_size_36pt * { font-size: '.(36 * $ratio).'pt !important; line-height:'.(36 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_48pt, .c-'.$uniq.' .visual_font_size_48pt * { font-size: '.(48 * $ratio).'pt !important; line-height:'.(48 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_60pt, .c-'.$uniq.' .visual_font_size_60pt * { font-size: '.(60 * $ratio).'pt !important; line-height:'.(60 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_72pt, .c-'.$uniq.' .visual_font_size_72pt * { font-size: '.(72 * $ratio).'pt !important; line-height:'.(72 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_84pt, .c-'.$uniq.' .visual_font_size_84pt * { font-size: '.(84 * $ratio).'pt !important; line-height:'.(84 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_96pt, .c-'.$uniq.' .visual_font_size_96pt * { font-size: '.(96 * $ratio).'pt !important; line-height:'.(96 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_116pt, .c-'.$uniq.' .visual_font_size_116pt * { font-size: '.(116 * $ratio).'pt !important; line-height:'.(116 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_128pt, .c-'.$uniq.' .visual_font_size_128pt * { font-size: '.(128 * $ratio).'pt !important; line-height:'.(128 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_140pt, .c-'.$uniq.' .visual_font_size_140pt * { font-size: '.(140 * $ratio).'pt !important; line-height:'.(140 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_154pt, .c-'.$uniq.' .visual_font_size_154pt * { font-size: '.(154 * $ratio).'pt !important; line-height:'.(154 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_196pt, .c-'.$uniq.' .visual_font_size_196pt * { font-size: '.(196 * $ratio).'pt !important; line-height:'.(196 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .flot-text, .c-'.$uniq.' .flot-text * { font-size: '.(($config['font_size'] - 2) * $ratio).'pt !important; line-height:'.(($config['font_size'] - 2) * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.time {font-size: '.(50 * $ratio).'px !important; line-height: '.(50 * $ratio).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.date {font-size: '.(25 * $ratio).'px !important; line-height: '.(25 * $ratio).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.timezone {font-size: '.(25 * $ratio).'px !important; line-height: '.(25 * $ratio).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph * {font-size: '.(8 * $ratio).'px !important; line-height: '.(8 * $ratio).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph g rect {width:'.(25 * $ratio).' !important; height: '.(15 * $ratio).' !important;}';
return $output;
}

View File

@ -1040,6 +1040,7 @@ function adjustTextUnits(name) {
"selected",
true
);
$("#" + name + "_units").trigger("change");
$("#text-" + name + "_text").val(restPrev);
unitsSelected = true;
}
@ -1048,7 +1049,9 @@ function adjustTextUnits(name) {
});
if (unitsSelected == false) {
//$("#" + name + "_units option:last").prop("selected", true);
$("#" + name + "_units option:last").prop("selected", true);
$("#" + name + "_units").trigger("change");
$("#text-" + name + "_text").val(restPrev);
}

View File

@ -1208,68 +1208,121 @@ function refresh_pagination_callback(
// eslint-disable-next-line no-unused-vars
function dashboardLoadVC(settings) {
var headerMobileFix = 40;
var container = document.getElementById(
"visual-console-container-" + settings.cellId
);
var interval = 300 * 1000;
// Add the datetime when the item was received.
var receivedAt = new Date();
var beforeUpdate = function(items, visualConsole, props) {
// Add the datetime when the item was received.
items.map(function(item) {
item["receivedAt"] = receivedAt;
return item;
});
var beforeUpdate = function(items, visualConsole, props, size) {
var ratio_visualconsole = props.height / props.width;
var ratio_w = size.width / props.width;
var ratio_h = size.height / props.height;
props.width = settings.size.width;
props.height = settings.size.width * ratio_visualconsole;
props.width = size.width;
props.height = size.width * ratio_visualconsole;
if (props.height > settings.size.height) {
props.height = settings.size.height;
props.width = settings.size.height / ratio_visualconsole;
var ratio = ratio_w;
if (settings.mobile != undefined && settings.mobile === true) {
if (props.height < props.width) {
if (props.height > size.height) {
ratio = ratio_h;
props.height = size.height;
props.width = size.height / ratio_visualconsole;
}
}
} else {
if (props.height > size.height) {
ratio = ratio_h;
props.height = size.height;
props.width = size.height / ratio_visualconsole;
}
}
// Update the data structure.
visualConsole.props = props;
// Update the items.
visualConsole.updateElements(items);
$.ajax({
method: "post",
url: settings.baseUrl + "ajax.php",
data: {
page: settings.page,
load_css_cv: 1,
uniq: settings.uniq,
ratio: ratio
},
dataType: "html",
success: function(css) {
$("#css_cv_" + settings.uniq)
.empty()
.append(css);
// Add the datetime when the item was received.
items.map(function(item) {
item["receivedAt"] = receivedAt;
return item;
});
// Update the data structure.
visualConsole.props = props;
// Update the items.
visualConsole.updateElements(items);
//Remove spinner change VC.
container.classList.remove("is-updating");
var div = container.querySelector(".div-visual-console-spinner");
if (div !== null) {
var parent = div.parentElement;
if (parent !== null) {
parent.removeChild(div);
}
}
if (settings.mobile != undefined && settings.mobile === true) {
// Update Url.
var regex = /(id=|id_visual_console=|id_layout=|id_visualmap=)\d+(&?)/gi;
var replacement = "$1" + props.id + "$2";
var regex_hash = /(hash=)[^&]+(&?)/gi;
var replacement_hash = "$1" + props.hash + "$2";
var regex_width = /(width=)[^&]+(&?)/gi;
var replacement_width = "$1" + size.width + "$2";
var regex_height = /(height=)[^&]+(&?)/gi;
var replacement_height =
"$1" + (size.height + headerMobileFix) + "$2";
// Change the URL (if the browser has support).
if ("history" in window) {
var href = window.location.href.replace(regex, replacement);
href = href.replace(regex_hash, replacement_hash);
href = href.replace(regex_width, replacement_width);
href = href.replace(regex_height, replacement_height);
window.history.replaceState({}, document.title, href);
}
container.classList.remove("cv-overflow");
// View title.
var title = document.querySelector(".ui-title");
if (title !== null) {
title.textContent = visualConsole.props.name;
}
}
},
error: function(error) {
console.error(error);
}
});
};
var handleUpdate = function(prevProps, newProps) {
if (!newProps) return;
//Remove spinner change VC.
document
.getElementById("visual-console-container" + settings.cellId)
.classList.remove("is-updating");
var div = document
.getElementById("visual-console-container" + settings.cellId)
.querySelector(".div-visual-console-spinner");
if (div !== null) {
var parent = div.parentElement;
if (parent !== null) {
parent.removeChild(div);
}
}
// Change the links.
if (prevProps && prevProps.id !== newProps.id) {
var regex = /(id=|id_visual_console=|id_layout=|id_visualmap=)\d+(&?)/gi;
var replacement = "$1" + newProps.id + "$2";
// Tab links.
var menuLinks = document.querySelectorAll("div#menu_tab a");
if (menuLinks !== null) {
menuLinks.forEach(function(menuLink) {
menuLink.href = menuLink.href.replace(regex, replacement);
});
}
}
var handleUpdate = function() {
return;
};
settings.items.map(function(item) {
@ -1282,18 +1335,56 @@ function dashboardLoadVC(settings) {
return item;
});
createVisualConsole(
var visualConsoleManager = createVisualConsole(
container,
settings.props,
settings.items,
settings.baseUrl,
300 * 1000,
interval,
handleUpdate,
beforeUpdate,
settings.size,
settings.id_user,
settings.hash
settings.hash,
settings.mobile != undefined && settings.mobile === true
? "mobile"
: "dashboard"
);
$(window).on("orientationchange", function() {
$(container).width($(window).height());
$(container).height($(window).width() - headerMobileFix);
//Remove spinner change VC.
container.classList.remove("is-updating");
container.classList.remove("cv-overflow");
var div = container.querySelector(".div-visual-console-spinner");
if (div !== null) {
var parent = div.parentElement;
if (parent !== null) {
parent.removeChild(div);
}
}
container.classList.add("is-updating");
container.classList.add("cv-overflow");
const divParent = document.createElement("div");
divParent.className = "div-visual-console-spinner";
const divSpinner = document.createElement("div");
divSpinner.className = "visual-console-spinner";
divParent.appendChild(divSpinner);
container.appendChild(divParent);
var dimensions = {
width: $(window).height(),
height: $(window).width() - 40
};
visualConsoleManager.changeDimensionsVc(dimensions, interval);
});
}
// eslint-disable-next-line no-unused-vars

View File

@ -33,7 +33,8 @@ function createVisualConsole(
beforeUpdate,
size,
id_user,
hash
hash,
mode = ""
) {
if (container == null || props == null || items == null) return null;
if (baseUrl == null) baseUrl = "";
@ -41,9 +42,18 @@ function createVisualConsole(
var visualConsole = null;
var asyncTaskManager = new AsyncTaskManager();
function updateVisualConsole(visualConsoleId, updateInterval, tts) {
function updateVisualConsole(
visualConsoleId,
updateInterval,
tts,
dimensions
) {
if (tts == null) tts = 0; // Time to start.
if (dimensions != undefined && dimensions != null && dimensions != "") {
size = dimensions;
}
asyncTaskManager.add(
"visual-console",
function(done) {
@ -53,16 +63,13 @@ function createVisualConsole(
size,
id_user,
hash,
mode,
function(error, data) {
if (error) {
//Remove spinner change VC.
document
.getElementById("visual-console-container")
.classList.remove("is-updating");
container.classList.remove("is-updating");
var div = document
.getElementById("visual-console-container")
.querySelector(".div-visual-console-spinner");
var div = container.querySelector(".div-visual-console-spinner");
if (div !== null) {
var parent = div.parentElement;
@ -95,7 +102,7 @@ function createVisualConsole(
var receivedAt = new Date();
var prevProps = visualConsole.props;
if (beforeUpdate) {
beforeUpdate(items, visualConsole, props);
beforeUpdate(items, visualConsole, props, size);
} else {
// Add the datetime when the item was received.
items.map(function(item) {
@ -105,6 +112,7 @@ function createVisualConsole(
// Update the data structure.
visualConsole.props = props;
// Update the items.
visualConsole.updateElements(items);
}
@ -460,6 +468,11 @@ function createVisualConsole(
asyncTaskManager.cancel("visual-console-start");
}
},
changeDimensionsVc: function(dimensions, interval) {
if (dimensions != null) {
updateVisualConsole(visualConsole.props.id, interval, null, dimensions);
}
},
createItem: function(typeString) {
var type;
switch (typeString) {
@ -673,7 +686,15 @@ function createVisualConsole(
* @return {Object} Cancellable. Object which include and .abort([statusText]) function.
*/
// eslint-disable-next-line no-unused-vars
function loadVisualConsoleData(baseUrl, vcId, size, id_user, hash, callback) {
function loadVisualConsoleData(
baseUrl,
vcId,
size,
id_user,
hash,
mode,
callback
) {
// var apiPath = baseUrl + "/include/rest-api";
var apiPath = baseUrl + "/ajax.php";
var vcJqXHR = null;
@ -762,6 +783,7 @@ function loadVisualConsoleData(baseUrl, vcId, size, id_user, hash, callback) {
visualConsoleId: vcId,
id_user: typeof id_user == undefined ? id_user : null,
auth_hash: typeof hash == undefined ? hash : null,
mode: mode,
widthScreen: widthScreen
},
"json"

View File

@ -379,23 +379,8 @@ class MapsMadeByUser extends Widget
$size['width'] = ($size['width'] + 30);
$ratio = $visualConsole->adjustToViewport($size, 'dashboard');
$visualConsoleData = $visualConsole->toArray();
$ratio_visualconsole = ($visualConsoleData['height'] / $visualConsoleData['width']);
$ratio_t = ($size['width'] / $visualConsoleData['width']);
$radio_h = ($size['height'] / $visualConsoleData['height']);
$visualConsoleData['width'] = $size['width'];
$visualConsoleData['height'] = ($size['width'] * $ratio_visualconsole);
if ($visualConsoleData['height'] > $size['height']) {
$ratio_t = $radio_h;
$visualConsoleData['height'] = $size['height'];
$visualConsoleData['width'] = ($size['height'] / $ratio_visualconsole);
}
$groupId = $visualConsoleData['groupId'];
$visualConsoleName = $visualConsoleData['name'];
$uniq = uniqid();
@ -435,68 +420,16 @@ class MapsMadeByUser extends Widget
$visualConsoleItems = VisualConsole::getItemsFromDB(
$this->values['vcId'],
$aclUserGroups,
$ratio_t
$ratio
);
// Horrible trick! due to the use of tinyMCE
// it is necessary to modify specific classes of each
// of the visual consoles.
$output .= '<style type="text/css">';
// $output .= '.c-'.$uniq.', .c-'.$uniq.' *:not(.parent_graph p table tr td span) { font-size: '.(8 * $ratio_t).'pt; line-height:'.(8 * ($ratio_t) * 1.5).'pt; }';
$output .= '.c-'.$uniq.' .visual-console-item div.label > strong { font-size: '.(8 * $ratio_t).'pt; line-height:'.(8 * ($ratio_t) * 1.5).'pt;}';
$output .= '.c-'.$uniq.' .visual-console-item div.label > strong > span { font-size: '.(10 * $ratio_t).'pt;}';
$output .= '.c-'.$uniq.' .visual-console-item div.label p { overflow:initial !important; margin:0px;}';
$output .= '.c-'.$uniq.' .visual-console-item div.label img { height: 100%; width: 100%; object-fit: contain;}';
$output .= '.c-'.$uniq.' .visual_font_size_4pt, .c-'.$uniq.' .visual_font_size_4pt * { font-size: '.(4 * $ratio_t).'pt !important; line-height:'.(4 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_6pt, .c-'.$uniq.' .visual_font_size_6pt * { font-size: '.(6 * $ratio_t).'pt !important; line-height:'.(6 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_8pt, .c-'.$uniq.' .visual_font_size_8pt * { font-size: '.(8 * $ratio_t).'pt !important; line-height:'.(8 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_10pt, .c-'.$uniq.' .visual_font_size_10pt * { font-size: '.(10 * $ratio_t).'pt !important; line-height:'.(10 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_12pt, .c-'.$uniq.' .visual_font_size_12pt * { font-size: '.(12 * $ratio_t).'pt !important; line-height:'.(12 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_14pt, .c-'.$uniq.' .visual_font_size_14pt * { font-size: '.(14 * $ratio_t).'pt !important; line-height:'.(14 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_18pt, .c-'.$uniq.' .visual_font_size_18pt * { font-size: '.(18 * $ratio_t).'pt !important; line-height:'.(18 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_24pt, .c-'.$uniq.' .visual_font_size_24pt * { font-size: '.(24 * $ratio_t).'pt !important; line-height:'.(24 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_28pt, .c-'.$uniq.' .visual_font_size_28pt * { font-size: '.(28 * $ratio_t).'pt !important; line-height:'.(28 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_36pt, .c-'.$uniq.' .visual_font_size_36pt * { font-size: '.(36 * $ratio_t).'pt !important; line-height:'.(36 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_48pt, .c-'.$uniq.' .visual_font_size_48pt * { font-size: '.(48 * $ratio_t).'pt !important; line-height:'.(48 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_60pt, .c-'.$uniq.' .visual_font_size_60pt * { font-size: '.(60 * $ratio_t).'pt !important; line-height:'.(60 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_72pt, .c-'.$uniq.' .visual_font_size_72pt * { font-size: '.(72 * $ratio_t).'pt !important; line-height:'.(72 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_84pt, .c-'.$uniq.' .visual_font_size_84pt * { font-size: '.(84 * $ratio_t).'pt !important; line-height:'.(84 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_96pt, .c-'.$uniq.' .visual_font_size_96pt * { font-size: '.(96 * $ratio_t).'pt !important; line-height:'.(96 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_116pt, .c-'.$uniq.' .visual_font_size_116pt * { font-size: '.(116 * $ratio_t).'pt !important; line-height:'.(116 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_128pt, .c-'.$uniq.' .visual_font_size_128pt * { font-size: '.(128 * $ratio_t).'pt !important; line-height:'.(128 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_140pt, .c-'.$uniq.' .visual_font_size_140pt * { font-size: '.(140 * $ratio_t).'pt !important; line-height:'.(140 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_154pt, .c-'.$uniq.' .visual_font_size_154pt * { font-size: '.(154 * $ratio_t).'pt !important; line-height:'.(154 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_196pt, .c-'.$uniq.' .visual_font_size_196pt * { font-size: '.(196 * $ratio_t).'pt !important; line-height:'.(196 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td p { overflow:initial !important; margin:0px; font-size: '.(10 * $ratio_t).'pt !important; line-height:'.(10 * $ratio_t * 1.5).'pt !important;}';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span { font-size: '.(10 * $ratio_t).'pt !important; line-height:'.(10 * $ratio_t * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_4pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_4pt * { font-size: '.(4 * $ratio_t).'pt !important; line-height:'.(4 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_6pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_6pt * { font-size: '.(6 * $ratio_t).'pt !important; line-height:'.(6 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_8pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_8pt * { font-size: '.(8 * $ratio_t).'pt !important; line-height:'.(8 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_10pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_10pt * { font-size: '.(10 * $ratio_t).'pt !important; line-height:'.(10 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_12pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_12pt * { font-size: '.(12 * $ratio_t).'pt !important; line-height:'.(12 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_14pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_14pt * { font-size: '.(14 * $ratio_t).'pt !important; line-height:'.(14 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_18pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_18pt * { font-size: '.(18 * $ratio_t).'pt !important; line-height:'.(18 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_24pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_24pt * { font-size: '.(24 * $ratio_t).'pt !important; line-height:'.(24 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_28pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_28pt * { font-size: '.(28 * $ratio_t).'pt !important; line-height:'.(28 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_36pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_36pt * { font-size: '.(36 * $ratio_t).'pt !important; line-height:'.(36 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_48pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_48pt * { font-size: '.(48 * $ratio_t).'pt !important; line-height:'.(48 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_60pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_60pt * { font-size: '.(60 * $ratio_t).'pt !important; line-height:'.(60 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_72pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_72pt * { font-size: '.(72 * $ratio_t).'pt !important; line-height:'.(72 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_84pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_84pt * { font-size: '.(84 * $ratio_t).'pt !important; line-height:'.(84 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_96pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_96pt * { font-size: '.(96 * $ratio_t).'pt !important; line-height:'.(96 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_116pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_116pt * { font-size: '.(116 * $ratio_t).'pt !important; line-height:'.(116 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_128pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_128pt * { font-size: '.(128 * $ratio_t).'pt !important; line-height:'.(128 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_140pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_140pt * { font-size: '.(140 * $ratio_t).'pt !important; line-height:'.(140 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_154pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_154pt * { font-size: '.(154 * $ratio_t).'pt !important; line-height:'.(154 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_196pt, .c-'.$uniq.' .visual-console-item-label table tr td span.visual_font_size_196pt * { font-size: '.(196 * $ratio_t).'pt !important; line-height:'.(196 * ($ratio_t) * 1.5).'pt !important; }';
$output .= '.c-'.$uniq.' .flot-text, .c-'.$uniq.' .flot-text * { font-size: '.(8 * $ratio_t).'pt !important; line-height:'.(8 * ($ratio_t)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph * {font-size: '.(8 * $ratio_t).'px !important; line-height: '.(8 * $ratio_t).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph g rect {width:'.(25 * $ratio_t).' !important; height: '.(15 * $ratio_t).' !important;}';
$output .= '<style id="css_cv_'.$uniq.'" type="text/css">';
$output .= css_label_styles_visual_console($uniq, $ratio);
$output .= '</style>';
$visualConsoleItems = array_reduce(
$visualConsoleItems,
function ($carry, $item) use ($ratio_t) {
function ($carry, $item) {
$carry[] = $item->toArray();
return $carry;
},
@ -508,11 +441,13 @@ class MapsMadeByUser extends Widget
'props' => $visualConsoleData,
'items' => $visualConsoleItems,
'baseUrl' => ui_get_full_url('/', false, false, false),
'ratio' => $ratio_t,
'ratio' => $ratio,
'size' => $size,
'cellId' => $this->cellId,
'hash' => User::generatePublicHash(),
'id_user' => $config['id_user'],
'page' => 'include/ajax/visual_console.ajax',
'uniq' => $uniq,
]
);

View File

@ -399,7 +399,10 @@ class ModuleIconWidget extends Widget
'class' => 'flex-row flex-end w100p',
'direct' => 1,
'block_content' => [
['label' => $image],
[
'label' => $image,
'arguments' => ['type' => 'image-item'],
],
],
];

View File

@ -389,7 +389,10 @@ class ModuleStatusWidget extends Widget
'class' => 'flex-row flex-end w100p',
'direct' => 1,
'block_content' => [
['label' => $image],
[
'label' => $image,
'arguments' => ['type' => 'image-item'],
],
],
];

View File

@ -88,25 +88,15 @@ if ($getVisualConsole === true) {
$width = get_parameter('widthScreen', 0);
$mode = get_parameter('mode', '');
$ratio = 0;
if (isset($size) === true
&& is_array($size) === true
&& empty($size) === false
) {
$ratio = $visualConsole->adjustToViewport($size, $mode);
$visualConsoleData = $visualConsole->toArray();
$ratio_visualconsole = ($visualConsoleData['height'] / $visualConsoleData['width']);
$ratio = ($size['width'] / $visualConsoleData['width']);
$radio_h = ($size['height'] / $visualConsoleData['height']);
$visualConsoleData['width'] = $size['width'];
$visualConsoleData['height'] = ($size['width'] * $ratio_visualconsole);
if ($visualConsoleData['height'] > $size['height']) {
$ratio = $radio_h;
$visualConsoleData['height'] = $size['height'];
$visualConsoleData['width'] = ($size['height'] / $ratio_visualconsole);
}
}
$widthRatio = 0;

View File

@ -213,6 +213,61 @@ abstract class Model
}
/**
* Calculate ratio for mobile.
*
* @param array $size Size viewport.
* @param string $mode Mode calculate (dashboard or mobile).
*
* @return float Ratio.
*/
public function adjustToViewport($size, $mode='')
{
$ratio_visualconsole = $this->getRatio();
$ratio_w = ($size['width'] / $this->data['width']);
$ratio_h = ($size['height'] / $this->data['height']);
$this->data['width'] = $size['width'];
$this->data['height'] = ($size['width'] * $ratio_visualconsole);
$ratio = $ratio_w;
if ($mode === 'mobile') {
if ($this->data['height'] < $this->data['width']) {
if ($this->data['height'] > $size['height']) {
$ratio = $ratio_h;
$this->data['height'] = $size['height'];
$this->data['width'] = ($size['height'] / $ratio_visualconsole);
}
}
} else {
if ($this->data['height'] > $size['height']) {
$ratio = $ratio_h;
$this->data['height'] = $size['height'];
$this->data['width'] = ($size['height'] / $ratio_visualconsole);
}
}
return $ratio;
}
/**
* Calculate ratio
*
* @return float Ratio.
*/
public function getRatio()
{
if (isset($this->data['width']) === false
|| empty($this->data['width']) === true
) {
return null;
}
return ($this->data['height'] / $this->data['width']);
}
/*
* -------------
* - UTILITIES -

View File

@ -1197,7 +1197,12 @@ class Item extends CachedModel
'operation/visual_console/view',
['id' => $vcId],
// No autologin from the public view.
!$config['public_view']
!$config['public_view'],
$mobile_navigation,
[
'page' => 'visualmap',
'id' => $vcId,
]
);
} catch (\Throwable $ignored) {
return null;
@ -1244,15 +1249,15 @@ class Item extends CachedModel
'sec2' => 'operation/agentes/status_monitor',
'id_module' => $moduleId,
];
}
if ($mobile_navigation === true) {
return $mobileUrl.'?'.http_build_query(
[
'page' => 'module_graph',
'id' => $moduleId,
]
);
if ($mobile_navigation === true) {
return $mobileUrl.'?'.http_build_query(
[
'page' => 'module_graph',
'id' => $moduleId,
]
);
}
}
return $baseUrl.'?'.http_build_query($queryParams);
@ -1308,7 +1313,12 @@ class Item extends CachedModel
'operation/agentes/status_monitor',
['id_module' => $moduleId],
// No autologin from the public view.
!$config['public_view']
!$config['public_view'],
$mobile_navigation,
[
'id' => $moduleId,
'page' => 'module_graph',
]
);
}
} catch (\Throwable $ignored) {
@ -1368,7 +1378,12 @@ class Item extends CachedModel
'operation/agentes/ver_agente',
['id_agente' => $agentId],
// No autologin from the public view.
!$config['public_view']
!$config['public_view'],
$mobile_navigation,
[
'id' => $agentId,
'page' => 'agent',
]
);
} catch (\Throwable $ignored) {
return null;

View File

@ -537,7 +537,10 @@ final class Group extends Item
'class' => 'flex-row flex-end w100p',
'direct' => 1,
'block_content' => [
['label' => $images],
[
'label' => $images,
'arguments' => ['type' => 'image-item'],
],
],
];

View File

@ -190,7 +190,10 @@ final class Icon extends Item
'class' => 'flex-row flex-end w100p',
'direct' => 1,
'block_content' => [
['label' => $images],
[
'label' => $images,
'arguments' => ['type' => 'image-item'],
],
],
];

View File

@ -351,7 +351,10 @@ final class StaticGraph extends Item
'class' => 'flex-row flex-end w100p',
'direct' => 1,
'block_content' => [
['label' => $images],
[
'label' => $images,
'arguments' => ['type' => 'image-item'],
],
],
];

View File

@ -562,12 +562,12 @@ div#main_pure {
}
/* Mobile trick */
.ui-mobile-viewport.ui-overlay-c > #main_page > .ui-content {
#main_page > .ui-content {
overflow: visible;
overflow-x: visible;
margin: 0 !important;
padding: 0 !important;
}
.ui-mobile-viewport.ui-overlay-c > #main_page > .ui-content div.label > p {
#main_page > .ui-content div.label > p {
margin: 0;
}

View File

@ -458,6 +458,312 @@ div.label strong span {
z-index: 999;
}
/*.termframe{
background-color: #82b92e;
}*/
.visual_font_size_4pt,
.visual_font_size_4pt > em,
.visual_font_size_4pt > strong,
.visual_font_size_4pt > strong > span,
.visual_font_size_4pt > span,
.visual_font_size_4pt > strong > em,
.visual_font_size_4pt > em > strong,
.visual_font_size_4pt em span,
.visual_font_size_4pt span em {
font-size: 4pt;
line-height: 4pt;
}
.visual_font_size_6pt,
.visual_font_size_6pt > em,
.visual_font_size_6pt > strong,
.visual_font_size_6pt > strong > span,
.visual_font_size_6pt > span,
.visual_font_size_6pt > strong > em,
.visual_font_size_6pt > em > strong,
.visual_font_size_6pt em span,
.visual_font_size_6pt span em {
font-size: 6pt;
line-height: 6pt;
}
.visual_font_size_8pt,
.visual_font_size_8pt > em,
.visual_font_size_8pt > strong,
.visual_font_size_8pt > strong > span,
.visual_font_size_8pt > span,
.visual_font_size_8pt > strong > em,
.visual_font_size_8pt > em > strong,
.visual_font_size_8pt em span,
.visual_font_size_8pt span em {
font-size: 8pt;
line-height: 8pt;
}
.visual_font_size_10pt,
.visual_font_size_10pt > em,
.visual_font_size_10pt > strong,
.visual_font_size_10pt > strong > span,
.visual_font_size_10pt > span,
.visual_font_size_10pt > strong > em,
.visual_font_size_10pt > em > strong,
.visual_font_size_10pt em span,
.visual_font_size_10pt span em {
font-size: 10pt;
line-height: 10pt;
}
.visual_font_size_12pt,
.visual_font_size_12pt > em,
.visual_font_size_12pt > strong,
.visual_font_size_12pt > strong > span,
.visual_font_size_12pt > span,
.visual_font_size_12pt > strong > em,
.visual_font_size_12pt > em > strong,
.visual_font_size_12pt em span,
.visual_font_size_12pt span em {
font-size: 12pt;
line-height: 12pt;
}
.visual_font_size_14pt,
.visual_font_size_14pt > em,
.visual_font_size_14pt > strong,
.visual_font_size_14pt > strong > span,
.visual_font_size_14pt > span,
.visual_font_size_14pt > strong > em,
.visual_font_size_14pt > em > strong,
.visual_font_size_14pt em span,
.visual_font_size_14pt span em {
font-size: 14pt;
line-height: 14pt;
}
.visual_font_size_18pt,
.visual_font_size_18pt > em,
.visual_font_size_18pt > strong,
.visual_font_size_18pt > strong > span,
.visual_font_size_18pt > span,
.visual_font_size_18pt > strong > em,
.visual_font_size_18pt > em > strong,
.visual_font_size_18pt em span,
.visual_font_size_18pt span em {
font-size: 18pt;
line-height: 18pt;
}
.visual_font_size_24pt,
.visual_font_size_24pt > em,
.visual_font_size_24pt > strong,
.visual_font_size_24pt > strong > span,
.visual_font_size_24pt > span,
.visual_font_size_24pt > strong > em,
.visual_font_size_24pt > em > strong,
.visual_font_size_24pt em span,
.visual_font_size_24pt span em {
font-size: 24pt;
line-height: 24pt;
}
.visual_font_size_28pt,
.visual_font_size_28pt > em,
.visual_font_size_28pt > strong,
.visual_font_size_28pt > strong > span,
.visual_font_size_28pt > span,
.visual_font_size_28pt > strong > em,
.visual_font_size_28pt > em > strong,
.visual_font_size_28pt em span,
.visual_font_size_28pt span em {
font-size: 28pt;
line-height: 28pt;
}
.visual_font_size_36pt,
.visual_font_size_36pt > em,
.visual_font_size_36pt > strong,
.visual_font_size_36pt > strong > span,
.visual_font_size_36pt > span,
.visual_font_size_36pt > strong > em,
.visual_font_size_36pt > em > strong,
.visual_font_size_36pt em span,
.visual_font_size_36pt span em {
font-size: 36pt;
line-height: 36pt;
}
.visual_font_size_48pt,
.visual_font_size_48pt > em,
.visual_font_size_48pt > strong,
.visual_font_size_48pt > strong > span,
.visual_font_size_48pt > span,
.visual_font_size_48pt > strong > em,
.visual_font_size_48pt > em > strong,
.visual_font_size_48pt em span,
.visual_font_size_48pt span em {
font-size: 48pt;
line-height: 48pt;
}
.visual_font_size_60pt,
.visual_font_size_60pt > em,
.visual_font_size_60pt > strong,
.visual_font_size_60pt > strong > span,
.visual_font_size_60pt > span,
.visual_font_size_60pt > strong > em,
.visual_font_size_60pt > em > strong,
.visual_font_size_60pt em span,
.visual_font_size_60pt span em {
font-size: 60pt;
line-height: 60pt;
}
.visual_font_size_72pt,
.visual_font_size_72pt > em,
.visual_font_size_72pt > strong,
.visual_font_size_72pt > strong > span,
.visual_font_size_72pt > span,
.visual_font_size_72pt > strong > em,
.visual_font_size_72pt > em > strong,
.visual_font_size_72pt em span,
.visual_font_size_72pt span em {
font-size: 72pt;
line-height: 72pt;
}
.visual_font_size_84pt,
.visual_font_size_84pt > em,
.visual_font_size_84pt > strong,
.visual_font_size_84pt > strong > span,
.visual_font_size_84pt > span,
.visual_font_size_84pt > strong > em,
.visual_font_size_84pt > em > strong,
.visual_font_size_84pt em span,
.visual_font_size_84pt span em {
font-size: 84pt;
line-height: 84pt;
}
.visual_font_size_96pt,
.visual_font_size_96pt > em,
.visual_font_size_96pt > strong,
.visual_font_size_96pt > strong > span,
.visual_font_size_96pt > span,
.visual_font_size_96pt > strong > em,
.visual_font_size_96pt > em > strong,
.visual_font_size_96pt em span,
.visual_font_size_96pt span em {
font-size: 96pt;
line-height: 96pt;
}
.visual_font_size_116pt,
.visual_font_size_116pt > em,
.visual_font_size_116pt > strong,
.visual_font_size_116pt > strong > span,
.visual_font_size_116pt > span,
.visual_font_size_116pt > strong > em,
.visual_font_size_116pt > em > strong,
.visual_font_size_116pt em span,
.visual_font_size_116pt span em {
font-size: 116pt;
line-height: 116pt;
}
.visual_font_size_128pt,
.visual_font_size_128pt > em,
.visual_font_size_128pt > strong,
.visual_font_size_128pt > strong > span,
.visual_font_size_128pt > span,
.visual_font_size_128pt > strong > em,
.visual_font_size_128pt > em > strong,
.visual_font_size_128pt em span,
.visual_font_size_128pt span em {
font-size: 128pt;
line-height: 128pt;
}
.visual_font_size_140pt,
.visual_font_size_140pt > em,
.visual_font_size_140pt > strong,
.visual_font_size_140pt > strong > span,
.visual_font_size_140pt > span,
.visual_font_size_140pt > strong > em,
.visual_font_size_140pt > em > strong,
.visual_font_size_140pt em span,
.visual_font_size_140pt span em {
font-size: 140pt;
line-height: 140pt;
}
.visual_font_size_154pt,
.visual_font_size_154pt > em,
.visual_font_size_154pt > strong,
.visual_font_size_154pt > strong > span,
.visual_font_size_154pt > span,
.visual_font_size_154pt > strong > em,
.visual_font_size_154pt > em > strong,
.visual_font_size_154pt em span,
.visual_font_size_154pt span em {
font-size: 154pt;
line-height: 154pt;
}
.visual_font_size_196pt,
.visual_font_size_196pt > em,
.visual_font_size_196pt > strong,
.visual_font_size_196pt > strong > span,
.visual_font_size_196pt > span,
.visual_font_size_196pt > strong > em,
.visual_font_size_196pt > em > strong,
.visual_font_size_196pt em span,
.visual_font_size_196pt span em {
font-size: 196pt;
line-height: 196pt;
}
.resize_visual_font_size_8pt,
.resize_visual_font_size_8pt > em,
.resize_visual_font_size_8pt > strong,
.resize_visual_font_size_8pt > strong > span,
.resize_visual_font_size_8pt > span,
.resize_visual_font_size_8pt > strong > em,
.resize_visual_font_size_8pt > em > strong,
.visual_font_size_8pt em span,
.visual_font_size_8pt span em {
font-size: 4pt;
line-height: 4pt;
}
.resize_visual_font_size_14pt,
.resize_visual_font_size_14pt > em,
.resize_visual_font_size_14pt > strong,
.resize_visual_font_size_14pt > strong > span,
.resize_visual_font_size_14pt > span,
.resize_visual_font_size_14pt > strong > em,
.resize_visual_font_size_14pt > em > strong,
.visual_font_size_14pt em span,
.visual_font_size_14pt span em {
font-size: 7pt;
line-height: 7pt;
}
.resize_visual_font_size_24pt,
.resize_visual_font_size_24pt > em,
.resize_visual_font_size_24pt > strong,
.resize_visual_font_size_24pt > strong > span,
.resize_visual_font_size_24pt > span,
.resize_visual_font_size_24pt > strong > em,
.resize_visual_font_size_24pt > em > strong,
.visual_font_size_14pt em span,
.visual_font_size_14pt span em {
font-size: 12pt;
line-height: 12pt;
}
.resize_visual_font_size_36pt,
.resize_visual_font_size_36pt > em,
.resize_visual_font_size_36pt > strong,
.resize_visual_font_size_36pt > strong > span,
.resize_visual_font_size_36pt > span,
.resize_visual_font_size_36pt > strong > em,
.resize_visual_font_size_36pt > em > strong,
.visual_font_size_36pt em span,
.visual_font_size_36pt span em {
font-size: 18pt;
line-height: 18pt;
}
.resize_visual_font_size_72pt,
.resize_visual_font_size_72pt > em,
.resize_visual_font_size_72pt > strong,
.resize_visual_font_size_72pt > strong > span,
.resize_visual_font_size_72pt > span,
.resize_visual_font_size_72pt > strong > em,
.resize_visual_font_size_72pt > em > strong,
.visual_font_size_72pt em span,
.visual_font_size_72pt span em {
font-size: 36pt;
line-height: 36pt;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

View File

@ -1396,6 +1396,7 @@ div.ui-mobile-viewport {
overflow: visible;
overflow-x: hidden;
padding: 1em;
min-height: calc(100vh - 60px);
}
.ui-corner-all > .ui-toolbar-header:first-child,
.ui-corner-all > .ui-content:first-child,

View File

@ -1102,7 +1102,7 @@ li.ui-btn {
}
.ui-header .ui-title {
font-size: 18px !important;
font-size: 14px;
min-height: 1.1em;
text-align: center;
display: block;
@ -1114,10 +1114,6 @@ li.ui-btn {
outline: 0 !important;
}
* {
font-size: 18px !important;
}
.event_name {
font-size: 15px !important;
}
@ -1450,7 +1446,7 @@ div.nodata_container {
}
.ui-page-active {
padding-top: 2.8em !important;
padding-top: 3.2em !important;
}
.ui-header-fixed {
@ -1497,3 +1493,15 @@ div.nodata_container {
padding: 0;
margin: 0.5em 0 !important;
}
.div-visual-console-spinner {
opacity: 1 !important;
}
.cv-overflow {
overflow: hidden !important;
}
.visual-console-container-dashboard a:visited {
color: inherit !important;
}

View File

@ -985,6 +985,30 @@ class Ui
}
/**
* Load VC.
*
* @param string $settings Json object.
* @param integer $visualConsoleId Id.
*
* @return void Output script.
*/
public function loadVc($settings, $visualConsoleId)
{
$this->contentAddHtml(
'<script type="text/javascript">
var settings = '.$settings.';
var fullUrl = "'.ui_get_full_url('/', false, false, false).'";
var visualConsoleId = '.$visualConsoleId.';
$(document).ready(function () {
dashboardLoadVC(settings);
});
</script>'
);
}
}
class Table

View File

@ -83,22 +83,60 @@ class User
{
$system = System::getInstance();
$loginhash = $system->getRequest('loginhash', null);
$autologin = $system->getRequest('autologin', false);
if ($autologin) {
if ($autologin !== false) {
$user = $system->getRequest('user', null);
$password = $system->getRequest('password', null);
$this->login($user, $password);
} else {
if (empty($loginhash) === false) {
// Hash login process.
$loginhash_data = $system->getRequest('loginhash_data', null);
$loginhash_user = str_rot13($system->getRequest('loginhash_user', null));
$this->login($loginhash_user, null, $loginhash_data);
}
}
return $this->logged;
}
public function login($user=null, $password=null)
public function login($user=null, $password=null, $loginhash_data='')
{
global $config;
$system = System::getInstance();
if (empty($loginhash_data) === false) {
if ($config['loginhash_pwd'] != ''
&& $loginhash_data == md5(
$user.io_output_password(
$config['loginhash_pwd']
)
)
) {
$this->logged = true;
$this->user = $user;
$this->loginTime = time();
$this->errorLogin = false;
$this->saveLogin();
} else {
include_once 'general/login_page.php';
db_pandora_audit(
AUDIT_LOG_USER_REGISTRATION,
'Loginhash failed',
'system'
);
while (ob_get_length() > 0) {
ob_end_flush();
}
exit('</html>');
}
return $this->logged;
}
if ($system->getConfig('auth', 'mysql') === 'saml') {
if ((bool) $system->getRequest('saml', false) === true) {
\enterprise_include_once('include/auth/saml.php');

View File

@ -170,6 +170,8 @@ switch ($action) {
case 'visualmap':
$visualmap = new Visualmap();
$visualmap->ajax($parameter2);
break;
case 'tactical':
$tactical = new Tactical();
$tactical->ajax($parameter2);

View File

@ -734,23 +734,29 @@ class Events
// --------------Fill the SQL POST-------------------------------
$sql_post = ' WHERE 1=1 ';
switch ($this->status) {
case 0:
case 1:
case 2:
$sql_post .= ' AND estado = '.$this->status;
break;
if ($this->status != null) {
switch ($this->status) {
case 0:
case 1:
case 2:
$sql_post .= ' AND estado = '.$this->status;
break;
case 3:
$sql_post .= ' AND (estado = 0 OR estado = 2)';
break;
case 3:
$sql_post .= ' AND (estado = 0 OR estado = 2)';
break;
default:
// Not posible.
break;
}
}
if ($this->free_search != '') {
$sql_post .= " AND evento LIKE '%".io_safe_input($this->free_search)."%'";
}
if ($this->severity != -1) {
if ($this->severity != null && $this->severity != -1) {
switch ($this->severity) {
case EVENT_CRIT_WARNING_OR_CRITICAL:
$sql_post .= ' AND (criticity = '.EVENT_CRIT_WARNING.' OR

View File

@ -126,13 +126,6 @@ class Visualmap
$this->id = (int) $system->getRequest('id', 0);
$this->width = (int) $system->getRequest('width', 0);
$this->height = (int) $system->getRequest('height', 0);
if ($this->width < $this->height) {
$w = $this->width;
$this->width = $this->height;
$this->height = $w;
$this->rotate = true;
}
}
@ -153,7 +146,8 @@ class Visualmap
$ui->retrieveViewPort();
}
$this->height -= 39;
// Header.
$this->height -= 40;
$this->visualmap = db_get_row(
'tlayout',
@ -211,29 +205,7 @@ class Visualmap
*/
public function ajax(string $parameter2='')
{
$system = System::getInstance();
$this->checkVisualmapACL($this->visualmap['id_group']);
if ((bool) $this->validAcl === false) {
$this->show_fail_acl();
} else {
switch ($parameter2) {
case 'render_map':
$map_id = $system->getRequest('map_id', '0');
$width = $system->getRequest('width', '400');
$height = $system->getRequest('height', '400');
visual_map_print_visual_map(
$map_id,
false,
true,
$width,
$height
);
exit;
default:
exit;
}
}
return;
}
@ -307,20 +279,8 @@ class Visualmap
'height' => $this->height,
];
$ratio_t = $visualConsole->adjustToViewport($size, 'mobile');
$visualConsoleData = $visualConsole->toArray();
$ratio_visualconsole = ($visualConsoleData['height'] / $visualConsoleData['width']);
$ratio_t = ($size['width'] / $visualConsoleData['width']);
$radio_h = ($size['height'] / $visualConsoleData['height']);
$visualConsoleData['width'] = $size['width'];
$visualConsoleData['height'] = ($size['width'] * $ratio_visualconsole);
if ($visualConsoleData['height'] > $size['height']) {
$ratio_t = $radio_h;
$visualConsoleData['height'] = $size['height'];
$visualConsoleData['width'] = ($size['height'] / $ratio_visualconsole);
}
$uniq = uniqid();
@ -328,7 +288,6 @@ class Visualmap
// Style.
$style = 'width:'.$visualConsoleData['width'].'px;';
$style .= 'height:'.$visualConsoleData['height'].'px;';
$style .= 'background-size: cover;';
// Class.
$class = 'visual-console-container-dashboard c-'.$uniq;
@ -366,42 +325,13 @@ class Visualmap
$ratio_t
);
// Horrible trick! due to the use of tinyMCE
// it is necessary to modify specific classes of each
// of the visual consoles.
$output .= '<style type="text/css">';
$output .= '.c-'.$uniq.', .c-'.$uniq.' *:not(.parent_graph p table tr td span) { font-size: '.(8 * $ratio_t).'pt; line-height:'.(8 * ($ratio_t) * 1.5).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_4pt, .c-'.$uniq.' .visual_font_size_4pt * { font-size: '.(4 * $ratio_t).'pt; line-height:'.(4 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_6pt, .c-'.$uniq.' .visual_font_size_6pt * { font-size: '.(6 * $ratio_t).'pt; line-height:'.(6 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_8pt, .c-'.$uniq.' .visual_font_size_8pt * { font-size: '.(8 * $ratio_t).'pt; line-height:'.(8 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_10pt, .c-'.$uniq.' .visual_font_size_10pt * { font-size: '.(10 * $ratio_t).'pt; line-height:'.(10 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_12pt, .c-'.$uniq.' .visual_font_size_12pt * { font-size: '.(12 * $ratio_t).'pt; line-height:'.(12 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_14pt, .c-'.$uniq.' .visual_font_size_14pt * { font-size: '.(14 * $ratio_t).'pt; line-height:'.(14 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_18pt, .c-'.$uniq.' .visual_font_size_18pt * { font-size: '.(18 * $ratio_t).'pt; line-height:'.(18 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_24pt, .c-'.$uniq.' .visual_font_size_24pt * { font-size: '.(24 * $ratio_t).'pt; line-height:'.(24 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_28pt, .c-'.$uniq.' .visual_font_size_28pt * { font-size: '.(28 * $ratio_t).'pt; line-height:'.(28 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_36pt, .c-'.$uniq.' .visual_font_size_36pt * { font-size: '.(36 * $ratio_t).'pt; line-height:'.(36 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_48pt, .c-'.$uniq.' .visual_font_size_48pt * { font-size: '.(48 * $ratio_t).'pt; line-height:'.(48 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_60pt, .c-'.$uniq.' .visual_font_size_60pt * { font-size: '.(60 * $ratio_t).'pt; line-height:'.(60 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_72pt, .c-'.$uniq.' .visual_font_size_72pt * { font-size: '.(72 * $ratio_t).'pt; line-height:'.(72 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_84pt, .c-'.$uniq.' .visual_font_size_84pt * { font-size: '.(84 * $ratio_t).'pt; line-height:'.(84 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_96pt, .c-'.$uniq.' .visual_font_size_96pt * { font-size: '.(96 * $ratio_t).'pt; line-height:'.(96 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_116pt, .c-'.$uniq.' .visual_font_size_116pt * { font-size: '.(116 * $ratio_t).'pt; line-height:'.(116 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_128pt, .c-'.$uniq.' .visual_font_size_128pt * { font-size: '.(128 * $ratio_t).'pt; line-height:'.(128 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_140pt, .c-'.$uniq.' .visual_font_size_140pt * { font-size: '.(140 * $ratio_t).'pt; line-height:'.(140 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_154pt, .c-'.$uniq.' .visual_font_size_154pt * { font-size: '.(154 * $ratio_t).'pt; line-height:'.(154 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .visual_font_size_196pt, .c-'.$uniq.' .visual_font_size_196pt * { font-size: '.(196 * $ratio_t).'pt; line-height:'.(196 * ($ratio_t)).'pt; }';
$output .= '.c-'.$uniq.' .flot-text, .c-'.$uniq.' .flot-text * { font-size: '.(8 * $ratio_t).'pt !important; line-height:'.(8 * ($ratio_t)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.time {font-size: '.(50 * $ratio_t).'px !important; line-height: '.(50 * $ratio_t).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.date {font-size: '.(25 * $ratio_t).'px !important; line-height: '.(25 * $ratio_t).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.timezone {font-size: '.(25 * $ratio_t).'px !important; line-height: '.(25 * $ratio_t).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph * {font-size: '.(8 * $ratio_t).'px !important; line-height: '.(8 * $ratio_t).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph g rect {width:'.(25 * $ratio_t).' !important; height: '.(15 * $ratio_t).' !important;}';
$output .= '<style id="css_cv_'.$uniq.'" type="text/css">';
$output .= css_label_styles_visual_console($uniq, $ratio_t);
$output .= '</style>';
$visualConsoleItems = array_reduce(
$visualConsoleItems,
function ($carry, $item) use ($ratio_t) {
function ($carry, $item) {
$carry[] = $item->toArray();
return $carry;
},
@ -413,36 +343,18 @@ class Visualmap
'props' => $visualConsoleData,
'items' => $visualConsoleItems,
'baseUrl' => ui_get_full_url('/', false, false, false),
'page' => 'include/ajax/visual_console.ajax',
'ratio' => $ratio_t,
'size' => $size,
'cellId' => $uniq,
'uniq' => $uniq,
'mobile' => true,
'vcId' => $visualConsoleId,
]
);
$output .= '<script type="text/javascript">';
$output .= '$(document).ready(function () {';
$output .= 'dashboardLoadVC('.$settings.')';
$output .= '});';
if ($this->rotate === true) {
$output .= "$('.container-center').css('transform', 'rotate(90deg)');";
}
$output .= '$( window ).on( "orientationchange", function( event )';
$output .= ' { window.location.href = "';
$output .= ui_get_full_url(
'/mobile/index.php?page=visualmap&id='.$visualConsoleId
);
$output .= '" });';
$output .= '</script>';
$ui->contentAddHtml($output);
// Load Visual Console Items.
$visualConsoleItems = VisualConsole::getItemsFromDB(
$visualConsoleId,
$aclUserGroups
);
$ui->loadVc($settings, $visualConsoleId);
$javascript = ob_get_clean();
$ui->contentAddHtml($javascript);

View File

@ -74,6 +74,13 @@ class Visualmaps
*/
private $type = 0;
/**
* CV favourites.
*
* @var boolean
*/
private $favourite = true;
/**
* Builder.
@ -188,6 +195,20 @@ class Visualmaps
$ui->showFooter(false);
$ui->beginContent();
$this->listVisualmapsHtml();
$output = '<script type="text/javascript">';
$output .= 'function loadVisualConsole(id) {';
$output .= ' var dimensions = "&width="+$(window).width();';
$output .= ' dimensions += "&height="+$(window).height();';
$output .= ' window.location.href = "';
$output .= ui_get_full_url('/', false, false, false);
$output .= 'mobile/index.php?page=visualmap&id="';
$output .= '+id+dimensions;';
$output .= '};';
$output .= '</script>';
$ui->contentAddHtml($output);
$ui->endContent();
$ui->showPage();
}
@ -201,9 +222,42 @@ class Visualmaps
private function listVisualmapsHtml()
{
$system = System::getInstance();
$this->favourite = (bool) $system->getRequest('favourite', true);
$ui = Ui::getInstance();
$visualmaps = visual_map_get_user_layouts();
$visualmaps = visual_map_get_user_layouts(
false,
false,
false,
true,
$this->favourite
);
if ($this->favourite === true) {
$ui->contentAddHtml(
$ui->createButton(
[
'icon' => '',
'pos' => 'right',
'text' => __('All visual consoles'),
'href' => 'index.php?page=visualmaps&favourite=0',
'class' => '',
]
)
);
} else {
$ui->contentAddHtml(
$ui->createButton(
[
'icon' => '',
'pos' => 'right',
'text' => __('Favourite visual consoles'),
'href' => 'index.php?page=visualmaps&favourite=1',
'class' => '',
]
)
);
}
if (empty($visualmaps) === true) {
$ui->contentAddHtml('<p style="color: #ff0000;">'.__('No maps defined').'</p>');
@ -214,8 +268,8 @@ class Visualmaps
$table->id = 'list_visualmaps';
foreach ($visualmaps as $map) {
$link = '<a class="ui-link" data-ajax="false" ';
$link .= ' href="index.php?page=visualmap&id=';
$link .= $map['id'].'">'.io_safe_output($map['name']).'</a>';
$link .= ' href="#" onclick="loadVisualConsole(';
$link .= $map['id'].')">'.io_safe_output($map['name']).'</a>';
$row = $link;
$row .= ui_print_group_icon(

View File

@ -221,6 +221,12 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
if (title !== null) {
title.textContent = newProps.name;
}
// Fullscreen Meta view title.
var titleMeta = document.querySelector("div.vc-title-meta");
if (titleMeta !== null) {
titleMeta.textContent = newProps.name;
}
}
// Change the links.

View File

@ -611,7 +611,7 @@ ui_require_css_file('form');
if (prevProps && prevProps.name != newProps.name) {
// View title.
var title = document.querySelector(
"div#menu_tab_frame_view > div#menu_tab_left span"
".breadcrumbs-title"
);
if (title !== null) {
title.textContent = newProps.name;
@ -621,7 +621,12 @@ ui_require_css_file('form');
if (fullscreenTitle !== null) {
fullscreenTitle.textContent = newProps.name;
}
// TODO: Change the metaconsole title.
// Fullscreen Meta view title.
var fullscreenTitleMeta = document.querySelector("div.vc-title-meta");
if (fullscreenTitleMeta !== null) {
fullscreenTitleMeta.textContent = newProps.name;
}
}
// Change the links.

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.760
%define release 220317
%define release 220323
# 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.760
%define release 220317
%define release 220323
# 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.760
%define release 220317
%define release 220323
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -4039,6 +4039,7 @@ CREATE TABLE IF NOT EXISTS `tipam_vlan` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(250) NOT NULL,
`description` TEXT,
`custom_id` bigint(20) UNSIGNED DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.760-220317
Version: 7.0NG.760-220323
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.760-220317"
pandora_version="7.0NG.760-220323"
package_cpan=0
package_pandora=1

View File

@ -66,8 +66,8 @@ sub new ($$$) {
# Call the constructor of the parent class
my $self = $class->SUPER::new($config, ALERTSERVER, \&PandoraFMS::AlertServer::data_producer, \&PandoraFMS::AlertServer::data_consumer, $dbh);
bless $self, $class;
return $self;
bless $self, $class;
return $self;
}
################################################################################
@ -91,6 +91,24 @@ sub data_producer ($) {
my @tasks;
my @rows;
my $n_servers = get_db_value($dbh,
'SELECT COUNT(*) FROM `tserver` WHERE `server_type` = ? AND `status` = 1',
ALERTSERVER
);
my $i = 0;
my %servers = map { $_->{'name'} => $i++; } get_db_rows($dbh,
'SELECT `name` FROM `tserver` WHERE `server_type` = ? AND `status` = 1 ORDER BY `name` ASC',
ALERTSERVER
);
if ($n_servers eq 0) {
$n_servers = 1;
}
# Retrieve alerts to be evaluated.
my $server_type_id = $servers{$pa_config->{'servername'}};
# Make a local copy of locked alerts.
$AlertSem->down ();
@ -98,9 +116,14 @@ sub data_producer ($) {
$AlertSem->up ();
# Check the execution queue.
if (pandora_is_master($pa_config) == 1) {
@rows = get_db_rows ($dbh, 'SELECT id, utimestamp FROM talert_execution_queue ORDER BY utimestamp ASC');
}
my $sql = sprintf(
'SELECT id, utimestamp FROM talert_execution_queue
WHERE `id` %% %d = %d ORDER BY utimestamp ASC',
$n_servers,
$server_type_id
);
@rows = get_db_rows($dbh, $sql);
# Queue alerts.
foreach my $row (@rows) {

View File

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

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.760";
my $pandora_build = "220317";
my $pandora_build = "220323";
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.760
%define release 220317
%define release 220323
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

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

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.760 Build 220317";
my $version = "7.0NG.760 Build 220323";
# 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.760 Build 220317";
my $version = "7.0NG.760 Build 220323";
# save program name for logging
my $progname = basename($0);

View File

@ -558,9 +558,23 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
const divSpinner = document.createElement("div");
divSpinner.className = "visual-console-spinner";
divParent.appendChild(divSpinner);
const containerVC = document.getElementById(
"visual-console-container"
);
let path = e.composedPath();
let containerId = "visual-console-container";
for (let index = 0; index < path.length; index++) {
const element = path[index] as HTMLInputElement;
if (
element.id != undefined &&
element.id != null &&
element.id != ""
) {
if (element.id.includes(containerId) === true) {
containerId = element.id;
break;
}
}
}
const containerVC = document.getElementById(containerId);
if (containerVC != null) {
containerVC.classList.add("is-updating");
containerVC.appendChild(divParent);