2016-07-22 20:00:27 +00:00
|
|
|
|
|
|
|
Vn.Contact = new Class
|
|
|
|
({
|
|
|
|
Extends: Vn.Form
|
|
|
|
|
|
|
|
,activate: function ()
|
|
|
|
{
|
|
|
|
var self = this;
|
2016-08-25 10:47:09 +00:00
|
|
|
this.$('contact-form').onsubmit = function ()
|
2016-07-22 20:00:27 +00:00
|
|
|
{ self.onSubmit (); return false; };
|
|
|
|
|
|
|
|
this.refreshCaptcha ();
|
|
|
|
}
|
|
|
|
|
|
|
|
,refreshCaptcha: function ()
|
|
|
|
{
|
2016-08-26 12:43:45 +00:00
|
|
|
params = {
|
|
|
|
'srv': 'rest:core/captcha',
|
|
|
|
'stamp': new Date ().getTime ()
|
|
|
|
};
|
|
|
|
this.$('captcha-img').src = '?'+ Vn.Url.makeUri (params);
|
|
|
|
|
|
|
|
Vn.Url.makeUri (params)
|
2016-07-22 20:00:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,onSubmit: function ()
|
|
|
|
{
|
|
|
|
var request = new Vn.JsonRequest ();
|
|
|
|
request.sendForm (this.$('contact-form'),
|
|
|
|
this.onResponse.bind (this));
|
|
|
|
}
|
|
|
|
|
|
|
|
,onResponse: function (request, json, error)
|
|
|
|
{
|
|
|
|
var form = this.$('contact-form');
|
|
|
|
|
|
|
|
if (json)
|
|
|
|
{
|
|
|
|
form.reset ();
|
|
|
|
Htk.Toast.showMessage (_('DataSentSuccess'));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Htk.Toast.showError (_('ErrorSendingData'));
|
|
|
|
|
|
|
|
form['captcha'].value = '';
|
|
|
|
this.refreshCaptcha ();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|