Merge branch 'ent-5532-Edicion-creacion-de-templates-acciones-comandos-MODO-CENTRALIZADO' into 'develop'
Ent 5532 edicion creacion de templates acciones comandos modo centralizado See merge request artica/pandorafms!3273
This commit is contained in:
commit
150e8b1ddc
|
@ -171,6 +171,11 @@ if ($delete_action) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_central_policies_on_node() === true) {
|
||||||
|
ui_print_warning_message(
|
||||||
|
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$search_string = (string) get_parameter('search_string', '');
|
$search_string = (string) get_parameter('search_string', '');
|
||||||
$group = (int) get_parameter('group', 0);
|
$group = (int) get_parameter('group', 0);
|
||||||
|
@ -224,8 +229,11 @@ $table->data = [];
|
||||||
$table->head = [];
|
$table->head = [];
|
||||||
$table->head[0] = __('Name');
|
$table->head[0] = __('Name');
|
||||||
$table->head[1] = __('Group');
|
$table->head[1] = __('Group');
|
||||||
$table->head[2] = __('Copy');
|
if (is_central_policies_on_node() === false) {
|
||||||
$table->head[3] = __('Delete');
|
$table->head[2] = __('Copy');
|
||||||
|
$table->head[3] = __('Delete');
|
||||||
|
}
|
||||||
|
|
||||||
$table->style = [];
|
$table->style = [];
|
||||||
$table->style[0] = 'font-weight: bold';
|
$table->style[0] = 'font-weight: bold';
|
||||||
$table->size = [];
|
$table->size = [];
|
||||||
|
@ -292,7 +300,9 @@ foreach ($actions as $action) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_acl($config['id_user'], $action['id_group'], 'LM')) {
|
if (is_central_policies_on_node() === false
|
||||||
|
&& check_acl($config['id_user'], $action['id_group'], 'LM')
|
||||||
|
) {
|
||||||
$table->cellclass[] = [
|
$table->cellclass[] = [
|
||||||
2 => 'action_buttons',
|
2 => 'action_buttons',
|
||||||
3 => 'action_buttons',
|
3 => 'action_buttons',
|
||||||
|
@ -318,12 +328,14 @@ if (isset($data)) {
|
||||||
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
|
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
if (is_central_policies_on_node() === false) {
|
||||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
|
||||||
html_print_input_hidden('create_alert', 1);
|
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||||
echo '</form>';
|
html_print_input_hidden('create_alert', 1);
|
||||||
echo '</div>';
|
echo '</form>';
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
enterprise_hook('close_meta_frame');
|
enterprise_hook('close_meta_frame');
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -46,6 +46,8 @@ if (is_ajax()) {
|
||||||
$id = (int) get_parameter('id', 0);
|
$id = (int) get_parameter('id', 0);
|
||||||
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
|
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
|
||||||
|
|
||||||
|
$is_central_policies_on_node = is_central_policies_on_node();
|
||||||
|
|
||||||
// If command ID is not provided, check for action id.
|
// If command ID is not provided, check for action id.
|
||||||
if ($id == 0) {
|
if ($id == 0) {
|
||||||
$id_action = (int) get_parameter('id_action');
|
$id_action = (int) get_parameter('id_action');
|
||||||
|
@ -124,40 +126,142 @@ if (is_ajax()) {
|
||||||
// HTML type.
|
// HTML type.
|
||||||
if (preg_match('/^_html_editor_$/i', $field_value)) {
|
if (preg_match('/^_html_editor_$/i', $field_value)) {
|
||||||
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
||||||
$editor_type_chkbx .= __('Basic').ui_print_help_tip(__('For sending emails, text must be HTML format, if you want to use plain text, type it between the following labels: <pre></pre>'), true);
|
$editor_type_chkbx .= __('Basic');
|
||||||
$editor_type_chkbx .= html_print_radio_button_extended('editor_type_value_'.$i, 0, '', false, false, "removeTinyMCE('textarea_field".$i."_value')", '', true);
|
$editor_type_chkbx .= ui_print_help_tip(
|
||||||
|
__('For sending emails, text must be HTML format, if you want to use plain text, type it between the following labels: <pre></pre>'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||||
|
'editor_type_value_'.$i,
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
$is_central_policies_on_node,
|
||||||
|
"removeTinyMCE('textarea_field".$i."_value')",
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
$editor_type_chkbx .= ' ';
|
$editor_type_chkbx .= ' ';
|
||||||
$editor_type_chkbx .= __('Advanced').' ';
|
$editor_type_chkbx .= __('Advanced').' ';
|
||||||
$editor_type_chkbx .= html_print_radio_button_extended('editor_type_value_'.$i, 0, '', true, false, "addTinyMCE('textarea_field".$i."_value')", '', true);
|
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||||
|
'editor_type_value_'.$i,
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node,
|
||||||
|
"addTinyMCE('textarea_field".$i."_value')",
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
$editor_type_chkbx .= '</small></b></div>';
|
$editor_type_chkbx .= '</small></b></div>';
|
||||||
$ffield = $editor_type_chkbx;
|
$ffield = $editor_type_chkbx;
|
||||||
$ffield .= html_print_textarea('field'.$i.'_value', 1, 1, '', 'class="fields"', true);
|
$ffield .= html_print_textarea(
|
||||||
|
'field'.$i.'_value',
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
'',
|
||||||
|
'class="fields"',
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
||||||
$editor_type_chkbx .= __('Basic').' ';
|
$editor_type_chkbx .= __('Basic').' ';
|
||||||
$editor_type_chkbx .= html_print_radio_button_extended('editor_type_recovery_value_'.$i, 0, '', false, false, "removeTinyMCE('textarea_field".$i."_recovery_value')", '', true);
|
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||||
|
'editor_type_recovery_value_'.$i,
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
$is_central_policies_on_node,
|
||||||
|
"removeTinyMCE('textarea_field".$i."_recovery_value')",
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
$editor_type_chkbx .= ' ';
|
$editor_type_chkbx .= ' ';
|
||||||
$editor_type_chkbx .= __('Advanced').' ';
|
$editor_type_chkbx .= __('Advanced').' ';
|
||||||
$editor_type_chkbx .= html_print_radio_button_extended('editor_type_recovery_value_'.$i, 0, '', true, false, "addTinyMCE('textarea_field".$i."_recovery_value')", '', true);
|
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||||
|
'editor_type_recovery_value_'.$i,
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node,
|
||||||
|
"addTinyMCE('textarea_field".$i."_recovery_value')",
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
$editor_type_chkbx .= '</small></b></div>';
|
$editor_type_chkbx .= '</small></b></div>';
|
||||||
$rfield = $editor_type_chkbx;
|
$rfield = $editor_type_chkbx;
|
||||||
$rfield .= html_print_textarea('field'.$i.'_recovery_value', 1, 1, '', 'class="fields_recovery"', true);
|
$rfield .= html_print_textarea(
|
||||||
|
'field'.$i.'_recovery_value',
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
'',
|
||||||
|
'class="fields_recovery"',
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
} else if (preg_match('/^_content_type_$/i', $field_value)) {
|
} else if (preg_match('/^_content_type_$/i', $field_value)) {
|
||||||
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
||||||
$editor_type_chkbx .= __('Text/plain').ui_print_help_tip(__('For sending emails only text plain'), true);
|
$editor_type_chkbx .= __('Text/plain');
|
||||||
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_value', 'text/plain', '', '', false, '', '', true);
|
$editor_type_chkbx .= ui_print_help_tip(
|
||||||
|
__('For sending emails only text plain'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||||
|
'field'.$i.'_value',
|
||||||
|
'text/plain',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
$editor_type_chkbx .= ' ';
|
$editor_type_chkbx .= ' ';
|
||||||
$editor_type_chkbx .= __('Text/html').' ';
|
$editor_type_chkbx .= __('Text/html').' ';
|
||||||
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_value', 'text/html', '', 'text/html', false, '', '', true);
|
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||||
|
'field'.$i.'_value',
|
||||||
|
'text/html',
|
||||||
|
'',
|
||||||
|
'text/html',
|
||||||
|
$is_central_policies_on_node,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
$editor_type_chkbx .= '</small></b></div>';
|
$editor_type_chkbx .= '</small></b></div>';
|
||||||
$ffield = $editor_type_chkbx;
|
$ffield = $editor_type_chkbx;
|
||||||
|
|
||||||
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
||||||
$editor_type_chkbx .= __('Text/plain').ui_print_help_tip(__('For sending emails only text plain'), true);
|
$editor_type_chkbx .= __('Text/plain');
|
||||||
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_recovery_value', 'text/plain', '', '', false, '', '', true);
|
$editor_type_chkbx .= ui_print_help_tip(
|
||||||
|
__('For sending emails only text plain'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||||
|
'field'.$i.'_recovery_value',
|
||||||
|
'text/plain',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
$editor_type_chkbx .= ' ';
|
$editor_type_chkbx .= ' ';
|
||||||
$editor_type_chkbx .= __('Text/html').' ';
|
$editor_type_chkbx .= __('Text/html').' ';
|
||||||
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_recovery_value', 'text/html', '', 'text/html', false, '', '', true);
|
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||||
|
'field'.$i.'_recovery_value',
|
||||||
|
'text/html',
|
||||||
|
'',
|
||||||
|
'text/html',
|
||||||
|
$is_central_policies_on_node,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
$editor_type_chkbx .= '</small></b></div>';
|
$editor_type_chkbx .= '</small></b></div>';
|
||||||
$rfield = $editor_type_chkbx;
|
$rfield = $editor_type_chkbx;
|
||||||
// Select type.
|
// Select type.
|
||||||
|
@ -192,7 +296,8 @@ if (is_ajax()) {
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'fields'
|
'fields',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
$rfield = html_print_select(
|
$rfield = html_print_select(
|
||||||
$fields_value_select,
|
$fields_value_select,
|
||||||
|
@ -204,7 +309,8 @@ if (is_ajax()) {
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'fields_recovery'
|
'fields_recovery',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$ffield = html_print_textarea(
|
$ffield = html_print_textarea(
|
||||||
|
@ -213,7 +319,9 @@ if (is_ajax()) {
|
||||||
1,
|
1,
|
||||||
$fv[0],
|
$fv[0],
|
||||||
'style="min-height:40px; '.$style.'" class="fields"',
|
'style="min-height:40px; '.$style.'" class="fields"',
|
||||||
true
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
$rfield = html_print_textarea(
|
$rfield = html_print_textarea(
|
||||||
'field'.$i.'_recovery_value',
|
'field'.$i.'_recovery_value',
|
||||||
|
@ -221,7 +329,9 @@ if (is_ajax()) {
|
||||||
1,
|
1,
|
||||||
$fv[0],
|
$fv[0],
|
||||||
'style="min-height:40px; '.$style.'" class="fields_recovery',
|
'style="min-height:40px; '.$style.'" class="fields_recovery',
|
||||||
true
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +342,9 @@ if (is_ajax()) {
|
||||||
1,
|
1,
|
||||||
'',
|
'',
|
||||||
'style="min-height:40px; '.$style.'" class="fields"',
|
'style="min-height:40px; '.$style.'" class="fields"',
|
||||||
true
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
$rfield = html_print_textarea(
|
$rfield = html_print_textarea(
|
||||||
'field'.$i.'_recovery_value',
|
'field'.$i.'_recovery_value',
|
||||||
|
@ -240,7 +352,9 @@ if (is_ajax()) {
|
||||||
1,
|
1,
|
||||||
'',
|
'',
|
||||||
'style="min-height:40px; '.$style.'" class="fields_recovery"',
|
'style="min-height:40px; '.$style.'" class="fields_recovery"',
|
||||||
true
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +518,15 @@ if ($copy_command) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$is_central_policies_on_node = is_central_policies_on_node();
|
||||||
|
|
||||||
|
if ($is_central_policies_on_node === true) {
|
||||||
|
ui_print_warning_message(
|
||||||
|
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = new stdClass;
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'info_table';
|
$table->class = 'info_table';
|
||||||
|
|
||||||
|
@ -457,7 +580,7 @@ foreach ($commands as $command) {
|
||||||
);
|
);
|
||||||
$data['action'] = '';
|
$data['action'] = '';
|
||||||
$table->cellclass[]['action'] = 'action_buttons';
|
$table->cellclass[]['action'] = 'action_buttons';
|
||||||
if (! $command['internal']) {
|
if ($is_central_policies_on_node === false && !$command['internal']) {
|
||||||
$data['action'] = '<span style="display: inline-flex">';
|
$data['action'] = '<span style="display: inline-flex">';
|
||||||
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&copy_command=1&id='.$command['id'].'&pure='.$pure.'"
|
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&copy_command=1&id='.$command['id'].'&pure='.$pure.'"
|
||||||
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true).'</a>';
|
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true).'</a>';
|
||||||
|
@ -475,11 +598,13 @@ if (count($table->data) > 0) {
|
||||||
ui_print_info_message(['no_close' => true, 'message' => __('No alert commands configured') ]);
|
ui_print_info_message(['no_close' => true, 'message' => __('No alert commands configured') ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
if ($is_central_policies_on_node === false) {
|
||||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
||||||
html_print_input_hidden('create_alert', 1);
|
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||||
echo '</form>';
|
html_print_input_hidden('create_alert', 1);
|
||||||
echo '</div>';
|
echo '</form>';
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
enterprise_hook('close_meta_frame');
|
enterprise_hook('close_meta_frame');
|
||||||
|
|
|
@ -125,13 +125,13 @@ if (defined('METACONSOLE')) {
|
||||||
$sec = 'galertas';
|
$sec = 'galertas';
|
||||||
}
|
}
|
||||||
|
|
||||||
// This prevents to duplicate the header in case delete_templete action is performed
|
// This prevents to duplicate the header in
|
||||||
|
// case delete_templete action is performed.
|
||||||
if (!$delete_template) {
|
if (!$delete_template) {
|
||||||
// Header
|
// Header.
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
alerts_meta_print_header();
|
alerts_meta_print_header();
|
||||||
} else {
|
} else {
|
||||||
// ~ ui_print_page_header (__('Alerts')." » ". __('Alert templates'), "images/gm_alerts.png", false, "alerts_config", true);
|
|
||||||
ui_print_page_header(
|
ui_print_page_header(
|
||||||
__('Alerts').' » '.__('Alert templates'),
|
__('Alerts').' » '.__('Alert templates'),
|
||||||
'images/gm_alerts.png',
|
'images/gm_alerts.png',
|
||||||
|
@ -142,7 +142,6 @@ if (!$delete_template) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($update_template) {
|
if ($update_template) {
|
||||||
$id = (int) get_parameter('id');
|
$id = (int) get_parameter('id');
|
||||||
|
|
||||||
|
@ -151,7 +150,7 @@ if ($update_template) {
|
||||||
$fields_recovery = [];
|
$fields_recovery = [];
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$values['field'.$i] = (string) get_parameter('field'.$i);
|
$values['field'.$i] = (string) get_parameter('field'.$i);
|
||||||
$values['field'.$i.'_recovery'] = $recovery_notify ? (string) get_parameter('field'.$i.'_recovery') : '';
|
$values['field'.$i.'_recovery'] = ($recovery_notify) ? (string) get_parameter('field'.$i.'_recovery') : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$values['recovery_notify'] = $recovery_notify;
|
$values['recovery_notify'] = $recovery_notify;
|
||||||
|
@ -164,13 +163,15 @@ if ($update_template) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If user tries to delete a template with group=ALL then must have "PM" access privileges
|
// If user tries to delete a template with group=ALL
|
||||||
|
// then must have "PM" access privileges.
|
||||||
if ($delete_template) {
|
if ($delete_template) {
|
||||||
$id = get_parameter('id');
|
$id = get_parameter('id');
|
||||||
$al_template = alerts_get_alert_template($id);
|
$al_template = alerts_get_alert_template($id);
|
||||||
|
|
||||||
if ($al_template !== false) {
|
if ($al_template !== false) {
|
||||||
// If user tries to delete a template with group=ALL then must have "PM" access privileges
|
// If user tries to delete a template with group=ALL
|
||||||
|
// then must have "PM" access privileges.
|
||||||
if ($al_template['id_group'] == 0) {
|
if ($al_template['id_group'] == 0) {
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||||
db_pandora_audit(
|
db_pandora_audit(
|
||||||
|
@ -192,8 +193,7 @@ if ($delete_template) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} //end if
|
} else {
|
||||||
else {
|
|
||||||
$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, 'PM')) {
|
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||||
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM'));
|
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM'));
|
||||||
|
@ -202,7 +202,7 @@ if ($delete_template) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_in_group = in_array($al_template['id_group'], $own_groups);
|
$is_in_group = in_array($al_template['id_group'], $own_groups);
|
||||||
// Then template group have to be is his own groups
|
// Then template group have to be is his own groups.
|
||||||
if ($is_in_group) {
|
if ($is_in_group) {
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
alerts_meta_print_header();
|
alerts_meta_print_header();
|
||||||
|
@ -241,9 +241,15 @@ if ($delete_template) {
|
||||||
$result = alerts_delete_alert_template($id);
|
$result = alerts_delete_alert_template($id);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Template alert management', 'Delete alert template #'.$id);
|
db_pandora_audit(
|
||||||
|
'Template alert management',
|
||||||
|
'Delete alert template #'.$id
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Template alert management', 'Fail try to delete alert template #'.$id);
|
db_pandora_audit(
|
||||||
|
'Template alert management',
|
||||||
|
'Fail try to delete alert template #'.$id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
|
@ -253,6 +259,11 @@ if ($delete_template) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_central_policies_on_node() === true) {
|
||||||
|
ui_print_warning_message(
|
||||||
|
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$search_string = (string) get_parameter('search_string');
|
$search_string = (string) get_parameter('search_string');
|
||||||
$search_type = (string) get_parameter('search_type');
|
$search_type = (string) get_parameter('search_type');
|
||||||
|
@ -269,7 +280,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';
|
||||||
if (defined('METACONSOLE')) {
|
if (is_metaconsole() === true) {
|
||||||
$table->cellspacing = 0;
|
$table->cellspacing = 0;
|
||||||
$table->cellpadding = 0;
|
$table->cellpadding = 0;
|
||||||
}
|
}
|
||||||
|
@ -313,7 +324,7 @@ $table->data[0][4] .= html_print_submit_button(
|
||||||
);
|
);
|
||||||
$table->data[0][4] .= '</div>';
|
$table->data[0][4] .= '</div>';
|
||||||
|
|
||||||
if (defined('METACONSOLE')) {
|
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>';
|
||||||
|
@ -394,18 +405,34 @@ foreach ($templates as $template) {
|
||||||
$data[1] = ui_print_group_icon($template['id_group'], true);
|
$data[1] = ui_print_group_icon($template['id_group'], true);
|
||||||
$data[3] = alerts_get_alert_templates_type_name($template['type']);
|
$data[3] = alerts_get_alert_templates_type_name($template['type']);
|
||||||
|
|
||||||
if (check_acl($config['id_user'], $template['id_group'], 'LM')) {
|
if (is_central_policies_on_node() === false
|
||||||
|
&& check_acl($config['id_user'], $template['id_group'], 'LM')
|
||||||
|
) {
|
||||||
$table->cellclass[][4] = 'action_buttons';
|
$table->cellclass[][4] = 'action_buttons';
|
||||||
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" style="display: inline; float: left">';
|
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" style="display: inline; float: left">';
|
||||||
$data[4] .= html_print_input_hidden('duplicate_template', 1, true);
|
$data[4] .= html_print_input_hidden('duplicate_template', 1, true);
|
||||||
$data[4] .= html_print_input_hidden('source_id', $template['id'], true);
|
$data[4] .= html_print_input_hidden('source_id', $template['id'], true);
|
||||||
$data[4] .= html_print_input_image('dup', 'images/copy.png', 1, '', true, ['title' => __('Duplicate')]);
|
$data[4] .= html_print_input_image(
|
||||||
|
'dup',
|
||||||
|
'images/copy.png',
|
||||||
|
1,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
['title' => __('Duplicate')]
|
||||||
|
);
|
||||||
$data[4] .= '</form> ';
|
$data[4] .= '</form> ';
|
||||||
|
|
||||||
$data[4] .= '<form method="post" style="display: inline; float: right" onsubmit="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
|
$data[4] .= '<form method="post" style="display: inline; float: right" onsubmit="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
|
||||||
$data[4] .= html_print_input_hidden('delete_template', 1, true);
|
$data[4] .= html_print_input_hidden('delete_template', 1, true);
|
||||||
$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('del', 'images/cross.png', 1, '', true, ['title' => __('Delete')]);
|
$data[4] .= html_print_input_image(
|
||||||
|
'del',
|
||||||
|
'images/cross.png',
|
||||||
|
1,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
['title' => __('Delete')]
|
||||||
|
);
|
||||||
$data[4] .= '</form> ';
|
$data[4] .= '</form> ';
|
||||||
} else {
|
} else {
|
||||||
$data[4] = '';
|
$data[4] = '';
|
||||||
|
@ -415,18 +442,34 @@ foreach ($templates as $template) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_pagination($total_templates, $url);
|
ui_pagination($total_templates, $url);
|
||||||
if (isset($data)) {
|
if (isset($data) === true) {
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
ui_pagination($total_templates, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
|
ui_pagination(
|
||||||
|
$total_templates,
|
||||||
|
$url,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
'offset',
|
||||||
|
true,
|
||||||
|
'pagination-bottom'
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
ui_print_info_message(['no_close' => true, 'message' => __('No alert templates defined') ]);
|
ui_print_info_message(
|
||||||
|
[
|
||||||
|
'no_close' => true,
|
||||||
|
'message' => __('No alert templates defined'),
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
if (is_central_policies_on_node() === false) {
|
||||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
|
||||||
html_print_input_hidden('create_alert', 1);
|
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||||
echo '</form>';
|
html_print_input_hidden('create_alert', 1);
|
||||||
echo '</div>';
|
echo '</form>';
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
enterprise_hook('close_meta_frame');
|
enterprise_hook('close_meta_frame');
|
||||||
|
|
|
@ -80,12 +80,20 @@ if ($al_action !== false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$is_central_policies_on_node = is_central_policies_on_node();
|
||||||
|
|
||||||
|
if ($is_central_policies_on_node === true) {
|
||||||
|
ui_print_warning_message(
|
||||||
|
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$name = '';
|
$name = '';
|
||||||
$id_command = '';
|
$id_command = '';
|
||||||
$group = 0;
|
$group = 0;
|
||||||
// All group is 0
|
|
||||||
$action_threshold = 0;
|
$action_threshold = 0;
|
||||||
// All group is 0
|
// All group is 0.
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$action = alerts_get_alert_action($id);
|
$action = alerts_get_alert_action($id);
|
||||||
$name = $action['name'];
|
$name = $action['name'];
|
||||||
|
@ -95,7 +103,7 @@ if ($id) {
|
||||||
$action_threshold = $action['action_threshold'];
|
$action_threshold = $action['action_threshold'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hidden div with help hint to fill with javascript
|
// Hidden div with help hint to fill with javascript.
|
||||||
html_print_div(
|
html_print_div(
|
||||||
[
|
[
|
||||||
'id' => 'help_alert_macros_hint',
|
'id' => 'help_alert_macros_hint',
|
||||||
|
@ -126,7 +134,26 @@ $table->size = [];
|
||||||
$table->size[0] = '20%';
|
$table->size[0] = '20%';
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
$table->data[0][0] = __('Name');
|
$table->data[0][0] = __('Name');
|
||||||
$table->data[0][1] = html_print_input_text('name', $name, '', 35, 255, true);
|
$table->data[0][1] = html_print_input_text(
|
||||||
|
'name',
|
||||||
|
$name,
|
||||||
|
'',
|
||||||
|
35,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
if (io_safe_output($name) == 'Monitoring Event') {
|
if (io_safe_output($name) == 'Monitoring Event') {
|
||||||
$table->data[0][1] .= ' '.ui_print_help_tip(
|
$table->data[0][1] .= ' '.ui_print_help_tip(
|
||||||
__('This action may stop working, if you change its name.'),
|
__('This action may stop working, if you change its name.'),
|
||||||
|
@ -141,7 +168,21 @@ $table->data[1][0] = __('Group');
|
||||||
|
|
||||||
$own_info = get_user_info($config['id_user']);
|
$own_info = get_user_info($config['id_user']);
|
||||||
|
|
||||||
$table->data[1][1] = html_print_select_groups(false, 'LW', true, 'group', $group, '', '', 0, true);
|
$table->data[1][1] = html_print_select_groups(
|
||||||
|
false,
|
||||||
|
'LW',
|
||||||
|
true,
|
||||||
|
'group',
|
||||||
|
$group,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
$table->colspan[1][1] = 2;
|
$table->colspan[1][1] = 2;
|
||||||
|
|
||||||
$table->data[2][0] = __('Command');
|
$table->data[2][0] = __('Command');
|
||||||
|
@ -163,10 +204,15 @@ $table->data[2][1] = html_print_select_from_sql(
|
||||||
'',
|
'',
|
||||||
__('None'),
|
__('None'),
|
||||||
0,
|
0,
|
||||||
true
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
$table->data[2][1] .= ' ';
|
$table->data[2][1] .= ' ';
|
||||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
if ($is_central_policies_on_node === false
|
||||||
|
&& check_acl($config['id_user'], 0, 'PM')
|
||||||
|
) {
|
||||||
$table->data[2][1] .= __('Create Command');
|
$table->data[2][1] .= __('Create Command');
|
||||||
$table->data[2][1] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
$table->data[2][1] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
||||||
$table->data[2][1] .= html_print_image('images/add.png', true);
|
$table->data[2][1] .= html_print_image('images/add.png', true);
|
||||||
|
@ -188,7 +234,7 @@ $table->data[3][1] = html_print_extended_select_for_time(
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
'',
|
'',
|
||||||
false,
|
$is_central_policies_on_node,
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
|
@ -251,46 +297,44 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||||
echo '<form method="post" action="'.'index.php?sec='.$sec.'&'.'sec2=godmode/alerts/alert_actions&'.'pure='.$pure.'">';
|
echo '<form method="post" action="'.'index.php?sec='.$sec.'&'.'sec2=godmode/alerts/alert_actions&'.'pure='.$pure.'">';
|
||||||
$table_html = html_print_table($table, true);
|
$table_html = html_print_table($table, true);
|
||||||
|
|
||||||
//
|
|
||||||
// Hack to hook the bubble dialog of clippy in any place, the intro.js
|
|
||||||
// fails with new elements in the dom from javascript code
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
$table_html = str_replace(
|
|
||||||
"</table>",
|
|
||||||
"</div>",
|
|
||||||
$table_html);
|
|
||||||
$table_html = str_replace(
|
|
||||||
'<tr id="table_macros-field1" style="" class="datos2">',
|
|
||||||
"</tbody></table>
|
|
||||||
<div id=\"clippy_fields\">
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
<tr id=\"table_macros-field1\" class=\"datos\">",
|
|
||||||
$table_html);
|
|
||||||
*/
|
|
||||||
//
|
|
||||||
echo $table_html;
|
echo $table_html;
|
||||||
|
if ($is_central_policies_on_node === false) {
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
if ($id) {
|
if ($id) {
|
||||||
html_print_input_hidden('id', $id);
|
html_print_input_hidden('id', $id);
|
||||||
if ($al_action['id_group'] == 0) {
|
if ($al_action['id_group'] == 0) {
|
||||||
// then must have "PM" access privileges
|
// Then must have "PM" access privileges.
|
||||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||||
|
html_print_input_hidden('update_action', 1);
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Update'),
|
||||||
|
'create',
|
||||||
|
false,
|
||||||
|
'class="sub upd"'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
html_print_input_hidden('update_action', 1);
|
html_print_input_hidden('update_action', 1);
|
||||||
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"');
|
html_print_submit_button(
|
||||||
|
__('Update'),
|
||||||
|
'create',
|
||||||
|
false,
|
||||||
|
'class="sub upd"'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
html_print_input_hidden('update_action', 1);
|
html_print_input_hidden('create_action', 1);
|
||||||
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"');
|
html_print_submit_button(
|
||||||
|
__('Create'),
|
||||||
|
'create',
|
||||||
|
false,
|
||||||
|
'class="sub wand"'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
html_print_input_hidden('create_action', 1);
|
echo '</div>';
|
||||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
enterprise_hook('close_meta_frame');
|
enterprise_hook('close_meta_frame');
|
||||||
|
|
|
@ -36,7 +36,7 @@ $pure = get_parameter('pure', 0);
|
||||||
$alert = [];
|
$alert = [];
|
||||||
|
|
||||||
// Header.
|
// Header.
|
||||||
if (defined('METACONSOLE')) {
|
if (is_metaconsole() === true) {
|
||||||
alerts_meta_print_header();
|
alerts_meta_print_header();
|
||||||
} else {
|
} else {
|
||||||
ui_print_page_header(
|
ui_print_page_header(
|
||||||
|
@ -135,30 +135,39 @@ if ($id) {
|
||||||
$fields_hidden = $alert['fields_hidden'];
|
$fields_hidden = $alert['fields_hidden'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($fields_descriptions)) {
|
if (empty($fields_descriptions) === false) {
|
||||||
$fields_descriptions = json_decode($fields_descriptions, true);
|
$fields_descriptions = json_decode($fields_descriptions, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($fields_values)) {
|
if (empty($fields_values) === false) {
|
||||||
$fields_values = json_decode($fields_values, true);
|
$fields_values = json_decode($fields_values, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($fields_hidden)) {
|
if (empty($fields_hidden) === false) {
|
||||||
$fields_hidden = json_decode($fields_hidden, true);
|
$fields_hidden = json_decode($fields_hidden, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$is_central_policies_on_node = is_central_policies_on_node();
|
||||||
|
|
||||||
|
if ($is_central_policies_on_node === true) {
|
||||||
|
ui_print_warning_message(
|
||||||
|
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filters';
|
||||||
|
|
||||||
if (defined('METACONSOLE')) {
|
if (is_metaconsole() === true) {
|
||||||
$table->head[0] = ($id) ? __('Update Command') : __('Create Command');
|
$table->head[0] = ($id) ? __('Update Command') : __('Create Command');
|
||||||
$table->head_colspan[0] = 4;
|
$table->head_colspan[0] = 4;
|
||||||
$table->headstyle[0] = 'text-align: center';
|
$table->headstyle[0] = 'text-align: center';
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->style = [];
|
$table->style = [];
|
||||||
if (!defined('METACONSOLE')) {
|
if (is_metaconsole() === false) {
|
||||||
$table->style[0] = 'font-weight: bold';
|
$table->style[0] = 'font-weight: bold';
|
||||||
$table->style[2] = 'font-weight: bold';
|
$table->style[2] = 'font-weight: bold';
|
||||||
$table->style[4] = 'font-weight: bold';
|
$table->style[4] = 'font-weight: bold';
|
||||||
|
@ -170,11 +179,38 @@ $table->data = [];
|
||||||
|
|
||||||
$table->colspan['name'][1] = 3;
|
$table->colspan['name'][1] = 3;
|
||||||
$table->data['name'][0] = __('Name');
|
$table->data['name'][0] = __('Name');
|
||||||
$table->data['name'][2] = html_print_input_text('name', $name, '', 35, 255, true);
|
$table->data['name'][2] = html_print_input_text(
|
||||||
|
'name',
|
||||||
|
$name,
|
||||||
|
'',
|
||||||
|
35,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
$table->colspan['command'][1] = 3;
|
$table->colspan['command'][1] = 3;
|
||||||
$table->data['command'][0] = __('Command');
|
$table->data['command'][0] = __('Command');
|
||||||
$table->data['command'][1] = html_print_textarea('command', 8, 30, $command, '', true);
|
$table->data['command'][1] = html_print_textarea(
|
||||||
|
'command',
|
||||||
|
8,
|
||||||
|
30,
|
||||||
|
$command,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
$table->colspan['group'][1] = 3;
|
$table->colspan['group'][1] = 3;
|
||||||
$table->data['group'][0] = __('Group');
|
$table->data['group'][0] = __('Group');
|
||||||
|
@ -187,60 +223,124 @@ $table->data['group'][1] = html_print_select_groups(
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
0,
|
0,
|
||||||
true
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->colspan['description'][1] = 3;
|
$table->colspan['description'][1] = 3;
|
||||||
$table->data['description'][0] = __('Description');
|
$table->data['description'][0] = __('Description');
|
||||||
$table->data['description'][1] = html_print_textarea('description', 10, 30, $description, '', true);
|
$table->data['description'][1] = html_print_textarea(
|
||||||
|
'description',
|
||||||
|
10,
|
||||||
|
30,
|
||||||
|
$description,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||||
$table->data['field'.$i][0] = sprintf(__('Field %s description'), $i);
|
$table->data['field'.$i][0] = sprintf(__('Field %s description'), $i);
|
||||||
|
|
||||||
if (!empty($fields_descriptions)) {
|
if (empty($fields_descriptions) === false) {
|
||||||
$field_description = $fields_descriptions[($i - 1)];
|
$field_description = $fields_descriptions[($i - 1)];
|
||||||
} else {
|
} else {
|
||||||
$field_description = '';
|
$field_description = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data['field'.$i][1] = html_print_input_text('field'.$i.'_description', $field_description, '', 30, 255, true);
|
$table->data['field'.$i][1] = html_print_input_text(
|
||||||
|
'field'.$i.'_description',
|
||||||
|
$field_description,
|
||||||
|
'',
|
||||||
|
30,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i).ui_print_help_tip(__('value1,tag1;value2,tag2;value3,tag3'), true);
|
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i);
|
||||||
|
$table->data['field'.$i][2] .= ui_print_help_tip(
|
||||||
|
__('value1,tag1;value2,tag2;value3,tag3'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
if (!empty($fields_values)) {
|
if (empty($fields_values) === false) {
|
||||||
$field_values = $fields_values[($i - 1)];
|
$field_values = $fields_values[($i - 1)];
|
||||||
} else {
|
} else {
|
||||||
$field_values = '';
|
$field_values = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($fields_hidden)) {
|
if (empty($fields_hidden) === false) {
|
||||||
$selected = (bool) $fields_hidden[($i - 1)];
|
$selected = (bool) $fields_hidden[($i - 1)];
|
||||||
} else {
|
} else {
|
||||||
$selected = false;
|
$selected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data['field'.$i][3] = html_print_input_text('field'.$i.'_values', $field_values, '', 55, 255, true, false, false, '', 'field_value');
|
$table->data['field'.$i][3] = html_print_input_text(
|
||||||
|
'field'.$i.'_values',
|
||||||
|
$field_values,
|
||||||
|
'',
|
||||||
|
55,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'field_value',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
$table->data['field'.$i][4] = __('Hide');
|
$table->data['field'.$i][4] = __('Hide');
|
||||||
|
|
||||||
$table->data['field'.$i][5] = html_print_checkbox_extended('field'.$i.'_hide', 1, $selected, false, 'cursor: \'pointer\'', 'class="hide_inputs"', true);
|
$table->data['field'.$i][5] = html_print_checkbox_extended(
|
||||||
|
'field'.$i.'_hide',
|
||||||
|
1,
|
||||||
|
$selected,
|
||||||
|
$is_central_policies_on_node,
|
||||||
|
'cursor: \'pointer\'',
|
||||||
|
'class="hide_inputs"',
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_commands&pure='.$pure.'">';
|
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_commands&pure='.$pure.'">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
if ($is_central_policies_on_node === false) {
|
||||||
if ($id) {
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
html_print_input_hidden('id', $id);
|
if ($id) {
|
||||||
html_print_input_hidden('update_command', 1);
|
html_print_input_hidden('id', $id);
|
||||||
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"');
|
html_print_input_hidden('update_command', 1);
|
||||||
} else {
|
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"');
|
||||||
html_print_input_hidden('create_command', 1);
|
} else {
|
||||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"');
|
html_print_input_hidden('create_command', 1);
|
||||||
|
html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"');
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
enterprise_hook('close_meta_frame');
|
enterprise_hook('close_meta_frame');
|
||||||
|
@ -251,20 +351,20 @@ $(document).ready (function () {
|
||||||
|
|
||||||
$(".hide_inputs").each(function(index) {
|
$(".hide_inputs").each(function(index) {
|
||||||
var $input_in_row = $(this).closest('tr').find('.field_value');
|
var $input_in_row = $(this).closest('tr').find('.field_value');
|
||||||
if($(this).is(':checked')) {
|
if($(this).is(':checked')) {
|
||||||
$input_in_row.prop('style', '-webkit-text-security: disc;');
|
$input_in_row.prop('style', '-webkit-text-security: disc;');
|
||||||
} else {
|
} else {
|
||||||
$input_in_row.prop('style', '');
|
$input_in_row.prop('style', '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".hide_inputs").click(function() {
|
$(".hide_inputs").click(function() {
|
||||||
var $input_in_row = $(this).closest('tr').find('.field_value');
|
var $input_in_row = $(this).closest('tr').find('.field_value');
|
||||||
if($(this).is(':checked')) {
|
if($(this).is(':checked')) {
|
||||||
$input_in_row.prop('style', '-webkit-text-security: disc;');
|
$input_in_row.prop('style', '-webkit-text-security: disc;');
|
||||||
} else {
|
} else {
|
||||||
$input_in_row.prop('style', '');
|
$input_in_row.prop('style', '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -363,7 +363,15 @@ function update_template($step)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// We set here the number of steps
|
$is_central_policies_on_node = is_central_policies_on_node();
|
||||||
|
|
||||||
|
if ($is_central_policies_on_node === true) {
|
||||||
|
ui_print_warning_message(
|
||||||
|
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We set here the number of steps.
|
||||||
define('LAST_STEP', 3);
|
define('LAST_STEP', 3);
|
||||||
|
|
||||||
$step = (int) get_parameter('step', 1);
|
$step = (int) get_parameter('step', 1);
|
||||||
|
@ -579,27 +587,74 @@ if ($step == 2) {
|
||||||
$show_matches = false;
|
$show_matches = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Firing conditions and events
|
// Firing conditions and events.
|
||||||
$table->colspan = [];
|
$table->colspan = [];
|
||||||
// $table->colspan[4][1] = 1;
|
|
||||||
$table->data[0][0] = __('Days of week');
|
$table->data[0][0] = __('Days of week');
|
||||||
$table->data[0][1] = __('Mon');
|
$table->data[0][1] = __('Mon');
|
||||||
$table->data[0][1] .= html_print_checkbox('monday', 1, $monday, true);
|
$table->data[0][1] .= html_print_checkbox(
|
||||||
|
'monday',
|
||||||
|
1,
|
||||||
|
$monday,
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
$table->data[0][1] .= __('Tue');
|
$table->data[0][1] .= __('Tue');
|
||||||
$table->data[0][1] .= html_print_checkbox('tuesday', 1, $tuesday, true);
|
$table->data[0][1] .= html_print_checkbox(
|
||||||
|
'tuesday',
|
||||||
|
1,
|
||||||
|
$tuesday,
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
$table->data[0][1] .= __('Wed');
|
$table->data[0][1] .= __('Wed');
|
||||||
$table->data[0][1] .= html_print_checkbox('wednesday', 1, $wednesday, true);
|
$table->data[0][1] .= html_print_checkbox(
|
||||||
|
'wednesday',
|
||||||
|
1,
|
||||||
|
$wednesday,
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
$table->data[0][1] .= __('Thu');
|
$table->data[0][1] .= __('Thu');
|
||||||
$table->data[0][1] .= html_print_checkbox('thursday', 1, $thursday, true);
|
$table->data[0][1] .= html_print_checkbox(
|
||||||
|
'thursday',
|
||||||
|
1,
|
||||||
|
$thursday,
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
$table->data[0][1] .= __('Fri');
|
$table->data[0][1] .= __('Fri');
|
||||||
$table->data[0][1] .= html_print_checkbox('friday', 1, $friday, true);
|
$table->data[0][1] .= html_print_checkbox(
|
||||||
|
'friday',
|
||||||
|
1,
|
||||||
|
$friday,
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
$table->data[0][1] .= __('Sat');
|
$table->data[0][1] .= __('Sat');
|
||||||
$table->data[0][1] .= html_print_checkbox('saturday', 1, $saturday, true);
|
$table->data[0][1] .= html_print_checkbox(
|
||||||
|
'saturday',
|
||||||
|
1,
|
||||||
|
$saturday,
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
$table->data[0][1] .= __('Sun');
|
$table->data[0][1] .= __('Sun');
|
||||||
$table->data[0][1] .= html_print_checkbox('sunday', 1, $sunday, true);
|
$table->data[0][1] .= html_print_checkbox(
|
||||||
|
'sunday',
|
||||||
|
1,
|
||||||
|
$sunday,
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
$table->data[0][2] = __('Use special days list');
|
$table->data[0][2] = __('Use special days list');
|
||||||
$table->data[0][3] = html_print_checkbox('special_day', 1, $special_day, true);
|
$table->data[0][3] = html_print_checkbox(
|
||||||
|
'special_day',
|
||||||
|
1,
|
||||||
|
$special_day,
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
$table->data[1][0] = __('Time from');
|
$table->data[1][0] = __('Time from');
|
||||||
$table->data[1][1] = html_print_input_text(
|
$table->data[1][1] = html_print_input_text(
|
||||||
|
@ -608,7 +663,18 @@ if ($step == 2) {
|
||||||
'',
|
'',
|
||||||
7,
|
7,
|
||||||
8,
|
8,
|
||||||
true
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
$table->data[1][2] = __('Time to');
|
$table->data[1][2] = __('Time to');
|
||||||
$table->data[1][3] = html_print_input_text(
|
$table->data[1][3] = html_print_input_text(
|
||||||
|
@ -617,7 +683,18 @@ if ($step == 2) {
|
||||||
'',
|
'',
|
||||||
7,
|
7,
|
||||||
8,
|
8,
|
||||||
true
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->colspan['threshold'][1] = 3;
|
$table->colspan['threshold'][1] = 3;
|
||||||
|
@ -629,7 +706,11 @@ if ($step == 2) {
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
true
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[3][0] = __('Min. number of alerts');
|
$table->data[3][0] = __('Min. number of alerts');
|
||||||
|
@ -639,11 +720,32 @@ if ($step == 2) {
|
||||||
'',
|
'',
|
||||||
5,
|
5,
|
||||||
7,
|
7,
|
||||||
true
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[3][2] = __('Reset counter for non-sustained alerts').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'), true);
|
$table->data[3][2] = __('Reset counter for non-sustained alerts');
|
||||||
$table->data[3][3] = html_print_checkbox('min_alerts_reset_counter', 1, $min_alerts_reset_counter, true);
|
$table->data[3][2] .= 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'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table->data[3][3] = html_print_checkbox(
|
||||||
|
'min_alerts_reset_counter',
|
||||||
|
1,
|
||||||
|
$min_alerts_reset_counter,
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
$table->data[4][0] = __('Max. number of alerts');
|
$table->data[4][0] = __('Max. number of alerts');
|
||||||
$table->data[4][1] = html_print_input_text(
|
$table->data[4][1] = html_print_input_text(
|
||||||
|
@ -652,39 +754,43 @@ if ($step == 2) {
|
||||||
'',
|
'',
|
||||||
5,
|
5,
|
||||||
7,
|
7,
|
||||||
true
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[4][2] = __('Disable event');
|
$table->data[4][2] = __('Disable event');
|
||||||
$table->data[4][3] = html_print_checkbox('disable_event', 1, $disable_event, true);
|
$table->data[4][3] = html_print_checkbox(
|
||||||
|
'disable_event',
|
||||||
|
1,
|
||||||
|
$disable_event,
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
$table->data[5][0] = __('Default action');
|
$table->data[5][0] = __('Default action');
|
||||||
$usr_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM', true)));
|
$usr_groups = implode(
|
||||||
switch ($config['dbtype']) {
|
',',
|
||||||
case 'mysql':
|
array_keys(users_get_groups($config['id_user'], 'LM', true))
|
||||||
case 'postgresql':
|
);
|
||||||
$sql_query = sprintf(
|
|
||||||
'
|
|
||||||
SELECT id, name
|
|
||||||
FROM talert_actions
|
|
||||||
WHERE id_group IN (%s)
|
|
||||||
ORDER BY name',
|
|
||||||
$usr_groups
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'oracle':
|
$sql_query = sprintf(
|
||||||
$sql_query = sprintf(
|
'
|
||||||
'
|
SELECT id, name
|
||||||
SELECT id,
|
FROM talert_actions
|
||||||
dbms_lob.substr(name,4000,1) AS nombre
|
WHERE id_group IN (%s)
|
||||||
FROM talert_actions
|
ORDER BY name',
|
||||||
WHERE id_group IN (%s)
|
$usr_groups
|
||||||
ORDER BY dbms_lob.substr(name,4000,1)',
|
);
|
||||||
$usr_groups
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->data[5][1] = html_print_select_from_sql(
|
$table->data[5][1] = html_print_select_from_sql(
|
||||||
$sql_query,
|
$sql_query,
|
||||||
|
@ -696,11 +802,12 @@ if ($step == 2) {
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
$is_central_policies_on_node,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
0
|
0
|
||||||
).ui_print_help_tip(
|
);
|
||||||
|
$table->data[5][1] .= ui_print_help_tip(
|
||||||
__('Unless they\'re left blank, the fields from the action will override those set on the template.'),
|
__('Unless they\'re left blank, the fields from the action will override those set on the template.'),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
@ -715,7 +822,9 @@ if ($step == 2) {
|
||||||
0,
|
0,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
$table->data[6][1] .= '<span id="matches_value" '.($show_matches ? '' : 'style="display: none"').'>';
|
$table->data[6][1] .= '<span id="matches_value" '.($show_matches ? '' : 'style="display: none"').'>';
|
||||||
$table->data[6][1] .= ' '.html_print_checkbox('matches_value', 1, $matches, true);
|
$table->data[6][1] .= ' '.html_print_checkbox('matches_value', 1, $matches, true);
|
||||||
|
@ -760,7 +869,7 @@ if ($step == 2) {
|
||||||
$table->data['value'][1] .= '</span>';
|
$table->data['value'][1] .= '</span>';
|
||||||
$table->colspan['value'][1] = 3;
|
$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] = __('Min.');
|
||||||
$table->data['min'][1] = html_print_input_text(
|
$table->data['min'][1] = html_print_input_text(
|
||||||
'min',
|
'min',
|
||||||
|
@ -798,25 +907,12 @@ if ($step == 2) {
|
||||||
$table->size[1] = '45%';
|
$table->size[1] = '45%';
|
||||||
$table->size[2] = '45%';
|
$table->size[2] = '45%';
|
||||||
|
|
||||||
// Alert recover
|
// Alert recover.
|
||||||
if (! $recovery_notify) {
|
if (! $recovery_notify) {
|
||||||
$table->cellstyle['label_fields'][2] = 'display:none;';
|
$table->cellstyle['label_fields'][2] = 'display:none;';
|
||||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||||
$table->cellstyle['field'.$i][2] = 'display:none;';
|
$table->cellstyle['field'.$i][2] = 'display:none;';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
$table->cellstyle['field1'][2] = 'display:none;';
|
|
||||||
$table->cellstyle['field2'][2] = 'display:none;';
|
|
||||||
$table->cellstyle['field3'][2] = 'display:none;';
|
|
||||||
$table->cellstyle['field4'][2] = 'display:none;';
|
|
||||||
$table->cellstyle['field5'][2] = 'display:none;';
|
|
||||||
$table->cellstyle['field6'][2] = 'display:none;';
|
|
||||||
$table->cellstyle['field7'][2] = 'display:none;';
|
|
||||||
$table->cellstyle['field8'][2] = 'display:none;';
|
|
||||||
$table->cellstyle['field9'][2] = 'display:none;';
|
|
||||||
$table->cellstyle['field10'][2] = 'display:none;';
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[0][0] = __('Alert recovery');
|
$table->data[0][0] = __('Alert recovery');
|
||||||
|
@ -833,7 +929,9 @@ if ($step == 2) {
|
||||||
'',
|
'',
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
$table->colspan[0][1] = 2;
|
$table->colspan[0][1] = 2;
|
||||||
|
|
||||||
|
@ -842,45 +940,98 @@ if ($step == 2) {
|
||||||
$table->data['label_fields'][2] = __('Recovery fields');
|
$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])) {
|
if (isset($template[$name]) === true) {
|
||||||
$value = $template[$name];
|
$value = $template[$name];
|
||||||
} else {
|
} else {
|
||||||
$value = '';
|
$value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// $table->rowclass['field'.$i] = 'row_field';
|
|
||||||
$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 style="padding: 4px 0px;"><b><small>';
|
$table->data['field'.$i][1] = '<div style="padding: 4px 0px;"><b><small>';
|
||||||
$table->data['field'.$i][1] .= __('Basic').' ';
|
$table->data['field'.$i][1] .= __('Basic').' ';
|
||||||
$table->data['field'.$i][1] .= html_print_radio_button_extended('editor_type_value_'.$i, 0, '', false, false, "removeTinyMCE('textarea_field".$i."')", '', true);
|
$table->data['field'.$i][1] .= html_print_radio_button_extended(
|
||||||
// Advanced
|
'editor_type_value_'.$i,
|
||||||
$table->data['field'.$i][1] .= ' ';
|
0,
|
||||||
$table->data['field'.$i][1] .= __('Advanced').' ';
|
'',
|
||||||
$table->data['field'.$i][1] .= html_print_radio_button_extended('editor_type_value_'.$i, 0, '', true, false, "addTinyMCE('textarea_field".$i."')", '', true);
|
false,
|
||||||
$table->data['field'.$i][1] .= '</small></b></div>';
|
$is_central_policies_on_node,
|
||||||
|
"removeTinyMCE('textarea_field".$i."')",
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
// Advanced.
|
||||||
|
$table->data['field'.$i][1] .= ' ';
|
||||||
|
$table->data['field'.$i][1] .= __('Advanced').' ';
|
||||||
|
$table->data['field'.$i][1] .= html_print_radio_button_extended(
|
||||||
|
'editor_type_value_'.$i,
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node,
|
||||||
|
"addTinyMCE('textarea_field".$i."')",
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table->data['field'.$i][1] .= '</small></b></div>';
|
||||||
|
|
||||||
// Texarea
|
// Texarea.
|
||||||
$table->data['field'.$i][1] .= html_print_textarea('field'.$i, 1, 1, isset($fields[$i]) ? $fields[$i] : '', 'style="min-height:40px;" class="fields"', true);
|
$table->data['field'.$i][1] .= html_print_textarea(
|
||||||
|
'field'.$i,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
isset($fields[$i]) ? $fields[$i] : '',
|
||||||
|
'style="min-height:40px;" class="fields"',
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
// Recovery
|
// Recovery.
|
||||||
// basic
|
// Basic.
|
||||||
$table->data['field'.$i][2] = '<div style="padding: 4px 0px;"><b><small>';
|
$table->data['field'.$i][2] = '<div style="padding: 4px 0px;"><b><small>';
|
||||||
$table->data['field'.$i][2] .= __('Basic').' ';
|
$table->data['field'.$i][2] .= __('Basic').' ';
|
||||||
$table->data['field'.$i][2] .= html_print_radio_button_extended('editor_type_recovery_value_'.$i, 0, '', false, false, "removeTinyMCE('textarea_field".$i."_recovery')", '', true);
|
$table->data['field'.$i][2] .= html_print_radio_button_extended(
|
||||||
// advanced
|
'editor_type_recovery_value_'.$i,
|
||||||
$table->data['field'.$i][2] .= ' ';
|
0,
|
||||||
$table->data['field'.$i][2] .= __('Advanced').' ';
|
'',
|
||||||
$table->data['field'.$i][2] .= html_print_radio_button_extended('editor_type_recovery_value_'.$i, 0, '', true, false, "addTinyMCE('textarea_field".$i."_recovery')", '', true);
|
false,
|
||||||
$table->data['field'.$i][2] .= '</small></b></div>';
|
$is_central_policies_on_node,
|
||||||
|
"removeTinyMCE('textarea_field".$i."_recovery')",
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
// Advanced.
|
||||||
|
$table->data['field'.$i][2] .= ' ';
|
||||||
|
$table->data['field'.$i][2] .= __('Advanced').' ';
|
||||||
|
$table->data['field'.$i][2] .= html_print_radio_button_extended(
|
||||||
|
'editor_type_recovery_value_'.$i,
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
$is_central_policies_on_node,
|
||||||
|
"addTinyMCE('textarea_field".$i."_recovery')",
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$table->data['field'.$i][2] .= '</small></b></div>';
|
||||||
|
|
||||||
// Texarea
|
// Texarea.
|
||||||
$table->data['field'.$i][2] .= html_print_textarea('field'.$i.'_recovery', 1, 1, isset($fields_recovery[$i]) ? $fields_recovery[$i] : '', 'style="min-height:40px" class="fields"', true);
|
$table->data['field'.$i][2] .= html_print_textarea(
|
||||||
|
'field'.$i.'_recovery',
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
isset($fields_recovery[$i]) ? $fields_recovery[$i] : '',
|
||||||
|
'style="min-height:40px" class="fields"',
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Step 1 by default
|
// Step 1 by default.
|
||||||
$table->size = [];
|
$table->size = [];
|
||||||
$table->size[0] = '20%';
|
$table->size[0] = '20%';
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
@ -916,20 +1067,53 @@ if ($step == 2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[0][0] = __('Name');
|
$table->data[0][0] = __('Name');
|
||||||
$table->data[0][1] = html_print_input_text('name', $name, '', 35, 255, true);
|
$table->data[0][1] = html_print_input_text(
|
||||||
|
'name',
|
||||||
|
$name,
|
||||||
|
'',
|
||||||
|
35,
|
||||||
|
255,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
$table->data[0][1] .= ' '.__('Group');
|
$table->data[0][1] .= ' '.__('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']);
|
||||||
// Only display group "All" if user is administrator or has "PM" privileges
|
// Only display group "All" if user is administrator or has "PM" privileges.
|
||||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||||
$display_all_group = true;
|
$display_all_group = true;
|
||||||
} else {
|
} else {
|
||||||
$display_all_group = false;
|
$display_all_group = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[0][1] .= ' '.html_print_select_groups(false, 'AR', $display_all_group, 'id_group', $id_group, '', '', 0, true);
|
$table->data[0][1] .= ' ';
|
||||||
|
$table->data[0][1] .= html_print_select_groups(
|
||||||
|
false,
|
||||||
|
'AR',
|
||||||
|
$display_all_group,
|
||||||
|
'id_group',
|
||||||
|
$id_group,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
$table->data[1][0] = __('Description');
|
$table->data[1][0] = __('Description');
|
||||||
|
@ -939,7 +1123,9 @@ if ($step == 2) {
|
||||||
30,
|
30,
|
||||||
$description,
|
$description,
|
||||||
'',
|
'',
|
||||||
true
|
true,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[2][0] = __('Priority');
|
$table->data[2][0] = __('Priority');
|
||||||
|
@ -952,7 +1138,9 @@ if ($step == 2) {
|
||||||
0,
|
0,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
'',
|
||||||
|
$is_central_policies_on_node
|
||||||
);
|
);
|
||||||
|
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
|
@ -1000,25 +1188,32 @@ if (!$create_alert && !$create_template) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$disabled) {
|
if (!$disabled) {
|
||||||
if ($step >= LAST_STEP) {
|
if ($is_central_policies_on_node === false) {
|
||||||
html_print_submit_button(__('Finish'), 'finish', false, 'class="sub upd"');
|
if ($step >= LAST_STEP) {
|
||||||
} else {
|
|
||||||
html_print_input_hidden('step', ($step + 1));
|
|
||||||
if ($step == 2) {
|
|
||||||
// Javascript onsubmit to avoid min = 0 and max = 0
|
|
||||||
html_print_submit_button(
|
html_print_submit_button(
|
||||||
__('Next'),
|
__('Finish'),
|
||||||
'next',
|
'finish',
|
||||||
false,
|
false,
|
||||||
'class="sub next" onclick="return check_fields_step2();"'
|
'class="sub upd"'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
html_print_submit_button(
|
html_print_input_hidden('step', ($step + 1));
|
||||||
__('Next'),
|
if ($step == 2) {
|
||||||
'next',
|
// Javascript onsubmit to avoid min = 0 and max = 0
|
||||||
false,
|
html_print_submit_button(
|
||||||
'class="sub next"'
|
__('Next'),
|
||||||
);
|
'next',
|
||||||
|
false,
|
||||||
|
'class="sub next" onclick="return check_fields_step2();"'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
html_print_submit_button(
|
||||||
|
__('Next'),
|
||||||
|
'next',
|
||||||
|
false,
|
||||||
|
'class="sub next"'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1833,13 +1833,14 @@ function html_print_input_text_extended(
|
||||||
$alt,
|
$alt,
|
||||||
$size,
|
$size,
|
||||||
$maxlength,
|
$maxlength,
|
||||||
$disabled,
|
$readonly,
|
||||||
$script,
|
$script,
|
||||||
$attributes,
|
$attributes,
|
||||||
$return=false,
|
$return=false,
|
||||||
$password=false,
|
$password=false,
|
||||||
$function='',
|
$function='',
|
||||||
$autocomplete='off'
|
$autocomplete='off',
|
||||||
|
$disabled=false
|
||||||
) {
|
) {
|
||||||
static $idcounter = 0;
|
static $idcounter = 0;
|
||||||
|
|
||||||
|
@ -1895,10 +1896,14 @@ function html_print_input_text_extended(
|
||||||
|
|
||||||
$output = '<input '.($password ? 'type="password" autocomplete="'.$autocomplete.'" ' : 'type="text" ');
|
$output = '<input '.($password ? 'type="password" autocomplete="'.$autocomplete.'" ' : 'type="text" ');
|
||||||
|
|
||||||
if ($disabled && (!is_array($attributes) || !array_key_exists('disabled', $attributes))) {
|
if ($readonly && (!is_array($attributes) || !array_key_exists('readonly', $attributes))) {
|
||||||
$output .= 'readonly="readonly" ';
|
$output .= 'readonly="readonly" ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($disabled && (!is_array($attributes) || !array_key_exists('disabled', $attributes))) {
|
||||||
|
$output .= 'disabled="disabled" ';
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($attributes)) {
|
if (is_array($attributes)) {
|
||||||
foreach ($attributes as $attribute => $attr_value) {
|
foreach ($attributes as $attribute => $attr_value) {
|
||||||
if (! in_array($attribute, $valid_attrs)) {
|
if (! in_array($attribute, $valid_attrs)) {
|
||||||
|
@ -2102,7 +2107,7 @@ function html_print_input_text(
|
||||||
$size=50,
|
$size=50,
|
||||||
$maxlength=255,
|
$maxlength=255,
|
||||||
$return=false,
|
$return=false,
|
||||||
$disabled=false,
|
$readonly=false,
|
||||||
$required=false,
|
$required=false,
|
||||||
$function='',
|
$function='',
|
||||||
$class='',
|
$class='',
|
||||||
|
@ -2111,7 +2116,8 @@ function html_print_input_text(
|
||||||
$autofocus=false,
|
$autofocus=false,
|
||||||
$onKeyDown='',
|
$onKeyDown='',
|
||||||
$formTo='',
|
$formTo='',
|
||||||
$onKeyUp=''
|
$onKeyUp='',
|
||||||
|
$disabled=false
|
||||||
) {
|
) {
|
||||||
if ($maxlength == 0) {
|
if ($maxlength == 0) {
|
||||||
$maxlength = 255;
|
$maxlength = 255;
|
||||||
|
@ -2163,12 +2169,14 @@ function html_print_input_text(
|
||||||
$alt,
|
$alt,
|
||||||
$size,
|
$size,
|
||||||
$maxlength,
|
$maxlength,
|
||||||
$disabled,
|
$readonly,
|
||||||
'',
|
'',
|
||||||
$attr,
|
$attr,
|
||||||
$return,
|
$return,
|
||||||
false,
|
false,
|
||||||
$function
|
$function,
|
||||||
|
'off',
|
||||||
|
$disabled
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2661,8 +2669,16 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
|
||||||
*
|
*
|
||||||
* @return string HTML code if return parameter is true.
|
* @return string HTML code if return parameter is true.
|
||||||
*/
|
*/
|
||||||
function html_print_textarea($name, $rows, $columns, $value='', $attributes='', $return=false, $class='', $disable=false)
|
function html_print_textarea(
|
||||||
{
|
$name,
|
||||||
|
$rows,
|
||||||
|
$columns,
|
||||||
|
$value='',
|
||||||
|
$attributes='',
|
||||||
|
$return=false,
|
||||||
|
$class='',
|
||||||
|
$disable=false
|
||||||
|
) {
|
||||||
$disabled = ($disable) ? 'disabled' : '';
|
$disabled = ($disable) ? 'disabled' : '';
|
||||||
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' class="'.$class.'" '.$disabled.'>';
|
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' class="'.$class.'" '.$disabled.'>';
|
||||||
$output .= ($value);
|
$output .= ($value);
|
||||||
|
|
Loading…
Reference in New Issue