2016-07-22 20:00:27 +00:00
|
|
|
|
2016-09-26 09:28:47 +00:00
|
|
|
Hedera.Contact = new Class
|
2016-07-22 20:00:27 +00:00
|
|
|
({
|
2016-09-26 09:28:47 +00:00
|
|
|
Extends: Hedera.Form
|
2016-07-22 20:00:27 +00:00
|
|
|
|
|
|
|
,activate: function ()
|
|
|
|
{
|
|
|
|
var self = this;
|
2016-08-25 10:47:09 +00:00
|
|
|
this.$('contact-form').onsubmit = function ()
|
2016-09-24 14:32:31 +00:00
|
|
|
{ self._onSubmit (); return false; };
|
2016-07-22 20:00:27 +00:00
|
|
|
|
|
|
|
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);
|
2016-07-22 20:00:27 +00:00
|
|
|
}
|
|
|
|
|
2016-09-24 14:32:31 +00:00
|
|
|
,_onSubmit: function ()
|
2016-07-22 20:00:27 +00:00
|
|
|
{
|
2016-09-24 14:32:31 +00:00
|
|
|
this.conn.sendForm (this.$('contact-form'),
|
|
|
|
this._onResponse.bind (this));
|
2016-07-22 20:00:27 +00:00
|
|
|
}
|
|
|
|
|
2016-09-24 14:32:31 +00:00
|
|
|
,_onResponse: function (json, error)
|
2016-07-22 20:00:27 +00:00
|
|
|
{
|
|
|
|
var form = this.$('contact-form');
|
|
|
|
|
|
|
|
if (json)
|
|
|
|
{
|
|
|
|
form.reset ();
|
|
|
|
Htk.Toast.showMessage (_('DataSentSuccess'));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Htk.Toast.showError (_('ErrorSendingData'));
|
|
|
|
|
|
|
|
form['captcha'].value = '';
|
|
|
|
this.refreshCaptcha ();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|