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:
parent
fb2c412a9f
commit
58d5760423
|
@ -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>
|
2013-03-05 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* include/functions_netflow.php, include/functions_graph.php,
|
* include/functions_netflow.php, include/functions_graph.php,
|
||||||
|
|
|
@ -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);
|
$updateGisData = db_get_value('update_gis_data','tagente', 'id_agente', $id_agente);
|
||||||
$agent_name = agents_get_name($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 */
|
/* Map with the current position */
|
||||||
echo "<div id=\"" . $agent_name . "_agent_map\" style=\"border:1px solid black; width:98%; height: 30em;\"></div>";
|
echo "<div id=\"" . $agent_name . "_agent_map\" style=\"border:1px solid black; width:98%; height: 30em;\"></div>";
|
||||||
|
|
||||||
|
|
|
@ -239,6 +239,8 @@ switch ($action) {
|
||||||
$arrayLayers[] = JSON_decode($layer, true);
|
$arrayLayers[] = JSON_decode($layer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$invalidFields = gis_validate_map_data($map_name, $map_zoom_level,
|
$invalidFields = gis_validate_map_data($map_name, $map_zoom_level,
|
||||||
$map_initial_longitude, $map_initial_latitude, $map_initial_altitude,
|
$map_initial_longitude, $map_initial_latitude, $map_initial_altitude,
|
||||||
$map_default_longitude, $map_default_latitude, $map_default_altitude,
|
$map_default_longitude, $map_default_latitude, $map_default_altitude,
|
||||||
|
|
|
@ -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 (array_key_exists('layer_agent_list', $layer)) {
|
||||||
if (count($layer['layer_agent_list']) > 0) {
|
if (count($layer['layer_agent_list']) > 0) {
|
||||||
foreach ($layer['layer_agent_list'] as $agent_name) {
|
foreach ($layer['layer_agent_list'] as $agent_name) {
|
||||||
|
|
||||||
db_process_sql_insert('tgis_map_layer_has_tagente',
|
db_process_sql_insert('tgis_map_layer_has_tagente',
|
||||||
array(
|
array(
|
||||||
'tgis_map_layer_id_tmap_layer' => $idLayer,
|
'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,14 +901,17 @@ function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $c
|
||||||
|
|
||||||
$agent_name = agents_get_name($agent_id);
|
$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]['name'] = $defaultMap['conection_name'];
|
||||||
$baselayers[0]['num_zoom_levels'] = $defaultMap['num_zoom_levels'];
|
$baselayers[0]['num_zoom_levels'] = $defaultMap['num_zoom_levels'];
|
||||||
|
|
||||||
$conectionData = json_decode($defaultMap['conection_data'], true);
|
$conectionData = json_decode($defaultMap['conection_data'], true);
|
||||||
$baselayers[0]['typeBaseLayer'] = $conectionData['type'];
|
$baselayers[0]['typeBaseLayer'] = $conectionData['type'];
|
||||||
$controls = array('PanZoomBar', 'ScaleLine', 'Navigation', 'MousePosition');
|
$controls = array('PanZoomBar', 'ScaleLine', 'Navigation', 'MousePosition');
|
||||||
$gmap_layer = false;
|
$gmap_layer = false;
|
||||||
|
|
||||||
switch ($conectionData['type']) {
|
switch ($conectionData['type']) {
|
||||||
case 'OSM':
|
case 'OSM':
|
||||||
$baselayers[0]['url'] = $conectionData['url'];
|
$baselayers[0]['url'] = $conectionData['url'];
|
||||||
|
@ -935,7 +940,7 @@ function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $c
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
gis_print_map($agent_name."_agent_map", $defaultMap['zoom_level'],
|
gis_print_map($agent_name . "_agent_map", $defaultMap['zoom_level'],
|
||||||
$defaultMap['initial_latitude'],
|
$defaultMap['initial_latitude'],
|
||||||
$defaultMap['initial_longitude'], $baselayers, $controls);
|
$defaultMap['initial_longitude'], $baselayers, $controls);
|
||||||
|
|
||||||
|
|
|
@ -36,29 +36,35 @@ $agentId = get_parameter('id_agente');
|
||||||
$agent_name = agents_get_name($agentId);
|
$agent_name = agents_get_name($agentId);
|
||||||
$agentData = gis_get_data_last_position_agent($id_agente);
|
$agentData = gis_get_data_last_position_agent($id_agente);
|
||||||
|
|
||||||
|
//Avoid the agents with characters that fails the div.
|
||||||
|
$agent_name = md5($agent_name);
|
||||||
|
|
||||||
$url = '';
|
$url = '';
|
||||||
//These variables come from index.php
|
//These variables come from index.php
|
||||||
foreach ($_GET as $key => $value) {
|
foreach ($_GET as $key => $value) {
|
||||||
$url .= '&'.safe_url_extraclean($key).'='.safe_url_extraclean($value);
|
$url .= '&' . safe_url_extraclean($key) . '=' . safe_url_extraclean($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<div style='margin-bottom: 30px;'></div>";
|
echo "<div style='margin-bottom: 30px;'></div>";
|
||||||
|
|
||||||
/* Map with the current position */
|
/* Map with the current position */
|
||||||
echo "<div id=\"".$agent_name."_agent_map\" style=\"border:1px solid black; width:98%; height: 39em;\"></div>";
|
echo "<div id=\"" . $agent_name . "_agent_map\" style=\"border:1px solid black; width:98%; height: 39em;\"></div>";
|
||||||
if (!gis_get_agent_map($agentId, "500px", "98%", true, true, $period)) {
|
if (!gis_get_agent_map($agentId, "500px", "98%", true, true, $period)) {
|
||||||
echo "<br /><div class='nf'>" . __("There is no default map.") . "</div>";
|
echo "<br /><div class='nf'>" . __("There is no default map.") . "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
$timestampLastOperation = db_get_value_sql("SELECT UNIX_TIMESTAMP()");
|
$timestampLastOperation = db_get_value_sql(
|
||||||
|
"SELECT UNIX_TIMESTAMP()");
|
||||||
break;
|
break;
|
||||||
case "postgresql":
|
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;
|
break;
|
||||||
case "oracle":
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,17 +90,22 @@ echo "</form>";
|
||||||
|
|
||||||
echo "<h4>" . __("Positional data from the last") . " " . human_time_description_raw ($period) ."</h4>";
|
echo "<h4>" . __("Positional data from the last") . " " . human_time_description_raw ($period) ."</h4>";
|
||||||
/* Get the total number of Elements for the pagination */
|
/* 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);
|
$countData = db_get_value_sql($sqlCount);
|
||||||
|
|
||||||
|
|
||||||
/* Get the elements to present in this page */
|
/* Get the elements to present in this page */
|
||||||
$sql = sprintf ("SELECT longitude, latitude, altitude, start_timestamp, end_timestamp, description, number_of_packages, manual_placement
|
$sql = sprintf ("SELECT longitude, latitude, altitude, start_timestamp, end_timestamp, description, number_of_packages, manual_placement
|
||||||
FROM tgis_data_history
|
FROM tgis_data_history
|
||||||
WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d)
|
WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d)
|
||||||
ORDER BY end_timestamp DESC
|
ORDER BY end_timestamp DESC
|
||||||
LIMIT %d OFFSET %d", $agentId, get_system_time () - $period, $config['block_size'], get_parameter ('offset'));
|
LIMIT %d OFFSET %d", $agentId, get_system_time () - $period, $config['block_size'], get_parameter ('offset'));
|
||||||
|
|
||||||
$result = db_get_all_rows_sql ($sql, true);
|
$result = db_get_all_rows_sql ($sql, true);
|
||||||
|
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
echo "<div class='nf'>".__('This agent doesn\'t have any GIS data')."</div>";
|
echo "<div class='nf'>".__('This agent doesn\'t have any GIS data')."</div>";
|
||||||
}
|
}
|
||||||
|
@ -111,10 +122,8 @@ else {
|
||||||
$table->title = $agent_name." ". __("positional data");
|
$table->title = $agent_name." ". __("positional data");
|
||||||
$table->titlestyle = "background-color:#799E48;";
|
$table->titlestyle = "background-color:#799E48;";
|
||||||
html_print_table($table); unset($table);
|
html_print_table($table); unset($table);
|
||||||
|
|
||||||
ui_pagination ($countData, false) ;
|
ui_pagination ($countData, false) ;
|
||||||
echo "<h3>" . __('Total') . ' ' . $countData . ' ' . __('Data') . "</h3>";
|
echo "<h3>" . __('Total') . ' ' . $countData . ' ' . __('Data') . "</h3>";
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
?>
|
|
|
@ -153,6 +153,8 @@ if ($layers != false) {
|
||||||
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer'],
|
$agentNamesByLayer = gis_get_agents_layer($layer['id_tmap_layer'],
|
||||||
array('nombre'));
|
array('nombre'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
||||||
|
|
||||||
foreach ($agentNames as $agentName) {
|
foreach ($agentNames as $agentName) {
|
||||||
|
|
Loading…
Reference in New Issue