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;
|
2022-05-28 01:18:06 +00:00
|
|
|
this.$.contactForm.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 ()
|
|
|
|
};
|
2022-05-28 01:18:06 +00:00
|
|
|
this.$.captchaImg.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
|
|
|
{
|
2022-05-28 01:18:06 +00:00
|
|
|
this.conn.sendForm (this.$.contactForm,
|
2016-09-24 14:32:31 +00:00
|
|
|
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
|
|
|
{
|
2022-05-28 01:18:06 +00:00
|
|
|
var form = this.$.contactForm;
|
2016-07-22 20:00:27 +00:00
|
|
|
|
|
|
|
if (json)
|
|
|
|
{
|
|
|
|
form.reset ();
|
|
|
|
Htk.Toast.showMessage (_('DataSentSuccess'));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Htk.Toast.showError (_('ErrorSendingData'));
|
|
|
|
|
|
|
|
form['captcha'].value = '';
|
|
|
|
this.refreshCaptcha ();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|