From da007ff7c07ac8a893e0ac9e07e88590850b7733 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 8 May 2017 17:54:35 +0200 Subject: [PATCH 1/5] =?UTF-8?q?Subida=20de=20fotos=20m=C3=BAltiple?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- forms/admin/photos/photos.js | 207 +++++++++++++++++++++++++++++++---- forms/admin/photos/style.css | 66 +++++++++-- forms/admin/photos/ui.xml | 64 ++++++----- js/vn/json-connection.js | 16 ++- rest/image/sync.php | 6 +- rest/image/thumb.php | 3 +- rest/image/upload.php | 81 +++----------- 7 files changed, 312 insertions(+), 131 deletions(-) diff --git a/forms/admin/photos/photos.js b/forms/admin/photos/photos.js index 9da93fe3..7800fb04 100644 --- a/forms/admin/photos/photos.js +++ b/forms/admin/photos/photos.js @@ -2,36 +2,203 @@ Hedera.Photos = new Class ({ Extends: Hedera.Form + ,filesData: [] + ,uploadCount: 0 + ,errors: false ,activate: function () { this.$('schema').value = 'catalog'; - this.$('photo-id').focus (); - - var self = this; - this.$('html-form').onsubmit = function () - { self._onSubmit (); return false; }; } - - ,_onSubmit: function () - { - this.$('schema-field').value = this.$('schema').value; - this.$('submit').disabled = true; - this.conn.sendFormMultipart (this.$('html-form'), - this._onResponse.bind (this)); + ,addFiles: function (files) + { + if (!files) + return; + + for (var i = 0; i < files.length; i++) + this.addFile (files[i]); } - - ,_onResponse: function (json, error) + + ,addFile: function (file) { - this.$('submit').disabled = false; + var doc = document; + var div = doc.createElement ('div'); - if (error) - throw error; + var button = new Htk.Button ({ + tip: 'Remove', + icon: 'delete' + }); + button.on ('click', this.onFileRemove, this); + div.appendChild (button.node); - this.$('photo-id').value = ''; - this.$('photo-id').focus (); - Htk.Toast.showMessage (_('ImageAdded')); + var thumb = doc.createElement ('img'); + thumb.file = file; + thumb.className = 'thumb'; + div.appendChild (thumb); + + var reader = new FileReader (); + reader.onload = function (e) { thumb.src = e.target.result; }; + reader.readAsDataURL(file); + + var name = doc.createElement ('input'); + name.type = 'text'; + name.value = getFileName (file.name); + div.appendChild (name); + + var status = doc.createElement ('span'); + status.className = 'status'; + div.appendChild (status); + + var fileData = { + div: div, + file: file, + name: name, + status: status, + sent: false, + loading : false + }; + this.filesData.push (fileData); + button.value = fileData; + + this.$('file-list').appendChild (div); + } + + ,onUploadClick: function () + { + var filesData = this.filesData; + var formData = new FormData(); + var count = 0; + + for (var i = 0; i < filesData.length; i++) + { + var fileData = filesData[i]; + + if (!(fileData.sent || fileData.loading)) + { + formData.set ('image', fileData.file); + formData.set ('name', fileData.name.value); + formData.set ('schema', this.$('schema').value); + formData.set ('srv', 'json:image/upload'); + this.conn.sendFormData (formData, + this.onFileUpload.bind (this, fileData)); + + fileData.loading = true; + this.uploadCount++; + count++; + } + } + + if (count === 0) + Htk.Toast.showWarning ('There are no files to upload'); + } + + ,onFileUpload: function (fileData, data, error) + { + fileData.loading = false; + + if (data) + { + var iconName = 'ok'; + var title = _('ImageAdded'); + fileData.sent = true; + fileData.name.disabled = true; + } + else + { + var iconName = 'error'; + var title = error.message; + this.errors = true; + } + + var status = fileData.status; + Vn.Node.removeChilds (status); + + var icon = new Htk.Icon ({icon: iconName}); + status.appendChild (icon.node); + status.title = title; + + this.uploadCount--; + + if (this.uploadCount === 0) + { + if (!this.errors) + Htk.Toast.showMessage (_('Upload finished successfully')); + else + Htk.Toast.showError (_('Some errors happened on upload')); + + this.errors = false; + } + } + + ,onFileRemove: function (button) + { + var fileData = button.value; + this.$('file-list').removeChild (fileData.div); + + for (var i = 0; i < this.filesData.length; i++) + if (this.filesData[i] === fileData) + { + this.filesData.splice (i, 1); + break; + } + } + + ,onClearClick: function () + { + this.filesData = []; + Vn.Node.removeChilds (this.$('file-list')); + } + + ,onDropzoneClick: function () + { + this.$('file').click (); + } + + ,onFileChange: function () + { + this.addFiles (this.$('file').files); + } + + ,onDragEnter: function (event) + { + Vn.Node.addClass (this.$('dropzone'), 'dragover'); + } + + ,onDragLeave: function (event) + { + Vn.Node.removeClass (this.$('dropzone'), 'dragover'); + } + + ,onDragOver: function (event) + { + event.preventDefault (); + } + + ,onDragEnd: function (event) + { + Vn.Node.removeClass (this.$('dropzone'), 'dragover'); + event.dataTransfer.clearData (); + } + + ,onDrop: function (event) + { + event.preventDefault (); + this.addFiles (event.dataTransfer.files); } }); +function getFileName (path) +{ + var barIndex = path.lastIndexOf ('/'); + if (barIndex === -1) + barIndex = path.lastIndexOf ('\\'); + if (barIndex === -1) + barIndex = 0; + + var dotIndex = path.lastIndexOf ('.'); + if (dotIndex === -1) + dotIndex = 0; + + return path.substr (barIndex, dotIndex); +} diff --git a/forms/admin/photos/style.css b/forms/admin/photos/style.css index 59dedb12..d75c2d2f 100644 --- a/forms/admin/photos/style.css +++ b/forms/admin/photos/style.css @@ -5,27 +5,69 @@ } .photos .box { - max-width: 30em; + max-width: 25em; padding: 2em; } -.photos .form + +/* Dropzone */ + +.photos .dropzone { - margin: 0 auto; - max-width: 25em; + background-color: white; + border-style: dashed; + border-radius: .4em; + border-color: #2196F3; + padding: 2em 1em; + text-align: center; + color: #666; + cursor: pointer; } -.photos iframe +.photos .dropzone.dragover +{ + color: #CCC; + border-style: solid; +} +.photos input[type=file] { display: none; } -/* Footer */ +/* File list */ -.photos input[type=submit] +.photos .file-list { - display: block; - margin: 0 auto; - padding: 0.6em; - margin-top: 1.5em; - font-size: 1.2em; + margin-top: 1em; +} +.photos .file-list > div +{ + height: 2.5em; +} +.photos .file-list .thumb +{ + max-height: 2em; + max-width: 2em; + vertical-align: middle; + margin: 0 1em; +} +.photos .file-list input +{ + max-width: 10em; +} +.photos .file-list .status +{ + margin-left: .5em; + cursor: pointer; } +/* Footer */ + +.photos .footer +{ + margin-top: 1.5em; + text-align: center; +} +.photos .footer > button +{ + font-size: 1.2em; + margin-left: 1em; +} diff --git a/forms/admin/photos/ui.xml b/forms/admin/photos/ui.xml index 23d9d94c..4e4caf53 100755 --- a/forms/admin/photos/ui.xml +++ b/forms/admin/photos/ui.xml @@ -4,36 +4,40 @@
-
-
- -
- - -
-
- - -
-
- - - - - SELECT name, `desc` FROM image_schema ORDER BY `desc` - - - - -
-
- - -
- -
+
+ + + + + SELECT name, `desc` FROM image_schema ORDER BY `desc` + + + +
+
+ Click or drop files here! +
+ +
+
diff --git a/js/vn/json-connection.js b/js/vn/json-connection.js index 7d38b9d6..4b583e73 100644 --- a/js/vn/json-connection.js +++ b/js/vn/json-connection.js @@ -183,7 +183,7 @@ module.exports = new Class if (this.token) formData.append ('token', this.token); - + var request = new XMLHttpRequest (); request.open ('post', form.action, true); request.onreadystatechange = @@ -193,6 +193,20 @@ module.exports = new Class this._addRequest (); } + ,sendFormData: function (formData, callback) + { + if (this.token) + formData.append ('token', this.token); + + var request = new XMLHttpRequest (); + request.open ('post', '', true); + request.onreadystatechange = + this._onStateChange.bind (this, request, callback); + request.send (formData); + + this._addRequest (); + } + /* * Called when REST response is received. */ diff --git a/rest/image/sync.php b/rest/image/sync.php index 04f62831..9ffeec70 100644 --- a/rest/image/sync.php +++ b/rest/image/sync.php @@ -5,7 +5,7 @@ require_once (__DIR__.'/util.php'); /** * Syncronizes the data directory with the database, this may take * some time. - **/ + */ class Sync extends Vn\Lib\Method { private $trashSubdir; @@ -20,7 +20,7 @@ class Sync extends Vn\Lib\Method function run () { - $db = $this->getSysConn () + $db = $this->getSysConn (); set_time_limit (0); $this->$trashSubdir = date ('YmdHis'); @@ -111,7 +111,7 @@ class Sync extends Vn\Lib\Method * Moves a data directory to the trash. * * @param string $file The file to move to the trash - **/ + */ function moveTrash ($file) { $trashBasedir = "{$this->dataDir}/.trash/". $this->$trashSubdir; diff --git a/rest/image/thumb.php b/rest/image/thumb.php index 9784e249..77db5872 100644 --- a/rest/image/thumb.php +++ b/rest/image/thumb.php @@ -9,7 +9,7 @@ require_once (__DIR__.'/util.php'); * @param string $file The file name * @param integer $width The width of the thumb * @param integer $height The height of the thumb - **/ + */ class Thumb extends Vn\Web\RestRequest { function run () @@ -64,7 +64,6 @@ class Thumb extends Vn\Web\RestRequest throw new Exception ('Size not allowed'); // Creates the thumb. - $util = new Util ($this->app); $baseDir = "{$util->dataDir}/$schema"; diff --git a/rest/image/upload.php b/rest/image/upload.php index 882cb02c..6f81ec07 100755 --- a/rest/image/upload.php +++ b/rest/image/upload.php @@ -7,80 +7,34 @@ use Vn\Lib\UserException; /** * Uploads a file creating its corresponding sizes. - **/ + */ class Upload extends Vn\Web\JsonRequest { + const PARAMS = [ + 'name', + 'schema' + ]; + function run ($db) { $util = new Util ($this->app); - // Checks schema. - - $regexp = '/[^a-z0-9_]/'; - - if (empty ($_REQUEST['schema']) || preg_match ($regexp, $_REQUEST['schema']) !== 0) - throw new UserException (s('Bad schema name')); - $schema = $_REQUEST['schema']; + $name = $_REQUEST['name']; + + // Checks schema + $info = $util->loadInfo ($schema); if (!$info) throw new UserException (s('Schema not exists')); - // Checks file name and identifier. + // Checks file name - $query = sprintf ( - 'SHOW INDEX FROM `%1$s`.`%2$s` WHERE Key_name = \'PRIMARY\'' - ,$info['schema'] - ,$info['table'] - ); - $pk = $db->getRow ($query); - - if (!empty ($_REQUEST['id']) && empty ($_REQUEST['name'])) - { - $query = sprintf ( - 'SELECT `%3$s` FROM `%1$s`.`%2$s` WHERE `%4$s` = #id' - ,$info['schema'] - ,$info['table'] - ,$info['column'] - ,$pk['Column_name'] - ); - $_REQUEST['name'] = $db->getValue ($query, - ['id' => $_REQUEST['id']]); - } - - if (empty ($_REQUEST['name']) || preg_match ($regexp, $_REQUEST['name']) !== 0) + if (preg_match ('/[^a-z0-9_]/', $_REQUEST['name']) !== 0) throw new UserException (s('Bad file name')); - // Checks permissions. - - if (!empty ($_REQUEST['id'])) - { - $filterColumn = $pk['Column_name']; - $filterValue = $_REQUEST['id']; - } - else - { - $filterColumn = $info['column']; - $filterValue = $_REQUEST['name']; - } - - $query = sprintf ( - 'UPDATE `%1$s`.`%2$s` SET `%3$s` = #name WHERE `%4$s` = #filter LIMIT 1' - ,$info['schema'] - ,$info['table'] - ,$info['column'] - ,$filterColumn - ); - $params = [ - 'name' => $_REQUEST['name'], - 'filter' => $filterValue - ]; - - if (!$db->query ($query, $params)) - throw new UserException (s('Permission denied')); - - // Checks for file errors. + // Checks for file errors if (empty ($_FILES['image']['name'])) throw new UserException (s('File not choosed')); @@ -123,14 +77,15 @@ class Upload extends Vn\Web\JsonRequest if ($_FILES['image']['size'] > $maxSize * 1048576) throw new UserException (sprintf (s('File size error'), $maxSize)); - // Resizes and saves the image. + // Resizes and saves the image - $fileName = "{$_REQUEST['name']}.png"; + $tmpName = $_FILES['image']['tmp_name']; + $fileName = "{$name}.png"; $schemaPath = "{$util->dataDir}/$schema"; $fullFile = "$schemaPath/full/$fileName"; $symbolicSrc = "../full/$fileName"; - $image = Image::create ($_FILES['image']['tmp_name']); + $image = Image::create ($tmpName); Image::resizeSave ($image, $fullFile, $info['max_height'], $info['max_width']); foreach ($info['sizes'] as $size => $i) @@ -140,7 +95,7 @@ class Upload extends Vn\Web\JsonRequest } imagedestroy ($image); - unlink ($_FILES['image']['tmp_name']); + unlink ($tmpName); return TRUE; } } From 45d336a64d1faf2a2c59be74b5fc206865d942c5 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 8 May 2017 17:57:54 +0200 Subject: [PATCH 2/5] Version incrementada --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 644d6018..aa1cfa9a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (1.401-deb8) stable; urgency=low +hedera-web (1.402-deb8) stable; urgency=low * Initial Release. From 82676a20a1b2dcb1063c94165d1062e7c9f41f55 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 9 May 2017 09:34:42 +0200 Subject: [PATCH 3/5] Errores solucionados --- debian/changelog | 2 +- forms/admin/photos/photos.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 644d6018..aa1cfa9a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (1.401-deb8) stable; urgency=low +hedera-web (1.402-deb8) stable; urgency=low * Initial Release. diff --git a/forms/admin/photos/photos.js b/forms/admin/photos/photos.js index 7800fb04..0b7510e8 100644 --- a/forms/admin/photos/photos.js +++ b/forms/admin/photos/photos.js @@ -76,10 +76,10 @@ Hedera.Photos = new Class if (!(fileData.sent || fileData.loading)) { - formData.set ('image', fileData.file); - formData.set ('name', fileData.name.value); - formData.set ('schema', this.$('schema').value); - formData.set ('srv', 'json:image/upload'); + formData.append ('image', fileData.file); + formData.append ('name', fileData.name.value); + formData.append ('schema', this.$('schema').value); + formData.append ('srv', 'json:image/upload'); this.conn.sendFormData (formData, this.onFileUpload.bind (this, fileData)); From 248c033806782c581e69f89b1c3b912c0a8183d7 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 9 May 2017 09:42:03 +0200 Subject: [PATCH 4/5] Version incrementada --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index aa1cfa9a..30af5d44 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (1.402-deb8) stable; urgency=low +hedera-web (1.403-deb8) stable; urgency=low * Initial Release. From bda508ec7d3750125d69833c4b576a7af9975e99 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 9 May 2017 14:03:06 +0200 Subject: [PATCH 5/5] =?UTF-8?q?Subir=20im=C3=A1genes=20Beta=20II?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 2 +- forms/admin/items/items.js | 17 ---- forms/admin/items/locale/ca.json | 4 + forms/admin/items/locale/en.json | 11 +-- forms/admin/items/locale/es.json | 9 +- forms/admin/items/locale/fr.json | 4 + forms/admin/items/locale/mn.json | 11 +-- forms/admin/items/locale/pt.json | 11 +-- forms/admin/items/style.css | 57 ++++++------ forms/admin/items/ui.xml | 91 ++++++++++--------- forms/admin/photos/locale/ca.json | 15 +-- forms/admin/photos/locale/en.json | 15 +-- forms/admin/photos/locale/es.json | 13 +-- forms/admin/photos/locale/fr.json | 15 +-- forms/admin/photos/locale/mn.json | 17 ++-- forms/admin/photos/locale/pt.json | 15 +-- forms/admin/photos/photos.js | 2 +- forms/admin/photos/ui.xml | 4 +- forms/reports/items-form/items-form.js | 23 +++++ forms/reports/items-form/locale/en.json | 9 ++ forms/reports/items-form/locale/es.json | 9 ++ forms/reports/items-form/locale/mn.json | 9 ++ forms/reports/items-form/locale/pt.json | 9 ++ forms/reports/items-form/style.css | 43 +++++++++ forms/reports/items-form/ui.xml | 49 ++++++++++ .../{admin => reports}/shelves/locale/ca.json | 0 .../{admin => reports}/shelves/locale/en.json | 0 .../{admin => reports}/shelves/locale/es.json | 0 .../{admin => reports}/shelves/locale/fr.json | 0 .../{admin => reports}/shelves/locale/mn.json | 0 .../{admin => reports}/shelves/locale/pt.json | 0 forms/{admin => reports}/shelves/shelves.js | 0 forms/{admin => reports}/shelves/style.css | 0 forms/{admin => reports}/shelves/ui.xml | 0 js/hedera/gui.js | 2 +- js/hedera/locale/ca.json | 1 + js/hedera/locale/en.json | 1 + js/hedera/locale/es.json | 1 + js/hedera/locale/fr.json | 1 + js/hedera/locale/mn.json | 1 + js/hedera/locale/pt.json | 1 + 41 files changed, 307 insertions(+), 165 deletions(-) create mode 100755 forms/admin/items/locale/ca.json mode change 100644 => 100755 forms/admin/items/locale/en.json mode change 100644 => 100755 forms/admin/items/locale/es.json create mode 100755 forms/admin/items/locale/fr.json mode change 100644 => 100755 forms/admin/items/locale/mn.json create mode 100644 forms/reports/items-form/items-form.js create mode 100644 forms/reports/items-form/locale/en.json create mode 100644 forms/reports/items-form/locale/es.json create mode 100644 forms/reports/items-form/locale/mn.json create mode 100644 forms/reports/items-form/locale/pt.json create mode 100644 forms/reports/items-form/style.css create mode 100755 forms/reports/items-form/ui.xml rename forms/{admin => reports}/shelves/locale/ca.json (100%) rename forms/{admin => reports}/shelves/locale/en.json (100%) rename forms/{admin => reports}/shelves/locale/es.json (100%) rename forms/{admin => reports}/shelves/locale/fr.json (100%) rename forms/{admin => reports}/shelves/locale/mn.json (100%) rename forms/{admin => reports}/shelves/locale/pt.json (100%) rename forms/{admin => reports}/shelves/shelves.js (100%) rename forms/{admin => reports}/shelves/style.css (100%) rename forms/{admin => reports}/shelves/ui.xml (100%) diff --git a/debian/changelog b/debian/changelog index 30af5d44..117c9294 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (1.403-deb8) stable; urgency=low +hedera-web (1.404-deb8) stable; urgency=low * Initial Release. diff --git a/forms/admin/items/items.js b/forms/admin/items/items.js index b029e140..96c5e973 100644 --- a/forms/admin/items/items.js +++ b/forms/admin/items/items.js @@ -2,22 +2,5 @@ Hedera.Items = new Class ({ Extends: Hedera.Form - - ,activate: function () - { - this.$('warehouse').value = 7; - this.$('realm').value = null; - } - - ,onPreviewClick: function () - { - var batch = new Sql.Batch (); - batch.addValues ({ - 'warehouse': this.$('warehouse').value - ,'realm': this.$('realm').value - ,'rate': this.$('rate').value - }); - this.gui.openReport ('items-report', batch); - } }); diff --git a/forms/admin/items/locale/ca.json b/forms/admin/items/locale/ca.json new file mode 100755 index 00000000..eab281b3 --- /dev/null +++ b/forms/admin/items/locale/ca.json @@ -0,0 +1,4 @@ +{ + "Items": "Artícles", + "Enter a search term": "Introdueix un terme de cerca" +} diff --git a/forms/admin/items/locale/en.json b/forms/admin/items/locale/en.json old mode 100644 new mode 100755 index 53a2579c..b59e1d2f --- a/forms/admin/items/locale/en.json +++ b/forms/admin/items/locale/en.json @@ -1,9 +1,4 @@ { - "Item list": "Item list" - - ,"Store": "Store" - ,"Realm": "Realm" - ,"Rate": "Rate" - - ,"Preview": "Preview" -} + "Items": "Items", + "Enter a search term": "Enter a search term" +} \ No newline at end of file diff --git a/forms/admin/items/locale/es.json b/forms/admin/items/locale/es.json old mode 100644 new mode 100755 index 68eee4ef..649219de --- a/forms/admin/items/locale/es.json +++ b/forms/admin/items/locale/es.json @@ -1,9 +1,4 @@ { - "Item list": "Listado de artículos" - - ,"Store": "Almacén" - ,"Realm": "Reino" - ,"Rate": "Tarifa" - - ,"Preview": "Mostrar" + "Items": "Artículos", + "Enter a search term": "Introduce un término de búsqueda" } diff --git a/forms/admin/items/locale/fr.json b/forms/admin/items/locale/fr.json new file mode 100755 index 00000000..bf70e9ab --- /dev/null +++ b/forms/admin/items/locale/fr.json @@ -0,0 +1,4 @@ +{ + "Items": "Articles", + "Enter a search term": "Entrez un terme de recherche" +} \ No newline at end of file diff --git a/forms/admin/items/locale/mn.json b/forms/admin/items/locale/mn.json old mode 100644 new mode 100755 index 53a2579c..b59e1d2f --- a/forms/admin/items/locale/mn.json +++ b/forms/admin/items/locale/mn.json @@ -1,9 +1,4 @@ { - "Item list": "Item list" - - ,"Store": "Store" - ,"Realm": "Realm" - ,"Rate": "Rate" - - ,"Preview": "Preview" -} + "Items": "Items", + "Enter a search term": "Enter a search term" +} \ No newline at end of file diff --git a/forms/admin/items/locale/pt.json b/forms/admin/items/locale/pt.json index 8bf6f7f2..54f69e72 100644 --- a/forms/admin/items/locale/pt.json +++ b/forms/admin/items/locale/pt.json @@ -1,9 +1,4 @@ { - "Item list": "Lista de Ítens" - - ,"Store": "Armazém" - ,"Realm": "Reino" - ,"Rate": "Tarifa" - - ,"Preview": "Mostrar" -} + "Items": "Artigos", + "Enter a search term": "Digite um termo de pesquisa" +} \ No newline at end of file diff --git a/forms/admin/items/style.css b/forms/admin/items/style.css index ff9ba1be..efe68e09 100644 --- a/forms/admin/items/style.css +++ b/forms/admin/items/style.css @@ -1,43 +1,42 @@ - .items -{ +{ padding: 1em; } .items .box -{ - max-width: 30em; - padding: 2em; -} -.items .form { max-width: 25em; - margin: auto; -} -.items .form-group -{ - padding: 0.4em; -} -.items form label -{ - display: block; - margin-bottom: 0.5em; -} -.items input[type=text], -.items select -{ - margin: 0; - width: 100%; + margin: 0 auto; } -/* Footer */ +/* Row */ -.items .footer +.items .row { - text-align: center; - margin-top: 1.5em; + padding: 1em; + border-bottom: 1px solid #DDD; } -.items .footer > button +.items .row > .photo { - margin: 0 .2em; + margin-right: 1em; + float: left; + border-radius: 50%; + height: 3.2em; + width: 3.2em; +} +.items .row > p +{ + margin: .1em 0; + margin-left: 5em; +} +.items .row > p.important +{ + font-size: 1.2em; +} + +/* Topbar */ + +.action-bar .htk-search-entry +{ + margin: .8em .6em; } diff --git a/forms/admin/items/ui.xml b/forms/admin/items/ui.xml index 07fc6174..2632fb94 100755 --- a/forms/admin/items/ui.xml +++ b/forms/admin/items/ui.xml @@ -1,49 +1,58 @@ + + + +
-

Item list

+

Items

-
- +
+
-
-
-
- - - - - - SELECT id, name FROM vn2008.warehouse - WHERE reserve ORDER BY name - - - -
-
- - - - - - SELECT id, reino FROM vn2008.reinos - WHERE display != FALSE ORDER BY reino - - - -
-
- - -
-
+
+ + + + SELECT Id_Article, Article, Medida, Categoria, Foto + FROM vn2008.Articles + WHERE Article LIKE CONCAT('%', #filter, '%') + OR Id_Article = #filter + ORDER BY Article LIMIT 50 + + + + + + + + +
+ +

+ + + +

+

+ +

+

+ +

+
+
+ +
diff --git a/forms/admin/photos/locale/ca.json b/forms/admin/photos/locale/ca.json index 33d37b50..704fe00c 100755 --- a/forms/admin/photos/locale/ca.json +++ b/forms/admin/photos/locale/ca.json @@ -1,12 +1,13 @@ { - "Photos": "Fotos" + "Images": "Imatges" - ,"Collection": "Colección" - ,"ImageName": "Nom de la imatge" - ,"Id": "Id" - ,"ImageFile": "Arxiu d'imatge" + ,"Collection": "Col·lecció" + ,"Click or drop files here": "Prem o deixa anar els arxius aquí" - ,"Upload": "Enviar" + ,"Clear all": "Netejar tot" + ,"Upload files": "Pujar arxius" - ,"ImageUploaded": "Imatge pujada correctament" + ,"Upload finished successfully": "Imatges pujades correctament" + ,"Some errors happened on upload": "Van ocórrer errors en pujar alguna de les imatges" + ,"There are no files to upload": "No s'ha seleccionat arxius per pujar" } diff --git a/forms/admin/photos/locale/en.json b/forms/admin/photos/locale/en.json index 402722b4..c160093c 100755 --- a/forms/admin/photos/locale/en.json +++ b/forms/admin/photos/locale/en.json @@ -1,12 +1,13 @@ { - "Photos": "Photos" + "Images": "Images" ,"Collection": "Collection" - ,"ImageName": "Image name" - ,"Id": "Id" - ,"ImageFile": "Image file" + ,"Click or drop files here": "Click or drop files here" - ,"Upload": "Upload" + ,"Clear all": "Clear all" + ,"Upload files": "Upload files" - ,"ImageUploaded": "Image uploaded successfully" -} + ,"Upload finished successfully": "Upload finished successfully" + ,"Some errors happened on upload": "Some errors happened on upload" + ,"There are no files to upload": "There are no files to upload" +} \ No newline at end of file diff --git a/forms/admin/photos/locale/es.json b/forms/admin/photos/locale/es.json index 65031e5f..841acff0 100755 --- a/forms/admin/photos/locale/es.json +++ b/forms/admin/photos/locale/es.json @@ -1,12 +1,13 @@ { - "Photos": "Fotos" + "Images": "Imágenes" ,"Collection": "Colección" - ,"ImageName": "Nombre de la imagen" - ,"Id": "Id" - ,"ImageFile": "Archivo de imagen" + ,"Click or drop files here": "Pulsa o suelta los archivos aquí" - ,"Upload": "Enviar" + ,"Clear all": "Limpiar todo" + ,"Upload files": "Subir archivos" - ,"ImageUploaded": "Imagen subida correctamente" + ,"Upload finished successfully": "Imágenes subidas correctamente" + ,"Some errors happened on upload": "Ocurrieron errores al subir alguna de las imágenes" + ,"There are no files to upload": "No se han seleccionado archivos para subir" } diff --git a/forms/admin/photos/locale/fr.json b/forms/admin/photos/locale/fr.json index b6be33d7..c2b17151 100755 --- a/forms/admin/photos/locale/fr.json +++ b/forms/admin/photos/locale/fr.json @@ -1,12 +1,13 @@ { - "Photos": "Photos" + "Images": "Images" ,"Collection": "Collection" - ,"ImageName": "Nom de l'image" - ,"Id": "Id" - ,"ImageFile": "Fichier image" + ,"Click or drop files here": "Cliquez ici ou déposer des fichiers" - ,"Upload": "Télécharger" + ,"Clear all": "Tout effacer" + ,"Upload files": "Upload Files" - ,"ImageUploaded": "téléchargement correct" -} + ,"Upload finished successfully": "Les images téléchargées correctement" + ,"Some errors happened on upload": "Des erreurs sont survenues lors du téléchargement des images" + ,"There are no files to upload": "Aucun fichier sélectionné pour télécharger" +} \ No newline at end of file diff --git a/forms/admin/photos/locale/mn.json b/forms/admin/photos/locale/mn.json index f40f409e..c160093c 100755 --- a/forms/admin/photos/locale/mn.json +++ b/forms/admin/photos/locale/mn.json @@ -1,12 +1,13 @@ { - "Photos": "Photos" + "Images": "Images" - ,"Collection": "цуглуулга" - ,"ImageName": "Image name" - ,"Id": "Id" - ,"ImageFile": "Image file" + ,"Collection": "Collection" + ,"Click or drop files here": "Click or drop files here" - ,"Upload": "Upload" + ,"Clear all": "Clear all" + ,"Upload files": "Upload files" - ,"ImageUploaded": "Image uploaded successfully" -} + ,"Upload finished successfully": "Upload finished successfully" + ,"Some errors happened on upload": "Some errors happened on upload" + ,"There are no files to upload": "There are no files to upload" +} \ No newline at end of file diff --git a/forms/admin/photos/locale/pt.json b/forms/admin/photos/locale/pt.json index 28ad4bb6..728f208e 100644 --- a/forms/admin/photos/locale/pt.json +++ b/forms/admin/photos/locale/pt.json @@ -1,12 +1,13 @@ { - "Photos": "Fotos" + "Images": "Imagens" ,"Collection": "Coleção" - ,"ImageName": "Nome da imagem" - ,"Id": "Id" - ,"ImageFile": "Arquivo de imagem" + ,"Click or drop files here": "Clique ou soltar arquivos aqui" - ,"Upload": "Enviar" + ,"Clear all": "Clear All" + ,"Upload files": "Fazer upload de arquivos" - ,"ImageUploaded": "Imagem subida correctamente" -} + ,"Upload finished successfully": "Upload concluído com sucesso" + ,"Some errors happened on upload": "Ocurrieron erros ao subir alguma das imagens" + ,"There are no files to upload": "Não há arquivos selecionados para upload" +} \ No newline at end of file diff --git a/forms/admin/photos/photos.js b/forms/admin/photos/photos.js index 0b7510e8..7fab2c61 100644 --- a/forms/admin/photos/photos.js +++ b/forms/admin/photos/photos.js @@ -90,7 +90,7 @@ Hedera.Photos = new Class } if (count === 0) - Htk.Toast.showWarning ('There are no files to upload'); + Htk.Toast.showWarning (_('There are no files to upload')); } ,onFileUpload: function (fileData, data, error) diff --git a/forms/admin/photos/ui.xml b/forms/admin/photos/ui.xml index 4e4caf53..a0a8ee1b 100755 --- a/forms/admin/photos/ui.xml +++ b/forms/admin/photos/ui.xml @@ -1,6 +1,6 @@
-

