2015-02-01 03:21:54 +00:00
|
|
|
|
|
|
|
Vn.Photos = new Class
|
|
|
|
({
|
2015-11-17 10:34:33 +00:00
|
|
|
Extends: Vn.Form
|
2015-02-01 03:21:54 +00:00
|
|
|
|
|
|
|
,activate: function ()
|
|
|
|
{
|
2015-03-06 23:33:54 +00:00
|
|
|
this.$('schema').value = 'catalog';
|
|
|
|
this.$('photo-id').focus ();
|
2016-08-30 07:43:47 +00:00
|
|
|
|
|
|
|
var self = this;
|
|
|
|
this.$('html-form').onsubmit = function ()
|
2016-09-24 14:32:31 +00:00
|
|
|
{ self._onSubmit (); return false; };
|
2015-02-01 03:21:54 +00:00
|
|
|
}
|
2016-08-30 07:43:47 +00:00
|
|
|
|
2016-09-24 14:32:31 +00:00
|
|
|
,_onSubmit: function ()
|
2015-02-01 03:21:54 +00:00
|
|
|
{
|
2015-03-06 23:33:54 +00:00
|
|
|
this.$('schema-field').value = this.$('schema').value;
|
|
|
|
this.$('submit').disabled = true;
|
2015-02-01 03:21:54 +00:00
|
|
|
|
2016-09-24 14:32:31 +00:00
|
|
|
this.conn.sendFormMultipart (this.$('html-form'),
|
|
|
|
this._onResponse.bind (this));
|
2016-08-30 07:43:47 +00:00
|
|
|
}
|
|
|
|
|
2016-09-24 14:32:31 +00:00
|
|
|
,_onResponse: function (request, json, error)
|
2016-08-30 07:43:47 +00:00
|
|
|
{
|
2015-03-06 23:33:54 +00:00
|
|
|
this.$('submit').disabled = false;
|
2015-02-01 03:21:54 +00:00
|
|
|
|
2016-08-30 07:43:47 +00:00
|
|
|
if (json)
|
|
|
|
{
|
|
|
|
this.$('photo-id').value = '';
|
|
|
|
this.$('photo-id').focus ();
|
|
|
|
Htk.Toast.showMessage (_('ImageAdded'));
|
2015-02-01 03:21:54 +00:00
|
|
|
}
|
2016-08-30 07:43:47 +00:00
|
|
|
else
|
|
|
|
Htk.Toast.showError (error.message);
|
2015-02-01 03:21:54 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|