hedera-web/forms/admin/photos/photos.js

43 lines
824 B
JavaScript
Raw Normal View History

2015-02-01 03:21:54 +00:00
Vn.Photos = new Class
({
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 ()
{ self.onSubmit (); return false; };
2015-02-01 03:21:54 +00:00
}
2016-08-30 07:43:47 +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
this.gui.loaderPush ();
2016-08-30 07:43:47 +00:00
var request = new Vn.JsonRequest ();
request.sendFormMultipart (this.$('html-form'),
this.onResponse.bind (this));
}
,onResponse: function (request, json, error)
{
2015-02-01 03:21:54 +00:00
this.gui.loaderPop ();
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
}
});