2012-09-05 Vanessa Gil <vanessa.gil@artica.es>

* 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
This commit is contained in:
vgilc 2012-09-05 14:45:46 +00:00
parent f33394789e
commit 2450b3176d
5 changed files with 66 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2012-09-05 Vanessa Gil <vanessa.gil@artica.es>
* 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 <vanessa.gil@artica.es>
* general/header.php

View File

@ -137,7 +137,10 @@ config_check();
echo ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)';
echo '</a>';
} 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'))) {

View File

@ -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] .= '</a>';
}
}
//create network component action
if (is_user_admin($config['id_user'])) {
$data[8] .= '&nbsp;<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create_network_from_module=1&id_agente='.$id_agente.'&create_module_from='.$module['id_agente_modulo'].'"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[8] .= html_print_image ('images/network.png', true,
array ('title' => __('Create network component')));
$data[8] .= '</a> ';
}
array_push ($table->data, $data);
}

View File

@ -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 "<div class='nf'>".__('There are no defined network components')."</div>";
}
echo '<form method="post" action="'.$url.'">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_input_hidden ('new_component', 1);

View File

@ -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 '</div>';