From 8bae65b4a24114ab6cf76b6c68a671ef1d171c9f Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Wed, 1 Mar 2017 09:20:28 +0100 Subject: [PATCH] Fixed gis map agents name when refresh map. Ticket #395 --- .../include/javascript/openlayers.pandora.js | 6 +++--- pandora_console/operation/gis_maps/ajax.php | 16 ++++++++-------- .../operation/gis_maps/render_view.php | 7 +++---- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/pandora_console/include/javascript/openlayers.pandora.js b/pandora_console/include/javascript/openlayers.pandora.js index 5c524db9c9..943da65c7a 100755 --- a/pandora_console/include/javascript/openlayers.pandora.js +++ b/pandora_console/include/javascript/openlayers.pandora.js @@ -464,7 +464,7 @@ function js_addAgentPoint(layerName, pointName, lon, lat, id, type_string, statu type: type_string, long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject()) }); - + if (isHideFeatureByStatus(statusAgent)) { feature.style.display = 'none'; } @@ -536,9 +536,9 @@ function js_addAgentPointExtent(layerName, pointName, lon, lat, icon, width, hei feature = new OpenLayers.Feature.Vector(point, { - id_parent: idParent, + id_parent: idParent.toString(), status: statusA, - id: id, + id: id.toString(), type: type_string, long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject()) }, diff --git a/pandora_console/operation/gis_maps/ajax.php b/pandora_console/operation/gis_maps/ajax.php index bfaf8b3dcd..deed8688a4 100644 --- a/pandora_console/operation/gis_maps/ajax.php +++ b/pandora_console/operation/gis_maps/ajax.php @@ -117,7 +117,7 @@ switch ($opt) { switch ($config["dbtype"]) { case "mysql": if (empty($idAgentsWithGIS)) { - $agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, + $agentsGISStatus = db_get_all_rows_sql('SELECT t1.alias, id_parent, t1.id_agente AS tagente_id_agente, IFNULL(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, IFNULL(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude FROM tagente t1 @@ -125,7 +125,7 @@ switch ($opt) { WHERE 1 = 0'); } else { - $agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, + $agentsGISStatus = db_get_all_rows_sql('SELECT t1.alias, id_parent, t1.id_agente AS tagente_id_agente, IFNULL(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, IFNULL(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude FROM tagente t1 @@ -135,7 +135,7 @@ switch ($opt) { break; case "postgresql": if (empty($idAgentsWithGIS)) { - $agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, + $agentsGISStatus = db_get_all_rows_sql('SELECT t1.alias, id_parent, t1.id_agente AS tagente_id_agente, COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude FROM tagente t1 @@ -143,7 +143,7 @@ switch ($opt) { WHERE 1 = 0'); } else { - $agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, + $agentsGISStatus = db_get_all_rows_sql('SELECT t1.alias, id_parent, t1.id_agente AS tagente_id_agente, COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude FROM tagente t1 @@ -153,7 +153,7 @@ switch ($opt) { break; case "oracle": if (empty($idAgentsWithGIS)) { - $agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, + $agentsGISStatus = db_get_all_rows_sql('SELECT t1.alias, id_parent, t1.id_agente AS tagente_id_agente, COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude FROM tagente t1 @@ -161,7 +161,7 @@ switch ($opt) { WHERE 1 = 0'); } else { - $agentsGISStatus = db_get_all_rows_sql('SELECT t1.nombre, id_parent, t1.id_agente AS tagente_id_agente, + $agentsGISStatus = db_get_all_rows_sql('SELECT t1.alias, id_parent, t1.id_agente AS tagente_id_agente, COALESCE(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude, COALESCE(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude FROM tagente t1 @@ -180,7 +180,7 @@ switch ($opt) { $status = agents_get_status($row['tagente_id_agente']); if (!$config['gis_label']) - $row['nombre'] = ''; + $row['alias'] = ''; $icon = gis_get_agent_icon_map($row['tagente_id_agente'], true, $status); if ($icon[0] !== '/') { @@ -196,7 +196,7 @@ switch ($opt) { 'icon_path' => $config["homeurl"] . '/' . $icon, 'icon_width' => $icon_width, 'icon_height' => $icon_height, - 'name' => $row['nombre'], + 'name' => io_safe_output($row['alias']), 'status' => $status, 'stored_longitude' => $row['stored_longitude'], 'stored_latitude' => $row['stored_latitude'], diff --git a/pandora_console/operation/gis_maps/render_view.php b/pandora_console/operation/gis_maps/render_view.php index 5d3996dd53..dfd3cb8e03 100644 --- a/pandora_console/operation/gis_maps/render_view.php +++ b/pandora_console/operation/gis_maps/render_view.php @@ -183,10 +183,10 @@ if ($layers != false) { $agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer); - foreach ($agentNames as $agentName) { - $idAgent = agents_get_agent_id($agentName); + foreach ($agentNames as $key => $agentName) { + $idAgent = $key; $coords = gis_get_data_last_position_agent($idAgent); - + if ($coords === false) { $coords['stored_latitude'] = $map['default_latitude']; $coords['stored_longitude'] = $map['default_longitude']; @@ -198,7 +198,6 @@ if ($layers != false) { } } - $icon = gis_get_agent_icon_map($idAgent, true); $icon_size = getimagesize($icon); $icon_width = $icon_size[0];