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-23 22:35:17 +00:00
|
|
|
this.$('form').action =
|
|
|
|
'//'+ Vn.Config['image_host'] +'/hedera-web/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 ();
|
|
|
|
}
|
|
|
|
|
2015-03-27 19:10:49 +00:00
|
|
|
,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) {}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|