From 25e56bea80e36a92bc722eda0139132e5411750e Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 Aug 2016 09:43:47 +0200 Subject: [PATCH] Backup --- forms/admin/photos/photos.js | 41 ++++----- forms/admin/photos/style.css | 3 +- forms/admin/photos/ui.xml | 23 ++--- forms/ecomerce/invoices/invoices.js | 7 +- js/htk/field/select.js | 1 + js/htk/image-editor.xml | 1 - js/vn/json-request.js | 39 ++++++-- locale/ca/forms/admin/photos.json | 2 +- locale/en/forms/admin/photos.json | 2 +- locale/es/forms/admin/photos.json | 2 +- locale/fr/forms/admin/photos.json | 2 +- locale/mn/forms/admin/photos.json | 2 +- locale/pt/forms/admin/photos.json | 2 +- rest/tpv/confirm-post.php | 4 +- {pages => rest}/tpv/soap-request.xml | 0 {pages => rest}/tpv/soap-test.php | 4 +- vn/web/app.php | 132 +++++++++++++++++++++++++++ vn/web/html-service.php | 2 +- vn/web/json-request.php | 2 +- vn/web/rest-request.php | 2 +- vn/web/rest-service.php | 129 -------------------------- vn/web/service.php | 3 +- 22 files changed, 215 insertions(+), 190 deletions(-) rename {pages => rest}/tpv/soap-request.xml (100%) rename {pages => rest}/tpv/soap-test.php (88%) diff --git a/forms/admin/photos/photos.js b/forms/admin/photos/photos.js index 0f2b7da4..a391a31d 100644 --- a/forms/admin/photos/photos.js +++ b/forms/admin/photos/photos.js @@ -6,38 +6,37 @@ Vn.Photos = new Class ,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'; + + var self = this; + this.$('html-form').onsubmit = function () + { self.onSubmit (); return false; }; } - - ,onFormSubmit: function () + + ,onSubmit: function () { this.$('schema-field').value = this.$('schema').value; this.$('submit').disabled = true; this.gui.loaderPush (); - } - ,onImageUpload: function () - { + var request = new Vn.JsonRequest (); + request.sendFormMultipart (this.$('html-form'), + this.onResponse.bind (this)); + } + + ,onResponse: function (request, json, error) + { 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 +')'); + if (json) + { + this.$('photo-id').value = ''; + this.$('photo-id').focus (); + Htk.Toast.showMessage (_('ImageAdded')); } - catch (e) {} + else + Htk.Toast.showError (error.message); } }); diff --git a/forms/admin/photos/style.css b/forms/admin/photos/style.css index c25d6923..59dedb12 100644 --- a/forms/admin/photos/style.css +++ b/forms/admin/photos/style.css @@ -20,11 +20,12 @@ /* Footer */ -.photos button +.photos input[type=submit] { display: block; margin: 0 auto; padding: 0.6em; margin-top: 1.5em; + font-size: 1.2em; } diff --git a/forms/admin/photos/ui.xml b/forms/admin/photos/ui.xml index 1b074152..23d9d94c 100755 --- a/forms/admin/photos/ui.xml +++ b/forms/admin/photos/ui.xml @@ -7,10 +7,8 @@
+ enctype="multipart/form-data"> +
@@ -20,27 +18,22 @@
- - + - SELECT name, `desc` FROM image_schema ORDER BY `desc` + + SELECT name, `desc` FROM image_schema ORDER BY `desc` + +
-
- +
-