Adapt views

This commit is contained in:
jose.gonzalez@pandorafms.com 2022-12-15 12:42:35 +01:00
parent d43ae677a3
commit 4fd0115d80
11 changed files with 606 additions and 515 deletions

View File

@ -544,7 +544,7 @@ if (empty($agent_id) === false
// TabName.
__('QuickShell'),
// TabIcon.
'images/ehorus/terminal.png',
'images/quick-shell@svg.svg',
// TabFunction.
'quickShell',
// Version.

View File

@ -308,7 +308,7 @@ if (enterprise_installed() === true) {
$paramsParentAgent['selectbox_id'] = 'cascade_protection_module';
$paramsParentAgent['javascript_is_function_select'] = true;
$paramsParentAgent['cascade_protection'] = true;
$paramsParentAgent['input_style'] = 'width: 540px;';
$paramsParentAgent['input_style'] = 'width: 100%;';
if ($id_agente !== 0) {
// Deletes the agent's offspring.
@ -380,14 +380,13 @@ if ($new_agent === true) {
$tableAgent->data['alias'][0] .= html_print_anchor(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$id_agente.'&disk_conf='.$agent_md5,
'class' => 'mrgn_lft_5px',
'content' => html_print_image(
'images/application_edit.png',
'images/remote-configuration@svg.svg',
true,
[
'border' => 0,
'title' => __('This agent can be remotely configured'),
'class' => 'invert_filter',
'class' => 'invert_filter after_input_icon',
]
),
],
@ -411,7 +410,7 @@ $tableAgent->data['additional_ip_address'][2] = html_print_input(
'name' => 'fixed_ip',
'value' => $fixed_ip,
]
).__('Fix IP address').'<p style="margin-right: 15px">'.ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'</p></div>';
);
$table_ip .= '</div></div>';
@ -489,7 +488,11 @@ $tableAgent->data['primary_group'][0] .= html_print_div(
$grupo,
true,
'groups_small',
($id_agente === 0) ? 'display: none;' : ''
($id_agente === 0) ? 'display: none;' : '',
true,
false,
false,
'after_input_icon'
),
],
true
@ -532,7 +535,7 @@ $tableAgent->data['os'][0] = html_print_select_from_sql(
);
$tableAgent->data['os'][0] .= html_print_div(
[
'class' => 'mrgn_lft_5px',
'class' => 'after_input_icon',
'id' => 'os_preview',
'content' => ui_print_os_icon(
$id_os,
@ -807,7 +810,7 @@ if ($new_agent === false && isset($filename) === true && file_exists($filename['
$tableAdvancedAgent->data['remote_configuration'][0] .= html_print_anchor(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente='.$id_agente,
'class' => 'mrgn_lft_5px',
'class' => 'after_input_icon',
'content' => html_print_image(
'images/cross.png',
true,

View File

@ -287,7 +287,6 @@ if ($create_agent) {
'fixed_ip' => $fixed_ip,
]
);
enterprise_hook('update_agent', [$id_agente]);
} else {
$id_agente = false;
}
@ -369,95 +368,96 @@ $img_style = [
if ($id_agente) {
// View tab.
$viewtab['text'] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/eye.png',
true,
$viewtab['text'] = html_print_anchor(
[
'title' => __('View'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'view') {
$viewtab['active'] = true;
} else {
$viewtab['active'] = false;
}
'href' => 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente,
'content' => html_print_image(
'images/enable.svg',
true,
[
'title' => __('View'),
'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
$viewtab['active'] = ($tab === 'view');
$viewtab['operation'] = 1;
// Main tab.
$maintab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/gm_setup.png',
true,
$maintab['text'] = html_print_anchor(
[
'title' => __('Setup'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab === 'main') {
$maintab['active'] = true;
} else {
$maintab['active'] = false;
}
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=main&amp;id_agente='.$id_agente,
'content' => html_print_image(
'images/configuration@svg.svg',
true,
[
'title' => __('Setup'),
'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
$maintab['active'] = ($tab === 'main');
// Module tab.
$moduletab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=module&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/gm_modules.png',
true,
$moduletab['text'] = html_print_anchor(
[
'title' => __('Modules'),
'class' => 'invert_filter',
]
).'</a>';
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=module&amp;id_agente='.$id_agente,
'content' => html_print_image(
'images/modules@svg.svg',
true,
[
'title' => __('Modules'),
'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
if ($tab == 'module') {
$moduletab['active'] = true;
} else {
$moduletab['active'] = false;
}
$moduletab['active'] = ($tab === 'module');
// Alert tab.
$alerttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/gm_alerts.png',
true,
$alerttab['text'] = html_print_anchor(
[
'title' => __('Alerts'),
'class' => 'invert_filter',
]
).'</a>';
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=alert&amp;id_agente='.$id_agente,
'content' => html_print_image(
'images/alert@svg.svg',
true,
[
'title' => __('Alerts'),
'class' => 'invert_filter main_menu_icon',
]
),
],
true
);
if ($tab == 'alert') {
$alerttab['active'] = true;
} else {
$alerttab['active'] = false;
}
$alerttab['active'] = ($tab === 'alert');
// Template tab.
$templatetab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=template&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/templates.png',
true,
$templatetab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=template&amp;id_agente='.$id_agente,
'image' => 'images/modules-group@svg.svg',
'title' => __('Module templates'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'template') {
$templatetab['active'] = true;
} else {
$templatetab['active'] = false;
}
],
true
);
$templatetab['active'] = ($tab === 'template');
// Inventory.
$inventorytab = enterprise_hook('inventory_tab');
if ($inventorytab == -1) {
if ($inventorytab === ENTERPRISE_NOT_HOOK) {
$inventorytab = '';
}
$has_remote_conf = enterprise_hook(
'config_agents_has_remote_configuration',
[$id_agente]
@ -469,7 +469,7 @@ if ($id_agente) {
if ($has_remote_conf === true) {
// Plugins.
$pluginstab = enterprise_hook('plugins_tab');
if ($pluginstab == -1) {
if ($pluginstab === ENTERPRISE_NOT_HOOK) {
$pluginstab = '';
}
} else {
@ -478,59 +478,57 @@ if ($id_agente) {
// Collection.
$collectiontab = enterprise_hook('collection_tab');
if ($collectiontab == -1) {
if ($collectiontab === ENTERPRISE_NOT_HOOK) {
$collectiontab = '';
}
// NetworkConfigManager tab.
$ncm_tab = enterprise_hook('networkconfigmanager_tab');
if ($ncm_tab === ENTERPRISE_NOT_HOOK) {
$ncm_tab = '';
}
// Group tab.
$grouptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group.'">'.html_print_image(
'images/group.png',
true,
$grouptab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group,
'image' => 'images/groups@svg.svg',
'title' => __('Group'),
'class' => 'invert_filter',
]
).'</a>';
],
true
);
$grouptab['active'] = false;
$gistab = [];
// GIS tab.
if ($config['activate_gis']) {
$gistab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=gis&id_agente='.$id_agente.'">'.html_print_image(
'images/gm_gis.png',
true,
[
'title' => __('GIS data'),
'class' => 'invert_filter',
]
).'</a>';
// TODO. OVERRIDE.
$config['activate_gis'] = true;
if ($tab == 'gis') {
$gistab['active'] = true;
} else {
$gistab['active'] = false;
}
// GIS tab.
if ((bool) $config['activate_gis'] === true) {
$gistab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=gis&id_agente='.$id_agente,
'image' => 'images/poi@svg.svg',
'title' => __('GIS data'),
],
true
);
$gistab['active'] = ($tab === 'gis');
}
// Agent wizard tab.
$agent_wizard['text'] = '<a href="javascript:" class="agent_wizard_tab">'.html_print_image(
'images/wand_agent.png',
true,
$agent_wizard['text'] = html_print_menu_button(
[
'href' => 'javascript:',
'class' => 'agent_wizard_tab',
'image' => 'images/wizard@svg.svg',
'title' => __('Agent wizard'),
'class' => 'invert_filter',
]
).'</a>';
],
true
);
// Hidden subtab layer.
$agent_wizard['sub_menu'] = '<ul class="mn subsubmenu invisible float-none">';
@ -575,45 +573,38 @@ if ($id_agente) {
$total_incidents = agents_get_count_incidents($id_agente);
// TODO. OVERRIDE.
$total_incidents = 1;
// Incident tab.
if ($total_incidents > 0) {
$incidenttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente.'">'.html_print_image(
'images/book_edit.png',
true,
$incidenttab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=incident&amp;id_agente='.$id_agente,
'image' => 'images/logs@svg.svg',
'title' => __('Incidents'),
'class' => 'invert_filter',
]
).'</a>';
],
true
);
if ($tab == 'incident') {
$incidenttab['active'] = true;
} else {
$incidenttab['active'] = false;
}
$incidenttab['active'] = ($tab === 'incident');
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
if ($has_remote_conf) {
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
if ($has_remote_conf !== false) {
$agent_name = agents_get_name($id_agente);
$agent_name = io_safe_output($agent_name);
$agent_md5 = md5($agent_name, false);
$remote_configuration_tab['text'] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=remote_configuration&amp;id_agente='.$id_agente.'&amp;disk_conf='.$agent_md5.'">'.html_print_image(
'images/remote_configuration.png',
true,
$remote_configuration_tab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;tab=remote_configuration&amp;id_agente='.$id_agente.'&amp;disk_conf='.$agent_md5,
'image' => 'images/remote-configuration@svg.svg',
'title' => __('Remote configuration'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'remote_configuration') {
$remote_configuration_tab['active'] = true;
} else {
$remote_configuration_tab['active'] = false;
}
],
true
);
$remote_configuration_tab['active'] = ($tab === 'remote_configuration');
$onheader = [
'view' => $viewtab,
@ -793,8 +784,8 @@ if ($id_agente) {
}
$helper = ($help_header === 'main_tab') ? 'main_tab' : '';
$pure = get_parameter('pure', 0);
if (!$pure) {
$pure = (int) get_parameter('pure');
if ($pure === 0) {
ui_print_standard_header(
agents_get_alias($id_agente),
'images/agent.png',
@ -2447,7 +2438,7 @@ switch ($tab) {
if(wizard_tab_showed <= 0) {
$('.subsubmenu').hide("fast");
}
},15000);
},1500);
}
/* ]]> */

View File

@ -855,20 +855,16 @@ if ($agents !== false) {
echo "<td align='left' class='$tdcolor'>";
// Has remote configuration ?
if (enterprise_installed()) {
if (enterprise_installed() === true) {
enterprise_include_once('include/functions_config_agents.php');
if (enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']])) {
echo "<a href='index.php?".'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'tab=remote_configuration&'.'id_agente='.$agent['id_agente']."&disk_conf=1'>";
echo html_print_image(
'images/application_edit.png',
true,
html_print_menu_button(
[
'align' => 'middle',
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$agent['id_agente'].'&disk_conf=1',
'image' => 'images/remote-configuration@svg.svg',
'title' => __('Edit remote config'),
'class' => 'invert_filter',
]
);
echo '</a>';
}
}

View File

@ -1073,71 +1073,82 @@ foreach ($modules as $module) {
}
if ((bool) $module['disabled'] === true) {
$data[8] = "<a href='index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente=".$id_agente.'&enable_module='.$module['id_agente_modulo']."'>".html_print_image(
'images/svg/change-active.svg',
true,
$data[8] = html_print_menu_button(
[
'alt' => __('Enable module'),
'href' => 'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&enable_module='.$module['id_agente_modulo'],
'image' => 'images/change-active.svg',
'title' => __('Enable module'),
'class' => 'filter_none',
]
).'</a>';
],
true
);
} else {
$data[8] = "<a href='index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente=".$id_agente.'&disable_module='.$module['id_agente_modulo']."'>".html_print_image(
'images/svg/change-pause.svg',
true,
$data[8] = html_print_menu_button(
[
'alt' => __('Disable module'),
'href' => 'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&disable_module='.$module['id_agente_modulo'],
'image' => 'images/change-pause.svg',
'title' => __('Disable module'),
]
).'</a>';
],
true
);
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') && $module['id_tipo_modulo'] != 25) {
$data[8] .= '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&duplicate_module='.$module['id_agente_modulo'].'"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[8] .= html_print_image(
'images/svg/duplicate.svg',
true,
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true && $module['id_tipo_modulo'] !== 25) {
$data[8] .= html_print_menu_button(
[
'title' => __('Duplicate'),
'class' => 'invert_filter',
]
'href' => 'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&duplicate_module='.$module['id_agente_modulo'],
'onClick' => "if (!confirm(\' '.__('Are you sure?').'\')) return false;",
'image' => 'images/copy.svg',
'title' => __('Duplicate'),
],
true
);
$data[8] .= '</a> ';
// Make a data normalization.
if (isset($numericModules[$type]) === true) {
/*
if (isset($numericModules[$type]) === true) {
if ($numericModules[$type] === true) {
$data[8] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[8] .= html_print_image(
'images/svg/module-graph.svg',
true,
$data[8] .= html_print_menu_button(
[
'title' => __('Normalize'),
'class' => 'invert_filter',
]
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'],
'onClick' => "if (!confirm(\' '.__('Are you sure?').'\')) return false;",
'image' => 'images/module-graph.svg',
'title' => __('Normalize'),
'image_class' => (isset($numericModules[$type]) === false || $numericModules[$type] === false) ? 'alpha50' : 'invert_filter main_menu_icon',
],
true
);
$data[8] .= '</a>';
}
} else {
} else {
$data[8] .= html_print_image(
'images/svg/module-graph.svg',
true,
[
'title' => __('Normalize (Disabled)'),
'style' => 'opacity: 0.5;',
'image_class' => 'opacity: 0.5;',
]
);
$data[8] .= '&nbsp;&nbsp;';
}
}
*/
$data[8] .= html_print_menu_button(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'],
'onClick' => "if (!confirm(\' '.__('Are you sure?').'\')) return false;",
'image' => 'images/module-graph.svg',
'title' => __('Normalize'),
'disabled' => (isset($numericModules[$type]) === false || $numericModules[$type] === false),
'disabled_title' => ' ('.__('Disabled').')',
],
true
);
// Create network component action.
if ((is_user_admin($config['id_user']) === true)
/*
if ((is_user_admin($config['id_user']) === true)
&& ((int) $module['id_modulo'] === MODULE_NETWORK)
) {
) {
$data[8] .= '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create_network_from_module=1&id_agente='.$id_agente.'&create_module_from='.$module['id_agente_modulo'].'"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[8] .= html_print_image(
'images/op_network.png',
true,
@ -1147,29 +1158,39 @@ foreach ($modules as $module) {
]
);
$data[8] .= '</a> ';
} else {
} else {
$data[8] .= html_print_image(
'images/network.disabled.png',
true,
['title' => __('Create network component (Disabled)')]
);
$data[8] .= '&nbsp;&nbsp;';
}
}
*/
$data[8] .= html_print_menu_button(
[
'href' => 'index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create_network_from_module=1&id_agente='.$id_agente.'&create_module_from='.$module['id_agente_modulo'],
'onClick' => "if (!confirm(\' '.__('Are you sure?').'\')) return false;",
'image' => 'images/cluster@svg.svg',
'title' => __('Create network component'),
'disabled' => ((is_user_admin($config['id_user']) === true) && (int) $module['id_modulo'] === MODULE_NETWORK) === false,
'disabled_title' => ' ('.__('Disabled').')',
],
true
);
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
// Delete module.
$data[9] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[9] .= html_print_image(
'images/svg/delete.svg',
true,
$data[9] = html_print_menu_button(
[
'title' => __('Delete'),
'class' => 'invert_filter',
]
'href' => 'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'],
'onClick' => "if (!confirm(\' '.__('Are you sure?').'\')) return false;",
'image' => 'images/delete.svg',
'title' => __('Delete'),
],
true
);
$data[9] .= '</a> ';
}
$table->cellclass[] = [
@ -1280,7 +1301,7 @@ if ((bool) check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === tr
draggable: true,
modal: true,
close: false,
height: 245,
height: 222,
width: 480,
overlay: {
opacity: 0.5,

View File

@ -323,11 +323,6 @@ if ($edit === false) {
}
$table_simple->data['module_n_type'][1] = '<span class="result_info_text">'.modules_get_moduletype_description($id_module_type).' ('.$type_names_hash[$id_module_type].')</span>';
$table_simple->data['module_n_type'][1] .= html_print_input_hidden(
'type_names',
base64_encode(io_json_mb_encode($type_names_hash)),
true
);
} else {
$idModuleType = (isset($id_module_type) === true) ? $idModuleType : '';
// Removed web analysis and log4x from select.
@ -375,17 +370,36 @@ if ($edit === false) {
false,
100
);
// Store the relation between id and name of the types on a hidden field.
$table_simple->data['module_n_type'][1] .= html_print_input_hidden(
'type_names',
base64_encode(io_json_mb_encode($type_names_hash)),
true
);
}
hd($type_names_hash);
hd($_REQUEST);
// Store the relation between id and name of the types on a hidden field.
$table_simple->data['module_n_type'][1] .= html_print_input_hidden(
'type_names',
base64_encode(io_json_mb_encode($type_names_hash)),
true
);
if ($edit_module === true) {
$id_module_type = (int) $id_module_type;
// Check if the module type is string.
switch ($id_module_type) {
case MODULE_TYPE_GENERIC_DATA_STRING:
case MODULE_TYPE_REMOTE_TCP_STRING:
case MODULE_TYPE_REMOTE_SNMP_STRING:
case MODULE_TYPE_ASYNC_STRING:
case MODULE_TYPE_WEB_CONTENT_STRING:
case MODULE_TYPE_REMOTE_CMD_STRING:
$stringTypeModule = true;
break;
default:
$stringTypeModule = false;
break;
}
if (($id_module_type >= 1 && $id_module_type <= 5)
|| ($id_module_type >= 21 && $id_module_type <= 23)
|| ($id_module_type === 100)
@ -428,12 +442,11 @@ $tableBasicThresholds->rowclass = [];
$tableBasicThresholds->data = [];
// WARNING THRESHOLD.
if (modules_is_string_type($id_module_type) === false) {
$tableBasicThresholds->rowclass['caption_warning_threshold'] = 'field_half_width pdd_t_10px';
$tableBasicThresholds->rowclass['warning_threshold'] = 'field_half_width';
$tableBasicThresholds->cellclass['caption_warning_threshold'] = 'show_hide_thresholds_minmax';
$tableBasicThresholds->cellclass['warning_threshold'] = 'show_hide_thresholds_minmax';
$tableBasicThresholds->data['caption_warning_threshold'][0] .= __('Warning threshold').' ('.__('Min / Max').')';
$tableBasicThresholds->rowclass['caption_warning_threshold'] = 'field_half_width pdd_t_10px';
$tableBasicThresholds->rowclass['warning_threshold'] = 'field_half_width';
$tableBasicThresholds->data['caption_warning_threshold'][0] .= __('Warning threshold').'&nbsp;';
if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === false)) {
$tableBasicThresholds->data['caption_warning_threshold'][0] .= '<span class="font_11" id="caption_minmax_warning">('.__('Min / Max').')</span>';
$tableBasicThresholds->data['warning_threshold'][0] .= html_print_input_text(
'min_warning',
$min_warning,
@ -465,18 +478,23 @@ if (modules_is_string_type($id_module_type) === false) {
html_print_radio_button_extended('warning_thresholds_checks', 'warning_inverse', __('Inverse interval'), $warning_inverse, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-warning_inverse'),
html_print_radio_button_extended('warning_thresholds_checks', 'percentage_warning', __('Percentage'), $percentage_warning, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-percentage_warning'),
],
[],
[ 'class' => 'margin-top-10' ],
true
);
}
if (modules_is_string_type($id_module_type) === true) {
$tableBasicThresholds->rowclass['caption_warning_threshold'] = 'field_half_width pdd_t_10px';
$tableBasicThresholds->rowclass['warning_threshold'] = 'field_half_width';
$tableBasicThresholds->cellclass['caption_warning_threshold'] = 'show_hide_thresholds_string';
$tableBasicThresholds->cellclass['warning_threshold'] = 'show_hide_thresholds_string';
$tableBasicThresholds->data['caption_warning_threshold'][0] .= __('Warning threshold').' ('.__('Str.').')';
$tableBasicThresholds->data['warning_threshold'][1] .= html_print_input_text(
if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === true)) {
$tableBasicThresholds->data['caption_switch_warning_inverse_string'][0] = __('Inverse interval');
$tableBasicThresholds->data['switch_warning_inverse_string'][0] = html_print_checkbox_switch(
'warning_inverse_string',
1,
$warning_inverse,
true,
$disabledBecauseInPolicy
);
$tableBasicThresholds->data['caption_warning_threshold'][0] .= '<span class="font_11" id="caption_str_warning">('.__('Str.').')</span>';
$tableBasicThresholds->data['warning_threshold'][0] .= html_print_input_text(
'str_warning',
str_replace('"', '', $str_warning),
'',
@ -488,88 +506,91 @@ if (modules_is_string_type($id_module_type) === true) {
'',
$classdisabledBecauseInPolicy
).'</span>';
$divPercentageContent = __('Percentage');
$divPercentageContent .= html_print_checkbox_switch('percentage_warning', 1, $percentage_warning, true, $disabledBecauseInPolicy);
$divPercentageContent .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true);
$tableBasicThresholds->data['switch_warning_threshold'][0] .= html_print_div(
[
'id' => 'percentage_warning',
'content' => $divPercentageContent,
],
true
);
}
// CRITICAL THRESHOLD.
$tableBasicThresholds->rowclass['caption_critical_threshold'] = 'field_half_width pdd_t_10px';
$tableBasicThresholds->rowclass['critical_threshold'] = 'field_half_width';
$tableBasicThresholds->cellclass['caption_critical_threshold'] = 'show_hide_thresholds_minmax';
$tableBasicThresholds->cellclass['critical_threshold'] = 'show_hide_thresholds_minmax';
$tableBasicThresholds->data['caption_critical_threshold'][0] .= __('Critical threshold').' ('.__('Min / Max').')';
$tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text(
'min_critical',
$min_critical,
'',
10,
255,
true,
$disabledBecauseInPolicy || $edit === false,
false,
'',
$classdisabledBecauseInPolicy
);
$tableBasicThresholds->data['critical_threshold'][1] .= html_print_input_text(
'max_critical',
$max_critical,
'',
10,
255,
true,
$disabledBecauseInPolicy || $edit === false,
false,
'',
$classdisabledBecauseInPolicy
).'</span>';
$tableBasicThresholds->data['switch_critical_threshold'][0] .= html_print_switch_radio_button(
$tableBasicThresholds->data['switch_warning_threshold'][0] .= html_print_div(
[
html_print_radio_button_extended('critical_thresholds_checks', 'normal_critical', __('Normal'), ($percentage_critical && $critical_inverse) === false, false, '', '', true, false, '', 'radius-normal_critical'),
html_print_radio_button_extended('critical_thresholds_checks', 'critical_inverse', __('Inverse interval'), $critical_inverse, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-critical_inverse'),
html_print_radio_button_extended('critical_thresholds_checks', 'percentage_critical', __('Percentage'), $percentage_critical, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-percentage_critical'),
],
[],
true
);
$divPercentageContent = __('Percentage');
$divPercentageContent .= html_print_checkbox_switch('percentage_critical', 1, $percentage_critical, true, $disabledBecauseInPolicy);
$divPercentageContent .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true);
$tableBasicThresholds->data['switch_critical_threshold'][0] .= html_print_div(
[
'id' => 'percentage_critical',
'id' => 'percentage_warning',
'content' => $divPercentageContent,
],
true
);
$tableBasicThresholds->cellclass['caption_critical_threshold'] = 'show_hide_thresholds_string';
$tableBasicThresholds->cellclass['critical_threshold'] = 'show_hide_thresholds_string';
$tableBasicThresholds->data['caption_critical_threshold'][0] .= __('Critical threshold').' ('.__('Str.').')';
$tableBasicThresholds->data['critical_threshold'][1] .= html_print_input_text(
'str_critical',
str_replace('"', '', $str_critical),
'',
10,
1024,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
);
// CRITICAL THRESHOLD.
$tableBasicThresholds->rowclass['caption_critical_threshold'] = 'field_half_width pdd_t_10px';
$tableBasicThresholds->rowclass['critical_threshold'] = 'field_half_width';
$tableBasicThresholds->data['caption_critical_threshold'][0] .= __('Critical threshold').'&nbsp;';
if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === false)) {
$tableBasicThresholds->data['caption_critical_threshold'][0] .= '<span class="font_11" id="caption_minmax_critical">('.__('Min / Max').')</span>';
$tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text(
'min_critical',
$min_critical,
'',
10,
255,
true,
$disabledBecauseInPolicy || $edit === false,
false,
'',
$classdisabledBecauseInPolicy
);
$tableBasicThresholds->data['critical_threshold'][1] .= html_print_input_text(
'max_critical',
$max_critical,
'',
10,
255,
true,
$disabledBecauseInPolicy || $edit === false,
false,
'',
$classdisabledBecauseInPolicy
).'</span>';
$tableBasicThresholds->data['switch_critical_threshold'][0] .= html_print_switch_radio_button(
[
html_print_radio_button_extended('critical_thresholds_checks', 'normal_critical', __('Normal'), ($percentage_critical && $critical_inverse) === false, false, '', '', true, false, '', 'radius-normal_critical'),
html_print_radio_button_extended('critical_thresholds_checks', 'critical_inverse', __('Inverse interval'), $critical_inverse, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-critical_inverse'),
html_print_radio_button_extended('critical_thresholds_checks', 'percentage_critical', __('Percentage'), $percentage_critical, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-percentage_critical'),
],
[ 'class' => 'margin-top-10' ],
true
);
}
if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === true)) {
$tableBasicThresholds->data['caption_switch_critical_inverse_string'][0] = __('Inverse interval');
$tableBasicThresholds->data['switch_critical_inverse_string'][0] = html_print_checkbox_switch(
'critical_inverse_string',
1,
$critical_inverse,
true,
$disabledBecauseInPolicy
);
$tableBasicThresholds->data['switch_critical_threshold'][0] .= html_print_div(
[
'id' => 'percentage_critical',
'content' => $divPercentageContent,
],
true
);
$tableBasicThresholds->data['caption_critical_threshold'][0] .= '<span class="font_11" id="caption_str_critical">('.__('Str.').')</span>';
$tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text(
'str_critical',
str_replace('"', '', $str_critical),
'',
10,
1024,
true,
$disabledBecauseInPolicy,
false,
'',
$classdisabledBecauseInPolicy
);
}
$table_simple->rowstyle['thresholds_table'] = 'margin-top: 15px;height: 320px;width: 100%';
$table_simple->cellclass['thresholds_table'][0] = 'basic_thresholds_table basic_thresholds_inputs';
@ -701,15 +722,16 @@ $table_advanced->colspan = [];
$table_advanced->rowspan = [];
$table_advanced->rowclass['title_1'] = 'w100p';
$table_advanced->cellstyle['title_1'][0] = 'width: 100%;';
$table_advanced->data['title_1'][0] = html_print_subtitle_table(__('Identification and Categorization'), [], true);
$table_advanced->data['title_1'][0] .= html_print_div(
$table_advanced->cellstyle['title_1'][0] = 'width: 40px;';
$table_advanced->cellstyle['title_1'][1] = 'width: 100%;';
$table_advanced->data['title_1'][0] = html_print_div(
[
'class' => 'section_table_title_line',
'content' => '',
],
true
);
$table_advanced->data['title_1'][1] = html_print_subtitle_table(__('Identification and Categorization'), [], true);
$table_advanced->rowclass['captions_custom_category'] = 'field_half_width pdd_t_10px';
$table_advanced->rowclass['custom_id_category'] = 'field_half_width';
$table_advanced->data['captions_custom_category'][0] = __('Custom ID');
@ -1002,15 +1024,17 @@ $table_advanced->data['textarea_crit_warn_instructions'][1] = html_print_textare
);
$table_advanced->rowclass['title_2'] = 'w100p mrgn_top_20px';
$table_advanced->cellstyle['title_2'][0] = 'width: 100%;';
$table_advanced->data['title_2'][0] = html_print_subtitle_table(__('Execution interval'), [], true);
$table_advanced->data['title_2'][0] .= html_print_div(
$table_advanced->cellstyle['title_2'][0] = 'width: 40px;';
$table_advanced->cellstyle['title_2'][1] = 'width: 100%;';
$table_advanced->data['title_2'][0] = html_print_div(
[
'class' => 'section_table_title_line',
'content' => '',
],
true
);
$table_advanced->data['title_2'][1] = html_print_subtitle_table(__('Execution interval'), [], true);
$table_advanced->data['caption_execution_interval'][0] = __('Interval');
$table_advanced->data['execution_interval'][0] = '<span class="result_info_text">'.$outputExecutionInterval.'</span>';
$table_advanced->data['execution_interval'][0] .= html_print_input_hidden('moduletype', $moduletype, true);
@ -1027,22 +1051,23 @@ if (isset($id_agente) === true && (int) $moduletype === MODULE_DATA) {
$table_advanced->data['cron_to_select'][0] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, ((bool) $has_remote_conf === true) ? $disabledBecauseInPolicy : true, true);
} else {
$table_advanced->data['caption_cron_from_select'][0] = __('Cron from');
$table_advanced->data['cron_from_select'][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
$table_advanced->data['cron_from_select'][0] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
$table_advanced->data['caption_cron_to_select'][0] = __('Cron to');
$table_advanced->data['cron_to_select'][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
$table_advanced->data['cron_to_select'][0] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
}
$table_advanced->rowclass['title_3'] = 'w100p mrgn_top_20px';
$table_advanced->cellstyle['title_3'][0] = 'width: 100%;';
$table_advanced->data['title_3'][0] = html_print_subtitle_table(__('Thresholds and state changes'), [], true);
$table_advanced->data['title_3'][0] .= html_print_div(
$table_advanced->cellstyle['title_3'][0] = 'width: 40px;';
$table_advanced->cellstyle['title_3'][1] = 'width: 100%;';
$table_advanced->data['title_3'][0] = html_print_div(
[
'class' => 'section_table_title_line',
'content' => '',
],
true
);
$table_advanced->data['title_3'][1] = html_print_subtitle_table(__('Thresholds and state changes'), [], true);
$table_advanced->rowclass['caption_min_max_values'] = 'w50p pdd_t_10px';
$table_advanced->rowclass['min_max_values'] = 'w50p';
@ -1256,25 +1281,17 @@ if ((bool) preg_match('/async/', $module_type_name) === false || $edit === true)
$table_advanced->data['ff_interval_timeout'][1] .= '<span id="ff_timeout_disable" class="result_info_text">'.__('Disabled').'</span>';
}
$table_advanced->rowclass['title_4'] = 'w100p mrgn_top_20px';
$table_advanced->cellstyle['title_4'][0] = 'width: 100%;';
$table_advanced->data['title_4'][0] = html_print_subtitle_table(__('Data and their processing'), [], true);
$table_advanced->data['title_4'][0] .= html_print_div(
$table_advanced->cellstyle['title_4'][0] = 'width: 40px;';
$table_advanced->cellstyle['title_4'][1] = 'width: 100%;';
$table_advanced->data['title_4'][0] = html_print_div(
[
'class' => 'section_table_title_line',
'content' => '',
],
true
);
$table_advanced->data['title_4'][1] = html_print_subtitle_table(__('Data and their processing'), [], true);
$table_advanced->rowclass['caption_process_unit'] = 'w50p';
$table_advanced->rowclass['process_unit'] = 'w50p';
@ -1305,19 +1322,21 @@ $table_advanced->data['process_unit'][1] = html_print_extended_select_for_post_p
);
$table_advanced->rowclass['title_5'] = 'w100p mrgn_top_20px';
$table_advanced->cellstyle['title_5'][0] = 'width: 100%;';
$table_advanced->data['title_5'][0] = html_print_subtitle_table(
__('Notifications and alerts'),
[],
true
);
$table_advanced->data['title_5'][0] .= html_print_div(
$table_advanced->cellstyle['title_5'][0] = 'width: 40px;';
$table_advanced->cellstyle['title_5'][1] = 'width: 100%;';
$table_advanced->data['title_5'][0] = html_print_div(
[
'class' => 'section_table_title_line',
'content' => '',
],
true
);
$table_advanced->data['title_5'][1] = html_print_subtitle_table(
__('Notifications and alerts'),
[],
true
);
$table_advanced->data['caption_export_target'][0] = __('Export target');
if ($__code_from === 'policies') {
@ -1707,9 +1726,8 @@ $(document).ready (function () {
'width=800,height=600'
);
}
}
if(type_name_selected == 'remote_tcp_string' ||
type_name_selected == 'remote_tcp_proc' ||
type_name_selected == 'remote_tcp_inc' ||
@ -1753,25 +1771,49 @@ $(document).ready (function () {
}
}
setModuleType(type_name_selected);
});
function setModuleType(type_name_selected) {
if (type_name_selected.match(/_string$/) == null) {
// Numeric types
$('#string_critical').hide();
$('#string_warning').hide();
$('#minmax_critical').show();
$('#minmax_warning').show();
$('#svg_dinamic').show();
// Hide string fields.
$('[id*=str_warning]').hide();
$('[id*=str_critical]').hide();
$('[id*=switch_warning_inverse_string]').hide();
$('[id*=switch_critical_inverse_string]').hide();
// Show numeric fields.
$('[id*=switch_warning_threshold]').show();
$('[id*=switch_critical_threshold]').show();
$('#caption_minmax_warning').show();
$('#caption_minmax_critical').show();
$('#text-min_warning').show();
$('#text-min_critical').show();
$('#text-max_warning').show();
$('#text-max_critical').show();
$('#percentage_warning').show();
$('#percentage_critical').show();
// Show dinamic reference.
$('#svg_dinamic').show();
}
else {
// String types
$('#string_critical').show();
$('#string_warning').show();
$('#minmax_critical').hide();
$('#minmax_warning').hide();
$('#svg_dinamic').hide();
// Show string fields.
$('[id*=str_warning]').show();
$('[id*=str_critical]').show();
$('[id*=switch_warning_inverse_string]').show();
$('[id*=switch_critical_inverse_string]').show();
// Hide numeric fields.
$('[id*=switch_warning_threshold]').hide();
$('[id*=switch_critical_threshold]').hide();
$('#caption_minmax_warning').hide();
$('#caption_minmax_critical').hide();
$('#text-min_warning').hide();
$('#text-min_critical').hide();
$('#text-max_warning').hide();
$('#text-max_critical').hide();
$('#percentage_warning').hide();
$('#percentage_critical').hide();
// Hide dinamic reference.
$('#svg_dinamic').hide();
}
if (type_name_selected.match(/async/) == null) {
@ -1782,7 +1824,7 @@ $(document).ready (function () {
$('#ff_timeout').show();
$('#ff_timeout_disable').hide();
}
});
}
$("#id_module_type").trigger('change');
@ -1857,19 +1899,23 @@ $(document).ready (function () {
$('#'+thisLabel).siblings().attr('checked', false);
if ($('#radius-warning_inverse').prop('checked') === true) {
$('#percentage_warning').hide();
//$('#percentage_warning').hide();
$("#svg_dinamic").show();
}
if ($('#radius-critical_inverse').prop('checked') === true) {
$('#percentage_critical').hide();
//$('#percentage_critical').hide();
$("#svg_dinamic").show();
}
if ($('#radius-percentage_warning').prop('checked') === true) {
$('#warning_inverse').hide();
//$('#warning_inverse').hide();
$("#svg_dinamic").hide();
}
if ($('#radius-percentage_critical').prop('checked') === true) {
$('#critical_inverse').hide();
//$('#critical_inverse').hide();
$("#svg_dinamic").hide();
}
$('#radius-warning_inverse').change (function() {

View File

@ -161,6 +161,7 @@ $params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'prediction_module';
$params['none_module_text'] = __('Select Module');
$params['use_hidden_input_idagent'] = true;
$params['input_style'] = 'width: 100%;';
$params['hidden_input_idagent_id'] = 'hidden-id_agente_module_prediction';
$data[0] = ui_print_agent_autocomplete_input($params);
@ -177,14 +178,18 @@ if ($id_agente > 0) {
'',
__('Select Module'),
0,
true
true,
false,
true,
false,
'width: 100%;'
);
} else {
$predictionModuleInput = '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>';
}
$data[1] = $predictionModuleInput;
$data[2] = html_print_select([__('Weekly'), __('Monthly'), __('Daily')], 'custom_integer_2', $custom_integer_2, '', '', 0, true);
$data[2] = html_print_select([__('Weekly'), __('Monthly'), __('Daily')], 'custom_integer_2', $custom_integer_2, '', '', 0, true, false, true, '', false, 'width: 100%;');
$data[2] .= html_print_input_hidden('id_agente_module_prediction', $id_agente, true);
$table_simple->cellclass['prediction_module'][0] = 'w33p';
$table_simple->cellclass['prediction_module'][1] = 'w33p';
@ -201,21 +206,22 @@ $table_simple->cellclass['caption_capacity_planning'][2] = 'w33p';
push_table_simple($data, 'caption_capacity_planning');
$data = [];
$data[0] = html_print_input(
$data[0] = html_print_select(
[
'type' => 'select',
'return' => 'true',
'name' => 'estimation_type',
'class' => 'w100p',
'style' => 'width: 100px;',
'fields' => [
'estimation_absolute' => __('Estimated absolute value'),
'estimation_calculation' => __('Calculation of days to reach limit'),
],
'selected' => $estimation_type,
'estimation_absolute' => __('Estimated absolute value'),
'estimation_calculation' => __('Calculation of days to reach limit'),
],
'div',
false
'estimation_type',
$estimation_type,
'',
'',
0,
true,
false,
true,
'',
false,
'width: 100%;'
);
$data[1] = html_print_input(

View File

@ -390,7 +390,7 @@ html_print_div(
'go_back',
false,
'',
['icon' => 'cancel'],
['icon' => 'back'],
true
).html_print_submit_button(
$buttonCaption,

View File

@ -2731,7 +2731,7 @@ function html_print_anchor(
$output .= (isset($options['href']) === true) ? 'href="'.io_safe_input_html($options['href']).'"' : ui_get_full_url();
foreach ($attrs as $attribute) {
if (isset($options[$attribute])) {
if (isset($options[$attribute]) === true && empty($options[$attribute]) === false) {
$output .= ' '.$attribute.'="'.io_safe_input_html($options[$attribute]).'"';
}
}
@ -6434,7 +6434,7 @@ function html_print_go_back_button(string $url, array $options=[], bool $return=
false,
'window.location.href = \''.$url.'\'',
[
'icon' => ($options['action_class'] ?? 'cancel'),
'icon' => ($options['action_class'] ?? 'back'),
'mode' => 'secondary',
],
true
@ -6588,4 +6588,64 @@ function html_print_subtitle_table(string $caption, array $options=[], bool $ret
],
$return
);
}
/**
* Prints a menu button.
*
* @param array $options Available options.
* - `id`: Id for the anchor.
* - `style`: Anchor inline styles.
* - `href`: Route to go.
* - `class`: Class for the anchor.
* - `image`: Path of the image.
* - `image_class`: Class for image. `invert_filter main_menu_icon` by default.
* - `title`: Alt Title for the image.
* - `disabled`: If true, the button does nothing.
* - `disabled_title`: If filled, add to the button and additional information.
* - `disabled_allow_onclick`: If true, the button will do onclick.
* - `onClick`: onClick action for anchor.
* - `content`: Alternative content.
* @param boolean $return If true, returns a string with formed menu button.
*
* @return string.
*/
function html_print_menu_button(array $options, bool $return=false)
{
// Disabled.
if (isset($options['disabled']) === true && $options['disabled'] === true) {
$options['href'] = '#';
$options['title'] .= ($options['disabled_title'] ?? '');
$options['image_class'] = (isset($options['image_class']) === true) ? $options['image_class'].' alpha50' : 'alpha50 main_menu_icon';
if (isset($options['disabled_allow_onclick']) === false || $options['disabled_allow_onclick'] !== true) {
$options['onClick'] = '';
}
}
// Attach the image. Otherwise, add additional content if user desires.
if (isset($options['image']) === true) {
$content = html_print_image(
$options['image'],
true,
[
'title' => ($options['title'] ?? ''),
'class' => ($options['image_class'] ?? 'invert_filter main_menu_icon'),
]
);
} else {
$content = ($options['content'] ?? '');
}
return html_print_anchor(
[
'id' => ($options['id'] ?? ''),
'href' => ($options['href'] ?? ''),
'class' => ($options['class'] ?? ''),
'style' => ($options['style'] ?? ''),
'onClick' => ($options['onClick'] ?? ''),
'content' => $content,
],
$return
);
}

View File

@ -644,10 +644,11 @@ function ui_print_tags_warning($return=false)
* @param boolean $link Whether the group have link or not.
* @param boolean $force_show_image Force show image.
* @param boolean $show_as_image Show as image.
* @param string $class Overrides the default class.
*
* @return string HTML code if return parameter is true.
*/
function ui_print_group_icon($id_group, $return=false, $path='groups_small', $style='', $link=true, $force_show_image=false, $show_as_image=false)
function ui_print_group_icon($id_group, $return=false, $path='groups_small', $style='', $link=true, $force_show_image=false, $show_as_image=false, $class='')
{
global $config;
@ -660,23 +661,25 @@ function ui_print_group_icon($id_group, $return=false, $path='groups_small', $st
$output = '';
// Don't show link in metaconsole.
if (defined('METACONSOLE')) {
if (is_metaconsole() === true) {
$link = false;
}
if ($link) {
if ($link === true) {
$output = '<a href="'.$config['homeurl'].'index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$id_group.'">';
}
if ($config['show_group_name']) {
$output .= '<span title="'.groups_get_name($id_group, true).'">'.groups_get_name($id_group, true).'&nbsp;</span>';
} else {
if (empty($icon)) {
if (empty($icon) === true) {
$output .= '<span title="'.groups_get_name($id_group, true).'">&nbsp;&nbsp;</span>';
} else {
$class = 'bot';
if ($icon === 'transmit') {
$class .= ' invert_filter';
if (empty($class) === true) {
$class = 'bot';
if ($icon === 'transmit') {
$class .= ' invert_filter';
}
}
$output .= html_print_image(
@ -781,7 +784,7 @@ function ui_print_os_icon(
$options=false,
$big_icons=false
) {
$subfolder = 'os_icons';
$subfolder = '.';
if ($networkmap) {
$subfolder = 'networkmap';
}
@ -790,15 +793,11 @@ function ui_print_os_icon(
$subfolder .= '/so_big_icons';
}
if (is_metaconsole()) {
$no_in_meta = false;
} else {
$no_in_meta = true;
}
$no_in_meta = (is_metaconsole() === false);
$icon = (string) db_get_value('icon_name', 'tconfig_os', 'id_os', (int) $id_os);
$os_name = get_os_name($id_os);
if (empty($icon)) {
if (empty($icon) === true) {
if ($only_src) {
$output = html_print_image(
'images/'.$subfolder.'/unknown.png',
@ -2557,7 +2556,7 @@ function ui_print_moduletype_icon(
[
'border' => 0,
'title' => $type['descripcion'],
'class' => 'invert_filter',
'class' => 'invert_filter main_menu_icon',
],
false,
$relative
@ -5607,7 +5606,7 @@ function ui_print_agent_autocomplete_input($parameters)
$javascript_function_change .= '
function setInputBackground(inputId, image) {
$("#"+inputId)
.attr("style", "background-image: url(\'"+image+"\'); background-repeat: no-repeat; background-position: 97% center; '.$inputStyles.'");
.attr("style", "background-image: url(\'"+image+"\'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; '.$inputStyles.'");
}
function set_functions_change_autocomplete_'.$input_name.'() {
@ -5879,7 +5878,7 @@ function ui_print_agent_autocomplete_input($parameters)
if (select_item_click) {
select_item_click = 0;
$("#'.$input_id.'")
.attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; '.$inputStyles.'");
.attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; '.$inputStyles.'");
return;
} else {
// Clear selectbox if item is not selected.
@ -5894,7 +5893,7 @@ function ui_print_agent_autocomplete_input($parameters)
//Set loading
$("#'.$input_id.'")
.attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; '.$inputStyles.'");
.attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; '.$inputStyles.'");
var term = input_value; //Word to search
'.$javascript_change_ajax_params_text.'
@ -5911,7 +5910,7 @@ function ui_print_agent_autocomplete_input($parameters)
success: function (data) {
if (data.length < 2) {
//Set icon
$("#'.$input_id.'").attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; '.$inputStyles.'");
$("#'.$input_id.'").attr("style", "background-image: url(\"'.$spinner_image.'\"); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; '.$inputStyles.'");
return;
}
@ -5961,7 +5960,7 @@ function ui_print_agent_autocomplete_input($parameters)
//Set icon
$("#'.$input_id.'")
.attr("style", "background: url(\"'.$icon_image.'\") 97% center no-repeat; '.$inputStyles.'")
.attr("style", "background: url(\"'.$icon_image.'\") 97% center no-repeat; background-size: 20px; '.$inputStyles.'")
return;
}
});
@ -5980,7 +5979,7 @@ function ui_print_agent_autocomplete_input($parameters)
}
$attrs = [];
$attrs['style'] = 'background-image: url('.$icon_image.'); background-repeat: no-repeat; background-position: 97% center; '.$text_color.' '.$inputStyles.'';
$attrs['style'] = 'background-image: url('.$icon_image.'); background-repeat: no-repeat; background-position: 97% center; background-size: 20px; '.$text_color.' '.$inputStyles.'';
if (!$disabled_javascript_on_blur_function) {
$attrs['onblur'] = $javascript_on_blur_function_name.'()';

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -1350,7 +1350,7 @@ if ($flag_agent !== '') {
if ($agent['icon_path']) {
$icon = gis_get_agent_icon_map($agent['id_agente'], true);
} else {
$icon = 'images/agent.png';
$icon = 'images/agents@svg.svg';
}
@ -1360,41 +1360,32 @@ $tab = get_parameter('tab', 'main');
// Manage tab.
$managetab = [];
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
$managetab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'">'.html_print_image(
'images/setup.png',
true,
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) {
$managetab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente,
'image' => 'images/configuration@svg.svg',
'title' => __('Manage'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab === 'manage') {
$managetab['active'] = true;
} else {
$managetab['active'] = false;
}
],
true
);
$managetab['active'] = ($tab === 'manage');
$managetab['godmode'] = 1;
}
// Main tab.
$maintab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">'.html_print_image(
'images/agent.png',
true,
$maintab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente,
'image' => 'images/agents@svg.svg',
'title' => __('Main'),
'class' => 'invert_filter',
]
).'</a>';
],
true
);
if ($tab === 'main') {
$maintab['active'] = true;
} else {
$maintab['active'] = false;
}
$maintab['active'] = ($tab === 'main');
// Interfaces tab.
$agent_interfaces = agents_get_network_interfaces(
@ -1431,54 +1422,50 @@ if ($agent_interfaces_count > 0) {
}
// Alert tab.
$alerttab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&tab=alert">'.html_print_image(
'images/bell.png',
true,
$alerttab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&tab=alert',
'image' => 'images/alert@svg.svg',
'title' => __('Alerts'),
'class' => 'invert_filter',
]
).'</a>';
],
true
);
if ($tab === 'alert') {
$alerttab['active'] = true;
} else {
$alerttab['active'] = false;
}
$alerttab['active'] = ($tab === 'alert');
// Inventory.
$inventoryCount = db_get_num_rows('SELECT id_agent_module_inventory FROM tagent_module_inventory WHERE id_agente = '.$agent['id_agente']);
$inventorytab = enterprise_hook('inventory_tab');
if ($inventorytab == -1 || $inventoryCount === 0) {
if ($inventorytab === ENTERPRISE_NOT_HOOK || $inventoryCount === 0) {
$inventorytab = '';
}
// Collection.
$collectiontab = enterprise_hook('collection_tab');
if ($collectiontab == -1) {
if ($collectiontab === ENTERPRISE_NOT_HOOK) {
$collectiontab = '';
}
// Policy.
$policyTab = enterprise_hook('policy_tab');
if ($policyTab == -1) {
if ($policyTab === ENTERPRISE_NOT_HOOK) {
$policyTab = '';
}
// WUX Console.
$modules_wux = enterprise_hook('get_wux_modules', [$id_agente]);
if ($modules_wux) {
if ((bool) $modules_wux === true) {
$wux_console_tab = enterprise_hook('wux_console_tab');
if ($wux_console_tab == -1) {
if ($wux_console_tab === ENTERPRISE_NOT_HOOK) {
$wux_console_tab = '';
}
}
$url_route_analyzer = enterprise_hook('get_url_route_analyzer_modules', [$id_agente]);
if ($url_route_analyzer) {
if ((bool) $url_route_analyzer === true) {
$url_route_analyzer_tab = enterprise_hook('url_route_analyzer_tab');
if ($url_route_analyzer_tab == -1) {
if ($url_route_analyzer_tab === ENTERPRISE_NOT_HOOK) {
$url_route_analyzer_tab = '';
}
}
@ -1490,128 +1477,106 @@ if ($ncm_tab === ENTERPRISE_NOT_HOOK) {
// GIS tab.
$gistab = [];
if ($config['activate_gis']) {
$gistab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente.'">'.html_print_image(
'images/op_gis.png',
true,
if ((bool) $config['activate_gis'] === true) {
$gistab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente,
'image' => 'images/poi@svg.svg',
'title' => __('GIS data'),
'class' => 'invert_filter',
]
).'</a>';
],
true
);
if ($tab == 'gis') {
$gistab['active'] = true;
} else {
$gistab['active'] = false;
}
$gistab['active'] = ($tab === 'gis');
}
// Incident tab.
$total_incidents = agents_get_count_incidents($id_agente);
if ($total_incidents > 0) {
$incidenttab['text'] = '<a href="index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&tab=incident&id_agente='.$id_agente.'">'.html_print_image(
'images/book_edit.png',
true,
$incidenttab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&tab=incident&id_agente='.$id_agente,
'image' => 'images/logs@svg.svg',
'title' => __('Incidents'),
'class' => 'invert_filter',
]
).'</a>';
],
true
);
if ($tab == 'incident') {
$incidenttab['active'] = true;
} else {
$incidenttab['active'] = false;
}
$incidenttab['active'] = ($tab === 'incident');
}
// Url address tab.
if ($agent['url_address'] != '') {
$urladdresstab['text'] = '<a href="index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&tab=url_address&id_agente='.$id_agente.'">'.html_print_image(
'images/link.png',
true,
if (empty($agent['url_address']) === false) {
$urladdresstab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&tab=url_address&id_agente='.$id_agente,
'image' => 'images/generic-string@svg.svg',
'title' => __('Url address'),
'class' => 'invert_filter',
]
).'</a>';
}
if ($tab == 'url_address') {
$urladdresstab['active'] = true;
} else {
$urladdresstab['active'] = false;
],
true
);
}
$urladdresstab['active'] = ($tab === 'url_address');
// Custom fields tab.
$custom_fields['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=custom_fields&id_agente='.$id_agente.'">'.html_print_image(
'images/custom_field.png',
true,
$custom_fields['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=custom_fields&id_agente='.$id_agente,
'image' => 'images/custom-input@svg.svg',
'title' => __('Custom fields'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'custom_fields') {
$custom_fields['active'] = true;
} else {
$custom_fields['active'] = false;
}
],
true
);
$custom_fields['active'] = ($tab === 'custom_fields');
// Graphs tab.
$graphs['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=graphs&id_agente='.$id_agente.'">'.html_print_image(
'images/chart.png',
true,
$graphs['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=graphs&id_agente='.$id_agente,
'image' => 'images/graph@svg.svg',
'title' => __('Graphs'),
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'graphs') {
$graphs['active'] = true;
} else {
$graphs['active'] = false;
}
],
true
);
$graphs['active'] = ($tab === 'graphs');
// Log viewer tab.
if (enterprise_installed() && $config['log_collector']) {
if (enterprise_installed() === true && (bool) $config['log_collector'] === true) {
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
$agent_has_logs = (bool) db_get_value('id_agent', 'tagent_module_log', 'id_agent', $id_agente);
if ($agent_has_logs && !$is_windows) {
if ($agent_has_logs === true && (bool) $is_windows === false) {
$log_viewer_tab = [];
$log_viewer_tab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=log_viewer&id_agente='.$id_agente.'">'.html_print_image(
'images/gm_log.png',
true,
$log_viewer_tab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=log_viewer&id_agente='.$id_agente,
'image' => 'images/gm_log.png',
'title' => __('Log Viewer'),
'class' => 'invert_filter',
]
).'</a>';
$log_viewer_tab['active'] = $tab == 'log_viewer';
],
true
);
$log_viewer_tab['active'] = ($tab === 'log_viewer');
}
}
// EHorus tab.
if ($config['ehorus_enabled'] && !empty($config['ehorus_custom_field'])
if ((bool) $config['ehorus_enabled'] === true && empty($config['ehorus_custom_field'] === false)
&& (check_acl_one_of_groups(
$config['id_user'],
$all_groups,
'AW'
) || is_user_admin($config['id_user']))
) || is_user_admin($config['id_user']) === true)
) {
$user_info = users_get_user_by_id($config['id_user']);
if ($config['ehorus_user_level_conf'] && !$user_info['ehorus_user_level_enabled']) {
if ($config['ehorus_user_level_conf'] && (bool) $user_info['ehorus_user_level_enabled'] === false) {
// If ehorus user configuration is enabled, and userr acces level is disabled do not show eHorus tab.
} else {
$ehorus_agent_id = agents_get_agent_custom_field($id_agente, $config['ehorus_custom_field']);
if (!empty($ehorus_agent_id)) {
if (empty($ehorus_agent_id) === false) {
$tab_url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=ehorus&id_agente='.$id_agente;
$ehorus_tab['text'] = '<a href="'.$tab_url.'" class="ehorus_tab">'.html_print_image(
'images/ehorus/ehorus.png',
@ -1626,11 +1591,11 @@ if ($config['ehorus_enabled'] && !empty($config['ehorus_custom_field'])
$ehorus_tab['sub_menu'] = '<ul class="mn subsubmenu float-none">';
$ehorus_tab['sub_menu'] .= '<a class="tab_terminal" href="'.$tab_url.'&client_tab=terminal">';
$ehorus_tab['sub_menu'] .= '<li class="nomn tab_godmode center">'.html_print_image(
'images/ehorus/terminal.png',
'images/quick-shell@svg.svg',
true,
[
'title' => __('Terminal'),
'class' => 'invert_filter',
'class' => 'invert_filter main_menu_icon',
]
);
$ehorus_tab['sub_menu'] .= '</li>';
@ -1687,28 +1652,32 @@ if ($config['ehorus_enabled'] && !empty($config['ehorus_custom_field'])
}
$is_sap = agents_get_sap_agents($id_agente);
if ($is_sap) {
$saptab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sap_view&page=1&id_agente='.$id_agente.'">'.html_print_image(
'images/sap_icon.png',
true,
['title' => __('SAP view')]
).'</a>';
if ($tab == 'sap_view') {
$saptab['active'] = true;
} else {
$saptab['active'] = false;
}
if ($is_sap === true) {
$saptab['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sap_view&page=1&id_agente='.$id_agente,
'image' => 'images/sap_icon.png',
'title' => __('SAP view'),
],
true
);
$saptab['active'] = ($tab === 'sap_view');
} else {
$saptab = '';
}
// External Tools tab.
$external_tools['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=external_tools&id_agente='.$id_agente.'">'.html_print_image('images/nettool.png', true, ['title' => __('External Tools'), 'class' => 'invert_filter']).'</a>';
if ($tab == 'external_tools') {
$external_tools['active'] = true;
} else {
$external_tools['active'] = false;
}
$external_tools['text'] = html_print_menu_button(
[
'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=external_tools&id_agente='.$id_agente,
'image' => 'images/external-tools@svg.svg',
'title' => __('External Tools'),
],
true
);
$external_tools['active'] = ($tab === 'external_tools');
$onheader = [
'manage' => ($managetab ?? null),