Merge branch 'ent-9662-Restyling-fuentes-colores-botones' of brutus.artica.es:artica/pandorafms into ent-9662-Restyling-fuentes-colores-botones

This commit is contained in:
Jose Gonzalez 2023-03-07 09:51:23 +01:00
commit 1d93c666ba
9 changed files with 929 additions and 676 deletions

View File

@ -230,11 +230,11 @@ $url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&search_string='
// Filter table. // Filter table.
$table_filter = new stdClass(); $table_filter = new stdClass();
$table_filter->width = '100%'; $table_filter->width = '100%';
$table_filter->class = 'databox filters'; $table_filter->class = 'databox filters filter-table-adv';
$table_filter->style = []; $table_filter->style = [];
$table_filter->style[0] = 'font-weight: bold'; $table_filter->style[0] = 'width: 33%';
$table_filter->style[2] = 'font-weight: bold'; $table_filter->style[2] = 'width: 33%';
$table_filter->style[4] = 'font-weight: bold'; $table_filter->style[4] = 'width: 33%';
$table_filter->data = []; $table_filter->data = [];
$table_filter->data[0][0] = __('Search'); $table_filter->data[0][0] = __('Search');
@ -246,6 +246,17 @@ $table_filter->data[0][1] = html_print_input_text(
255, 255,
true true
); );
$table_filter->data[0][0] = html_print_label_input_block(
__('Search'),
html_print_input_text(
'search_string',
$search_string,
'',
25,
255,
true
)
);
$return_all_group = false; $return_all_group = false;
@ -464,8 +475,9 @@ if (isset($data)) {
if (is_management_allowed() === true) { if (is_management_allowed() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'&offset='.$offset.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'&offset='.$offset.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); $button = html_print_submit_button(__('Create'), 'create', false, ['icon' => 'wand'], true);
html_print_input_hidden('create_alert', 1); html_print_input_hidden('create_alert', 1);
html_print_action_buttons($button);
echo '</form>'; echo '</form>';
echo '</div>'; echo '</div>';
} }

View File

