From 2450b3176d0fa69b6ee3a43619802e11fad368d9 Mon Sep 17 00:00:00 2001 From: vgilc Date: Wed, 5 Sep 2012 14:45:46 +0000 Subject: [PATCH] 2012-09-05 Vanessa Gil * godmode/agentes/module_manager.php godmode/modules/manage_network_components.php godmode/modules/manage_network_components_form.php: Add button to create a network component from module. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6934 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 +++ pandora_console/general/header.php | 5 ++- .../godmode/agentes/module_manager.php | 10 ++++- .../modules/manage_network_components.php | 4 +- .../manage_network_components_form.php | 45 ++++++++++++++++++- 5 files changed, 66 insertions(+), 5 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 516b0a9f99..d000aecc7d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2012-09-05 Vanessa Gil + + * godmode/agentes/module_manager.php + godmode/modules/manage_network_components.php + godmode/modules/manage_network_components_form.php: Add button + to create a network component from module. + 2012-09-05 Vanessa Gil * general/header.php diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 2ec0121988..e927b46ccd 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -137,7 +137,10 @@ config_check(); echo ' ('.date ("i:s", $config["refr"]).')'; echo ''; } else { - + + if (!isset($_GET['sec2'])) + $_GET['sec2'] = ''; + if (($config['refr']) && (($_GET['sec2'] == 'operation/agentes/tactical') || ($_GET['sec2'] == 'operation/agentes/estado_agente') || ($_GET['sec2'] == 'operation/agentes/group_view') || ($_GET['sec2'] == 'operation/events/events') || ($_GET['sec2'] == 'enterprise/dashboard/main_dashboard'))) { diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index c2c6fbde01..797a84f4d3 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -428,7 +428,7 @@ $table->style = array (); $table->style[0] = 'font-weight: bold'; $table->size = array (); $table->size[2] = '55px'; -$table->size[8] = '100px'; +$table->size[8] = '120px'; $table->align = array (); $table->align[2] = 'center'; $table->align[8] = 'left'; @@ -590,6 +590,14 @@ foreach ($modules as $module) { $data[8] .= ''; } } + //create network component action + if (is_user_admin($config['id_user'])) { + $data[8] .= ' '; + $data[8] .= html_print_image ('images/network.png', true, + array ('title' => __('Create network component'))); + $data[8] .= ' '; + } array_push ($table->data, $data); } diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 9a56094135..f1187a050e 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -91,6 +91,7 @@ $new_component = (bool) get_parameter ('new_component'); $duplicate_network_component = (bool) get_parameter ('duplicate_network_component'); $delete_multiple = (bool) get_parameter('delete_multiple'); $multiple_delete = (bool)get_parameter('multiple_delete', 0); +$create_network_from_module = (bool) get_parameter ('create_network_from_module', 0); if ($duplicate_network_component) { $source_id = (int) get_parameter ('source_id'); @@ -300,7 +301,7 @@ if ($multiple_delete) { $id = 0; } -if ($id || $new_component) { +if ($id || $new_component || $create_network_from_module) { include_once ('godmode/modules/manage_network_components_form.php'); return; } @@ -441,7 +442,6 @@ else { echo "
".__('There are no defined network components')."
"; } - echo '
'; echo '
'; html_print_input_hidden ('new_component', 1); diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index acc269b970..422e5ff53e 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -25,7 +25,49 @@ if (! check_acl ($config['id_user'], 0, "PM")) { exit; } +$create_network_from_module = get_parameter('create_network_from_module'); + +if ($create_network_from_module) { + + $id_agentmodule = get_parameter('create_module_from'); + $data_module = db_get_row_filter('tagente_modulo', array ('id_agente_modulo' => $id_agentmodule)); + + $name = $data_module["nombre"]; + $description = $data_module["descripcion"]; + $max = $data_module["max"]; + $min = $data_module["min"]; + $module_interval = $data_module["module_interval"]; + $tcp_port = $data_module["tcp_port"]; + $tcp_rcv = $data_module["tcp_rcv"]; + $tcp_send = $data_module["tcp_send"]; + $snmp_community = $data_module["snmp_community"]; + $snmp_oid = $data_module["snmp_oid"]; + $id_module_group = $data_module["id_module_group"]; + $id_plugin = $data_module["id_plugin"]; + $plugin_user = $data_module["plugin_user"]; + $plugin_pass = $data_module["plugin_pass"]; + $plugin_parameter = $data_module["plugin_parameter"]; + $macros = $data_module["macros"]; + $max_timeout = $data_module["max_timeout"]; + $min_warning = $data_module["min_warning"]; + $max_warning = $data_module["max_warning"]; + $str_warning = $data_module["str_warning"]; + $max_critical = $data_module["max_critical"]; + $min_critical = $data_module["min_critical"]; + $str_critical = $data_module["str_critical"]; + $ff_event = $data_module["min_ff_event"]; + $history_data = $data_module["history_data"]; + $post_process = $data_module["post_process"]; + $unit = $data_module["unit"]; + $wizard_level = $data_module["wizard_level"]; + +} + $id_component_type = (int) get_parameter ('id_component_type'); +if ($create_network_from_module) { + $id_component_type = 2; +} + if (isset ($id)) { $component = network_components_get_network_component ((int) $id); if ($component !== false) { @@ -135,7 +177,7 @@ else if ($id_component_type == 4) { require ("godmode/modules/manage_network_components_form_common.php"); require ("godmode/modules/manage_network_components_form_plugin.php"); } -else if ($id_component_type == 2) { +else if ($id_component_type == 2 || $create_network_from_module) { $categories = array (3, 4, 5); require ("godmode/modules/manage_network_components_form_common.php"); require ("godmode/modules/manage_network_components_form_network.php"); @@ -164,6 +206,7 @@ if ($id) { } else { html_print_input_hidden ('create_component', 1); + html_print_input_hidden ('create_network_from_module', 0); html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"'); } echo '
';