2012-04-04 Sergio Martin <sergio.martin@artica.es>

* godmode/massive/massive_edit_agents.php
	godmode/massive/massive_edit_modules.php: Fixed several bugs 
	like fields without "no change" value, change a nosense radio 
	button by a checkbox, add the snmp v3 fields to the edit modules 
	form, etc.
	Merged from 4.0



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5899 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2012-04-04 12:58:46 +00:00
parent 221f918fc8
commit 3508598a4c
3 changed files with 89 additions and 45 deletions

View File

@ -1,3 +1,12 @@
2012-04-04 Sergio Martin <sergio.martin@artica.es>
* godmode/massive/massive_edit_agents.php
godmode/massive/massive_edit_modules.php: Fixed several bugs
like fields without "no change" value, change a nosense radio
button by a checkbox, add the snmp v3 fields to the edit modules
form, etc.
Merged from 4.0
2012-04-04 Juan Manuel Ramon <juanmanuel.ramon@artica.es> 2012-04-04 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/javascript/pandora_modules.js * include/javascript/pandora_modules.js
@ -10,8 +19,8 @@
2012-04-04 Dario Rodriguez <dario.rodriguez@artica.es> 2012-04-04 Dario Rodriguez <dario.rodriguez@artica.es>
* extensions/update_manager.php: Moved from gsetup * extensions/update_manager.php: Moved from gsetup
to extensions menu to extensions menu
2012-04-04 Dario Rodriguez <dario.rodriguez@artica.es> 2012-04-04 Dario Rodriguez <dario.rodriguez@artica.es>

View File