@ -32,29 +32,16 @@ $pure = get_parameter('pure', 0);
$table = new stdClass(); $table = new stdClass();
$table->id = 'add_alert_table'; $table->id = 'add_alert_table';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
$table->width = '100%'; $table->width = '100%';
$table->head = []; $table->head = [];
$table->data = []; $table->data = [];
$table->size = []; $table->size = [];
$table->size = []; $table->style[0] = 'width: 50%';
$table->style[0] = 'font-weight: bold;'; $table->style[1] = 'width: 50%';
$table->style[1] = 'font-weight: bold;display: flex;align-items: baseline;';
$table->style[2] = 'font-weight: bold;';
$table->style[3] = 'font-weight: bold;';
// This is because if this view is reused after list alert view then
// styles in the previous view can affect this table.
$table->rowstyle[0] = '';
$table->rowstyle[1] = '';
$table->rowstyle[2] = '';
$table->rowstyle[3] = '';
// Add an agent selector // Add an agent selector
if (! $id_agente) { if (! $id_agente) {
$table->data['agent'][0] = __('Agent');
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
$params['show_helptip'] = true; $params['show_helptip'] = true;
@ -64,36 +51,37 @@ if (! $id_agente) {
$params['metaconsole_enabled'] = false; $params['metaconsole_enabled'] = false;
$params['use_hidden_input_idagent'] = true; $params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true; $params['print_hidden_input_idagent'] = true;
$table->data['agent'][1] = ui_print_agent_autocomplete_input($params); $table->data[0][0] = html_print_label_input_block(
__('Agent'),
ui_print_agent_autocomplete_input($params)
);
} }
$table->data[0][0] = __('Module');
$modules = []; $modules = [];
if ($id_agente) { if ($id_agente) {
$modules = agents_get_modules($id_agente, false, ['delete_pending' => 0]); $modules = agents_get_modules($id_agente, false, ['delete_pending' => 0]);
} }
$table->data[0][1] = html_print_select( $table->data[0][1] = html_print_label_input_block(
$modules, __('Module'),
'id_agent_module', html_print_select(
0, $modules,
true, 'id_agent_module',
__('Select'), 0,
0, true,
true, __('Select'),
false, 0,
true, true,
'', false,
($id_agente == 0), true,
'min-width: 250px;margin-right: 0.5em;' 'w100p',
($id_agente == 0),
'width: 100%;'
).'<span id="latest_value" class="invisible">'.__('Latest value').':
<span id="value">&nbsp;</span></span>
<span id="module_loading" class="invisible">'.html_print_image('images/spinner.gif', true).'</span>'
); );
$table->data[0][1] .= ' <span id="latest_value" class="invisible">'.__('Latest value').': ';
$table->data[0][1] .= '<span id="value">&nbsp;</span></span>';
$table->data[0][1] .= ' <span id="module_loading" class="invisible">';
$table->data[0][1] .= html_print_image('images/spinner.gif', true).'</span>';
$table->data[1][0] = __('Actions');
$groups_user = users_get_groups($config['id_user']); $groups_user = users_get_groups($config['id_user']);
if (!empty($groups_user)) { if (!empty($groups_user)) {
@ -109,40 +97,36 @@ if (!empty($groups_user)) {
$actions = db_get_all_rows_sql($sql); $actions = db_get_all_rows_sql($sql);
} }
$table->data[1][1] = html_print_select(
index_array($actions, 'id', 'name'),
'action_select',
'',
'',
__('Default action'),
'0',
true,
false,
true,
'',
false,
'width: 250px;'
);
$table->data[1][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
$table->data[1][1] .= __('Number of alerts match from').' ';
$table->data[1][1] .= html_print_input_text('fires_min', '', '', 4, 10, true);
$table->data[1][1] .= ' '.__('to').' ';
$table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
$table->data[1][1] .= '</span>';
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) { if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
$table->data[1][1] .= html_print_button( $create_action = html_print_button(
__('Create Action'), __('Create Action'),
'', '',
false, false,
'window.location.assign(\'index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'\')', 'window.location.assign("index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'")',
[ 'mode' => 'link' ], [ 'mode' => 'link' ],
true true
); );
} }
$table->data[2][0] = __('Template'); $table->data[1][0] = html_print_label_input_block(
$own_info = get_user_info($config['id_user']); __('Actions'),
html_print_select(
index_array($actions, 'id', 'name'),
'action_select',
'',
'',
__('Default action'),
'0',
true,
false,
true,
'w100p',
false,
'width: 100%;'
).'<span id="advanced_action" class="advanced_actions invisible"><br>'.__('Number of alerts match from').' '.html_print_input_text('fires_min', '', '', 4, 10, true).' '.__('to').' '.html_print_input_text('fires_max', '', '', 4, 10, true).'</span>'.$create_action
);
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin']) { if ($own_info['is_admin']) {
$templates = alerts_get_alert_templates(false, ['id', 'name']); $templates = alerts_get_alert_templates(false, ['id', 'name']);
} else { } else {
@ -152,7 +136,20 @@ if ($own_info['is_admin']) {
$templates = alerts_get_alert_templates(['id_group IN ('.$filter_groups.')'], ['id', 'name']); $templates = alerts_get_alert_templates(['id_group IN ('.$filter_groups.')'], ['id', 'name']);
} }
$table->data[2][1] = html_print_select( if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
$create_template = 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[1][1] = html_print_label_input_block(
__('Template'),
html_print_select(
index_array($templates, 'id', 'name'), index_array($templates, 'id', 'name'),
'template', 'template',
'', '',
@ -162,24 +159,15 @@ if ($own_info['is_admin']) {
true, true,
false, false,
true, true,
'', 'w100p',
false, false,
'width: 250px;' 'width: 100%;'
); ).' <a class="template_details invisible" href="#">'.html_print_image('images/zoom.png', true, ['class' => 'img_help']).'</a>'.$create_template
$table->data[2][1] .= ' <a class="template_details invisible" href="#">'.html_print_image('images/zoom.png', true, ['class' => 'img_help']).'</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'); $table->data[2][0] = html_print_label_input_block(
$table->data[3][1] = html_print_extended_select_for_time( __('Threshold'),
html_print_extended_select_for_time(
'module_action_threshold', 'module_action_threshold',
0, 0,
'', '',
@ -189,62 +177,58 @@ if ($own_info['is_admin']) {
true, true,
false, false,
true, true,
'', 'w100p',
false, false,
false, false,
'', '',
false, false,
true true
); )
);
if (isset($step) === false) { if (isset($step) === false) {
echo '<form class="add_alert_form" method="post">'; echo '<form class="add_alert_form max_floating_element_size" method="post">';
html_print_table($table); html_print_table($table);
} }
if (isset($step) === false) { if (isset($step) === false) {
$output = ''; $output = '';
if ($id_cluster) { if ($id_cluster) {
$output .= html_print_button( $actionButtons .= html_print_button(
__('Finish and view cluster'), __('Finish and view cluster'),
'store', 'store',
false,
'window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");',
[
'icon' => 'update',
'mode' => 'secondary mini',
],
true
);
}
$output .= html_print_submit_button(
__('Add alert'),
'add',
false, false,
[ 'icon' => 'wand' ], 'window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");',
[
'icon' => 'update',
'mode' => 'secondary',
],
true true
); );
html_print_div(
[
'class' => 'action-buttons',
'content' => $output,
]
);
html_print_input_hidden('create_alert', 1);
echo '</form>';
} }
ui_require_css_file('cluetip', 'include/styles/js/'); $actionButtons .= html_print_submit_button(
ui_require_jquery_file('validate'); __('Add alert'),
ui_require_jquery_file('cluetip'); 'add',
ui_require_jquery_file('pandora.controls'); false,
ui_require_jquery_file('bgiframe'); [ 'icon' => 'wand' ],
true
);
?> html_print_action_buttons($actionButtons, ['right_content' => $pagination]);
html_print_input_hidden('create_alert', 1);
echo '</form>';
}
ui_require_css_file('cluetip', 'include/styles/js/');
ui_require_jquery_file('validate');
ui_require_jquery_file('cluetip');
ui_require_jquery_file('pandora.controls');
ui_require_jquery_file('bgiframe');
?>
<script type="text/javascript"> <script type="text/javascript">
/* <![CDATA[ */ /* <![CDATA[ */
$(document).ready (function () { $(document).ready (function () {

View File

@ -61,11 +61,13 @@ if ($id_agente) {
// Table for filter controls. // Table for filter controls.
$form_filter = '<form method="post" action="index.php?sec='.$sec.'&amp;sec2='.$sec2.'&amp;refr='.((int) get_parameter('refr', 0)).'&amp;pure='.$config['pure'].'">'; $form_filter = '<form method="post" action="index.php?sec='.$sec.'&amp;sec2='.$sec2.'&amp;refr='.((int) get_parameter('refr', 0)).'&amp;pure='.$config['pure'].'">';
$form_filter .= "<input type='hidden' name='search' value='1' />"; $form_filter .= "<input type='hidden' name='search' value='1' />";
$form_filter .= '<table cellpadding="0" cellspacing="0" class="databox filters w100p">'; $form_filter .= '<table cellpadding="0" cellspacing="0" class="databox filters w100p filter-table-adv">';
$form_filter .= '<tr>'; $form_filter .= '<tr>';
$form_filter .= "<td class='bolder''>".__('Template name').'</td><td>'; $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= html_print_input_text('template_name', $templateName, '', 12, 255, true); __('Template name'),
$form_filter .= '</td>'; html_print_input_text('template_name', $templateName, '', 12, 255, true)
).'</td>';
$temp = agents_get_agents(); $temp = agents_get_agents();
$arrayAgents = []; $arrayAgents = [];
@ -76,8 +78,6 @@ if ($temp !== false) {
} }
} }
$form_filter .= "<td class='bolder''>".__('Agents').'</td><td>';
$params = []; $params = [];
$params['return'] = true; $params['return'] = true;
$params['show_helptip'] = true; $params['show_helptip'] = true;
@ -91,14 +91,19 @@ $params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
$params['hidden_input_idagent_name'] = 'agent_id'; $params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id; $params['hidden_input_idagent_value'] = $agent_id;
$form_filter .= ui_print_agent_autocomplete_input($params);
$form_filter .= '</td>'; $form_filter .= '</td>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Agents'),
ui_print_agent_autocomplete_input($params)
).'</td>';
$form_filter .= "<td class='bolder''>".__('Module name').'</td><td>'; $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= html_print_input_text('module_name', $moduleName, '', 12, 255, true); __('Module name'),
$form_filter .= '</td>'; html_print_input_text('module_name', $moduleName, '', 12, 255, true)
).'</td>';
$form_filter .= '</tr>'; $form_filter .= '</tr>';
$all_groups = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']); $all_groups = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
@ -127,19 +132,37 @@ if (is_array($temp) === true) {
} }
} }
$form_filter .= "<td class='bolder''>".__('Actions').'</td><td>'; $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= html_print_select($arrayActions, 'action_id', $actionID, '', __('All'), -1, true, false, true, '', false, 'width:95%'); __('Actions'),
$form_filter .= '</td>'; html_print_select($arrayActions, 'action_id', $actionID, '', __('All'), -1, true, false, true, '', false, 'width:95%')
$form_filter .= "<td class='bolder''>".__('Field content').'</td><td>'; ).'</td>';
$form_filter .= html_print_input_text('field_content', $fieldContent, '', 12, 255, true);
$form_filter .= '</td>'; $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= "<td class='bolder''>".__('Priority').'</td><td>'; __('Field content'),
$form_filter .= html_print_select(get_priorities(), 'priority', $priority, '', __('All'), -1, true); html_print_input_text('field_content', $fieldContent, '', 12, 255, true)
$form_filter .= "</td class='bolder''>"; ).'</td>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Priority'),
html_print_select(
get_priorities(),
'priority',
$priority,
'',
__('All'),
-1,
true,
false,
true,
'w100p',
false,
'width: 100%;'
)
).'</td>';
$form_filter .= '</tr>'; $form_filter .= '</tr>';
$form_filter .= '<tr>'; $form_filter .= '<tr>';
$form_filter .= "<td class='bolder'>".__('Status').'</td><td>';
$ed_list = []; $ed_list = [];
$alert_status_filter = []; $alert_status_filter = [];
$alert_status_filter['all_enabled'] = __('All (Enabled)'); $alert_status_filter['all_enabled'] = __('All (Enabled)');
@ -147,14 +170,45 @@ $alert_status_filter['all'] = __('All');
$alert_status_filter['fired'] = __('Fired'); $alert_status_filter['fired'] = __('Fired');
$alert_status_filter['notfired'] = __('Not fired'); $alert_status_filter['notfired'] = __('Not fired');
$alert_status_filter['disabled'] = __('Disabled'); $alert_status_filter['disabled'] = __('Disabled');
$form_filter .= html_print_select($alert_status_filter, 'status_alert', $status_alert, '', '', '', true); $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= "</td><td class='bolder'>".__('Standby').'</td><td>'; __('Status'),
html_print_select(
$alert_status_filter,
'status_alert',
$status_alert,
'',
'',
'',
true,
false,
true,
'w100p',
false,
'width: 100%;'
)
).'</td>';
$sb_list = []; $sb_list = [];
$sb_list[1] = __('Standby on'); $sb_list[1] = __('Standby on');
$sb_list[0] = __('Standby off'); $sb_list[0] = __('Standby off');
$form_filter .= html_print_select($sb_list, 'standby', $standby, '', __('All'), -1, true); $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= '</td>'; __('Standby'),
$form_filter .= "</td><td class='bolder''>".__('Group').'</td><td>'; html_print_select(
$sb_list,
'standby',
$standby,
'',
__('All'),
-1,
true,
false,
true,
'w100p',
false,
'width: 100%;'
)
).'</td>';
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) { if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = false; $return_all_group = false;
@ -162,8 +216,12 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_
$return_all_group = true; $return_all_group = true;
} }
$form_filter .= html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false); $form_filter .= '<td class="w33p">'.html_print_label_input_block(
$form_filter .= '</td></tr>'; __('Group'),
html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false)
).'</td>';
$form_filter .= '</tr>';
$updateButton = html_print_submit_button( $updateButton = html_print_submit_button(
__('Update'), __('Update'),
@ -196,7 +254,17 @@ if (is_metaconsole() === true) {
} }
if (!$id_cluster) { if (!$id_cluster) {
ui_toggle($form_filter, __('Alert control filter'), __('Toggle filter(s)')); ui_toggle(
$form_filter,
'<span class="subsection_header_title">'.__('Alert control filter').'</span>',
__('Toggle filter(s)'),
'update',
true,
false,
'',
'white-box-content no_border',
'filter-datatable-main box-flat white_table_graph fixed_filter_bar '
);
} else { } else {
unset($form_filter); unset($form_filter);
} }
@ -438,12 +506,6 @@ switch ($sortField) {
$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group.'&status_alert='.$status_alert; $form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group.'&status_alert='.$status_alert;
$sort_params = '&sort_field='.$sortField.'&sort='.$sort; $sort_params = '&sort_field='.$sortField.'&sort='.$sort;
if ($id_agente) {
ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params);
} else {
ui_pagination($total, 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list'.$form_params.$sort_params);
}
$offset = (int) get_parameter('offset'); $offset = (int) get_parameter('offset');
$simple_alerts = agents_get_alerts_simple( $simple_alerts = agents_get_alerts_simple(
(empty($agent_id) === false) ? ['0' => $agent_id] : $id_agents, (empty($agent_id) === false) ? ['0' => $agent_id] : $id_agents,
@ -525,8 +587,7 @@ $table_alert_list->cellstyle = [];
$table_alert_list->data = []; $table_alert_list->data = [];
$url .= $sort_params; // $url .= $sort_params;
$rowPair = true; $rowPair = true;
$iterator = 0; $iterator = 0;
@ -591,7 +652,7 @@ foreach ($simple_alerts as $alert) {
} }
$module_name = modules_get_agentmodule_name($alert['id_agent_module']); $module_name = modules_get_agentmodule_name($alert['id_agent_module']);
$data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[&hellip;]', 'display:block;font-weight:normal;').'<br>'; $data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[&hellip;]', 'display:block;font-weight:normal;');
$data[1] = ui_print_status_image($status, $title, true); $data[1] = ui_print_status_image($status, $title, true);
@ -690,7 +751,7 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '<form method="post" action="'.$url.'" class="delete_link display_in">'; $data[3] .= '<form method="post" action="'.$url.'" class="delete_link display_in">';
$data[3] .= html_print_input_image( $data[3] .= html_print_input_image(
'delete', 'delete',
'images/cross.png', 'images/delete.svg',
1, 1,
'padding:0px; margin-left:5px; margin-right:5px;', 'padding:0px; margin-left:5px; margin-right:5px;',
true, true,
@ -742,67 +803,73 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible">'; $data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible">';
$data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post" style="height:85%;">'; $data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post" style="height:85%;">';
$data[3] .= '<table class="w100p bg_color222">'; $data[3] .= '<table class="w100p bg_color222 filter-table-adv">';
$data[3] .= html_print_input_hidden('add_action', 1, true); $data[3] .= html_print_input_hidden('add_action', 1, true);
$data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true); $data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
if (! $id_agente) { if (! $id_agente) {
$data[3] .= '<tr class="datos2">'; $data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="datos2 bolder pdd_6px font_10pt">'; $data[3] .= '<td class="w50p">'.html_print_label_input_block(
$data[3] .= __('Agent'); __('Agent'),
$data[3] .= '</td>'; ui_print_truncate_text($alias, 'agent_small', false, true, true, '[&hellip;]')
$data[3] .= '<td class="datos">'; ).'</td>';
$data[3] .= ui_print_truncate_text($alias, 'agent_small', false, true, true, '[&hellip;]'); $data[3] .= '<td class="w50p">'.html_print_label_input_block(
$data[3] .= '</td>'; __('Module'),
ui_print_truncate_text($module_name, 'module_small', false, true, true, '[&hellip;]')
).'</td>';
$data[3] .= '</tr>'; $data[3] .= '</tr>';
} }
$data[3] .= '<tr class="datos">';
$data[3] .= '<td class="datos bolder pdd_6px font_10pt">';
$data[3] .= __('Module');
$data[3] .= '</td>';
$data[3] .= '<td class="datos">';
$data[3] .= ui_print_truncate_text($module_name, 'module_small', false, true, true, '[&hellip;]');
$data[3] .= '</td>';
$data[3] .= '</tr>';
$data[3] .= '<tr class="datos2">'; $data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="datos2 bolder pdd_6px font_10pt">'; $data[3] .= '<td class="w50p">'.html_print_label_input_block(
$data[3] .= __('Action'); __('Action'),
$data[3] .= '</td>'; html_print_select(
$data[3] .= '<td class="datos2">'; $actions,
$data[3] .= html_print_select($actions, 'action_select', '', '', __('None'), 0, true, false, true, '', false, 'width:95%'); 'action_select',
$data[3] .= '</td>'; '',
$data[3] .= '</tr>'; '',
$data[3] .= '<tr class="datos">'; __('None'),
$data[3] .= '<td class="datos bolder pdd_6px font_10pt">'; 0,
$data[3] .= __('Number of alerts match from'); true,
$data[3] .= '</td>'; false,
$data[3] .= '<td class="datos">'; true,
$data[3] .= html_print_input_text( '',
false,
'width:100%'
)
).'</td>';
$data[3] .= '<td class="w50p">'.html_print_label_input_block(
__('Number of alerts match from'),
'<div class="inline">'.html_print_input_text(
'fires_min', 'fires_min',
0, 0,
'', '',
4, 4,
10, 10,
true true,
); false,
$data[3] .= ' '.__('to').' '; false,
$data[3] .= html_print_input_text( '',
'w40p'
).' '.__('to').' '.html_print_input_text(
'fires_max', 'fires_max',
0, 0,
'', '',
4, 4,
10, 10,
true true,
); false,
$data[3] .= '</td>'; false,
'',
'w40p'
).'</div>'
).'</td>';
$data[3] .= '</tr>'; $data[3] .= '</tr>';
$data[3] .= '<tr class="datos2">'; $data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="datos2 bolder pdd_6px font_10pt">'; $data[3] .= '<td class="w50p">'.html_print_label_input_block(
$data[3] .= __('Threshold'); __('Threshold'),
$data[3] .= '</td>'; html_print_extended_select_for_time(
$data[3] .= '<td class="datos2">';
$data[3] .= html_print_extended_select_for_time(
'module_action_threshold', 'module_action_threshold',
0, 0,
'', '',
@ -818,15 +885,18 @@ foreach ($simple_alerts as $alert) {
'', '',
false, false,
true true
); )
$data[3] .= '</td>'; ).'</td>';
$data[3] .= '</tr>'; $data[3] .= '</tr>';
$data[3] .= '</table>'; $data[3] .= '</table>';
$data[3] .= html_print_submit_button( $data[3] .= html_print_submit_button(
__('Add'), __('Add'),
'addbutton', 'addbutton',
false, false,
['icon' => 'next'], [
'icon' => 'next',
'class' => 'mini float-right',
],
true true
); );
$data[3] .= '</form>'; $data[3] .= '</form>';
@ -845,7 +915,7 @@ foreach ($simple_alerts as $alert) {
1, 1,
'padding:0px', 'padding:0px',
true, true,
['class' => 'filter_none'] ['class' => 'filter_none main_menu_icon']
); );
$data[4] .= html_print_input_hidden('enable_alert', 1, true); $data[4] .= html_print_input_hidden('enable_alert', 1, true);
} else { } else {
@ -854,7 +924,8 @@ foreach ($simple_alerts as $alert) {
'images/lightbulb.png', 'images/lightbulb.png',
1, 1,
'padding:0px;', 'padding:0px;',
true true,
['class' => 'main_menu_icon']
); );
$data[4] .= html_print_input_hidden('disable_alert', 1, true); $data[4] .= html_print_input_hidden('disable_alert', 1, true);
} }
@ -872,7 +943,7 @@ foreach ($simple_alerts as $alert) {
1, 1,
'padding:0px;', 'padding:0px;',
true, true,
['class' => 'invert_filter'] ['class' => 'invert_filter main_menu_icon']
); );
$data[4] .= html_print_input_hidden('standbyon_alert', 1, true); $data[4] .= html_print_input_hidden('standbyon_alert', 1, true);
} else { } else {
@ -882,7 +953,7 @@ foreach ($simple_alerts as $alert) {
1, 1,
'padding:0px;', 'padding:0px;',
true, true,
['class' => 'invert_filter'] ['class' => 'invert_filter main_menu_icon']
); );
$data[4] .= html_print_input_hidden('standbyoff_alert', 1, true); $data[4] .= html_print_input_hidden('standbyoff_alert', 1, true);
} }
@ -922,19 +993,37 @@ foreach ($simple_alerts as $alert) {
true, true,
[ [
'title' => __('Add action'), 'title' => __('Add action'),
'class' => 'invert_filter', 'class' => 'invert_filter main_menu_icon',
] ]
); );
} else { } else {
if ((int) $alert['id_policy_alerts'] === 0 || $module_linked === '0') { if ((int) $alert['id_policy_alerts'] === 0 || $module_linked === '0') {
$data[4] .= '<a href="javascript:show_add_action(\''.$alert['id'].'\');">'; $data[4] .= '<a href="javascript:show_add_action(\''.$alert['id'].'\');">';
$data[4] .= html_print_image('images/add.png', true, ['title' => __('Add action'), 'class' => 'invert_filter']); $data[4] .= html_print_image(
'images/plus-black.svg',
true,
[
'title' => __('Add action'),
'class' => 'invert_filter main_menu_icon',
'style' => 'margin-bottom: 12px;',
]
);
$data[4] .= '</a>'; $data[4] .= '</a>';
} }
} }
} }
$data[4] .= html_print_input_image('delete', 'images/cross.png', 1, '', true, ['title' => __('Delete'), 'class' => 'invert_filter']); $data[4] .= html_print_input_image(
'delete',
'images/delete.svg',
1,
'',
true,
[
'title' => __('Delete'),
'class' => 'invert_filter main_menu_icon',
]
);
$data[4] .= html_print_input_hidden('delete_alert', 1, true); $data[4] .= html_print_input_hidden('delete_alert', 1, true);
$data[4] .= html_print_input_hidden('id_alert', $alert['id'], true); $data[4] .= html_print_input_hidden('id_alert', $alert['id'], true);
$data[4] .= '</form>'; $data[4] .= '</form>';
@ -942,7 +1031,17 @@ foreach ($simple_alerts as $alert) {
if ($is_cluster) { if ($is_cluster) {
$data[4] .= '<form class="view_alert_form display_in" method="post">'; $data[4] .= '<form class="view_alert_form display_in" method="post">';
$data[4] .= html_print_input_image('update', 'images/builder.png', 1, '', true, ['title' => __('Update'), 'class' => 'invert_filter']); $data[4] .= html_print_input_image(
'update',
'images/builder.png',
1,
'',
true,
[
'title' => __('Update'),
'class' => 'invert_filter main_menu_icon',
]
);
$data[4] .= html_print_input_hidden('upd_alert', 1, true); $data[4] .= html_print_input_hidden('upd_alert', 1, true);
$data[4] .= html_print_input_hidden('id_alert', $alert['id'], true); $data[4] .= html_print_input_hidden('id_alert', $alert['id'], true);
@ -952,7 +1051,17 @@ foreach ($simple_alerts as $alert) {
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) { if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
$data[4] .= '<form class="view_alert_form display_in" method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_view">'; $data[4] .= '<form class="view_alert_form display_in" method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_view">';
$data[4] .= html_print_input_image('view_alert', 'images/operation.png', 1, '', true, ['title' => __('View alert advanced details'), 'class' => 'invert_filter']); $data[4] .= html_print_input_image(
'view_alert',
'images/operation.png',
1,
'',
true,
[
'title' => __('View alert advanced details'),
'class' => 'invert_filter main_menu_icon',
]
);
$data[4] .= html_print_input_hidden('id_alert', $alert['id'], true); $data[4] .= html_print_input_hidden('id_alert', $alert['id'], true);
$data[4] .= '</form>'; $data[4] .= '</form>';
} }
@ -960,12 +1069,13 @@ foreach ($simple_alerts as $alert) {
array_push($table_alert_list->data, $data); array_push($table_alert_list->data, $data);
} }
$pagination = '';
if (isset($data)) { if (isset($data)) {
html_print_table($table_alert_list); html_print_table($table_alert_list);
if ($id_agente) { if ($id_agente) {
ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom'); $pagination .= ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params, 0, 0, true, 'offset', false, '');
} else { } else {
ui_pagination($total, 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list'.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom'); $pagination .= ui_pagination($total, 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list'.$form_params.$sort_params, 0, 0, true, 'offset', false, '');
} }
} else { } else {
ui_print_info_message(['no_close' => true, 'message' => __('No alerts defined') ]); ui_print_info_message(['no_close' => true, 'message' => __('No alerts defined') ]);
@ -982,18 +1092,14 @@ if (isset($dont_display_alert_create_bttn)) {
if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && !$id_cluster) { if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && !$id_cluster) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">';
html_print_div( $actionButtons = html_print_submit_button(
[ __('Create'),
'class' => 'action-buttons', 'crtbtn',
'content' => html_print_submit_button( false,
__('Create'), ['icon' => 'next'],
'crtbtn', true
false,
['icon' => 'next'],
true
),
]
); );
html_print_action_buttons($actionButtons, ['right_content' => $pagination]);
echo '</form>'; echo '</form>';
} }
@ -1174,7 +1280,7 @@ function show_add_action(id_alert) {
dropdownParent: $("#add_action-div-" + id_alert) dropdownParent: $("#add_action-div-" + id_alert)
}); });
}, },
width: 600, width: 665,
height: 300 height: 300
}) })
.show (); .show ();

