From f1b67fc083fc51ea71685996ef1f0659ecb289d9 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 1 Mar 2010 11:17:27 +0000 Subject: [PATCH] 2010-03-01 Miguel de Dios * include/functions_gis.php: now function "getAgentMap" return true or false if there is default map or not. * operation/agentes/gis_view.php, godmode/agentes/agent_conf_gis.php: show message of error when there isn't a default map git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2436 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 ++++++++ pandora_console/godmode/agentes/agent_conf_gis.php | 5 ++++- pandora_console/include/functions_gis.php | 8 +++++++- pandora_console/operation/agentes/gis_view.php | 4 +++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ba7a153e67..a1d7397fa2 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2010-03-01 Miguel de Dios + + * include/functions_gis.php: now function "getAgentMap" return true or false + if there is default map or not. + + * operation/agentes/gis_view.php, godmode/agentes/agent_conf_gis.php: show + message of error when there isn't a default map + 2010-03-01 Miguel de Dios * extras/pandoradb_migrate_v3.0_to_v3.1.sql: update with the new data in diff --git a/pandora_console/godmode/agentes/agent_conf_gis.php b/pandora_console/godmode/agentes/agent_conf_gis.php index bd14250f50..1ba56561cf 100644 --- a/pandora_console/godmode/agentes/agent_conf_gis.php +++ b/pandora_console/godmode/agentes/agent_conf_gis.php @@ -31,7 +31,10 @@ $agent_name = get_agent_name($id_agente); /* Map with the current position */ echo "
"; -echo getAgentMap($id_agente, "500px", "98%", false); + +if (!getAgentMap($id_agente, "500px", "98%", false)) { + echo "
" . __("There is no default map.") . "
"; +} diff --git a/pandora_console/include/functions_gis.php b/pandora_console/include/functions_gis.php index de3a7db309..526fd1480b 100644 --- a/pandora_console/include/functions_gis.php +++ b/pandora_console/include/functions_gis.php @@ -775,7 +775,7 @@ function updateMap($idMap, $map_name, $map_initial_longitude, $map_initial_latit * @param $centerInAgent boolean Default is true, set the map center in the icon agent. * @param $history_time: Number of seconds in the past to show from where to start the history path. * - * @return A div tag with the map and the agent and the history path if asked. + * @return boolean True ok and false fail. */ function getAgentMap($agent_id, $heigth, $width, $show_history = false, $centerInAgent = true, $history_time = 86400) { $defaultMap = get_db_all_rows_sql(" @@ -786,6 +786,10 @@ function getAgentMap($agent_id, $heigth, $width, $show_history = false, $centerI WHERE t1.default_map = 1 AND t2.tgis_map_id_tgis_map = t1.id_tgis_map AND t2.default_map_connection = 1 AND t3.id_tmap_connection = t2.tgis_map_connection_id_tmap_connection"); + + if ($defaultMap === false) + return false; + $defaultMap = $defaultMap[0]; $agent_position = getDataLastPositionAgent($agent_id); @@ -837,6 +841,8 @@ function getAgentMap($agent_id, $heigth, $width, $show_history = false, $centerI " . __("Map with the last position/s") . " " . human_time_description /* Map with the current position */ echo "
"; -echo getAgentMap($agentId, "500px", "98%", true, true, $period); +if (!getAgentMap($agentId, "500px", "98%", true, true, $period)) { + echo "
" . __("There is no default map.") . "
"; +} $timestampLastOperation = get_db_value_sql("SELECT UNIX_TIMESTAMP()");