2013-03-05 Miguel de Dios <miguel.dedios@artica.es>

* operation/gis_maps/render_view.php,
	operation/agentes/gis_view.php,
	godmode/gis_maps/configure_gis_map.php,
	godmode/agentes/agent_conf_gis.php, include/functions_gis.php: fixes
	about agents with white spaces.

	MERGED FROM THE BRANCH pandora_4




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7782 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-03-05 14:24:44 +00:00
parent fb2c412a9f
commit 58d5760423
6 changed files with 47 additions and 16 deletions

View File

@ -1,3 +1,13 @@
2013-03-05 Miguel de Dios <miguel.dedios@artica.es>
* operation/gis_maps/render_view.php,
operation/agentes/gis_view.php,
godmode/gis_maps/configure_gis_map.php,
godmode/agentes/agent_conf_gis.php, include/functions_gis.php: fixes
about agents with white spaces.
MERGED FROM THE BRANCH pandora_4
2013-03-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_netflow.php, include/functions_graph.php,

View File

@ -30,6 +30,9 @@ $agentData = gis_get_data_last_position_agent($id_agente);
$updateGisData = db_get_value('update_gis_data','tagente', 'id_agente', $id_agente);
$agent_name = agents_get_name($id_agente);
//Avoid the agents with characters that fails the div.
$agent_name = md5($agent_name);
/* Map with the current position */
echo "<div id=\"" . $agent_name . "_agent_map\" style=\"border:1px solid black; width:98%; height: 30em;\"></div>";

View File

@ -239,6 +239,8 @@ switch ($action) {
$arrayLayers[] = JSON_decode($layer, true);
}
$invalidFields = gis_validate_map_data($map_name, $map_zoom_level,
$map_initial_longitude, $map_initial_latitude, $map_initial_altitude,
$map_default_longitude, $map_default_latitude, $map_default_altitude,

View File

@ -827,10 +827,12 @@ function gis_update_map($idMap, $map_name, $map_initial_longitude, $map_initial_
if (array_key_exists('layer_agent_list', $layer)) {
if (count($layer['layer_agent_list']) > 0) {
foreach ($layer['layer_agent_list'] as $agent_name) {
db_process_sql_insert('tgis_map_layer_has_tagente',
array(
'tgis_map_layer_id_tmap_layer' => $idLayer,
'tagente_id_agente' => agents_get_agent_id($agent_name)
'tagente_id_agente' => agents_get_agent_id(
io_safe_input($agent_name))
)
);
}
@ -899,6 +901,9 @@ function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $c
$agent_name = agents_get_name($agent_id);
//Avoid the agents with characters that fails the div.
$agent_name = md5($agent_name);
$baselayers[0]['name'] = $defaultMap['conection_name'];
$baselayers[0]['num_zoom_levels'] = $defaultMap['num_zoom_levels'];

View File

@ -36,6 +36,9 @@ $agentId = get_parameter('id_agente');
$agent_name = agents_get_name($agentId);
$agentData = gis_get_data_last_position_agent($id_agente);
//Avoid the agents with characters that fails the div.
$agent_name = md5($agent_name);
$url = '';
//These variables come from index.php
foreach ($_GET as $key => $value) {
@ -52,13 +55,16 @@ if (!gis_get_agent_map($agentId, "500px", "98%", true, true, $period)) {
switch ($config["dbtype"]) {
case "mysql":
$timestampLastOperation = db_get_value_sql("SELECT UNIX_TIMESTAMP()");
$timestampLastOperation = db_get_value_sql(
"SELECT UNIX_TIMESTAMP()");
break;
case "postgresql":
$timestampLastOperation = db_get_value_sql("SELECT ceil(date_part('epoch', CURRENT_TIMESTAMP))");
$timestampLastOperation = db_get_value_sql(
"SELECT ceil(date_part('epoch', CURRENT_TIMESTAMP))");
break;
case "oracle":
$timestampLastOperation = db_get_value_sql("SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) from dual");
$timestampLastOperation = db_get_value_sql(
"SELECT ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) from dual");
break;
}
@ -84,17 +90,22 @@ echo "</form>";
echo "<h4>" . __("Positional data from the last") . " " . human_time_description_raw ($period) ."</h4>";
/* Get the total number of Elements for the pagination */
$sqlCount = sprintf ("SELECT COUNT(*) FROM tgis_data_history WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d) ORDER BY end_timestamp DESC", $agentId, get_system_time () - $period);
$sqlCount = sprintf ("SELECT COUNT(*)
FROM tgis_data_history
WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d)
ORDER BY end_timestamp DESC", $agentId, get_system_time () - $period);
$countData = db_get_value_sql($sqlCount);
/* Get the elements to present in this page */
$sql = sprintf ("SELECT longitude, latitude, altitude, start_timestamp, end_timestamp, description, number_of_packages, manual_placement
FROM tgis_data_history
WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d)
ORDER BY end_timestamp DESC
LIMIT %d OFFSET %d", $agentId, get_system_time () - $period, $config['block_size'], get_parameter ('offset'));
$result = db_get_all_rows_sql ($sql, true);
if ($result === false) {
echo "<div class='nf'>".__('This agent doesn\'t have any GIS data')."</div>";
}
@ -115,6 +126,4 @@ else {
ui_pagination ($countData, false) ;
echo "<h3>" . __('Total') . ' ' . $countData . ' ' . __('Data') . "</h3>";
}
?>

View File

@ -153,6 +153,8 @@ if ($layers != false) {
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer'],
array('nombre'));
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
foreach ($agentNames as $agentName) {