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:
parent
c0a6b5fddf
commit
a5507b73f2
|
@ -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>
|
2010-02-12 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* include/javascript/pandora_modules.js: add support to snmp ver3 in the
|
* include/javascript/pandora_modules.js: add support to snmp ver3 in the
|
||||||
|
|
|
@ -48,7 +48,7 @@ $action = get_parameter('action');
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'delete_map':
|
case 'delete_map':
|
||||||
$idMap = get_parameter('id_map');
|
$idMap = get_parameter('map_id');
|
||||||
deleteMap($idMap);
|
deleteMap($idMap);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -71,18 +71,22 @@ $maps = get_db_all_rows_in_table ('tgis_map','map_name');
|
||||||
|
|
||||||
$table->data = array();
|
$table->data = array();
|
||||||
|
|
||||||
|
$defaultMapId = null;
|
||||||
|
|
||||||
if ($maps !== false) {
|
if ($maps !== false) {
|
||||||
foreach ($maps as $map) {
|
foreach ($maps as $map) {
|
||||||
|
|
||||||
$checked = false;
|
$checked = false;
|
||||||
if ($map['default_map'])
|
if ($map['default_map']) {
|
||||||
$checked = true;
|
$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'].'&action=edit_map">' . $map['map_name'] . '</a>',
|
$table->data[] = array('<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='.$map['id_tgis_map'].'&action=edit_map">' . $map['map_name'] . '</a>',
|
||||||
print_group_icon ($map['group_id'], true),
|
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>',
|
'<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),
|
print_radio_button_extended('default_map', $map['id_tgis_map'], '', $checked, false, "setDefault(" . $map['id_tgis_map'] . ");", '', true),
|
||||||
'<a href="index.php?sec=godgismaps&sec2=godmode/gis_maps/index&map_id='.$map['id_tgis_map'].'&action=delete_map">' . print_image ("images/cross.png", true).'</a>');
|
'<a href="index.php?sec=godgismaps&sec2=godmode/gis_maps/index&map_id='.$map['id_tgis_map'].'&action=delete_map" onclick="return confirmDelete();">' . print_image ("images/cross.png", true).'</a>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,18 +100,39 @@ echo '</form>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<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) {
|
function setDefault(id_tgis_map) {
|
||||||
jQuery.ajax ({
|
if (confirm('<?php echo __('Do you want to set default the map?');?>')) {
|
||||||
data: "page=godmode/gis_maps/index&action=set_default&id_map=" + id_tgis_map,
|
jQuery.ajax ({
|
||||||
type: "POST",
|
data: "page=godmode/gis_maps/index&action=set_default&id_map=" + id_tgis_map,
|
||||||
dataType: 'json',
|
type: "POST",
|
||||||
url: "ajax.php",
|
dataType: 'json',
|
||||||
timeout: 10000,
|
url: "ajax.php",
|
||||||
success: function (data) {
|
timeout: 10000,
|
||||||
if (data.correct == 0) {
|
success: function (data) {
|
||||||
alert('<?php echo __('There was error on setup the default map.');?>');
|
if (data.correct == 0) {
|
||||||
|
alert('<?php echo __('There was error on setup the default map.');?>');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
else {
|
||||||
|
jQuery.each($("input[name=default_map]"), function() {
|
||||||
|
if ($(this).val() == defaultMapId) {
|
||||||
|
$(this).attr("checked", "checked");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(this).removeAttr("checked");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
|
@ -171,7 +171,8 @@ if ($mapConnectionData != null) {
|
||||||
echo "<div id='form_map_connection_type'>" . $optionsConnectionTypeTable . "</div>";
|
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 "<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>";
|
echo "<div id='map' style='width: 300px; height: 300px; border: 1px solid black; float: left'></div>";
|
||||||
|
|
||||||
$table->width = '60%';
|
$table->width = '60%';
|
||||||
|
@ -279,8 +280,8 @@ function refreshMapView() {
|
||||||
centerPoint = null;
|
centerPoint = null;
|
||||||
GISDefaultPositionPoint = null;
|
GISDefaultPositionPoint = null;
|
||||||
|
|
||||||
//Change the text.
|
//Change the text to button.
|
||||||
$("#link_save_refresh").html('<?php echo __("Refresh the map view");?>');
|
$("input[name=button_refresh]").val('<?php echo __("Refresh the map view");?>');
|
||||||
|
|
||||||
//Obtain data of map of fields.
|
//Obtain data of map of fields.
|
||||||
inital_zoom = $('input[name=initial_zoom]').val();
|
inital_zoom = $('input[name=initial_zoom]').val();
|
||||||
|
|
|
@ -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_has_tgis_map_connection', array('tgis_map_id_tgis_map' => $idMap));
|
||||||
process_sql_delete('tgis_map', array('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();
|
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) {
|
foreach ($map_connection_list as $map_connection) {
|
||||||
process_sql_insert('tgis_map_has_tgis_map_connection',
|
process_sql_insert('tgis_map_has_tgis_map_connection',
|
||||||
array(
|
array(
|
||||||
|
|
Loading…
Reference in New Issue