Revize c6b00989
Přidáno uživatelem Ondřej Fibich před téměř 6 roky(ů)
application/views/js/__pieces/gps.php | ||
---|---|---|
?>
|
||
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 ()
|
||
$("#street_id, #street_number, #town_id, #country_id").change(function ()
|
||
{
|
||
get_gps_by_address($("#street_id").val(), $("#street_number").val(),
|
||
$("#town_id").val(), $("#country_id").val(), function(data)
|
||
{
|
||
if (data != '')
|
||
{
|
||
var s = data.split(" ");
|
||
$("#gpsx").val(gps_dms_coord(s[0]));
|
||
$("#gpsy").val(gps_dms_coord(s[1]));
|
||
}
|
||
else
|
||
{
|
||
$("#gpsx").val("");
|
||
$("#gpsy").val("");
|
||
}
|
||
gps_get = null;
|
||
});
|
||
});
|
||
|
||
// 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").change(function ()
|
||
{
|
||
get_gps_by_address($("#domicile_street_id").val(),
|
||
$("#domicile_street_number").val(), $("#domicile_town_id").val(),
|
||
$("#domicile_country_id").val(), function(data)
|
||
{
|
||
var s = data.split(" ");
|
||
$("#domicile_gpsx").val(gps_dms_coord(s[0]));
|
||
$("#domicile_gpsy").val(gps_dms_coord(s[1]));
|
||
});
|
||
});
|
||
|
||
function get_gps_by_address(street_id, street_number, town_id, country_id, clb)
|
||
{
|
||
if (gps_get != null)
|
||
{
|
||
gps_get.abort();
|
||
gps_get = null;
|
||
}
|
||
if (!street_number ||!town_id || !country_id)
|
||
{
|
||
return false;
|
||
}
|
||
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()
|
||
"street_id": street_id,
|
||
"street_number": street_number,
|
||
"town_id": town_id,
|
||
"country_id": country_id
|
||
}, function(data)
|
||
{
|
||
if (data != '')
|
||
{
|
||
var s = data.split(" ");
|
||
$("#gpsx").val(s[0]);
|
||
$("#gpsy").val(s[1]);
|
||
}
|
||
else
|
||
{
|
||
$("#gpsx").val("");
|
||
$("#gpsy").val("");
|
||
}
|
||
clb(data);
|
||
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');
|
||
});
|
||
return true;
|
||
}
|
Také k dispozici: Unified diff
Fixes #1105: map support fixes [develop]