Skip to content

Commit

Permalink
better response management for support add
Browse files Browse the repository at this point in the history
  • Loading branch information
gerald2545 committed Jan 17, 2021
1 parent e8314a1 commit 8c20388
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions lib/js/public/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,10 @@ var SupportObservationForm = new Ext.FormPanel({
id_poi: idPoiComment
},
success: function(SupportObservationForm, o) {
console.log("SupportObservationForm success "+o.result.ok);

var myArr = JSON.parse(o.response.responseText)
Ext.MessageBox.show({
title: T_transfertOK,
msg: o.result.ok,
title: "Vote pris en compte",
msg: myArr.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO,
iconCls: 'silk_tick'
Expand All @@ -454,10 +453,12 @@ var SupportObservationForm = new Ext.FormPanel({
popup.hide();
},
failure: function(SupportObservationForm, o) {
console.log("SupportObservationForm echec "+o.result.pb);

console.log("my object: %o", o)
var myArr = JSON.parse(o.response.responseText)
Ext.MessageBox.show({
title: 'Hum ...',
msg: o.result.pb,
msg: myArr.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR,
iconCls: 'fugue_cross-script'
Expand Down Expand Up @@ -989,29 +990,30 @@ function createFeatureAdd(X,Y) {
longitudeField.setValue(geom.x);
console.log('feat not yet defined ' + latitudeField.getValue() + ' ' + longitudeField.getValue());
if (activateReverseGeocoding){
PublicAddRueField.disable();
Ext.Ajax.request({
waitMsg: T_pleaseWait,
url: 'lib/php/public/getAdresse.php',
params: {
lon: longitudeField.getValue(),
lat: latitudeField.getValue()
},
success: function(response) {
console.log('address found = '+response.responseText);
PublicAddRueField.setValue(response.responseText);
PublicAddRueField.enable();
},
failure: function(response){
var result = response.responseText;
console.log('error getting address = '+response.responseText);
PublicAddRueField.enable();
}
});
PublicAddRueField.disable();
Ext.Ajax.request({
waitMsg: T_pleaseWait,
url: 'lib/php/public/getAdresse.php',
params: {
lon: longitudeField.getValue(),
lat: latitudeField.getValue()
},
success: function(response) {
console.log('address found = '+response.responseText);
var res = response.responseText.split(":");
PublicAddRueField.setValue(res[0]);
PublicAddRueField.enable();
},
failure: function(response){
var result = response.responseText;
console.log('error getting address = '+response.responseText);
PublicAddRueField.enable();
}
});

}
}else{
console.log('Reverse geocoding is deactivated, look at key.js.template to enable it');
}else{
console.log('Reverse geocoding is deactivated, look at key.js.template to enable it');
}
}
}

Expand Down

0 comments on commit 8c20388

Please sign in to comment.