0
1
Fork 0
hedera-web-mindshore/web/forms/admin/photos/photos.js

44 lines
938 B
JavaScript
Raw Normal View History

2015-02-01 03:21:54 +00:00
Vn.Photos = new Class
({
Extends: Vn.Module
,activate: function ()
{
2015-03-06 23:33:54 +00:00
this.$('schema').value = 'catalog';
this.$('photo-size').value = 10 /* MB */ * 1048576;
this.$('photo-id').focus ();
2015-09-24 11:50:27 +00:00
this.$('html-form').action =
2015-09-28 09:46:24 +00:00
'//'+ Vn.Config['image_host'] +'/rest.php?action=image';
2015-02-01 03:21:54 +00:00
}
,onFormSubmit: function ()
{
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 ();
}
,onImageUpload: function ()
2015-08-17 18:02:14 +00:00
{
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
try {
2015-03-06 23:33:54 +00:00
var responseText = this.$('iframe').contentDocument.body.textContent;
2015-02-01 03:21:54 +00:00
var response = eval ('('+ responseText +')');
if (response.data)
{
2015-03-06 23:33:54 +00:00
this.$('photo-id').value = '';
this.$('photo-id').focus ();
2015-08-17 18:02:14 +00:00
Htk.Toast.showMessage (_('ImageUploaded'));
2015-02-01 03:21:54 +00:00
}
else
2015-08-17 18:02:14 +00:00
Htk.Toast.showError (response.error.message +' ('+ response.error.code +')');
2015-02-01 03:21:54 +00:00
}
catch (e) {}
}
});