Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2213

Přidáno uživatelem David Raška před asi 11 roky(ů)

Upravy:
- refs #80: Uprava chovani naseptavace adres podle pozadavku PVFree

Opravy:
- Oprava naseptavace GPS, kdy google neumi pracovat s mestskymi castmi

Zobrazit rozdíly:

freenetis/branches/1.1/application/views/js/__pieces/address_point_database.php
var apd_xhr = null;
var apd_search_again = false;
var apd_context = null;
var apd_show = false;
function get_el(id, context) {
if (typeof context !== 'undefined')
......
};
function apd_town_render( ul, item ) {
var details = '';
var cls = '';
if (typeof item.district !== 'undefined' &&
item.town !== item.district &&
item.district.length)
{
details = item.district;
}
if (details !== '')
{
details = "<br><span class='details'>" + details + "</span></a>";
}
return $( "<li>" )
.data("item.autocomplete", item)
.append( "<a><span class='label details'>" + item.label + "</span>" + details)
.append( "<a><span class='label details'>" + item.label + "</span></a>")
.appendTo( ul );
};
......
apd_xhr = $.ajax({
url: '<?php echo url::base() ?>cs/json/get_address',
dataType: "json",
data: "street="+get_el('street', this).val()+"&country="+get_el('country_id').val()+"&town="+get_el('town').val()+"&zip="+get_el('zip').val()+"&district="+get_el('district').val(),
data: "street="+get_el('street', this).val()+"&country="+get_el('country_id').val()+"&town="+get_el('town').val()+"&district="+get_el('district').val(),
success: function( data ) {
get_el('street', this._parent).removeClass('ui-autocomplete-loading');
response( $.map(data, function ( item ) {
get_el('street').removeClass('ui-autocomplete-loading');
return {
label: item.street,
value: item.street + ((typeof item.street !== 'undefined' && item.street.length) ? ' ' : '') + ((typeof item.number !== 'undefined') ? item.number : ''),
......
zip: item.zip_code
}
}));
apd_xhr = null;
}
});
},
......
dataType: "json",
data: "town="+get_el('town', this).val()+"&district="+get_el('district').val()+"&country="+get_el('country_id').val(),
success: function( data ) {
get_el('district', this._parent).removeClass('ui-autocomplete-loading');
response( $.map(data, function ( item ) {
get_el('district').removeClass('ui-autocomplete-loading');
return {
label: item.district_name,
item: item,
......
district: item.district_name
}
}));
apd_xhr = null;
}
});
},
......
}
get_el('street').focus();
return false;
},
minLength: 0
......
dataType: "json",
data: "town="+get_el('town', this).val()+"&country="+get_el('country_id').val(),
success: function( data ) {
get_el('town', this._parent).removeClass('ui-autocomplete-loading');
response( $.map(data, function ( item ) {
get_el('town').removeClass('ui-autocomplete-loading');
return {
label: item.town_name,
item: item,
town: item.town_name,
district: item.district_name
}
district: item.district_count
}
}));
apd_xhr = null;
}
});
},
......
{
get_el('town').val(ui.item.town);
}
get_el('district').val('');
if (typeof ui.item.district !== 'undefined' &&
ui.item.town !== ui.item.district &&
ui.item.district.length)
// has town any district?
if (ui.item.district > 1)
{
get_el('district').val(ui.item.district);
// enable district field and set focus
get_el('district').removeAttr('disabled');
apd_show = true;
get_el('district').focus();
apd_show = false;
}
else
{
get_el('district').val('');
// disable district fiels and set focus to street
get_el('district').attr('disabled', 'disabled');
get_el('street').focus();
}
get_el('street').focus();
return false;
},
......
$('#town, #domicile_town').keyup(function(){
value = $(this).val();
object = new Object();
object.element = $(this);
if (value.match(' -$'))
if (!get_el('district', object).attr('disabled')
&& value.match(' -$'))
{
$(this).val(substr(value, 0, value.length - 2));
object = new Object();
object.element = $(this);
district = get_el('district', object);
district = get_el('district');
district.val('');
district.focus();
district.autocomplete("search", '');
}
get_el('district', object).removeAttr('disabled');
});
$('#district, #domicile_district').keyup(function(){
......
$(this).val('');
}
});
});
$('#district, #domicile_district').focusin(function(){
if (apd_show)
{
object = new Object();
object.element = $(this);
get_el('district', object).autocomplete("search", '');
}
apd_show = false;
});
$('#town, #domicile_town').focusout(function(){
object = new Object();
object.element = $(this);
if (get_el('town', object).val().length > 2)
{
apd_show = true;
$.ajax({
url: '<?php echo url::base() ?>cs/json/get_address',
dataType: "json",
data: "town="+get_el('town', object).val()+"&country="+get_el('country_id').val(),
success: function( data ) {
if (data !== null &&
typeof data[0] !== 'undefined' &&
data[0].district_count > 1)
{
get_el('district', object).removeAttr('disabled');
}
else
{
get_el('district', object).attr('disabled', 'disabled');
get_el('district').val('');
get_el('street').focus();
}
}
});
}
});
});
freenetis/branches/1.1/application/views/js/__pieces/whisperer_gps.php
// try to find GPS for address point and set it (esed ad devices and members)
$("#country_id, #town, #district, #street, #zip").change(function ()
{
if (gps_get != null)
if (gps_get !== null)
{
gps_get.abort();
gps_get = null;
......
gps_get = $.ajax({
url: '<?php echo url_lang::base() ?>address_points/get_gps_by_address_string/',
data: "country_id="+$("#country_id").val()+"&town="+$("#town").val()+"&district="+$("#district").val()+"&street="+$("#street").val()+"&zip="+$("#zip").val(),
data: "country_id="+$("#country_id").val()+"&town="+$("#town").val()+"&street="+$("#street").val()+"&zip="+$("#zip").val(),
success: function( data ) {
if (data != '')
if (data !== '')
{
var s = data.split(" ");
$("#gpsx").val(s[0]);
......
}
});
});
// triggers find of GPS
/*$("#country_id, #town, #district, #street, #zip").change(function ()
{
$(this).trigger('keyup');
});*/
// try to find GPS for domicile address point and set it (used at members)
$("#domicile_country_id, #domicile_town, #domicile_district, #domicile_street, #domicile_zip").keyup(function ()
......
gps_get = $.ajax({
url: '<?php echo url_lang::base() ?>address_points/get_gps_by_address_string/',
data: "country_id="+$("#domicile_country_id").val()+"&town="+$("#domicile_town").val()+"&district="+$("#domicile_district").val()+"&street="+$("#domicile_street").val()+"&zip="+$("#domicile_zip").val(),
data: "country_id="+$("#domicile_country_id").val()+"&town="+$("#domicile_town").val()+"&street="+$("#domicile_street").val()+"&zip="+$("#domicile_zip").val(),
success: function( data ) {
if (data != '')
if (data !== '')
{
var s = data.split(" ");
$("#domicile_gpsx").val(s[0]);
freenetis/branches/1.1/media/css/installation.css
font-style: normal;
}
.ui-autocomplete-loading {
background: white url('../images/icons/animations/ajax-loader.gif') right center no-repeat;
}
#district {
margin-left: 20px;
}

Také k dispozici: Unified diff