Several views updated

This commit is contained in:
jose.gonzalez@pandorafms.com 2022-11-11 16:15:17 +01:00
parent 52ee0cdfa6
commit bf678b55dc
12 changed files with 456 additions and 291 deletions

View File

@ -151,7 +151,7 @@ if (is_ajax()) {
ui_require_javascript_file('openlayers.pandora');
$new_agent = (empty($id_agente)) ? true : false;
$new_agent = (empty($id_agente) === true) ? true : false;
if (! isset($id_agente) && ! $new_agent) {
db_pandora_audit(
@ -209,6 +209,189 @@ $custom_id_div .= html_print_input_text(
'agent_custom_id'
).'</div>';
// Get groups.
$groups = users_get_groups($config['id_user'], 'AR', false);
// Get modules.
$modules = db_get_all_rows_sql(
'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = '.$id_parent
);
$modules_values = [];
$modules_values[0] = __('Any');
if (is_array($modules) === true) {
foreach ($modules as $m) {
$modules_values[$m['id_module']] = $m['name'];
}
}
// Get Servers.
$servers = servers_get_names();
// Set the agent have not server.
if (array_key_exists($server_name, $servers) === false) {
$server_name = 0;
}
if ($new_agent === true) {
// Set first server by default.
$servers_get_names = $servers;
$array_keys_servers_get_names = array_keys($servers_get_names);
$server_name = reset($array_keys_servers_get_names);
}
$tableAgent = new stdClass();
$tableAgent->id = 'simple';
$tableAgent->class = 'w100p mrgn_10px';
$tableAgent->data = [];
$tableAgent->style = [];
$tableAgent->cellclass = [];
$tableAgent->colspan = [];
$tableAgent->rowspan = [];
/*
$tableAgent->cellpadding = 2;
$tableAgent->cellspacing = 0;
$tableAgent->rowspan[3][2] = 3;
$tableAgent->rowspan[4][2] = 3;
*/
// Agent name.
if ($new_agent === false) {
$tableAgent->data['name'][0] = __('Agent name');
$tableAgent->data['name'][1] = html_print_input_text('agente', $nombre_agente, '', 80, 100, true);
$tableAgent->data['name'][1] .= html_print_div(
[
'class' => 'moduleIdBox',
'content' => __('ID').'&nbsp;<span class="font_14pt">'.$id_agente.'</span>',
],
true
);
// Agent options for QR code.
$agent_options_update = 'agent_options_update';
}
// Alias.
$tableAgent->data['alias'][0] = __('Alias');
$tableAgent->data['alias'][1] = html_print_input_text('alias', $alias, '', 50, 100, true, false, true);
if ($new_agent === true) {
$tableAgent->data['alias'][2] = __('Use alias as name');
$tableAgent->data['alias'][3] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
}
// Ip adress.
$tableAgent->data['ip_address'][0] = __('IP Address');
$tableAgent->data['ip_address'][1] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true);
$tableAgent->data['ip_address'][2] = __('Unique IP');
$tableAgent->data['ip_address'][3] .= html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
$tableAgent->data['ip_address'][4] = __('Fix IP address');
$tableAgent->data['ip_address'][4] .= ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true);
$tableAgent->data['ip_address'][5] = html_print_input(
[
'type' => 'switch',
'id' => 'fixed_ip',
'name' => 'fixed_ip',
'value' => $fixed_ip,
]
);
// IP Address List.
if ($new_agent === false) {
$tableAgent->data['ip_address_list'][0] = __('IP Address list');
$tableAgent->data['ip_address_list'][1] = html_print_select(agents_get_addresses($id_agente), 'address_list', $direccion_agente, '', '', 0, true);
$tableAgent->data['ip_address_list'][2] = __('Delete selected IPs');
$tableAgent->data['ip_address_list'][3] = html_print_checkbox_switch('delete_ip', 1, false, true);
}
// Select primary group.
$tableAgent->data['primary_group'][0] = __('Primary group');
if (isset($groups[$grupo]) === true || $new_agent === true) {
// Cannot change primary group if user have not permission for that group.
$tableAgent->data['primary_group'][1] = html_print_input(
[
'type' => 'select_groups',
'returnAllGroup' => false,
'name' => 'grupo',
'selected' => $grupo,
'return' => true,
'required' => true,
'privilege' => 'AW',
]
);
} else {
$tableAgent->data['primary_group'][1] .= groups_get_name($grupo);
$tableAgent->data['primary_group'][1] .= html_print_input_hidden('grupo', $grupo, true);
}
$tableAgent->data['primary_group'][1] .= '<div class="label_select_child_icons"><span id="group_preview">';
if ($id_agente === 0) {
$hidden = 'display: none;';
} else {
$hidden = '';
}
$tableAgent->data['primary_group'][1] .= ui_print_group_icon($grupo, true, 'groups_small', $hidden);
$tableAgent->data['interval'][0] = __('Interval');
$tableAgent->data['interval'][1] = html_print_extended_select_for_time(
'intervalo',
$intervalo,
'',
'',
'0',
10,
true,
false,
true,
'w40p'
);
if ($intervalo < SECONDS_5MINUTES) {
$tableAgent->data['interval'][1] .= clippy_context_help('interval_agent_min');
}
$tableAgent->data['os'][0] = __('OS');
$tableAgent->data['os'][1] = html_print_select_from_sql(
'SELECT id_os, name FROM tconfig_os',
'id_os',
$id_os,
'',
'',
'0',
true
);
$tableAgent->data['os'][1] .= html_print_div(
[
'content' => '<span id="os_preview">'.ui_print_os_icon($id_os, false, true).'<span>',
],
true
);
$tableAgent->data['server'][0] = __('Server');
$tableAgent->data['server'][1] = html_print_select(
$servers,
'server_name',
$server_name,
'',
__('None'),
0,
true
);
// Description.
$tableAgent->data['server'][0] = __('Description');
$tableAgent->data['server'][1] = html_print_textarea(
'comentarios',
3,
10,
$comentarios,
'',
true,
'agent_description'
);
html_print_table($tableAgent);
if (!$new_agent && $alias != '') {
$table_agent_name = '<div class="label_select"><p class="input_label">'.__('Agent name').'</p>';
$table_agent_name .= '<div class="label_select_parent">';
@ -230,20 +413,6 @@ if (!$new_agent && $alias != '') {
$table_agent_name .= '</a>';
}
$agent_options_update = 'agent_options_update';
// Delete link from here.
if (is_management_allowed() === true) {
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=".$id_agente."&search=&offset=0&sort_field=&sort=none'>".html_print_image(
'images/cross.png',
true,
[
'title' => __('Delete agent'),
'class' => 'invert_filter',
]
).'</a>';
}
// Remote configuration available.
$remote_agent = false;
if (isset($filename)) {
@ -284,36 +453,38 @@ if (!$new_agent && $alias != '') {
$table_qr_code .= '</div>';
}
if ($new_agent) {
/*
if ($new_agent) {
$label_select_child_left = 'label_select_child_left';
$label_select_parent = 'label_select_parent';
}
}
$table_alias = '<div class="label_select"><p class="input_label">'.__('Alias').'</p>';
$table_alias .= '<div class='.$label_select_parent.'>';
$table_alias .= '<div class='.$label_select_child_left.'>'.html_print_input_text('alias', $alias, '', 50, 100, true, false, true).'</div>';
if ($new_agent) {
$table_alias = '<div class="label_select"><p class="input_label">'.__('Alias').'</p>';
$table_alias .= '<div class='.$label_select_parent.'>';
$table_alias .= '<div class='.$label_select_child_left.'>'.html_print_input_text('alias', $alias, '', 50, 100, true, false, true).'</div>';
if ($new_agent) {
$table_alias .= '<div class="label_select_child_right">'.html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true).__('Use alias as name').'</div>';
}
}
$table_alias .= '</div></div>';
$table_ip = '<div class="label_select"><p class="input_label">'.__('IP Address').'</p>';
$table_ip .= '<div class="label_select_parent">';
$table_ip .= '<div class="label_select_child_left">'.html_print_input_text('direccion', $direccion_agente, '', 16, 100, true).'</div>';
$table_ip .= '<div class="label_select_child_right">'.html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true).__('Unique IP').'</div>';
$table_ip .= '<div class="label_select_child_right">'.html_print_input(
$table_alias .= '</div></div>';
*/
/*
$table_ip = '<div class="label_select"><p class="input_label">'.__('IP Address').'</p>';
$table_ip .= '<div class="label_select_parent">';
$table_ip .= '<div class="label_select_child_left">'.html_print_input_text('direccion', $direccion_agente, '', 16, 100, true).'</div>';
$table_ip .= '<div class="label_select_child_right">'.html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true).__('Unique IP').'</div>';
$table_ip .= '<div class="label_select_child_right">'.html_print_input(
[
'type' => 'switch',
'id' => 'fixed_ip',
'name' => 'fixed_ip',
'value' => $fixed_ip,
]
).__('Fix IP address').ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'</div>';
).__('Fix IP address').ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'</div>';
$table_ip .= '</div></div>';
if ($id_agente) {
$table_ip .= '</div></div>';*/
/*
if ($id_agente) {
$ip_all = agents_get_addresses($id_agente);
$table_ip .= '<div class="label_select">';
@ -321,7 +492,7 @@ if ($id_agente) {
$table_ip .= '<div class="label_select_child_left">'.html_print_select($ip_all, 'address_list', $direccion_agente, '', '', 0, true).'</div>';
$table_ip .= '<div class="label_select_child_right">'.html_print_checkbox_switch('delete_ip', 1, false, true).__('Delete selected IPs').'</div>';
$table_ip .= '</div></div>';
}
}*/
?>
<style type="text/css">
@ -330,24 +501,11 @@ if ($id_agente) {
}
</style>
<?php
$groups = users_get_groups($config['id_user'], 'AR', false);
$modules = db_get_all_rows_sql(
'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = '.$id_parent
);
$modules_values = [];
$modules_values[0] = __('Any');
if (is_array($modules)) {
foreach ($modules as $m) {
$modules_values[$m['id_module']] = $m['name'];
}
}
$table_primary_group = '<div class="label_select"><p class="input_label">'.__('Primary group').'</p>';
$table_primary_group .= '<div class="label_select_parent">';
// Cannot change primary group if user have not permission for that group.
if (isset($groups[$grupo]) || $new_agent) {
/*
$table_primary_group = '<div class="label_select"><p class="input_label">'.__('Primary group').'</p>';
$table_primary_group .= '<div class="label_select_parent">';
// Cannot change primary group if user have not permission for that group.
if (isset($groups[$grupo]) || $new_agent) {
$table_primary_group .= html_print_input(
[
'type' => 'select_groups',
@ -359,25 +517,25 @@ if (isset($groups[$grupo]) || $new_agent) {
'privilege' => 'AW',
]
);
} else {
} else {
$table_primary_group .= groups_get_name($grupo);
$table_primary_group .= html_print_input_hidden('grupo', $grupo, true);
}
}
$table_primary_group .= '<div class="label_select_child_icons"><span id="group_preview">';
if ($id_agente === 0) {
$table_primary_group .= '<div class="label_select_child_icons"><span id="group_preview">';
if ($id_agente === 0) {
$hidden = 'display: none;';
} else {
} else {
$hidden = '';
}
}
$table_primary_group .= ui_print_group_icon($grupo, true, 'groups_small', $hidden);
$table_primary_group .= ui_print_group_icon($grupo, true, 'groups_small', $hidden);
$table_primary_group .= '</span></div></div></div>';
$table_primary_group .= '</span></div></div></div>';
$table_interval = '<div class="label_select"><p class="input_label">'.__('Interval').'</p>';
$table_interval .= '<div class="label_select_parent">';
$table_interval .= html_print_extended_select_for_time(
$table_interval = '<div class="label_select"><p class="input_label">'.__('Interval').'</p>';
$table_interval .= '<div class="label_select_parent">';
$table_interval .= html_print_extended_select_for_time(
'intervalo',
$intervalo,
'',
@ -388,19 +546,19 @@ $table_interval .= html_print_extended_select_for_time(
false,
true,
'w40p'
);
);
if ($intervalo < SECONDS_5MINUTES) {
if ($intervalo < SECONDS_5MINUTES) {
$table_interval .= clippy_context_help('interval_agent_min');
}
}
$table_interval .= '</div></div>';
$table_interval .= '</div></div>';
$table_os = '<div class="label_select"><p class="input_label">'.__('OS').'</p>';
$table_os .= '<div class="label_select_parent">';
$table_os .= html_print_select_from_sql(
$table_os = '<div class="label_select"><p class="input_label">'.__('OS').'</p>';
$table_os .= '<div class="label_select_parent">';
$table_os .= html_print_select_from_sql(
'SELECT id_os, name FROM tconfig_os',
'id_os',
$id_os,
@ -408,36 +566,11 @@ $table_os .= html_print_select_from_sql(
'',
'0',
true
);
$table_os .= '<div class="label_select_child_icons"> <span id="os_preview">';
$table_os .= ui_print_os_icon($id_os, false, true);
$table_os .= '</span></div></div></div>';
// Network server.
$servers = servers_get_names();
// Set the agent have not server.
if (array_key_exists($server_name, $servers) === false) {
$server_name = 0;
}
$table_server = '<div class="label_select"><p class="input_label">'.__('Server').'</p>';
$table_server .= '<div class="label_select_parent">';
if ($new_agent) {
// Set first server by default.
$servers_get_names = $servers;
$array_keys_servers_get_names = array_keys($servers_get_names);
$server_name = reset($array_keys_servers_get_names);
}
$table_server .= html_print_select(
$servers,
'server_name',
$server_name,
'',
__('None'),
0,
true
).'<div class="label_select_child_icons"></div></div></div>';
);
$table_os .= '<div class="label_select_child_icons"> <span id="os_preview">';
$table_os .= ui_print_os_icon($id_os, false, true);
$table_os .= '</span></div></div></div>';
*/
$table_satellite = '';
@ -475,20 +608,10 @@ if ($remote_agent === true) {
}
}
// Description.
$table_description = '<div class="label_select"><p class="input_label">'.__('Description').'</p>';
$table_description .= html_print_textarea(
'comentarios',
3,
10,
$comentarios,
'',
true,
'agent_description'
).'</div>';
// QR code.
echo '<div class="first_row">
echo '<div class="max_floating_element_size first_row">
<div class="box-shadow agent_options '.$agent_options_update.' white_box">
<div class="agent_options_column_left">'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'</div>
<div class="agent_options_column_right">'.$table_interval.$table_os.$table_server.$table_satellite.$table_description.'</div>
@ -966,7 +1089,7 @@ echo clippy_context_help('modules_not_learning_mode');
echo '</span>';
if ($id_agente) {
if ($new_agent === false) {
$submitButton = html_print_submit_button(
__('Update'),
'updbutton',
@ -976,6 +1099,20 @@ if ($id_agente) {
);
$submitButton .= html_print_input_hidden('update_agent', 1);
$submitButton .= html_print_input_hidden('id_agente', $id_agente);
if (is_management_allowed() === true) {
$submitButton .= html_print_button(
__('Delete agent'),
'deleteAgent',
false,
'onClick=onClick="if (!confirm(\'"'.__('Are you sure?').'"\')) return false;\" href=\'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=\''.$id_agente,
[
'icon' => 'delete',
'mode' => 'secondary',
],
true
);
}
} else {
$submitButton = html_print_submit_button(
__('Create'),

View File

@ -395,7 +395,7 @@ if ($id_agente) {
'class' => 'invert_filter',
]
).'</a>';
if ($tab == 'main') {
if ($tab === 'main') {
$maintab['active'] = true;
} else {
$maintab['active'] = false;

View File

@ -360,7 +360,7 @@ foreach ($pre_fields as $key => $value) {
html_print_select($fields, 'os', $os, 'this.form.submit()', 'All', 0);
echo '</td><td>';
echo __('Search').'&nbsp;';
echo __('Free search').'&nbsp;';
html_print_input_text('search', $search, '', 12);
echo ui_print_help_tip(
@ -375,7 +375,7 @@ html_print_submit_button(
false,
[
'icon' => 'search',
'mode' => 'secondary mini',
'mode' => 'mini',
]
);
echo '</form>';

View File

@ -766,12 +766,32 @@ if ($moduletype != 13) {
// Submit.
echo '<div class="action-buttons" style="width: '.$table_simple->width.'">';
if ($id_agent_module) {
html_print_submit_button(
$actionButtons = html_print_submit_button(
__('Update'),
'updbutton',
false,
'class="sub upd"'
[ 'icon' => 'update' ],
true
);
$actionButtons .= html_print_button(
__('Delete'),
'deleteModule',
false,
'window.location.action(\'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.')',
[
'icon' => 'delete',
'mode' => 'secondary',
],
true
);
html_print_div(
[
'class' => 'action-buttons',
'content' => $actionButtons,
]
);
html_print_input_hidden('update_module', 1);
html_print_input_hidden('id_agent_module', $id_agent_module);
html_print_input_hidden('id_module_type', $id_module_type);
@ -784,11 +804,17 @@ if ($id_agent_module) {
<?php
}
} else {
html_print_submit_button(
__('Create'),
'crtbutton',
false,
'class="sub wand"'
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Create'),
'crtbutton',
false,
[ 'icon' => 'wand' ],
true
),
]
);
html_print_input_hidden('id_module', $moduletype);
html_print_input_hidden('create_module', 1);

View File

@ -194,26 +194,34 @@ $update_module_id = (int) get_parameter_get('update_module');
$edit_module = (bool) get_parameter_get('edit_module');
$table_simple = new stdClass();
$table_simple->id = 'simple';
$table_simple->width = '100%';
$table_simple->class = 'no-class';
$table_simple->class = 'w100p mrgn_10px';
$table_simple->data = [];
$table_simple->style = [];
$table_simple->style[0] = 'font-weight: bold; width: 25%;';
$table_simple->style[1] = 'width: 25%';
$table_simple->style[2] = 'font-weight: bold; width: 25%;';
$table_simple->style[3] = 'width: 25%';
$table_simple->cellclass = [];
$table_simple->colspan = [];
$table_simple->rowspan = [];
$table_simple->cellpadding = 2;
$table_simple->cellspacing = 0;
$table_simple->rowspan[3][2] = 3;
$table_simple->rowspan[4][2] = 3;
$table_simple->rowspan[2][2] = 3;
$table_simple->colspan[2][2] = 2;
$table_simple->colspan[3][1] = 3;
$dataRow = 0;
$dataCol = 0;
$table_simple->data[0][0] = __('Name');
$table_simple->data[0][1] = html_print_input_text_extended(
if (empty($id_agent_module) === false && isset($id_agente) === true) {
$moduleIdContent = html_print_div(
[
'class' => 'moduleIdBox',
'content' => __('ID').'&nbsp;<span class="font_14pt">'.$id_agent_module.'</span>',
],
true
);
} else {
$moduleIdContent = '';
}
$table_simple->data[$dataRow][$dataCol++] = __('Name');
$table_simple->data[$dataRow][$dataCol++] = html_print_input_text_extended(
'name',
$name,
'text-name',
@ -224,23 +232,7 @@ $table_simple->data[0][1] = html_print_input_text_extended(
'',
$largeClassDisabledBecauseInPolicy,
true
);
if (!empty($id_agent_module) && isset($id_agente)) {
$table_simple->data[0][1] .= '&nbsp;<b>'.__('ID').'</b>&nbsp;&nbsp;'.$id_agent_module.' ';
$table_simple->data[0][1] .= '&nbsp;<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.'"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$table_simple->data[0][1] .= html_print_image(
'images/cross.png',
true,
[
'title' => __('Delete module'),
'class' => 'invert_filter',
]
);
$table_simple->data[0][1] .= '</a> ';
}
).$moduleIdContent;
$disabled_enable = 0;
$policy_link = db_get_value(
@ -254,16 +246,26 @@ if ($policy_link != 0) {
$disabled_enable = 1;
}
$table_simple->data[0][2] = __('Disabled');
$table_simple->data[0][2] .= html_print_checkbox(
$table_simple->cellclass[$dataRow][$dataCol] = 'flex_center ';
$table_simple->data[$dataRow][$dataCol] = __('Disabled');
$table_simple->data[$dataRow][$dataCol++] .= html_print_checkbox(
'disabled',
1,
$disabled,
true,
$disabled_enable
$disabled_enable,
'',
false,
'',
'',
'style="margin-left: 5px;"'
);
$table_simple->data[0][3] = __('Module group');
$table_simple->data[0][3] .= html_print_select_from_sql(
$dataRow++;
$dataCol = 0;
$table_simple->data[$dataRow][$dataCol++] = __('Module group');
$table_simple->colspan[$dataRow][$dataCol] = '3';
$table_simple->data[$dataRow][$dataCol++] .= html_print_select_from_sql(
'SELECT id_mg, name FROM tmodule_group ORDER BY name',
'id_module_group',
$id_module_group,
@ -274,10 +276,10 @@ $table_simple->data[0][3] .= html_print_select_from_sql(
false,
true,
$disabledBecauseInPolicy,
'width: 150px'
'width: 280px'
);
if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
if ((isset($id_agent_module) === true && $id_agent_module) || $id_policy_module != 0) {
$edit = false;
} else {
$edit = true;
@ -285,10 +287,13 @@ if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
$in_policy = strstr($page, 'policy_modules');
$table_simple->data[1][0] = __('Type').' '.ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help');
$table_simple->data[1][0] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true);
$dataRow++;
$dataCol = 0;
$table_simple->data[$dataRow][$dataCol] .= html_print_input_hidden('id_module_type_hidden', $id_module_type, true);
$table_simple->data[$dataRow][$dataCol++] = __('Type').ui_print_help_icon($help_type, true, '', 'images/help_green.png', '', 'module_type_help');
$table_simple->colspan[$dataRow][$dataCol] = '3';
if (!$edit) {
if ($edit === false) {
$sql = sprintf(
'SELECT id_tipo, nombre
FROM ttipo_modulo
@ -304,14 +309,14 @@ if (!$edit) {
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
}
$table_simple->data[1][1] = '<em>'.modules_get_moduletype_description($id_module_type).' ('.$type_names_hash[$id_module_type].')</em>';
$table_simple->data[1][1] .= html_print_input_hidden(
$table_simple->data[$dataRow][$dataCol] = '<em>'.modules_get_moduletype_description($id_module_type).' ('.$type_names_hash[$id_module_type].')</em>';
$table_simple->data[$dataRow][$dataCol] .= html_print_input_hidden(
'type_names',
base64_encode(io_json_mb_encode($type_names_hash)),
true
);
} else {
if (isset($id_module_type)) {
if (isset($id_module_type) === true) {
$idModuleType = $id_module_type;
} else {
$idModuleType = '';
@ -319,8 +324,7 @@ if (!$edit) {
// Removed web analysis and log4x from select.
$tipe_not_in = '24, 25';
// TODO: FIX credential store for remote command in metaconsole.
if (is_metaconsole()) {
if (is_metaconsole() === true) {
$tipe_not_in = '24, 25, 34, 35, 36, 37';
}
@ -347,7 +351,7 @@ if (!$edit) {
}
}
$table_simple->data[1][1] = html_print_select(
$table_simple->data[$dataRow][$dataCol] = html_print_select(
$type_description_hash,
'id_module_type',
$idModuleType,
@ -359,13 +363,13 @@ if (!$edit) {
false,
'',
false,
'width:200px',
'width: 280px;',
false,
100
);
// Store the relation between id and name of the types on a hidden field.
$table_simple->data[1][1] .= html_print_input_hidden(
$table_simple->data[$dataRow][$dataCol] .= html_print_input_hidden(
'type_names',
base64_encode(io_json_mb_encode($type_names_hash)),
true
@ -397,23 +401,22 @@ if ($edit_module) {
if ($id_module_type >= 30 && $id_module_type <= 33) {
$help_header = 'webserver_module_tab';
}
$table_simple->data[1][0] = __('Type').' ';
$table_simple->data[1][0] .= ui_print_help_icon($help_header, true);
}
if ($disabledBecauseInPolicy) {
$table_simple->data[1][3] .= html_print_input_hidden(
$table_simple->data[$dataRow][3] .= html_print_input_hidden(
'id_module_group',
$id_module_group,
true
);
}
$table_simple->data[2][0] = __('Warning threshold');
if (!modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[2][1] .= '<span id="minmax_warning"><em>'.__('Min. ').'</em>';
$table_simple->data[2][1] .= html_print_input_text(
$dataRow++;
$table_simple->data[$dataRow][0] .= __('Warning threshold');
$table_simple->cellclass[$dataRow][1] = 'module_thresholds_fields';
if (modules_is_string_type($id_module_type) === false || $edit === true) {
$table_simple->data[$dataRow][1] .= '<span class="flex_center" id="minmax_warning"><em>'.__('Min. ').'</em>';
$table_simple->data[$dataRow][1] .= html_print_input_text(
'min_warning',
$min_warning,
'',
@ -425,8 +428,8 @@ if (!modules_is_string_type($id_module_type) || $edit) {
'',
$classdisabledBecauseInPolicy
);
$table_simple->data[2][1] .= '<br /><em>'.__('Max.').'</em>';
$table_simple->data[2][1] .= html_print_input_text(
$table_simple->data[$dataRow][1] .= '<em>'.__('Max.').'</em>';
$table_simple->data[$dataRow][1] .= html_print_input_text(
'max_warning',
$max_warning,
'',
@ -440,9 +443,9 @@ if (!modules_is_string_type($id_module_type) || $edit) {
).'</span>';
}
if (modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[2][1] .= '<span id="string_warning"><em>'.__('Str.').'</em>';
$table_simple->data[2][1] .= html_print_input_text(
if (modules_is_string_type($id_module_type) === true || $edit === true) {
$table_simple->data[$dataRow][1] .= '<span id="string_warning"><em>'.__('Str.').'</em>';
$table_simple->data[$dataRow][1] .= html_print_input_text(
'str_warning',
str_replace('"', '', $str_warning),
'',
@ -456,25 +459,31 @@ if (modules_is_string_type($id_module_type) || $edit) {
).'</span>';
}
$table_simple->data[2][1] .= '<div id="warning_inverse"><em>'.__('Inverse interval').'</em>';
$table_simple->data[2][1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true, $disabledBecauseInPolicy);
$table_simple->data[2][1] .= '</div>';
$table_simple->data[$dataRow][1] .= '<div class="flex_center" id="warning_inverse"><em>'.__('Inverse interval').'</em>';
$table_simple->data[$dataRow][1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true, $disabledBecauseInPolicy);
$table_simple->data[$dataRow][1] .= '</div>';
if (modules_is_string_type($id_module_type) === false) {
$table_simple->data[2][1] .= '<div id="percentage_warning"><em>'.__('Percentage').'</em>';
$table_simple->data[2][1] .= html_print_checkbox('percentage_warning', 1, $percentage_warning, true, $disabledBecauseInPolicy);
$table_simple->data[2][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true);
$table_simple->data[2][1] .= '</div>';
$table_simple->data[$dataRow][1] .= '<div class="flex_center" id="percentage_warning"><em>'.__('Percentage').'</em>';
$table_simple->data[$dataRow][1] .= html_print_checkbox('percentage_warning', 1, $percentage_warning, true, $disabledBecauseInPolicy);
$table_simple->data[$dataRow][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true);
$table_simple->data[$dataRow][1] .= '</div>';
}
if (!modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[2][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
if (modules_is_string_type($id_module_type) === false || (bool) $edit === true) {
$table_simple->cellstyle[$dataRow][2] = 'top: 160px; left: 700px; position: absolute; width: 280px;';
$table_simple->colspan[$dataRow][2] = '2';
$table_simple->data[$dataRow][2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
}
$table_simple->data[3][0] = __('Critical threshold');
if (!modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[3][1] .= '<span id="minmax_critical"><em>'.__('Min. ').'</em>';
$table_simple->data[3][1] .= html_print_input_text(
$dataRow++;
$table_simple->data[$dataRow][0] = __('Critical threshold');
$table_simple->cellclass[$dataRow][1] = 'module_thresholds_fields';
if (modules_is_string_type($id_module_type) === false || $edit === true) {
$table_simple->data[$dataRow][1] .= '<span class="flex_center" id="minmax_critical"><em>'.__('Min').'</em>';
$table_simple->data[$dataRow][1] .= html_print_input_text(
'min_critical',
$min_critical,
'',
@ -486,8 +495,8 @@ if (!modules_is_string_type($id_module_type) || $edit) {
'',
$classdisabledBecauseInPolicy
);
$table_simple->data[3][1] .= '<br /><em>'.__('Max.').'</em>';
$table_simple->data[3][1] .= html_print_input_text(
$table_simple->data[$dataRow][1] .= '<br /><em>'.__('Max').'</em>';
$table_simple->data[$dataRow][1] .= html_print_input_text(
'max_critical',
$max_critical,
'',
@ -501,9 +510,9 @@ if (!modules_is_string_type($id_module_type) || $edit) {
).'</span>';
}
if (modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[3][1] .= '<span id="string_critical"><em>'.__('Str.').'</em>';
$table_simple->data[3][1] .= html_print_input_text(
if (modules_is_string_type($id_module_type) === true || $edit === true) {
$table_simple->data[$dataRow][1] .= '<span class="flex_center" id="string_critical"><em>'.__('Str.').'</em>';
$table_simple->data[$dataRow][1] .= html_print_input_text(
'str_critical',
str_replace('"', '', $str_critical),
'',
@ -517,33 +526,34 @@ if (modules_is_string_type($id_module_type) || $edit) {
).'</span>';
}
$table_simple->data[3][1] .= '<div id="critical_inverse"><em>'.__('Inverse interval').'</em>';
$table_simple->data[3][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy);
$table_simple->data[3][1] .= '</div>';
$table_simple->data[$dataRow][1] .= '<div class="flex_center" id="critical_inverse"><em>'.__('Inverse interval').'</em>';
$table_simple->data[$dataRow][1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true, $disabledBecauseInPolicy);
$table_simple->data[$dataRow][1] .= '</div>';
if (modules_is_string_type($id_module_type) === false) {
$table_simple->data[3][1] .= '<div id="percentage_critical" /><em>'.__('Percentage').'</em>';
$table_simple->data[3][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true);
$table_simple->data[3][1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true, $disabledBecauseInPolicy);
$table_simple->data[3][1] .= '</div>';
$table_simple->data[$dataRow][1] .= '<div class="flex_center" id="percentage_critical" /><em>'.__('Percentage').'</em>';
$table_simple->data[$dataRow][1] .= html_print_checkbox('percentage_critical', 1, $percentage_critical, true, $disabledBecauseInPolicy);
$table_simple->data[$dataRow][1] .= ui_print_help_tip('Defines threshold as a percentage of value decrease/increment', true);
$table_simple->data[$dataRow][1] .= '</div>';
}
$table_simple->data[4][0] = __('Historical data');
$dataRow++;
$table_simple->data[$dataRow][0] = __('Historical data');
if ($disabledBecauseInPolicy) {
// If is disabled, we send a hidden in his place and print a false
// checkbox because HTML dont send disabled fields
// and could be disabled by error.
$table_simple->data[4][1] = html_print_checkbox(
$table_simple->data[$dataRow][1] = html_print_checkbox(
'history_data_fake',
1,
$history_data,
true,
$disabledBecauseInPolicy
);
$table_simple->data[4][1] .= '<input type="hidden" name="history_data" value="'.(int) $history_data.'">';
$table_simple->data[$dataRow][1] .= '<input type="hidden" name="history_data" value="'.(int) $history_data.'">';
} else {
$table_simple->data[4][1] = html_print_checkbox(
$table_simple->data[$dataRow][1] = html_print_checkbox(
'history_data',
1,
$history_data,
@ -1677,9 +1687,11 @@ $(document).ready (function () {
paint_graph_values();
if ($('#checkbox-warning_inverse').prop('checked') === true){
$('#checkbox-percentage_warning').prop('checked', false);
$('#percentage_warning').hide();
$('#percentage_warning').attr('onClick', 'return false;');
$('#percentage_warning>em').addClass('color_666');
} else {
$('#percentage_warning').show();
$('#percentage_warning').removeAttr('onClick');
$('#percentage_warning>em').removeClass('color_666');
}
});
@ -1688,9 +1700,11 @@ $(document).ready (function () {
if ($('#checkbox-critical_inverse').prop('checked') === true){
$('#checkbox-percentage_critical').prop('checked', false);
$('#percentage_critical').hide();
$('#percentage_critical').attr('onClick', 'return false;');
$('#percentage_critical>em').addClass('color_666');
} else {
$('#percentage_critical').show();
$('#percentage_critical').removeAttr('onClick');
$('#percentage_critical>em').removeClass('color_666');
}
});
@ -1698,9 +1712,11 @@ $(document).ready (function () {
paint_graph_values();
if ($('#checkbox-percentage_warning').prop('checked') === true){
$('#checkbox-warning_inverse').prop('checked', false);
$('#warning_inverse').hide();
$('#warning_inverse').attr('onClick', 'return false;');
$('#warning_inverse>em').addClass('color_666');
} else {
$('#warning_inverse').show();
$('#warning_inverse').removeAttr('onClick');
$('#warning_inverse>em').removeClass('color_666');
}
});
@ -1708,10 +1724,11 @@ $(document).ready (function () {
paint_graph_values();
if ($('#checkbox-percentage_critical').prop('checked') === true){
$('#checkbox-critical_inverse').prop('checked', false);
$('#critical_inverse').hide();
}
else {
$('#critical_inverse').show();
$('#critical_inverse').attr('onClick', 'return false;');
$('#critical_inverse>em').addClass('color_666');
} else {
$('#critical_inverse').removeAttr('onClick');
$('#critical_inverse>em').removeClass('color_666');
}
});

View File

@ -117,11 +117,11 @@ $table->data[1][1] = html_print_select(
__('Default action'),
'0',
true,
'',
false,
true,
'',
false,
'min-width: 250px;'
'width: 250px;'
);
$table->data[1][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
$table->data[1][1] .= __('Number of alerts match from').' ';
@ -130,11 +130,15 @@ $table->data[1][1] .= ' '.__('to').' ';
$table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
$table->data[1][1] .= '</span>';
if (check_acl($config['id_user'], 0, 'LM')) {
$table->data[1][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
$table->data[1][1] .= html_print_image('images/add.png', true, ['class' => 'invert_filter']);
$table->data[1][1] .= '<span class="mrgn_lft_05em">'.__('Create Action').'</span>';
$table->data[1][1] .= '</a>';
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
$table->data[1][1] .= html_print_button(
__('Create Action'),
'',
false,
'window.location.assign(\'index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'\')',
[ 'mode' => 'link' ],
true
);
}
$table->data[2][0] = __('Template');
@ -163,11 +167,15 @@ if ($own_info['is_admin']) {
'width: 250px;'
);
$table->data[2][1] .= ' <a class="template_details invisible" href="#">'.html_print_image('images/zoom.png', true, ['class' => 'img_help']).'</a>';
if (check_acl($config['id_user'], 0, 'LM')) {
$table->data[2][1] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
$table->data[2][1] .= html_print_image('images/add.png', true, ['class' => 'invert_filter']);
$table->data[2][1] .= '<span class=""mrgn_lft_05em>'.__('Create Template').'</span>';
$table->data[2][1] .= '</a>';
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
$table->data[2][1] .= html_print_button(
__('Create Template'),
'',
false,
'window.location.assign(\'index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'\')',
[ 'mode' => 'link' ],
true
);
}
$table->data[3][0] = __('Threshold');

View File

@ -338,7 +338,7 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
if (!$no_close_bool) {
// Use the no_meta parameter because this image is only in
// the base console.
$output .= '<a href="javascript: close_info_box(\''.$id.'\')">'.html_print_image('images/blade.png', true, false, false, false).'</a>';
$output .= '<a href="javascript: close_info_box(\''.$id.'\')">'.html_print_image('images/svg/fail.svg', true, false, false, false).'</a>';
}
$output .= '</td>
@ -5592,12 +5592,12 @@ function ui_print_agent_autocomplete_input($parameters)
$javascript_function_change .= '
function setInputBackground(inputId, image) {
$("#"+inputId)
.css("background","url(\'"+image+"\') 95% center no-repeat");
.css({"background-image":"url(\'"+image+"\')", "background-repeat":"no-repeat", "backgound-position": "95% center"});
}
function set_functions_change_autocomplete_'.$input_name.'() {
var cache_'.$input_name.' = {};
$("#'.$input_id.'").autocomplete({
minLength: 2,
source: function( request, response ) {
@ -5864,8 +5864,7 @@ function ui_print_agent_autocomplete_input($parameters)
if (select_item_click) {
select_item_click = 0;
$("#'.$input_id.'")
.css("background",
"url(\"'.$icon_image.'\") 95% center no-repeat");
.css({"background-image":"url(\"'.$icon_image.'\")", "background-repeat":"no-repeat", "backgound-position": "95% center"});
return;
} else {
// Clear selectbox if item is not selected.
@ -5880,11 +5879,7 @@ function ui_print_agent_autocomplete_input($parameters)
//Set loading
$("#'.$input_id.'")
.css("background",
"url(\"'.$spinner_image.'\") 95% center no-repeat");
.css({"background-image":"url(\"'.$spinner_image.'\")", "background-repeat":"no-repeat", "backgound-position": "95% center"});
var term = input_value; //Word to search
'.$javascript_change_ajax_params_text.'
@ -5901,13 +5896,10 @@ function ui_print_agent_autocomplete_input($parameters)
success: function (data) {
if (data.length < 2) {
//Set icon
$("#'.$input_id.'")
.css("background",
"url(\"'.$icon_image.'\") 95% center no-repeat");
$("#'.$input_id.'").css({"background-image":"url(\"'.$icon_image.'\")", "background-repeat":"no-repeat", "backgound-position": "95% center"});
return;
}
var agent_name = data[0].name;
var agent_id = data[0].id;
var server_name = "";
@ -5970,12 +5962,12 @@ function ui_print_agent_autocomplete_input($parameters)
$html = '';
$text_color = '';
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
if ($config['style'] === 'pandora_black' && is_metaconsole() === false) {
$text_color = 'color: white';
}
$attrs = [];
$attrs['style'] = 'background: url('.$icon_image.') no-repeat 95% center; '.$text_color.'';
$attrs['style'] = 'background-image: url('.$icon_image.'); background-repeat: no-repeat; background-position: 95% center; '.$text_color.'';
if (!$disabled_javascript_on_blur_function) {
$attrs['onblur'] = $javascript_on_blur_function_name.'()';

View File

@ -146,10 +146,6 @@ h1 {
cursor: pointer;
}
label span.p-slider {
width: 30px;
}
#modal-add-widget .container-list-widgets {
display: flex;
flex-direction: row;

View File

@ -136,10 +136,6 @@ form.flex-row div.filter_input.filter_input_switch {
justify-content: flex-start;
}
form.flex-row div.filter_input.filter_input_switch .p-slider {
width: 30px;
}
fieldset {
margin: 0 auto;
}
@ -299,7 +295,7 @@ ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header
}
li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab.ui-tabs-active.ui-state-active {
border-bottom: 4px solid rgb(130, 185, 46) !important;
border-bottom: 5px solid rgb(130, 185, 46) !important;
}
tr.group {

View File

@ -173,7 +173,6 @@ input[type="checkbox"] {
}
select {
padding: 2px 3px 3px 3px;
vertical-align: middle;
border: 1px solid #ddd;
}
@ -319,14 +318,22 @@ select:-webkit-autofill:focus {
}
/* All select type multiple */
select[multiple] option:checked {
background: #82b92e linear-gradient(0deg, #82b92e 0%, #82b92e 100%);
color: #fff;
select[multiple] {
min-height: 10em;
}
select[multiple] option:checked,
select[multiple] option:active {
background: #d9efee;
}
select[multiple] option {
padding: 6px 12px;
margin: 0px -10px;
}
select option:checked {
background-color: #82b92e;
color: #fff;
background-color: #d9efee;
}
select > option:hover {
@ -1356,6 +1363,7 @@ td.datos2f9 {
}
table.info_box.suc {
border-left: 5px solid #5a8629;
background-color: #d9efee;
}
.suc * {
@ -1363,6 +1371,7 @@ table.info_box.suc {
}
table.info_box.info {
border-left: 5px solid #006f9d;
background-color: #d6edff;
}
.info * {
@ -1370,6 +1379,7 @@ table.info_box.info {
}
table.info_box.error {
border-left: 5px solid #f85858;
background-color: #ffe8e8;
}
.error * {
@ -1377,6 +1387,7 @@ table.info_box.error {
}
table.info_box.warning {
border-left: 5px solid #f3b200;
background-color: #fff1d6;
}
.warning * {
@ -2208,7 +2219,9 @@ div#event_control {
}
.ac_loading {
background: white url("../images/loading.gif") 95% center no-repeat;
background-image: url("../images/loading.gif");
background-position: 95% center;
background-repeat: no-repeat;
}
.ac_over {
@ -2434,9 +2447,6 @@ td.cellBig {
margin-top: 10px;
margin-bottom: 10px;
padding: 0px 5px 5px 10px;
border-color: #e2e2e2;
border-style: solid;
border-width: 1px;
width: 100%;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
@ -2449,8 +2459,7 @@ td.cellBig {
}
.info_box .icon {
width: 30px;
text-align: center;
width: 24px;
}
/* Standard styles for status colos (groups, events, backgrounds...) */
@ -8104,7 +8113,6 @@ div.graph div.legend table {
.icon_ui {
padding-right: 10px;
padding-top: 3px;
vertical-align: top;
}
@ -8973,7 +8981,6 @@ div#err_msg_centralised {
font: normal normal normal 13px Pandora-Light;
padding: 5.5pt 20pt;
cursor: pointer;
background-color: #fff;
color: #14524f;
border: 2px solid #14524f;
box-shadow: none;
@ -9002,6 +9009,7 @@ select {
box-sizing: border-box;
}
input[readonly],
input:disabled,
textarea:disabled,
select:disabled,
@ -9022,20 +9030,13 @@ select:focus {
#autorefresh_list_out::-webkit-scrollbar {
/*color: test;*/
}
textarea,
select {
padding: 10px;
}
select[multiple] {
min-height: 10em;
}
select:focus {
border-color: #8a96a6;
}
textarea {
padding: 10px;
height: auto;
}
.dataTables_length > label > select {

View File

@ -389,10 +389,6 @@ p.error-p-validate {
border-radius: 5px 5px 0px 0px;
}
label span.p-slider {
width: 30px;
}
li.interval-color-ranges > label,
li#li-default-ranges > label {
margin-right: 15px;

View File

@ -389,10 +389,6 @@ p.error-p-validate {
border-radius: 5px 5px 0px 0px;
}
label span.p-slider {
width: 30px;
}
li.interval-color-ranges > label,
li#li-default-ranges > label {
margin-right: 15px;