View File

@ -476,6 +476,70 @@ if ($standbyoff_alert) {
); );
} }
$searchFlag = true;
if (!is_metaconsole()) {
// The tabs will be shown only with manage alerts permissions
if (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], 0, 'LM')) {
$buttons = [
'list' => [
'active' => false,
'text' => '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure='.$pure.'">'.html_print_image('images/list.png', true, ['title' => __('List alerts'), 'class' => 'invert_filter']).'</a>',
],
'builder' => [
'active' => false,
'text' => '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">'.html_print_image('images/pencil.png', true, ['title' => __('Builder alert'), 'class' => 'invert_filter']).'</a>',
],
];
$buttons[$tab]['active'] = true;
} else {
$buttons = '';
}
if ($tab == 'list') {
ui_print_standard_header(
__('Alerts'),
'images/gm_alerts.png',
false,
'',
true,
$buttons,
[
[
'link' => '',
'label' => __('Manage alerts'),
],
[
'link' => '',
'label' => __('List'),
],
]
);
} else {
ui_print_standard_header(
__('Alerts'),
'images/gm_alerts.png',
false,
'',
true,
$buttons,
[
[
'link' => '',
'label' => __('Manage alerts'),
],
[
'link' => '',
'label' => __('Create'),
],
]
);
}
} else {
alerts_meta_print_header();
}
if ($id_agente) { if ($id_agente) {
$agents = [$id_agente => agents_get_name($id_agente)]; $agents = [$id_agente => agents_get_name($id_agente)];
@ -494,64 +558,35 @@ if ($id_agente) {
} }
return; return;
} else { }
$searchFlag = true;
if (!is_metaconsole()) { echo $messageAction;
// The tabs will be shown only with manage alerts permissions
if (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], 0, 'LM')) { switch ($tab) {
$buttons = [ case 'list':
'list' => [ if ($group == 0) {
'active' => false, $groups = users_get_groups();
'text' => '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure='.$pure.'">'.html_print_image('images/list.png', true, ['title' => __('List alerts'), 'class' => 'invert_filter']).'</a>', } else {
], $groups = [0 => __('All')];
'builder' => [ }
'active' => false,
'text' => '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">'.html_print_image('images/pencil.png', true, ['title' => __('Builder alert'), 'class' => 'invert_filter']).'</a>', $agents = agents_get_group_agents(array_keys($groups), false, 'none', true);
],
]; include_once $config['homedir'].'/godmode/alerts/alert_list.list.php';
$buttons[$tab]['active'] = true; return;
} else {
$buttons = ''; break;
} case 'builder':
if ($group == 0) {
if ($tab == 'list') { $groups = users_get_groups();
ui_print_page_header(__('Alerts').' &raquo; '.__('Manage alerts').' &raquo; '.__('List'), 'images/gm_alerts.png', false, '', true, $buttons); } else {
} else { $groups = [0 => __('All')];
ui_print_page_header(__('Alerts').' &raquo; '.__('Manage alerts').' &raquo; '.__('Create'), 'images/gm_alerts.png', false, '', true, $buttons); }
}
} else { include_once $config['homedir'].'/godmode/alerts/alert_list.builder.php';
alerts_meta_print_header();
} return;
echo $messageAction; break;
switch ($tab) {
case 'list':
if ($group == 0) {
$groups = users_get_groups();
} else {
$groups = [0 => __('All')];
}
$agents = agents_get_group_agents(array_keys($groups), false, 'none', true);
include_once $config['homedir'].'/godmode/alerts/alert_list.list.php';
return;
break;
case 'builder':
if ($group == 0) {
$groups = users_get_groups();
} else {
$groups = [0 => __('All')];
}
include_once $config['homedir'].'/godmode/alerts/alert_list.builder.php';
return;
break;
}
} }

