git-svn-id: https://msi/svn/firstRepo/WebClient/branches/NewRelease@43 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
@@ -5,6 +5,7 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
|
||||
|
||||
//initialize template
|
||||
template:_.template(settingsViewTemplate),
|
||||
_flagSave: false,
|
||||
|
||||
initialize: function () {
|
||||
var self = this;
|
||||
@@ -18,6 +19,12 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
|
||||
},
|
||||
|
||||
saveBtn:function(e){
|
||||
var self = this;
|
||||
|
||||
if(self._flagSave)
|
||||
return;
|
||||
|
||||
self._flagSave = true;
|
||||
e.preventDefault();
|
||||
Profile.data.risRic = this.$el.find('#nResult').val();
|
||||
Profile.data.tema = this.$el.find('#theme').val();
|
||||
@@ -33,6 +40,26 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
|
||||
Profile.data.dataSpacc.tipopm = this.$el.find('#tPM').val();
|
||||
Profile.data.dataSpacc.privacy = this.$el.find('#privacyChk').prop('checked')?"1":"0";
|
||||
|
||||
if(Profile.data.email === "" ||
|
||||
Profile.data.dataSpacc.provincia === "" ||
|
||||
Profile.data.dataSpacc.comune === "" ||
|
||||
Profile.data.dataSpacc.cap === "" ||
|
||||
Profile.data.dataSpacc.tipopm === "")
|
||||
{
|
||||
this.$el.find('#messaggio').html("<center><h1>ATTENZIONE</h1> devono essere settate tutte i campi</center>");
|
||||
this.$el.find('#popupDialog').popup("open");
|
||||
self._flagSave = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if(Profile.data.dataSpacc.privacy==="0")
|
||||
{
|
||||
this.$el.find('#messaggio').html("<center><h1>ATTENZIONE</h1> per proseguire si DEVE accettare l'informativa privacy</center>");
|
||||
this.$el.find('#popupDialog').popup("open");
|
||||
self._flagSave = false;
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "http://maps.google.com/maps/api/geocode/json?address=" +
|
||||
Profile.data.dataSpacc.comune + "+" +
|
||||
@@ -40,14 +67,23 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
|
||||
Profile.data.dataSpacc.provincia + "+italia&sensor=false",
|
||||
Type: "GET"
|
||||
}).then(function ( response ) {
|
||||
|
||||
if(response.results.length == 1)
|
||||
{
|
||||
Profile.data.dataSpacc.lat = response.results[0].geometry.location.lat;
|
||||
Profile.data.dataSpacc.long = response.results[0].geometry.location.lng;
|
||||
Profile.updateProfile(function(){
|
||||
self._flagSave = false;
|
||||
Backbone.history.loadUrl(Backbone.history.getFragment());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Profile.updateProfile(function(){
|
||||
Backbone.history.loadUrl();
|
||||
self._flagSave = false;
|
||||
Backbone.history.loadUrl(Backbone.history.getFragment());
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user