Cuando se graban datos , si no se mueve el Pin del mapa no se grabará, para evitar que siempre se grabe la localizacion por defecto.

This commit is contained in:
humano 2014-10-01 10:34:42 -05:00
parent 40fb91af52
commit e766aa1c57

View File

@ -12,7 +12,7 @@
#map {width: 100%;height: 280px;} #map {width: 100%;height: 280px;}
</style> </style>
</head> </head>
<body> <body onload="javascript:window.parent.document.getElementById('<?php echo $_REQUEST[id]?>').value= '';">
@ -24,13 +24,16 @@
?> ?>
<script> <script>
var map = L.map('map') var map = L.map('map')
.setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>); .setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>);
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map); L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
//var lat = window.parent.document.getElementById('lat'); //var lat = window.parent.document.getElementById('lat');
//var lng = window.parent.document.getElementById('lon'); //var lng = window.parent.document.getElementById('lon');
var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
//var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
var marker = L.marker([<?php echo $lon ?>,<?php echo $lat ?>],{draggable: true}).addTo(map); var marker = L.marker([<?php echo $lon ?>,<?php echo $lat ?>],{draggable: true}).addTo(map);
@ -49,7 +52,8 @@ function ondragend() {
// lat.value= m.lat; // lat.value= m.lat;
// lng.value= m.lng; // lng.value= m.lng;
mapa.value= m.lng+' '+m.lat+' '+z; //mapa.value= m.lng+' '+m.lat+' '+z;
window.parent.document.getElementById('<?php echo $_REQUEST[id]?>').value= m.lng+' '+m.lat+' '+z;
} }
</script> </script>