Photos

+

Images

@@ -22,7 +22,7 @@ on-drop="onDrop" on-dragend="onDragEnd" on-click="onDropzoneClick"> - Click or drop files here! + Click or drop files here
button +{ + margin: 0 .2em; +} + diff --git a/forms/reports/items-form/ui.xml b/forms/reports/items-form/ui.xml new file mode 100755 index 00000000..07fc6174 --- /dev/null +++ b/forms/reports/items-form/ui.xml @@ -0,0 +1,49 @@ + +
+

Item list

+
+
+ +
+
+
+
+
+ + + + + + SELECT id, name FROM vn2008.warehouse + WHERE reserve ORDER BY name + + + +
+
+ + + + + + SELECT id, reino FROM vn2008.reinos + WHERE display != FALSE ORDER BY reino + + + +
+
+ + +
+
+
+
+
diff --git a/forms/admin/shelves/locale/ca.json b/forms/reports/shelves/locale/ca.json similarity index 100% rename from forms/admin/shelves/locale/ca.json rename to forms/reports/shelves/locale/ca.json diff --git a/forms/admin/shelves/locale/en.json b/forms/reports/shelves/locale/en.json similarity index 100% rename from forms/admin/shelves/locale/en.json rename to forms/reports/shelves/locale/en.json diff --git a/forms/admin/shelves/locale/es.json b/forms/reports/shelves/locale/es.json similarity index 100% rename from forms/admin/shelves/locale/es.json rename to forms/reports/shelves/locale/es.json diff --git a/forms/admin/shelves/locale/fr.json b/forms/reports/shelves/locale/fr.json similarity index 100% rename from forms/admin/shelves/locale/fr.json rename to forms/reports/shelves/locale/fr.json diff --git a/forms/admin/shelves/locale/mn.json b/forms/reports/shelves/locale/mn.json similarity index 100% rename from forms/admin/shelves/locale/mn.json rename to forms/reports/shelves/locale/mn.json diff --git a/forms/admin/shelves/locale/pt.json b/forms/reports/shelves/locale/pt.json similarity index 100% rename from forms/admin/shelves/locale/pt.json rename to forms/reports/shelves/locale/pt.json diff --git a/forms/admin/shelves/shelves.js b/forms/reports/shelves/shelves.js similarity index 100% rename from forms/admin/shelves/shelves.js rename to forms/reports/shelves/shelves.js diff --git a/forms/admin/shelves/style.css b/forms/reports/shelves/style.css similarity index 100% rename from forms/admin/shelves/style.css rename to forms/reports/shelves/style.css diff --git a/forms/admin/shelves/ui.xml b/forms/reports/shelves/ui.xml similarity index 100% rename from forms/admin/shelves/ui.xml rename to forms/reports/shelves/ui.xml diff --git a/js/hedera/gui.js b/js/hedera/gui.js index a4285b17..afa6a80f 100644 --- a/js/hedera/gui.js +++ b/js/hedera/gui.js @@ -175,7 +175,7 @@ module.exports = new Class ,loadMenu: function () { - var sql = 'CALL form_list ()'; + var sql = 'CALL formList ()'; this._conn.execQuery (sql, this._onMenuLoad.bind (this)); } diff --git a/js/hedera/locale/ca.json b/js/hedera/locale/ca.json index 6e8a99f0..4e07c231 100644 --- a/js/hedera/locale/ca.json +++ b/js/hedera/locale/ca.json @@ -50,6 +50,7 @@ ,"Visits": "Visites" ,"News": "Noticies" ,"Photos": "Fotos" + ,"Items": "Artícles" ,"Reports": "Informes" ,"Shelves": "Estanterías" ,"Items list": "Llistat articles" diff --git a/js/hedera/locale/en.json b/js/hedera/locale/en.json index ea6d9e3f..2f599146 100644 --- a/js/hedera/locale/en.json +++ b/js/hedera/locale/en.json @@ -50,6 +50,7 @@ ,"Visits": "Visits" ,"News": "News" ,"Photos": "Photos" + ,"Items": "Items" ,"Reports": "Reports" ,"Shelves": "Shelves" ,"Items list": "Items list" diff --git a/js/hedera/locale/es.json b/js/hedera/locale/es.json index 93a365f5..6efbf899 100644 --- a/js/hedera/locale/es.json +++ b/js/hedera/locale/es.json @@ -50,6 +50,7 @@ ,"Visits": "Visitas" ,"News": "Noticias" ,"Photos": "Fotos" + ,"Items": "Artículos" ,"Reports": "Informes" ,"Shelves": "Estanterías" ,"Items list": "Listado artículos" diff --git a/js/hedera/locale/fr.json b/js/hedera/locale/fr.json index 9ff1e6fb..e3c46d25 100644 --- a/js/hedera/locale/fr.json +++ b/js/hedera/locale/fr.json @@ -50,6 +50,7 @@ ,"Visits": "Visites" ,"News": "Nouvelles" ,"Photos": "Photos" + ,"Items": "Articles" ,"Reports": "Rapport" ,"Shelves": "Etagères" ,"Items list": "Liste des articles" diff --git a/js/hedera/locale/mn.json b/js/hedera/locale/mn.json index 425a379b..53ada016 100644 --- a/js/hedera/locale/mn.json +++ b/js/hedera/locale/mn.json @@ -50,6 +50,7 @@ ,"Visits": "уулзалт" ,"News": "мэдээ" ,"Photos": "Фото зураг" + ,"Items": "зүйл" ,"Reports": "мэдээ" ,"Shelves": "тавиур" ,"Items list": "зүйлс жагсаалт" diff --git a/js/hedera/locale/pt.json b/js/hedera/locale/pt.json index 55356558..e8fe2c92 100644 --- a/js/hedera/locale/pt.json +++ b/js/hedera/locale/pt.json @@ -50,6 +50,7 @@ ,"Visits": "Visitas" ,"News": "Noticias" ,"Photos": "Fotos" + ,"Items": "Artigos" ,"Reports": "Relatórios" ,"Shelves": "Estantes" ,"Items list": "Lista de Itens"