From e815289373823bc4b3d873680ccc58a401c1141a Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Thu, 11 Feb 2010 18:44:12 +0000
Subject: [PATCH] 2010-02-11 Miguel de Dios  <miguel.dedios@artica.es>

	* include/functions_gis.php: clean source code, delete javascript debug
	info messages for firebug.

	* godmode/agentes/module_manager_editor_network.php,
	godmode/agentes/configurar_agente.php: add support for SMNP ver3 in the
	forms to add or edit "Network module".


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2352 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                     |  9 ++++
 .../godmode/agentes/configurar_agente.php     | 23 ++++++----
 .../agentes/module_manager_editor_network.php | 46 +++++++++++++++++++
 pandora_console/include/functions_gis.php     |  4 +-
 4 files changed, 71 insertions(+), 11 deletions(-)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 6b8e15bf8d..bd5337bb9e 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,12 @@
+2010-02-10 Miguel de Dios  <miguel.dedios@artica.es>
+
+	* include/functions_gis.php: clean source code, delete javascript debug
+	info messages for firebug.
+
+	* godmode/agentes/module_manager_editor_network.php,
+	godmode/agentes/configurar_agente.php: add support for SMNP ver3 in the
+	forms to add or edit "Network module".
+
 2010-02-10  Sancho Lerena <slerena@artica.es>
 
  	* godmode/db/db_main.php: Added new metrics about DB usage. Added
diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index 838b712af4..380145a87c 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -470,15 +470,17 @@ if ($update_module || $create_module) {
 		$custom_string_2 = (string) get_parameter ('snmp3_privacy_pass');
 		$custom_string_3 = (string) get_parameter ('snmp3_security_level');
 	}
-
+	else {
+		$plugin_user = (string) get_parameter ('plugin_user');
+		if (get_parameter('id_module_component_type') == 7)
+			$plugin_pass = (int) get_parameter ('plugin_pass');
+		else
+			$plugin_pass = (string) get_parameter ('plugin_pass');
+			
+		$plugin_parameter = (string) get_parameter ('plugin_parameter');
+	}
+		
 	$ip_target = (string) get_parameter ('ip_target');
-	$plugin_user = (string) get_parameter ('plugin_user');
-	if (get_parameter('id_module_component_type') == 7)
-		$plugin_pass = (int) get_parameter ('plugin_pass');
-	else
-		$plugin_pass = (string) get_parameter ('plugin_pass');
-
-	$plugin_parameter = (string) get_parameter ('plugin_parameter');
 	$custom_id = (string) get_parameter ('custom_id');
 	$history_data = (int) get_parameter('history_data');
 	$min_warning = (float) get_parameter ('min_warning');
@@ -486,6 +488,11 @@ if ($update_module || $create_module) {
 	$min_critical = (float) get_parameter ('min_critical');
 	$max_critical = (float) get_parameter ('max_critical');
 	$ff_event = (int) get_parameter ('ff_event');
+	
+	$active_snmp_v3 = get_parameter('active_snmp_v3');
+	if ($active_snmp_v3) {
+	//
+	}
 }
 
 // MODULE UPDATE
diff --git a/pandora_console/godmode/agentes/module_manager_editor_network.php b/pandora_console/godmode/agentes/module_manager_editor_network.php
index 66f7e8df57..a18c50cb7f 100644
--- a/pandora_console/godmode/agentes/module_manager_editor_network.php
+++ b/pandora_console/godmode/agentes/module_manager_editor_network.php
@@ -123,4 +123,50 @@ if ($id_module_type >= 15 && $id_module_type <= 18) {
 	$table_simple->rowstyle['snmp_1'] = 'display: none';
 	$table_simple->rowstyle['snmp_2'] = 'display: none';
 }
+
+$data = array();
+$data[0] = __('Auth user');
+$data[1] = print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
+$data[2] = __('Auth password');
+$data[3] = print_input_text ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
+$data[3] .= print_input_hidden('active_snmp_v3', 0, true);
+if ($snmp_version != 3) $table_simple->rowstyle['field_snmpv3_row1'] = 'display: none;';
+push_table_simple($data, 'field_snmpv3_row1');
+
+$data = array();
+$data[0] = __('Privacy method');
+$data[1] = print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
+$data[2] = __('privacy pass');
+$data[3] = print_input_text ('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
+if ($snmp_version != 3) $table_simple->rowstyle['field_snmpv3_row2'] = 'display: none;';
+push_table_simple($data, 'field_snmpv3_row2');
+
+$data = array();
+$data[0] = __('Auth method');
+$data[1] = print_select(array('MD5' => __('MD5'), 'SHA' => __('SHA')), 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true);
+$data[2] = __('Security level');
+$data[3] = print_select(array('noAuthNoPriv' => __('Not auth and not privacy method'),
+	'authNoPriv' => __('Auth and not privacy method'), 'authPriv' => __('Auth and privacy method')), 'snmp3_security_level', $snmp3_security_level, '', '', '', true);
+if ($snmp_version != 3) $table_simple->rowstyle['field_snmpv3_row3'] = 'display: none;';
+push_table_simple($data, 'field_snmpv3_row3');
+
+
 ?>
+<script type="text/javascript">
+$(document).ready (function () {
+	$("#snmp_version").change(function () {
+		if (this.value == "3") {
+			$("#simple-field_snmpv3_row1").attr("style", "");
+			$("#simple-field_snmpv3_row2").attr("style", "");
+			$("#simple-field_snmpv3_row3").attr("style", "");
+			$("input[name=active_snmp_v3]").val(1);
+		}
+		else {
+			$("#simple-field_snmpv3_row1").css("display", "none");
+			$("#simple-field_snmpv3_row2").css("display", "none");
+			$("#simple-field_snmpv3_row3").css("display", "none");
+			$("input[name=active_snmp_v3]").val(0);
+		}
+	});
+});
+</script>
diff --git a/pandora_console/include/functions_gis.php b/pandora_console/include/functions_gis.php
index 0154bcaa2e..bcf3fbeb7d 100644
--- a/pandora_console/include/functions_gis.php
+++ b/pandora_console/include/functions_gis.php
@@ -195,7 +195,7 @@ function activateAjaxRefresh($layers = null, $lastTimeOfData = null) {
 		var refreshAjaxIntervalSeconds = 1000;
 		var idIntervalAjax = null;
 
-		function searchPointAgentById(id) {console.log(id);
+		function searchPointAgentById(id) {
 			for (layerIndex = 0; layerIndex < map.getNumLayers(); layerIndex++) {
 				layer = map.layers[layerIndex];
 
@@ -243,8 +243,6 @@ function activateAjaxRefresh($layers = null, $lastTimeOfData = null) {
 				        				for (var pointIndex in listPoints) {
 				        					if (isInt(pointIndex)) {
 					        					feature = searchPointAgentById(idAgent);
-
-					        					console.log(listPoints[pointIndex]);
 	
 					        					var point = new OpenLayers.LonLat(listPoints[pointIndex].longitude, listPoints[pointIndex].latitude)
 					        					.transform(map.displayProjection, map.getProjectionObject());