From 9c0997f2792fc06af8c74e798a14c8cf7b0a2a31 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Wed, 4 Apr 2012 12:58:46 +0000 Subject: [PATCH] 2012-04-04 Sergio Martin * 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 --- pandora_console/ChangeLog | 13 +++- .../godmode/massive/massive_edit_agents.php | 76 +++++++++---------- .../godmode/massive/massive_edit_modules.php | 45 ++++++++++- 3 files changed, 89 insertions(+), 45 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 7c0e220ef5..d9473d11ad 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2012-04-04 Sergio Martin + + * 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 * include/javascript/pandora_modules.js @@ -10,8 +19,8 @@ 2012-04-04 Dario Rodriguez - * extensions/update_manager.php: Moved from gsetup - to extensions menu + * extensions/update_manager.php: Moved from gsetup + to extensions menu 2012-04-04 Dario Rodriguez diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index 1e7942a34c..05f0a489fb 100644 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -33,7 +33,6 @@ require_once ('include/functions_users.php'); if (is_ajax ()) { $get_n_conf_files = (bool) get_parameter ('get_n_conf_files'); - if ($get_n_conf_files) { $id_agents = get_parameter('id_agents'); $cont = 0; @@ -43,7 +42,7 @@ if (is_ajax ()) { if (file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5")) $cont ++; } - + echo $cont; return; } } @@ -55,7 +54,7 @@ if ($update_agents) { $values = array(); if (get_parameter ('group', '') != -1) $values['id_grupo'] = get_parameter ('group'); - if (get_parameter ('interval', '') != '') + if (get_parameter ('interval', 0) != 0) $values['intervalo'] = get_parameter ('interval'); if (get_parameter ('id_os', '') != -1) $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][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][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 $table->data[3][1] = ''; +$table->data[3][1] .= ') '.html_print_checkbox_extended ("delete_conf", 1, 0, false, '', 'style="margin-right: 40px;"', true).''; $table->data[3][1] .= ''; @@ -338,7 +337,7 @@ else { } $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) . ' ' . __('Without status') . ': ' . html_print_image($path_without, true, array("id" => 'icon_without_status',"style" => 'display:'.$display_icons.';')) . ' ' . __('Default') . ': ' . html_print_image($path_default, true, array("id" => 'icon_default',"style" => 'display:'.$display_icons.';')) . ' ' . __('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 $(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", "" + icon + ".default.png"); - $("#icon_default").attr("src", "" + icon + ".default.png"); - $("#icon_ok").attr("src", "" + icon + ".ok.png"); - $("#icon_bad").attr("src", "" + icon + ".bad.png"); - $("#icon_warning").attr("src", "" + 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", "" + icon + - } - function get_n_conf_files(idAgents) { } @@ -454,7 +421,6 @@ $(document).ready (function () { jQuery.each ($("#id_agents option:selected"), function (i, val) { idAgents.push($(val).val()); }); - jQuery.post ("ajax.php", {"page" : "godmode/massive/massive_edit_agents", "get_n_conf_files" : 1, @@ -522,4 +488,36 @@ $(document).ready (function () { 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", "" + icon + ".default.png"); + $("#icon_default").attr("src", "" + icon + ".default.png"); + $("#icon_ok").attr("src", "" + icon + ".ok.png"); + $("#icon_bad").attr("src", "" + icon + ".bad.png"); + $("#icon_warning").attr("src", "" + 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", "" + icon + +} diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 85c8bf87bf..833146bc00 100644 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -36,12 +36,27 @@ function process_manage_edit ($module_name, $agents_select = null) { /* 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', - '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 (); + + // 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) { $value = get_parameter ($field, ''); - if ($value != '') + if ($value != '') { $values[$field] = $value; + } } if (strlen(get_parameter('history_data')) > 0) { @@ -339,6 +354,19 @@ $table->data['edit35'][0] = ''; $table->data['edit35'][1] = ''; $table->data['edit35'][2] = __('SNMP version'); $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'][1] = ''.__('Min.').''; @@ -463,7 +491,7 @@ $(document).ready (function () { ); }); 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=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 (); @@ -474,7 +502,7 @@ $(document).ready (function () { $("#module_name").html(''); $("#agents").html(''); $("#module").html(''); - $("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('disabled', true); $('#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 ( function () { $('input[type=checkbox]').attr('checked', false);