2010-02-15 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_gis.php: in the function "saveMap" set the first map
	as default.
	
	* godmode/setup/gis_step_2.php: minor stetic change the link of refresh by
	button.

	* godmode/gis_maps/index.php: add many alerts in the change the default map
	and delete any map. And fix the delete map parameter.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2359 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-02-15 11:00:51 +00:00
parent c0a6b5fddf
commit a5507b73f2
4 changed files with 61 additions and 17 deletions

View File

@ -1,3 +1,14 @@
2010-02-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_gis.php: in the function "saveMap" set the first map
as default.
* godmode/setup/gis_step_2.php: minor stetic change the link of refresh by
button.
* godmode/gis_maps/index.php: add many alerts in the change the default map
and delete any map. And fix the delete map parameter.
2010-02-12 Miguel de Dios <miguel.dedios@artica.es>
* include/javascript/pandora_modules.js: add support to snmp ver3 in the

View File

@ -48,7 +48,7 @@ $action = get_parameter('action');
switch ($action) {
case 'delete_map':
$idMap = get_parameter('id_map');
$idMap = get_parameter('map_id');
deleteMap($idMap);
break;
}
@ -71,18 +71,22 @@ $maps = get_db_all_rows_in_table ('tgis_map','map_name');
$table->data = array();
$defaultMapId = null;
if ($maps !== false) {
foreach ($maps as $map) {
$checked = false;
if ($map['default_map'])
if ($map['default_map']) {
$checked = true;
$defaultMapId = $map['id_tgis_map'];
}
$table->data[] = array('<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='.$map['id_tgis_map'].'&amp;action=edit_map">' . $map['map_name'] . '</a>',
print_group_icon ($map['group_id'], true),
'<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='.$map['id_tgis_map'].'">' . print_image ("images/eye.png", true).'</a>',
print_radio_button_extended('default_map', $map['id_tgis_map'], '', $checked, false, "setDefault(" . $map['id_tgis_map'] . ");", '', true),
'<a href="index.php?sec=godgismaps&amp;sec2=godmode/gis_maps/index&amp;map_id='.$map['id_tgis_map'].'&amp;action=delete_map">' . print_image ("images/cross.png", true).'</a>');
'<a href="index.php?sec=godgismaps&amp;sec2=godmode/gis_maps/index&amp;map_id='.$map['id_tgis_map'].'&amp;action=delete_map" onclick="return confirmDelete();">' . print_image ("images/cross.png", true).'</a>');
}
}
@ -96,7 +100,17 @@ echo '</form>';
echo '</div>';
?>
<script type="text/javascript">
var defaultMapId = "<?php echo $defaultMapId; ?>";
function confirmDelete() {
if (confirm('<?php echo __('Caution: Do you want delete the map?');?>'))
return true;
return false;
}
function setDefault(id_tgis_map) {
if (confirm('<?php echo __('Do you want to set default the map?');?>')) {
jQuery.ajax ({
data: "page=godmode/gis_maps/index&action=set_default&id_map=" + id_tgis_map,
type: "POST",
@ -110,4 +124,15 @@ function setDefault(id_tgis_map) {
}
});
}
else {
jQuery.each($("input[name=default_map]"), function() {
if ($(this).val() == defaultMapId) {
$(this).attr("checked", "checked");
}
else {
$(this).removeAttr("checked");
}
});
}
}
</script>

View File

@ -171,7 +171,8 @@ if ($mapConnectionData != null) {
echo "<div id='form_map_connection_type'>" . $optionsConnectionTypeTable . "</div>";
echo "<h3>" . __('Preview and Select the center of the map and the default position of an agent without gis data') . "</h3>";
echo "<a id='link_save_refresh' href='javascript: refreshMapView();'>" . __("Load the map view") . "</a>";
print_button('Load the map view','button_refresh', false, 'refreshMapView();', 'class="sub"');
echo "<br /><br />";
echo "<div id='map' style='width: 300px; height: 300px; border: 1px solid black; float: left'></div>";
$table->width = '60%';
@ -279,8 +280,8 @@ function refreshMapView() {
centerPoint = null;
GISDefaultPositionPoint = null;
//Change the text.
$("#link_save_refresh").html('<?php echo __("Refresh the map view");?>');
//Change the text to button.
$("input[name=button_refresh]").val('<?php echo __("Refresh the map view");?>');
//Obtain data of map of fields.
inital_zoom = $('input[name=initial_zoom]').val();

View File

@ -509,6 +509,8 @@ function deleteMap($idMap) {
process_sql_delete('tgis_map_has_tgis_map_connection', array('tgis_map_id_tgis_map' => $idMap));
process_sql_delete('tgis_map', array('id_tgis_map' => $idMap));
$numMaps = get_db_num_rows('SELECT * FROM tgis_map');
clean_cache();
}
@ -550,6 +552,11 @@ function saveMap($map_name, $map_initial_longitude, $map_initial_latitude,
)
);
$numMaps = get_db_num_rows('SELECT * FROM tgis_map');
if ($numMaps == 1)
process_sql_update('tgis_map', array('default_map' => 1), array('id_tgis_map' => $idMap));
foreach ($map_connection_list as $map_connection) {
process_sql_insert('tgis_map_has_tgis_map_connection',
array(