@ -33,7 +33,6 @@ require_once ('include/functions_users.php');
if (is_ajax ()) { if (is_ajax ()) {
$get_n_conf_files = (bool) get_parameter ('get_n_conf_files'); $get_n_conf_files = (bool) get_parameter ('get_n_conf_files');
if ($get_n_conf_files) { if ($get_n_conf_files) {
$id_agents = get_parameter('id_agents'); $id_agents = get_parameter('id_agents');
$cont = 0; $cont = 0;
@ -43,7 +42,7 @@ if (is_ajax ()) {
if (file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5")) if (file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5"))
$cont ++; $cont ++;
} }
echo $cont;
return; return;
} }
} }
@ -55,7 +54,7 @@ if ($update_agents) {
$values = array(); $values = array();
if (get_parameter ('group', '') != -1) if (get_parameter ('group', '') != -1)
$values['id_grupo'] = get_parameter ('group'); $values['id_grupo'] = get_parameter ('group');
if (get_parameter ('interval', '') != '') if (get_parameter ('interval', 0) != 0)
$values['intervalo'] = get_parameter ('interval'); $values['intervalo'] = get_parameter ('interval');
if (get_parameter ('id_os', '') != -1) if (get_parameter ('id_os', '') != -1)
$values['id_os'] = get_parameter ('id_os'); $values['id_os'] = get_parameter ('id_os');
@ -247,7 +246,7 @@ $table->data[1][1] = html_print_select_groups(false, "AR", false, 'group', $grou
$table->data[2][0] = __('Interval'); $table->data[2][0] = __('Interval');
$table->data[2][1] = html_print_extended_select_for_time ('interval', $interval, '', '', '0', 10, true, 'width: 150px'); $table->data[2][1] = html_print_extended_select_for_time ('interval', 0, '', __('No change'), '0', 10, true, 'width: 150px');
$table->data[3][0] = __('OS'); $table->data[3][0] = __('OS');
$table->data[3][1] = html_print_select_from_sql ('SELECT id_os, name FROM tconfig_os', $table->data[3][1] = html_print_select_from_sql ('SELECT id_os, name FROM tconfig_os',
@ -309,7 +308,7 @@ $table->data[3][0] = __('Remote configuration');
// Delete remote configuration // Delete remote configuration
$table->data[3][1] = '<div id="delete_configurations" style="display: none">'. __('Delete available remote configurations').' ('; $table->data[3][1] = '<div id="delete_configurations" style="display: none">'. __('Delete available remote configurations').' (';
$table->data[3][1] .= '<span id="n_configurations"></span>'; $table->data[3][1] .= '<span id="n_configurations"></span>';
$table->data[3][1] .= ') '.html_print_radio_button_extended ("delete_conf", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true).'</div>'; $table->data[3][1] .= ') '.html_print_checkbox_extended ("delete_conf", 1, 0, false, '', 'style="margin-right: 40px;"', true).'</div>';
$table->data[3][1] .= '<div id="not_available_configurations" style="display: none"><em>'.__('Not available').'</em></div>'; $table->data[3][1] .= '<div id="not_available_configurations" style="display: none"><em>'.__('Not available').'</em></div>';
@ -338,7 +337,7 @@ else {
} }
$table->data[4][0] = __('Agent icon'); $table->data[4][0] = __('Agent icon');
$table->data[4][1] = html_print_select($arraySelectIcon, "icon_path", $icon_path, "changeIcons();", __('None'), '', true) . $table->data[4][1] = html_print_select($arraySelectIcon, "icon_path", $icon_path, "changeIcons();", __('No change'), '', true) .
'&nbsp;' . __('Without status') . ': ' . html_print_image($path_without, true, array("id" => 'icon_without_status',"style" => 'display:'.$display_icons.';')) . '&nbsp;' . __('Without status') . ': ' . html_print_image($path_without, true, array("id" => 'icon_without_status',"style" => 'display:'.$display_icons.';')) .
'&nbsp;' . __('Default') . ': ' . html_print_image($path_default, true, array("id" => 'icon_default',"style" => 'display:'.$display_icons.';')) . '&nbsp;' . __('Default') . ': ' . html_print_image($path_default, true, array("id" => 'icon_default',"style" => 'display:'.$display_icons.';')) .
'&nbsp;' . __('Ok') . ': ' . html_print_image($path_ok, true, array("id" => 'icon_ok',"style" => 'display:'.$display_icons.';')) . '&nbsp;' . __('Ok') . ': ' . html_print_image($path_ok, true, array("id" => 'icon_ok',"style" => 'display:'.$display_icons.';')) .
@ -413,38 +412,6 @@ ui_require_jquery_file ('autocomplete');
//Use this function for change 3 icons when change the selectbox //Use this function for change 3 icons when change the selectbox
$(document).ready (function () { $(document).ready (function () {
function changeIcons() {
icon = $("#icon_path :selected").val();
$("#icon_without_status").attr("src", "images/spinner.png");
$("#icon_default").attr("src", "images/spinner.png");
$("#icon_ok").attr("src", "images/spinner.png");
$("#icon_bad").attr("src", "images/spinner.png");
$("#icon_warning").attr("src", "images/spinner.png");
if (icon.length == 0) {
$("#icon_without_status").attr("style", "display:none;");
$("#icon_default").attr("style", "display:none;");
$("#icon_ok").attr("style", "display:none;");
$("#icon_bad").attr("style", "display:none;");
$("#icon_warning").attr("style", "display:none;");
}
else {
$("#icon_without_status").attr("src", "<?php echo $path; ?>" + icon + ".default.png");
$("#icon_default").attr("src", "<?php echo $path; ?>" + icon + ".default.png");
$("#icon_ok").attr("src", "<?php echo $path; ?>" + icon + ".ok.png");
$("#icon_bad").attr("src", "<?php echo $path; ?>" + icon + ".bad.png");
$("#icon_warning").attr("src", "<?php echo $path; ?>" + icon + ".warning.png");
$("#icon_without_status").attr("style", "");
$("#icon_default").attr("style", "");
$("#icon_ok").attr("style", "");
$("#icon_bad").attr("style", "");
$("#icon_warning").attr("style", "");
}
//$("#icon_default").attr("src", "<?php echo $path; ?>" + icon +
}
function get_n_conf_files(idAgents) { function get_n_conf_files(idAgents) {
} }
@ -454,7 +421,6 @@ $(document).ready (function () {
jQuery.each ($("#id_agents option:selected"), function (i, val) { jQuery.each ($("#id_agents option:selected"), function (i, val) {
idAgents.push($(val).val()); idAgents.push($(val).val());
}); });
jQuery.post ("ajax.php", jQuery.post ("ajax.php",
{"page" : "godmode/massive/massive_edit_agents", {"page" : "godmode/massive/massive_edit_agents",
"get_n_conf_files" : 1, "get_n_conf_files" : 1,
@ -522,4 +488,36 @@ $(document).ready (function () {
recursion: function() {return recursion} recursion: function() {return recursion}
}); });
}); });
function changeIcons() {
icon = $("#icon_path :selected").val();
$("#icon_without_status").attr("src", "images/spinner.png");
$("#icon_default").attr("src", "images/spinner.png");
$("#icon_ok").attr("src", "images/spinner.png");
$("#icon_bad").attr("src", "images/spinner.png");
$("#icon_warning").attr("src", "images/spinner.png");
if (icon.length == 0) {
$("#icon_without_status").attr("style", "display:none;");
$("#icon_default").attr("style", "display:none;");
$("#icon_ok").attr("style", "display:none;");
$("#icon_bad").attr("style", "display:none;");
$("#icon_warning").attr("style", "display:none;");
}
else {
$("#icon_without_status").attr("src", "<?php echo $path; ?>" + icon + ".default.png");
$("#icon_default").attr("src", "<?php echo $path; ?>" + icon + ".default.png");
$("#icon_ok").attr("src", "<?php echo $path; ?>" + icon + ".ok.png");
$("#icon_bad").attr("src", "<?php echo $path; ?>" + icon + ".bad.png");
$("#icon_warning").attr("src", "<?php echo $path; ?>" + icon + ".warning.png");
$("#icon_without_status").attr("style", "");
$("#icon_default").attr("style", "");
$("#icon_ok").attr("style", "");
$("#icon_bad").attr("style", "");
$("#icon_warning").attr("style", "");
}
//$("#icon_default").attr("src", "<?php echo $path; ?>" + icon +
}
</script> </script>

View File

@ -36,12 +36,27 @@ function process_manage_edit ($module_name, $agents_select = null) {
/* List of fields which can be updated */ /* List of fields which can be updated */
$fields = array ('min_warning', 'max_warning', 'str_warning', 'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'module_interval', $fields = array ('min_warning', 'max_warning', 'str_warning', 'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'module_interval',
'disabled', 'post_process', 'snmp_community', 'tcp_send', 'min', 'max', 'id_module_group', 'plugin_user', 'plugin_pass', 'id_export', 'history_data'); 'disabled', 'post_process', 'snmp_community', 'tcp_send', 'custom_string_1', 'plugin_parameter',
'custom_string_2', 'custom_string_3', 'min', 'max', 'id_module_group', 'plugin_user', 'plugin_pass', 'id_export', 'history_data');
$values = array (); $values = array ();
// Specific snmp reused fields
if(get_parameter ('tcp_send', '') == 3) {
$plugin_user_snmp = get_parameter ('plugin_user_snmp', '');
if($plugin_user_snmp != '') {
$values['plugin_user'] = $plugin_user_snmp;
}
$plugin_pass_snmp = get_parameter ('plugin_pass_snmp', '');
if($plugin_pass_snmp != '') {
$values['plugin_pass'] = $plugin_pass_snmp;
}
}
foreach ($fields as $field) { foreach ($fields as $field) {
$value = get_parameter ($field, ''); $value = get_parameter ($field, '');
if ($value != '') if ($value != '') {
$values[$field] = $value; $values[$field] = $value;
}
} }
if (strlen(get_parameter('history_data')) > 0) { if (strlen(get_parameter('history_data')) > 0) {
@ -339,6 +354,19 @@ $table->data['edit35'][0] = '';
$table->data['edit35'][1] = ''; $table->data['edit35'][1] = '';
$table->data['edit35'][2] = __('SNMP version'); $table->data['edit35'][2] = __('SNMP version');
$table->data['edit35'][3] = html_print_select ($snmp_versions, 'tcp_send', '', '', __('No change'), '', true, false, false, ''); $table->data['edit35'][3] = html_print_select ($snmp_versions, 'tcp_send', '', '', __('No change'), '', true, false, false, '');
$table->data['edit36'][0] = __('Auth user');
$table->data['edit36'][1] = html_print_input_text ('plugin_user_snmp', '', '', 15, 60, true);
$table->data['edit36'][2] = __('Auth password') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
$table->data['edit36'][3] = html_print_input_text ('plugin_pass_snmp', '', '', 15, 60, true);
$table->data['edit37'][0] = __('Privacy method');
$table->data['edit37'][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'custom_string_1', '', '', __('No change'), '', true);
$table->data['edit37'][2] = __('Privacy pass') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
$table->data['edit37'][3] = html_print_input_text ('custom_string_2', '', '', 15, 60, true);
$table->data['edit38'][0] = __('Auth method');
$table->data['edit38'][1] = html_print_select(array('MD5' => __('MD5'), 'SHA' => __('SHA')), 'plugin_parameter', '', '', __('No change'), '', true);
$table->data['edit38'][2] = __('Security level');
$table->data['edit38'][3] = html_print_select(array('noAuthNoPriv' => __('Not auth and not privacy method'),
'authNoPriv' => __('Auth and not privacy method'), 'authPriv' => __('Auth and privacy method')), 'custom_string_3', '', '', __('No change'), '', true);
$table->data['edit4'][0] = __('Value'); $table->data['edit4'][0] = __('Value');
$table->data['edit4'][1] = '<em>'.__('Min.').'</em>'; $table->data['edit4'][1] = '<em>'.__('Min.').'</em>';
@ -463,7 +491,7 @@ $(document).ready (function () {
); );
}); });
function show_form() { function show_form() {
$("td#delete_table-0-1, td#delete_table-edit1-1, td#delete_table-edit2-1").css ("width", "100%"); $("td#delete_table-0-1, td#delete_table-edit1-1, td#delete_table-edit2-1").css ("width", "300px");
$("#form_edit input[type=text]").attr ("value", ""); $("#form_edit input[type=text]").attr ("value", "");
$("#form_edit input[type=checkbox]").not ("#checkbox-recursion").removeAttr ("checked"); $("#form_edit input[type=checkbox]").not ("#checkbox-recursion").removeAttr ("checked");
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit35, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7, tr#delete_table-edit8").show (); $("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit35, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7, tr#delete_table-edit8").show ();
@ -474,7 +502,7 @@ $(document).ready (function () {
$("#module_name").html('<?php echo __('None'); ?>'); $("#module_name").html('<?php echo __('None'); ?>');
$("#agents").html('<?php echo __('None'); ?>'); $("#agents").html('<?php echo __('None'); ?>');
$("#module").html('<?php echo __('None'); ?>'); $("#module").html('<?php echo __('None'); ?>');
$("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit35, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7, tr#delete_table-edit8").hide (); $("tr#delete_table-edit1, tr#delete_table-edit2, tr#delete_table-edit3, tr#delete_table-edit35, tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38, tr#delete_table-edit4, tr#delete_table-edit5, tr#delete_table-edit6, tr#delete_table-edit7, tr#delete_table-edit8").hide ();
$('input[type=checkbox]').attr('checked', false); $('input[type=checkbox]').attr('checked', false);
$('input[type=checkbox]').attr('disabled', true); $('input[type=checkbox]').attr('disabled', true);
$('#module_type').val(-1); $('#module_type').val(-1);
@ -530,6 +558,15 @@ $(document).ready (function () {
} }
}); });
$('#tcp_send').change(function() {
if($(this).val() == 3) {
$("tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38").show();
}
else {
$("tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38").hide();
}
});
$("#groups_select").change ( $("#groups_select").change (
function () { function () {
$('input[type=checkbox]').attr('checked', false); $('input[type=checkbox]').attr('checked', false);