freenetis-github/application/views/js/__pieces/gps.php @ 410613f3
8baed187 | Michal Kliment | <?php
|
|
/**
|
|||
* GPS javascript view.
|
|||
* During adding of address point, try to add GPS for selected country,
|
|||
* street, street number and town and set it to GPS fields.
|
|||
*
|
|||
* @author Michal Kliment, Ondřej Fibich
|
|||
*/
|
|||
// IDE complementation
|
|||
if (FALSE): ?><script type="text/javascript"><?php endif
|
|||
?>
|
|||
var gps_get = null;
|
|||
// try to find GPS for address point and set it (esed ad devices and members)
|
|||
$("#street_id, #street_number, #town_id, #country_id").keyup(function ()
|
|||
{
|
|||
if (gps_get != null)
|
|||
{
|
|||
gps_get.abort();
|
|||
gps_get = null;
|
|||
}
|
|||
gps_get = $.get("<?php echo url_lang::base() ?>address_points/get_gps_by_address/",
|
|||
{
|
|||
"street_id": $("#street_id").val(),
|
|||
"street_number": $("#street_number").val(),
|
|||
"town_id": $("#town_id").val(),
|
|||
"country_id": $("#country_id").val()
|
|||
}, function(data)
|
|||
{
|
|||
if (data != '')
|
|||
{
|
|||
var s = data.split(" ");
|
|||
$("#gpsx").val(s[0]);
|
|||
$("#gpsy").val(s[1]);
|
|||
}
|
|||
else
|
|||
{
|
|||
$("#gpsx").val("");
|
|||
$("#gpsy").val("");
|
|||
}
|
|||
gps_get = null;
|
|||
});
|
|||
});
|
|||
// triggers find of GPS
|
|||
$("#street_id, #street_number, #town_id, #country_id").change(function ()
|
|||
{
|
|||
$(this).trigger('keyup');
|
|||
});
|
|||
// try to find GPS for domicile address point and set it (used at members)
|
|||
$("#domicile_street_id, #domicile_street_number, #domicile_town_id, #domicile_country_id").keyup(function ()
|
|||
{
|
|||
$.get("<?php echo url_lang::base() ?>address_points/get_gps_by_address/",
|
|||
{
|
|||
"street_id": $("#domicile_street_id").val(),
|
|||
"street_number": $("#domicile_street_number").val(),
|
|||
"town_id": $("#domicile_town_id").val(),
|
|||
"country_id": $("#domicile_country_id").val()
|
|||
}, function(data)
|
|||
{
|
|||
var s = data.split(" ");
|
|||
$("#domicile_gpsx").val(s[0]);
|
|||
$("#domicile_gpsy").val(s[1]);
|
|||
});
|
|||
});
|
|||
// triggers find of GPS
|
|||
$("#domicile_street_id, #domicile_street_number, #domicile_town_id, #domicile_country_id").change(function ()
|
|||
{
|
|||
$(this).trigger('keyup');
|
|||
});
|