View File

@ -125,12 +125,19 @@ if (!$delete_template) {
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Alert templates'), __('Alerts'),
'images/gm_alerts.png', 'images/gm_alerts.png',
false, false,
'', '',
true true,
[],
[
[
'link' => '',
'label' => __('Alert templates'),
],
]
); );
} }
} }
@ -283,7 +290,7 @@ $url = ui_get_url_refresh(
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters filter-table-adv';
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$table->cellspacing = 0; $table->cellspacing = 0;
$table->cellpadding = 0; $table->cellpadding = 0;
@ -293,51 +300,70 @@ $table->data = [];
$table->head = []; $table->head = [];
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold'; $table->style[0] = 'width: 50%;';
$table->style[2] = 'font-weight: bold'; $table->style[1] = 'width: 50%;';
$table->data[0][0] = html_print_label_input_block(
__('Type'),
html_print_select(
alerts_get_alert_templates_types(),
'search_type',
$search_type,
'',
__('All'),
'',
true,
false,
false,
'w100p',
false,
'width: 100%;'
)
);
$table->data[0][0] = __('Type'); $table->data[0][1] = html_print_label_input_block(
$table->data[0][1] = html_print_select( __('Search'),
alerts_get_alert_templates_types(), html_print_input_text(
'search_type', 'search_string',
$search_type, $search_string,
'', '',
__('All'), 25,
'', 255,
true, true,
false, false,
false false,
'',
'w100p'
)
); );
$table->data[0][2] = __('Search');
$table->data[0][3] = html_print_input_text( $table->data[1][0] = '&nbsp;';
'search_string', $table->data[1][1] = html_print_submit_button(
$search_string,
'',
25,
255,
true
);
$table->data[0][4] = '<div class="action-buttons">';
$table->data[0][4] .= html_print_submit_button(
__('Search'), __('Search'),
'', '',
false, false,
'class="sub search"', [
'class' => 'float-right',
'icon' => 'search',
],
true true
); );
$table->data[0][4] .= '</div>';
if (is_metaconsole() === true) { $filter = '<form class="" method="post" action="'.$url.'">';
$filter = '<form class="" method="post" action="'.$url.'">'; $filter .= html_print_table($table, true);
$filter .= html_print_table($table, true); $filter .= '</form>';
$filter .= '</form>'; ui_toggle(
ui_toggle($filter, __('Show Options')); $filter,
} else { '<span class="subsection_header_title">'.__('Show Options').'</span>',
echo '<form method="post" action="'.$url.'">'; __('Show Options'),
html_print_table($table); 'update',
echo '</form>'; true,
} false,
'',
'white-box-content no_border',
'filter-datatable-main box-flat white_table_graph fixed_filter_bar '
);
unset($table); unset($table);
@ -428,7 +454,10 @@ foreach ($templates as $template) {
1, 1,
'', '',
true, true,
['title' => __('Duplicate')] [
'title' => __('Duplicate'),
'class' => 'main_menu_icon',
]
); );
$data[4] .= '</form> '; $data[4] .= '</form> ';
@ -438,11 +467,14 @@ foreach ($templates as $template) {
$data[4] .= html_print_input_hidden('id', $template['id'], true); $data[4] .= html_print_input_hidden('id', $template['id'], true);
$data[4] .= html_print_input_image( $data[4] .= html_print_input_image(
'del', 'del',
'images/cross.png', 'images/delete.svg',
1, 1,
'', '',
true, true,
['title' => __('Delete')] [
'title' => __('Delete'),
'class' => 'main_menu_icon',
]
); );
$data[4] .= '</form> '; $data[4] .= '</form> ';
} }
@ -453,18 +485,18 @@ foreach ($templates as $template) {
array_push($table->data, $data); array_push($table->data, $data);
} }
ui_pagination($total_templates, $url); $pagination = '';
if (isset($data) === true) { if (isset($data) === true) {
html_print_table($table); html_print_table($table);
ui_pagination( $pagination = ui_pagination(
$total_templates, $total_templates,
$url, $url,
0, 0,
0, 0,
false,
'offset',
true, true,
'pagination-bottom' 'offset',
false,
''
); );
} else { } else {
ui_print_info_message( ui_print_info_message(
@ -475,11 +507,15 @@ if (isset($data) === true) {
); );
} }
$buttons = '';
if (is_management_allowed() === true) { if (is_management_allowed() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">'; echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); $buttons = html_print_submit_button(__('Create'), 'create', false, ['icon' => 'wand'], true);
html_print_input_hidden('create_alert', 1); $buttons .= html_print_input_hidden('create_alert', 1);
html_print_action_buttons($buttons, ['right_content' => $pagination]);
echo '</form>'; echo '</form>';
echo '</div>'; echo '</div>';
} else {
html_print_action_buttons($buttons, ['right_content' => $pagination]);
} }

View File

@ -91,12 +91,19 @@ if ($a_template !== false) {
$help_header = ''; $help_header = '';
} }
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Configure alert template'), __('Alerts'),
'', 'images/gm_alerts.png',
false, false,
$help_header, $help_header,
true true,
[],
[
[
'link' => '',
'label' => __('Configure alert template'),
],
]
); );
} }
} else { } else {
@ -115,12 +122,19 @@ if ($a_template !== false) {
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
alerts_meta_print_header(); alerts_meta_print_header();
} else { } else {
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Configure alert template'), __('Alerts'),
'images/gm_alerts.png', 'images/gm_alerts.png',
false, false,
'conf_alert_template', 'conf_alert_template',
true true,
[],
[
[
'link' => '',
'label' => __('Configure alert template'),
],
]
); );
} }
} else { } else {
@ -147,12 +161,19 @@ if ($a_template !== false) {
$help_header = ''; $help_header = '';
} }
ui_print_page_header( ui_print_standard_header(
__('Alerts').' &raquo; '.__('Configure alert template'), __('Alerts'),
'images/gm_alerts.png', 'images/gm_alerts.png',
false, false,
$help_header, $help_header,
true true,
[],
[
[
'link' => '',
'label' => __('Configure alert template'),
],
]
); );
} }
} }
@ -598,27 +619,22 @@ print_alert_template_steps($step, $id);
$table = new stdClass(); $table = new stdClass();
$table->id = 'template'; $table->id = 'template';
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox filters'; $table->class = 'databox filters w100p filter-table-adv';
if (is_metaconsole() === true) {
$table->head[0] = __('Create Template');
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
}
$table->style = []; $table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;';
$table->size = []; $table->size = [];
$table->size[0] = '20%'; $table->size[0] = '50%';
$table->size[2] = '20%'; $table->size[2] = '50%';
$table->colspan = [];
$table->colspan[1][0] = 2;
if ($step == 2) { if ($step == 2) {
if (!isset($show_matches)) { if (!isset($show_matches)) {
$show_matches = false; $show_matches = false;
} }
$table->data[0][0] = __('Use special days list');
$data_special_days = Calendar::calendars( $data_special_days = Calendar::calendars(
// Fields. // Fields.
[ '`talert_calendar`.*' ], [ '`talert_calendar`.*' ],
@ -637,121 +653,154 @@ if ($step == 2) {
// Reduce to a select. // Reduce to a select.
true true
); );
$table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_select( __('Use special days list'),
$data_special_days, html_print_select(
'special_day', $data_special_days,
$special_day, 'special_day',
'', $special_day,
__('None'), '',
0, __('None'),
true, 0,
false, true,
false, false,
'', false,
(!$is_management_allowed | $disabled) 'w100p',
(!$is_management_allowed | $disabled),
'width: 100%'
)
); );
$table->data[0][1] = '&nbsp;';
// Firing conditions and events. // Firing conditions and events.
$table->colspan = []; $table->data[1][0] = html_print_label_input_block(
$table->data[1][0] = __('Schedule'); __('Schedule'),
$table->colspan[1][1] = 3; ui_print_warning_message(
$table->data[1][1] = ui_print_warning_message( [
[ 'message' => __('No alert has been scheduled yet'),
'message' => __('No alert has been scheduled yet'), 'force_style' => 'display:none;',
'force_style' => 'display:none;', 'force_class' => 'alert_schedule',
'force_class' => 'alert_schedule', ],
], '',
'', true
true ).'<div id="calendar_map" style="width: 90%;"></div>'.html_print_input_hidden('schedule', $schedule, true)
);
$table->data[1][1] .= '<div id="calendar_map" style="width: 90%;"></div>';
$table->data[1][1] .= html_print_input_hidden('schedule', $schedule, true);
$table->colspan['threshold'][1] = 3;
$table->data['threshold'][0] = __('Time threshold');
$table->data['threshold'][1] = html_print_extended_select_for_time(
'threshold',
$threshold,
'',
'',
'',
false,
true,
false,
true,
'',
(!$is_management_allowed | $disabled)
); );
$table->data[4][0] = __('Min. number of alerts'); $table->data[2][0] = html_print_label_input_block(
$table->data[4][1] = html_print_input_text( __('Time threshold'),
'min_alerts', html_print_extended_select_for_time(
$min_alerts, 'threshold',
'', $threshold,
5, '',
7, '',
true, '',
false, false,
false, true,
'', false,
'', true,
'', 'w100p',
'', (!$is_management_allowed | $disabled)
false, )
'',
'',
'',
(!$is_management_allowed | $disabled)
); );
$table->data[4][2] = __('Reset counter for non-sustained alerts'); $table->data[2][1] = html_print_label_input_block(
$table->data[4][2] .= ui_print_help_tip( __('Default action').ui_print_help_tip(
__('Enable this option if you want the counter to be reset when the alert is not being fired consecutively, even if it\'s within the time threshold'), __('Unless they\'re left blank, the fields from the action will override those set on the template.'),
true true
); ),
$table->data[4][3] = html_print_checkbox( html_print_select_from_sql(
'min_alerts_reset_counter', $sql_query,
1, 'default_action',
$min_alerts_reset_counter, $default_action,
true, '',
(!$is_management_allowed | $disabled), __('None'),
'', 0,
false, true,
($create_template == 1) ? 'checked=checked' : '' false,
false,
(!$is_management_allowed | $disabled),
false,
false,
0,
'w100p'
)
); );
$table->data[5][0] = __('Max. number of alerts'); $table->data[3][0] = html_print_label_input_block(
$table->data[5][1] = html_print_input_text( __('Min. number of alerts'),
'max_alerts', html_print_input_text(
$max_alerts, 'min_alerts',
'', $min_alerts,
5, '',
7, 5,
true, 7,
false, true,
false, false,
'', false,
'', '',
'', 'w100p',
'', '',
false, '',
'', false,
'', '',
'', '',
(!$is_management_allowed | $disabled) '',
(!$is_management_allowed | $disabled)
)
); );
$table->data[5][2] = __('Disable event'); $table->data[3][1] = html_print_label_input_block(
$table->data[5][3] = html_print_checkbox( __('Reset counter for non-sustained alerts').ui_print_help_tip(
'disable_event', __('Enable this option if you want the counter to be reset when the alert is not being fired consecutively, even if it\'s within the time threshold'),
1, true
$disable_event, ),
true, html_print_checkbox(
(!$is_management_allowed | $disabled) 'min_alerts_reset_counter',
1,
$min_alerts_reset_counter,
true,
(!$is_management_allowed | $disabled),
'',
false,
($create_template == 1) ? 'checked=checked' : ''
)
);
$table->data[4][0] = html_print_label_input_block(
__('Max. number of alerts'),
html_print_input_text(
'max_alerts',
$max_alerts,
'',
5,
7,
true,
false,
false,
'',
'w100p',
'',
'',
false,
'',
'',
'',
(!$is_management_allowed | $disabled)
)
);
$table->data[4][1] = html_print_label_input_block(
__('Disable event'),
html_print_checkbox(
'disable_event',
1,
$disable_event,
true,
(!$is_management_allowed | $disabled)
)
); );
$table->data[6][0] = __('Default action');
$usr_groups = implode( $usr_groups = implode(
',', ',',
array_keys(users_get_groups($config['id_user'], 'LM', true)) array_keys(users_get_groups($config['id_user'], 'LM', true))
@ -765,123 +814,98 @@ if ($step == 2) {
$usr_groups $usr_groups
); );
$table->data[6][1] = html_print_select_from_sql( $table->data[5][0] = html_print_label_input_block(
$sql_query, __('Condition type'),
'default_action', html_print_select(
$default_action, alerts_get_alert_templates_types(),
'', 'type',
__('None'), $type,
0, '',
true, __('None'),
false, 0,
false, true,
(!$is_management_allowed | $disabled), false,
false, false,
false, 'w100p',
0 (!$is_management_allowed | $disabled)
); ).'<span id="matches_value" '.(($show_matches) ? '' : 'class="invisible"').'>'.'&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true).html_print_label(
$table->data[6][1] .= ui_print_help_tip( __('Trigger when matches the value'),
__('Unless they\'re left blank, the fields from the action will override those set on the template.'), 'checkbox-matches_value',
true true
).'</span>'
); );
$table->data[7][0] = __('Condition type'); $table->data['value'][1] = html_print_label_input_block(
$table->data[7][1] = html_print_select( __('Value'),
alerts_get_alert_templates_types(), html_print_input_text(
'type', 'value',
$type, $value,
'', '',
__('None'), 35,
0, 255,
true, true
false, ).'&nbsp;<span id="regex_ok">'.html_print_image(
false, 'images/suc.png',
'', true,
(!$is_management_allowed | $disabled) [
'style' => 'display:none',
'id' => 'regex_good',
'title' => __('The regular expression is valid'),
'width' => '20px',
]
).html_print_image(
'images/err.png',
true,
[
'style' => 'display:none',
'id' => 'regex_bad',
'title' => __('The regular expression is not valid'),
'width' => '20px',
]
).'</span>'
); );
$table->data[7][1] .= '<span id="matches_value" '.(($show_matches) ? '' : 'class="invisible"').'>';
$table->data[7][1] .= '&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true);
$table->data[7][1] .= html_print_label(
__('Trigger when matches the value'),
'checkbox-matches_value',
true
);
$table->data[7][1] .= '</span>';
$table->colspan[7][1] = 3;
$table->data['value'][0] = __('Value');
$table->data['value'][1] = html_print_input_text(
'value',
$value,
'',
35,
255,
true
);
$table->data['value'][1] .= '&nbsp;<span id="regex_ok">';
$table->data['value'][1] .= html_print_image(
'images/suc.png',
true,
[
'style' => 'display:none',
'id' => 'regex_good',
'title' => __('The regular expression is valid'),
'width' => '20px',
]
);
$table->data['value'][1] .= html_print_image(
'images/err.png',
true,
[
'style' => 'display:none',
'id' => 'regex_bad',
'title' => __('The regular expression is not valid'),
'width' => '20px',
]
);
$table->data['value'][1] .= '</span>';
$table->colspan['value'][1] = 3;
// Min first, then max, that's more logical. // Min first, then max, that's more logical.
$table->data['min'][0] = __('Min.'); $table->data['min'][0] = html_print_label_input_block(
$table->data['min'][1] = html_print_input_text( __('Min.'),
'min', html_print_input_text(
$min, 'min',
'', $min,
5, '',
255, 5,
true, 255,
$disabled true,
$disabled
)
); );
$table->colspan['min'][1] = 3;
$table->data['max'][0] = __('Max.'); $table->data['max'][1] = html_print_label_input_block(
$table->data['max'][1] = html_print_input_text( __('Max.'),
'max', html_print_input_text(
$max, 'max',
'', $max,
5, '',
255, 5,
true, 255,
$disabled true,
$disabled
)
); );
$table->colspan['max'][1] = 3;
$table->data['example'][1] = ui_print_alert_template_example( $table->data['example'][0] = ui_print_alert_template_example(
$id, $id,
true, true,
false false
); );
$table->colspan['example'][1] = 4;
} else if ($step == 3) { } else if ($step == 3) {
$table->style[0] = 'font-weight: bold; vertical-align: middle'; $table->style[1] = 'font-weight: bold; vertical-align: top;';
$table->style[1] = 'font-weight: bold; vertical-align: top'; $table->style[2] = 'font-weight: bold; vertical-align: top;';
$table->style[2] = 'font-weight: bold; vertical-align: top';
$table->size = []; $table->size = [];
$table->size[0] = '10%'; $table->size[1] = '50%';
$table->size[1] = '45%'; $table->size[2] = '50%';
$table->size[2] = '45%'; $table->colspan[0][0] = 2;
$table->class = 'databox filters w100p filter-table-adv alert-template-fields';
// Alert recover. // Alert recover.
if (! $recovery_notify) { if (! $recovery_notify) {
$table->cellstyle['label_fields'][2] = 'display:none;'; $table->cellstyle['label_fields'][2] = 'display:none;';
@ -890,29 +914,29 @@ if ($step == 2) {
} }
} }
$table->data[0][0] = __('Alert recovery');
$values = [ $values = [
false => __('Disabled'), false => __('Disabled'),
true => __('Enabled'), true => __('Enabled'),
]; ];
$table->data[0][1] = html_print_select( $table->data[0][0] = html_print_label_input_block(
$values, __('Alert recovery'),
'recovery_notify', html_print_select(
$recovery_notify, $values,
'', 'recovery_notify',
'', $recovery_notify,
'', '',
true, '',
false, '',
false, true,
'', false,
(!$is_management_allowed | $disabled) false,
'w25p',
(!$is_management_allowed | $disabled)
)
); );
$table->colspan[0][1] = 2;
$table->data['label_fields'][0] = ''; $table->data['label_fields'][1] = '<span class"center">'.__('Firing fields').'</span>';
$table->data['label_fields'][1] = __('Firing fields'); $table->data['label_fields'][2] = '<span class"center">'.__('Recovery fields').'</span>';
$table->data['label_fields'][2] = __('Recovery fields');
for ($i = 1; $i <= $config['max_macro_fields']; $i++) { for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
if (isset($template[$name]) === true) { if (isset($template[$name]) === true) {
@ -921,13 +945,13 @@ if ($step == 2) {
$value = ''; $value = '';
} }
$table->data['field'.$i][0] = sprintf(__('Field %s'), $i); // $table->data['field'.$i][0] = sprintf(__('Field %s'), $i);
// TinyMCE. // TinyMCE.
// triggering fields. // triggering fields.
// Basic. // Basic.
$table->data['field'.$i][1] = '<div id="command_div"><b><small>'; $col1 = '<div id="command_div"><b><small>';
$table->data['field'.$i][1] .= __('Basic').'&nbsp;&nbsp;'; $col1 .= __('Basic').'&nbsp;&nbsp;';
$table->data['field'.$i][1] .= html_print_radio_button_extended( $col1 .= html_print_radio_button_extended(
'editor_type_value_'.$i, 'editor_type_value_'.$i,
0, 0,
'', '',
@ -938,9 +962,9 @@ if ($step == 2) {
true true
); );
// Advanced. // Advanced.
$table->data['field'.$i][1] .= '&nbsp;&nbsp;&nbsp;&nbsp;'; $col1 .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$table->data['field'.$i][1] .= __('Advanced').'&nbsp;&nbsp;'; $col1 .= __('Advanced').'&nbsp;&nbsp;';
$table->data['field'.$i][1] .= html_print_radio_button_extended( $col1 .= html_print_radio_button_extended(
'editor_type_value_'.$i, 'editor_type_value_'.$i,
0, 0,
'', '',
@ -950,10 +974,10 @@ if ($step == 2) {
'style="height: 15px !important;"', 'style="height: 15px !important;"',
true true
); );
$table->data['field'.$i][1] .= '</small></b></div>'; $col1 .= '</small></b></div>';
// Texarea. // Texarea.
$table->data['field'.$i][1] .= html_print_textarea( $col1 .= html_print_textarea(
'field'.$i, 'field'.$i,
1, 1,
1, 1,
@ -963,12 +987,16 @@ if ($step == 2) {
'', '',
(!$is_management_allowed | $disabled) (!$is_management_allowed | $disabled)
); );
$table->data['field'.$i][1] = html_print_label_input_block(
sprintf(__('Field %s'), $i),
$col1
);
// Recovery. // Recovery.
// Basic. // Basic.
$table->data['field'.$i][2] = '<div id="command_div"><b><small>'; $col2 = '<div id="command_div"><b><small>';
$table->data['field'.$i][2] .= __('Basic').'&nbsp;&nbsp;'; $col2 .= __('Basic').'&nbsp;&nbsp;';
$table->data['field'.$i][2] .= html_print_radio_button_extended( $col2 .= html_print_radio_button_extended(
'editor_type_recovery_value_'.$i, 'editor_type_recovery_value_'.$i,
0, 0,
'', '',
@ -979,9 +1007,9 @@ if ($step == 2) {
true true
); );
// Advanced. // Advanced.
$table->data['field'.$i][2] .= '&nbsp;&nbsp;&nbsp;&nbsp;'; $col2 .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$table->data['field'.$i][2] .= __('Advanced').'&nbsp;&nbsp;'; $col2 .= __('Advanced').'&nbsp;&nbsp;';
$table->data['field'.$i][2] .= html_print_radio_button_extended( $col2 .= html_print_radio_button_extended(
'editor_type_recovery_value_'.$i, 'editor_type_recovery_value_'.$i,
0, 0,
'', '',
@ -991,10 +1019,10 @@ if ($step == 2) {
'style="height: 15px !important;"', 'style="height: 15px !important;"',
true true
); );
$table->data['field'.$i][2] .= '</small></b></div>'; $col2 .= '</small></b></div>';
// Texarea. // Texarea.
$table->data['field'.$i][2] .= html_print_textarea( $col2 .= html_print_textarea(
'field'.$i.'_recovery', 'field'.$i.'_recovery',
1, 1,
1, 1,
@ -1004,16 +1032,19 @@ if ($step == 2) {
'', '',
(!$is_management_allowed | $disabled) (!$is_management_allowed | $disabled)
); );
$table->data['field'.$i][2] = html_print_label_input_block(
'&nbsp;',
$col2
);
} }
} else { } else {
// Step 1 by default. // Step 1 by default.
$table->size = []; $table->size = [];
$table->size[0] = '20%'; $table->size[0] = '50%';
$table->size[1] = '50%';
$table->colspan = [];
$table->colspan[1][0] = 2;
$table->data = []; $table->data = [];
$table->rowstyle = [];
$table->rowstyle['value'] = 'display: none';
$table->rowstyle['max'] = 'display: none';
$table->rowstyle['min'] = 'display: none';
$show_matches = false; $show_matches = false;
switch ($type) { switch ($type) {
@ -1045,29 +1076,29 @@ if ($step == 2) {
break; break;
} }
$table->data[0][0] = __('Name'); $table->data[0][0] = html_print_label_input_block(
$table->data[0][1] = html_print_input_text( __('Name'),
'name', html_print_input_text(
$name, 'name',
'', $name,
35, '',
255, 35,
true, 255,
false, true,
false, false,
'', false,
'', '',
'', '',
'', '',
false, '',
'', false,
'', '',
'', '',
(!$is_management_allowed | $disabled) '',
(!$is_management_allowed | $disabled)
)
); );
$table->data[0][1] .= '&nbsp;&nbsp;'.__('Group');
$groups = users_get_groups(); $groups = users_get_groups();
$own_info = get_user_info($config['id_user']); $own_info = get_user_info($config['id_user']);
@ -1081,59 +1112,76 @@ if ($step == 2) {
} }
} }
$table->data[0][1] .= '&nbsp;'; $table->data[0][1] = html_print_label_input_block(
$table->data[0][1] .= '<div class="w250px inline">'.html_print_select_groups( __('Group'),
false, html_print_select_groups(
'AR', false,
$return_all_group, 'AR',
'id_group', $return_all_group,
$id_group, 'id_group',
'', $id_group,
'', '',
0, '',
true, 0,
false, true,
true, false,
'', true,
(!$is_management_allowed | $disabled) '',
).'</div>'; (!$is_management_allowed | $disabled)
)
$table->data[1][0] = __('Description');
$table->data[1][1] = html_print_textarea(
'description',
10,
30,
$description,
'',
true,
'',
(!$is_management_allowed | $disabled)
); );
$table->data[2][0] = __('Priority'); $table->data[1][0] = html_print_label_input_block(
$table->data[2][1] = html_print_select( __('Description'),
get_priorities(), html_print_textarea(
'priority', 'description',
$priority, 10,
'', 30,
0, $description,
0, '',
true, true,
false, '',
false, (!$is_management_allowed | $disabled)
'', )
(!$is_management_allowed | $disabled) );
$table->data[2][0] = html_print_label_input_block(
__('Priority'),
html_print_select(
get_priorities(),
'priority',
$priority,
'',
0,
0,
true,
false,
false,
'',
(!$is_management_allowed | $disabled)
)
); );
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$table->data[3][0] = __('Wizard level');
$wizard_levels = [ $wizard_levels = [
'nowizard' => __('No wizard'), 'nowizard' => __('No wizard'),
'basic' => __('Basic'), 'basic' => __('Basic'),
'advanced' => __('Advanced'), 'advanced' => __('Advanced'),
]; ];
$table->data[3][1] = html_print_select($wizard_levels, 'wizard_level', $wizard_level, '', '', -1, true, false, false); $table->data[2][1] = html_print_label_input_block(
__('Wizard level'),
html_print_select(
$wizard_levels,
'wizard_level',
$wizard_level,
'',
'',
-1,
true,
false,
false
)
);
} else { } else {
$table->data[2][1] .= html_print_input_hidden('wizard_level', $wizard_level, true); $table->data[2][1] .= html_print_input_hidden('wizard_level', $wizard_level, true);
} }
@ -1146,9 +1194,9 @@ if ($step == 2) {
$offset = (int) get_parameter('offset'); $offset = (int) get_parameter('offset');
// If it's the last step it will redirect to template lists. // If it's the last step it will redirect to template lists.
if ($step >= LAST_STEP) { if ($step >= LAST_STEP) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_templates&pure='.$pure.'&offset='.$offset.'">'; echo '<form class="max_floating_element_size" method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_templates&pure='.$pure.'&offset='.$offset.'">';
} else { } else {
echo '<form method="post">'; echo '<form class="max_floating_element_size" method="post">';
} }
html_print_table($table); html_print_table($table);
@ -1168,7 +1216,7 @@ if (!$disabled) {
__('Finish'), __('Finish'),
'finish', 'finish',
false, false,
'class="submitButton"', ['icon' => 'wand'],
true true
); );
} else { } else {
@ -1179,7 +1227,11 @@ if (!$disabled) {
__('Next'), __('Next'),
'next', 'next',
false, false,
'class="submitButton" onclick="return check_fields_step2();"', [
'class' => 'submitButton',
'onclick' => 'return check_fields_step2();',
'icon' => 'next',
],
true true
); );
} else { } else {
@ -1187,7 +1239,7 @@ if (!$disabled) {
__('Next'), __('Next'),
'next', 'next',
false, false,
'class="submitButton"', ['icon' => 'next'],
true true
); );
} }

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 27.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;}
.st1{fill:#000000;}
</style>
<g>
<circle class="st0" cx="10" cy="10" r="10"/>
</g>
<path class="st1" d="M15.6,11.4H4.4C3.6,11.4,3,10.8,3,10v0c0-0.8,0.6-1.4,1.4-1.4h11.1c0.8,0,1.4,0.6,1.4,1.4v0
C17,10.8,16.4,11.4,15.6,11.4z"/>
<path class="st1" d="M8.6,15.6V4.4C8.6,3.6,9.2,3,10,3h0c0.8,0,1.4,0.6,1.4,1.4v11.1c0,0.8-0.6,1.4-1.4,1.4h0
C9.2,17,8.6,16.4,8.6,15.6z"/>
</svg>

After

Width:  |  Height:  |  Size: 776 B

View File

@ -2369,10 +2369,10 @@ div.pager input {
/* Steps style */ /* Steps style */
ol.steps { ol.steps {
margin-bottom: 70px;
padding: 0; padding: 0;
list-style-type: none; list-style-type: none;
list-style-position: outside; list-style-position: outside;
margin-top: 0px;
} }
ol.steps li { ol.steps li {
@ -9289,7 +9289,7 @@ div.stat-win-spinner img {
} }
.fc-col-header-cell-cushion { .fc-col-header-cell-cushion {
color: #fff; color: #000;
} }
.stat_win_histogram { .stat_win_histogram {
@ -11498,7 +11498,7 @@ div[role="dialog"] {
color: #161628; color: #161628;
text-align: left; text-align: left;
margin-bottom: 10px; margin-bottom: 10px;
font-weight: bold; /* font-weight: bold; */
} }
.preimage_container span { .preimage_container span {
@ -11524,3 +11524,15 @@ input[type="text"]:has(+ .inputbuton) {
.notzindex { .notzindex {
z-index: 0; z-index: 0;
} }
table.alert-template-fields > tbody > tr > td > div > label {
margin-bottom: 0px;
}
table.alert-template-fields > tbody > tr > td > div > textarea {
margin-bottom: 15px;
}
table.alert-template-fields > tbody > tr > td[id^="template-label_fields"] {
text-align: center;
}

View File

@ -194,7 +194,7 @@
-webkit-border-radius: 0px; -webkit-border-radius: 0px;
border-radius: 0px; border-radius: 0px;
/*border: none;*/ /*border: none;*/
border-bottom: 1px solid #c0ccdc; /* border-bottom: 1px solid #c0ccdc; */
padding: 7px 3px; padding: 7px 3px;
/* /*
padding-left: 0px; padding-left: 0px;