2009-09-21 Sancho Lerena <slerena@artica.es>
* include/functions_network_components.php, godmode/modules/manage_network_components.php: add icon duplicate (and necesary code...functions), that it's use for duplicate with easy the local components. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1967 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
f8e8bffe90
commit
237d76d92d
|
@ -1,3 +1,10 @@
|
|||
2009-09-21 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* include/functions_network_components.php,
|
||||
godmode/modules/manage_network_components.php: add icon duplicate (and
|
||||
necesary code...functions), that it's use for duplicate with easy the local
|
||||
components.
|
||||
|
||||
2009-09-21 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* install.php: Updated version in the main screen (2.0 > 3.0)
|
||||
|
|
|
@ -58,6 +58,23 @@ $create_component = (bool) get_parameter ('create_component');
|
|||
$update_component = (bool) get_parameter ('update_component');
|
||||
$delete_component = (bool) get_parameter ('delete_component');
|
||||
$new_component = (bool) get_parameter ('new_component');
|
||||
$duplicate_network_component = (bool) get_parameter ('duplicate_network_component');
|
||||
|
||||
if ($duplicate_network_component) {
|
||||
$source_id = (int) get_parameter ('source_id');
|
||||
|
||||
$id = duplicate_network_component ($source_id);
|
||||
print_result_message ($id,
|
||||
__('Successfully created from %s', get_network_component_name ($source_id)),
|
||||
__('Could not be created'));
|
||||
|
||||
//List unset for jump the bug in the pagination (TODO) that the make another
|
||||
//copy for each pass into pages.
|
||||
unset($_POST['source_id']);
|
||||
unset($_POST['duplicate_network_component']);
|
||||
|
||||
$id = 0;
|
||||
}
|
||||
|
||||
if ($create_component) {
|
||||
$id = create_network_component ($name, $type, $id_group,
|
||||
|
@ -237,7 +254,7 @@ $table->head[4] = __('Group');
|
|||
$table->head[5] = __('Max/Min');
|
||||
$table->head[6] = __('Action');
|
||||
$table->size = array ();
|
||||
$table->size[6] = '40px';
|
||||
$table->size[6] = '50px';
|
||||
$table->data = array ();
|
||||
|
||||
foreach ($components as $component) {
|
||||
|
@ -255,7 +272,13 @@ foreach ($components as $component) {
|
|||
$data[3] = substr ($component['description'], 0, 30);
|
||||
$data[4] = get_network_component_group_name ($component['id_group']);
|
||||
$data[5] = $component['max']." / ".$component['min'];
|
||||
$data[6] = '<form method="post" action="'.$url.'" onsubmit="if (! confirm (\''.__('Are you sure?').'\')) return false">';
|
||||
|
||||
$data[6] = '<form method="post" action="index.php?sec=galertas&sec2=godmode/modules/manage_network_components" style="display: inline; float: left">';
|
||||
$data[6] .= print_input_hidden ('duplicate_network_component', 1, true);
|
||||
$data[6] .= print_input_hidden ('source_id', $component['id_nc'], true);
|
||||
$data[6] .= print_input_image ('dup', 'images/copy.png', 1, '', true, array ('title' => __('Duplicate')));
|
||||
$data[6] .= '</form> ';
|
||||
$data[6] .= '<form method="post" action="'.$url.'" onsubmit="if (! confirm (\''.__('Are you sure?').'\')) return false">';
|
||||
$data[6] .= print_input_hidden ('delete_component', 1, true);
|
||||
$data[6] .= print_input_hidden ('id', $component['id_nc'], true);
|
||||
$data[6] .= print_input_hidden ('search_id_group', $search_id_group, true);
|
||||
|
|
|
@ -292,4 +292,55 @@ function create_agent_module_from_network_component ($id_network_component, $id_
|
|||
|
||||
return create_agent_module ($id_agent, $name, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of a network component.
|
||||
*
|
||||
* @param int Component id to get.
|
||||
*
|
||||
* @return Component name with the given id. False if not available or readable.
|
||||
*/
|
||||
function get_network_component_name ($id_network_component) {
|
||||
if (empty ($id_network_component))
|
||||
return false;
|
||||
return @get_db_value ('name', 'tnetwork_component', 'id', $id_network_component);
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate local compoment.
|
||||
* @param integer id_local_component Id of localc component for duplicate.
|
||||
*/
|
||||
function duplicate_network_component ($id_local_component) {
|
||||
$network = get_network_component ($id_local_component);
|
||||
|
||||
if ($network === false)
|
||||
return false;
|
||||
|
||||
$name = __('Copy of').' '.$network['name'];
|
||||
|
||||
$networkCopy['description'] = $network['description'];
|
||||
$networkCopy['max'] = $network['max'];
|
||||
$networkCopy['min'] = $network['min'];
|
||||
$networkCopy['module_interval'] = $network['module_interval'];
|
||||
$networkCopy['tcp_port'] = $network['tcp_port'];
|
||||
$networkCopy['tcp_send'] = $network['tcp_send'];
|
||||
$networkCopy['tcp_rcv'] = $network['tcp_rcv'];
|
||||
$networkCopy['snmp_community'] = $network['snmp_community'];
|
||||
$networkCopy['snmp_oid'] = $network['snmp_oid'];
|
||||
$networkCopy['id_module_group'] = $network['id_module_group'];
|
||||
$networkCopy['id_modulo'] = $network['id_modulo'];
|
||||
$networkCopy['id_plugin'] = $network['id_plugin'];
|
||||
$networkCopy['plugin_user'] = $network['plugin_user'];
|
||||
$networkCopy['plugin_pass'] = $network['plugin_pass'];
|
||||
$networkCopy['plugin_parameter'] = $network['plugin_parameter'];
|
||||
$networkCopy['max_timeout'] = $network['max_timeout'];
|
||||
$networkCopy['history_data'] = $network['history_data'];
|
||||
$networkCopy['min_warning'] = $network['min_warning'];
|
||||
$networkCopy['max_warning'] = $network['max_warning'];
|
||||
$networkCopy['min_critical'] = $network['min_critical'];
|
||||
$networkCopy['max_critical'] = $network['max_critical'];
|
||||
$networkCopy['min_ff_event'] = $network['min_ff_event'];
|
||||
|
||||
return create_network_component ($name, $network['type'], $network['id_group'], $networkCopy);
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue