Vn.Photos = new Class ({ Extends: Vn.Form ,activate: function () { this.$('schema').value = 'catalog'; this.$('photo-size').value = 10 /* MB */ * 1048576; this.$('photo-id').focus (); this.$('html-form').action = '//'+ Vn.Config['image_host'] +'/rest.php?action=image'; } ,onFormSubmit: function () { this.$('schema-field').value = this.$('schema').value; this.$('submit').disabled = true; this.gui.loaderPush (); } ,onImageUpload: function () { this.gui.loaderPop (); this.$('submit').disabled = false; try { var responseText = this.$('iframe').contentDocument.body.textContent; var response = eval ('('+ responseText +')'); if (response.data) { this.$('photo-id').value = ''; this.$('photo-id').focus (); Htk.Toast.showMessage (_('ImageUploaded')); } else Htk.Toast.showError (response.error.message +' ('+ response.error.code +')'); } catch (e) {} } });