2015-02-01 03:21:54 +00:00
|
|
|
|
2016-09-26 09:28:47 +00:00
|
|
|
Hedera.Photos = new Class
|
2015-02-01 03:21:54 +00:00
|
|
|
({
|
2016-09-26 09:28:47 +00:00
|
|
|
Extends: Hedera.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-10-11 14:45:10 +00:00
|
|
|
,_onResponse: function (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-10-11 14:45:10 +00:00
|
|
|
if (error)
|
|
|
|
throw error;
|
|
|
|
|
|
|
|
this.$('photo-id').value = '';
|
|
|
|
this.$('photo-id').focus ();
|
|
|
|
Htk.Toast.showMessage (_('ImageAdded'));
|
2015-02-01 03:21:54 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|