diff --git a/LICENSE b/LICENSE index 5e558e2..2a40ad6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2020 - Verdnatura Levante S.L. +Copyright (C) 2023 - Verdnatura Levante S.L. This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/fonts/Poppins-Black.ttf b/fonts/Poppins-Black.ttf new file mode 100644 index 0000000..71c0f99 Binary files /dev/null and b/fonts/Poppins-Black.ttf differ diff --git a/fonts/Poppins-BlackItalic.ttf b/fonts/Poppins-BlackItalic.ttf new file mode 100644 index 0000000..7aeb58b Binary files /dev/null and b/fonts/Poppins-BlackItalic.ttf differ diff --git a/fonts/Poppins-Bold.ttf b/fonts/Poppins-Bold.ttf new file mode 100644 index 0000000..00559ee Binary files /dev/null and b/fonts/Poppins-Bold.ttf differ diff --git a/fonts/Poppins-BoldItalic.ttf b/fonts/Poppins-BoldItalic.ttf new file mode 100644 index 0000000..e61e8e8 Binary files /dev/null and b/fonts/Poppins-BoldItalic.ttf differ diff --git a/fonts/Poppins-ExtraBold.ttf b/fonts/Poppins-ExtraBold.ttf new file mode 100644 index 0000000..df70936 Binary files /dev/null and b/fonts/Poppins-ExtraBold.ttf differ diff --git a/fonts/Poppins-ExtraBoldItalic.ttf b/fonts/Poppins-ExtraBoldItalic.ttf new file mode 100644 index 0000000..14d2b37 Binary files /dev/null and b/fonts/Poppins-ExtraBoldItalic.ttf differ diff --git a/fonts/Poppins-ExtraLight.ttf b/fonts/Poppins-ExtraLight.ttf new file mode 100644 index 0000000..e76ec69 Binary files /dev/null and b/fonts/Poppins-ExtraLight.ttf differ diff --git a/fonts/Poppins-ExtraLightItalic.ttf b/fonts/Poppins-ExtraLightItalic.ttf new file mode 100644 index 0000000..89513d9 Binary files /dev/null and b/fonts/Poppins-ExtraLightItalic.ttf differ diff --git a/fonts/Poppins-Italic.ttf b/fonts/Poppins-Italic.ttf new file mode 100644 index 0000000..12b7b3c Binary files /dev/null and b/fonts/Poppins-Italic.ttf differ diff --git a/fonts/Poppins-Light.ttf b/fonts/Poppins-Light.ttf new file mode 100644 index 0000000..bc36bcc Binary files /dev/null and b/fonts/Poppins-Light.ttf differ diff --git a/fonts/Poppins-LightItalic.ttf b/fonts/Poppins-LightItalic.ttf new file mode 100644 index 0000000..9e70be6 Binary files /dev/null and b/fonts/Poppins-LightItalic.ttf differ diff --git a/fonts/Poppins-Medium.ttf b/fonts/Poppins-Medium.ttf new file mode 100644 index 0000000..6bcdcc2 Binary files /dev/null and b/fonts/Poppins-Medium.ttf differ diff --git a/fonts/Poppins-MediumItalic.ttf b/fonts/Poppins-MediumItalic.ttf new file mode 100644 index 0000000..be67410 Binary files /dev/null and b/fonts/Poppins-MediumItalic.ttf differ diff --git a/fonts/Poppins-Regular.ttf b/fonts/Poppins-Regular.ttf new file mode 100644 index 0000000..9f0c71b Binary files /dev/null and b/fonts/Poppins-Regular.ttf differ diff --git a/fonts/Poppins-SemiBold.ttf b/fonts/Poppins-SemiBold.ttf new file mode 100644 index 0000000..74c726e Binary files /dev/null and b/fonts/Poppins-SemiBold.ttf differ diff --git a/fonts/Poppins-SemiBoldItalic.ttf b/fonts/Poppins-SemiBoldItalic.ttf new file mode 100644 index 0000000..3e6c942 Binary files /dev/null and b/fonts/Poppins-SemiBoldItalic.ttf differ diff --git a/fonts/Poppins-Thin.ttf b/fonts/Poppins-Thin.ttf new file mode 100644 index 0000000..03e7366 Binary files /dev/null and b/fonts/Poppins-Thin.ttf differ diff --git a/fonts/Poppins-ThinItalic.ttf b/fonts/Poppins-ThinItalic.ttf new file mode 100644 index 0000000..e26db5d Binary files /dev/null and b/fonts/Poppins-ThinItalic.ttf differ diff --git a/setup.iss b/setup.iss index d71a90f..080816f 100644 --- a/setup.iss +++ b/setup.iss @@ -56,6 +56,8 @@ Source: "ocx\*"; \ DestDir: {sys}; Flags: onlyifdoesntexist regserver 32bit Source: "fonts\Roboto*"; \ DestDir: "{fonts}"; FontInstall: "Roboto"; Flags: onlyifdoesntexist uninsneveruninstall +Source: "fonts\Poppins*"; \ + DestDir: "{fonts}"; FontInstall: "Poppins"; Flags: onlyifdoesntexist uninsneveruninstall Source: "fonts\Lucida Sans - *"; \ DestDir: "{fonts}"; FontInstall: "Lucida Sans"; Flags: onlyifdoesntexist uninsneveruninstall Source: "fonts\Code128B.ttf"; \ diff --git a/src/datasource.png b/src/datasource.png new file mode 100644 index 0000000..6fe34c3 Binary files /dev/null and b/src/datasource.png differ diff --git a/src/main.js b/src/main.js index 6cbb475..3dfbd66 100755 --- a/src/main.js +++ b/src/main.js @@ -1,45 +1,74 @@ var Conf = { - appName: 'Verdnatura' - ,dsName: 'verdnatura' - ,dsPath: 'HKCU\\Software\\ODBC\\ODBC.INI\\verdnatura' - ,regPath: 'HKCU\\Software\\Verdnatura\\vn-access' - ,remoteUrl: 'https://cdn.verdnatura.es/vn-access' - ,dbHost: 'db.verdnatura.es' - ,defaultModule: 'tpv' - ,defaultLocale: 'es' - ,defaultBranch: 'master' - ,dbName: 'vn2008' - ,maxCorruptSize: 600 - ,odbcDriver: 'MySQL ODBC 8.0 Unicode Driver' - ,driverPath: '\\MySQL\\Connector ODBC 8.0\\myodbc8w.dll' - ,version: 3 + appName: 'Verdnatura', + dsName: 'verdnatura', + dsPath: 'HKCU\\SOFTWARE\\ODBC\\ODBC.INI\\verdnatura', + regPath: 'HKCU\\SOFTWARE\\Verdnatura\\vn-access', + remoteUrl: 'https://cdn.verdnatura.es/vn-access', + dbHost: 'db.verdnatura.es', + defaultModule: 'vn', + defaultLocale: 'es', + defaultBranch: 'master', + dbName: 'vn2008', + maxCorruptSize: 600, + odbcDriver: 'MySQL ODBC 8.0 Unicode Driver', + driverPath: '\\MySQL\\Connector ODBC 8.0\\myodbc8w.dll', + defaultDatasource: 'production', + version: 4, + cdnURL: 'https://cdn.verdnatura.es/vn-access', + cdnURL: 'https://salix.verdnatura.es', + datasources: { + production: { + DESCRIPTION: 'production', + SERVER: 'db.verdnatura.es', + PORT: '3306', + SSLMODE: 'VERIFY_IDENTITY' + }, + test: { + DESCRIPTION: 'test', + SERVER: 'test-db.verdnatura.es', + PORT: '3307', + SSLMODE: 'DISABLED' + }, + dev: { + DESCRIPTION: 'dev', + SERVER: 'dev-db.verdnatura.es', + PORT: '3307', + SSLMODE: 'DISABLED' + }, + local: { + DESCRIPTION: 'local', + SERVER: 'localhost', + PORT: '3306', + SSLMODE: 'DISABLED' + } + } }; var Locale = { es: { "Enter a user name": - "Introduce un nombre de usuario" - ,"Enter a password": - "Introduce una contraseña" - ,"Server can't be reached": - "No se ha podido conectar con el servidor" - ,"Updating": - "Actualizando" - ,"Bad login": - "Usuario o contraseña incorrectos" - ,"Application it's already open": - "La aplicación ya está abierta" - ,"Loading": - "Cargando" - ,"Error while updating": - "Error al actualizar" - ,"Microsoft Access 2003 is not installed": - "Microsoft Access 2003 no está instalado en el sistema" - ,"MDB file not found": - "No se encontró el fichero MDB" - ,"Cache files have been deleted": - "Se han borrado todos los ficheros de la caché" + "Introduce un nombre de usuario", + "Enter a password": + "Introduce una contraseña", + "Server can't be reached": + "No se ha podido conectar con el servidor", + "Updating": + "Actualizando", + "Bad login": + "Usuario o contraseña incorrectos, recuerda que se hace distinción entre mayúsculas y minúsculas", + "Application it's already open": + "La aplicación ya está abierta", + "Loading": + "Cargando", + "Error while updating": + "Error al actualizar", + "Microsoft Access 2003 is not installed": + "Microsoft Access 2003 no está instalado en el sistema", + "MDB file not found": + "No se encontró el fichero MDB", + "Cache files have been deleted": + "Se han borrado todos los ficheros almacenados en la caché" } }; @@ -48,9 +77,10 @@ var App = { fso: new ActiveXObject('scripting.filesystemobject'), init: function() { - var width = 420; - var height = 525; + // Specify the size of window + var width = 420; + var height = 560; window.resizeTo(width, height); window.moveTo((screen.width - width) / 2, (screen.height - height) / 2); }, @@ -78,9 +108,9 @@ var App = { // Creates the necessary registry entries - var configured = this.regRead(Conf.regPath, 'configured'); + var myVersion = this.regRead(Conf.regPath, 'version'); - if (!configured || configured < Conf.version) { + if (!myVersion || myVersion != Conf.version) { var path; // Creates the Access configuration entries @@ -118,26 +148,51 @@ var App = { params ); - // Marks the application as configured - - this.regWrite(Conf.regPath, 'configured', Conf.version); + // Upload the string value to version installed + + this.regWrite(Conf.regPath, 'version', Conf.version); } - // Loads the form data + //Datasources creations + this.createDatasources(); + + // Check the strings values and the respective keys + var stringValues = [ + 'remoteURL', + 'remoteUser', + 'remotePass' + ] + + for (var i in stringValues) { + if (!this.regRead(Conf.regPath, stringValues[i])) + this.regWrite(Conf.regPath, stringValues[i], null) + } + + if (!this.regRead(Conf.regPath, 'currentDatasource')) + this.regWrite(Conf.regPath, 'currentDatasource', Conf.defaultDatasource); + + if (!this.regRead(Conf.regPath, 'notSignOut')) + this.regWrite(Conf.regPath, 'notSignOut', 0); + + // Loads the form data + var user = this.regRead(Conf.dsPath, 'UID'); var password = this.regRead(Conf.dsPath, 'PWD'); - var remember = this.regRead(Conf.regPath, 'remember'); + var notSignOut = this.regRead(Conf.regPath, 'notSignOut'); this.$('branch').value = this.getBranch(); - this.onChangeBranchChange(); + this.onChangeBranch(); + + this.$('datasource').value = this.getDatasource(); + this.onChangeDatasource(); if (user) this.$('user').value = user; - if (remember && password) { + if (notSignOut && password) { this.$('password').value = password; - this.$('remember').checked = true; + this.$('notSignOut').checked = true; this.onEnterClick(); } else this.resetForm(true); @@ -167,7 +222,7 @@ var App = { this.$('user').disabled = disabled; this.$('password').disabled = disabled; - this.$('remember').disabled = disabled; + this.$('notSignOut').disabled = disabled; this.$('enter').disabled = disabled; var display = disabled ? 'block' : 'none'; @@ -179,14 +234,27 @@ var App = { setTimeout(function() { App.cleanCache(); }); }, - onShowOptionsClick: function() { + onShowBranchOptionsClick: function() { var style = this.$("branchSelector").style; style.display = style.display == 'none' || !style.display ? 'inline' : 'none'; }, - onChangeBranchChange: function() { + onShowDatasourceOptionsClick: function() { + var style = this.$("datasourceSelector").style; + style.display = style.display == 'none' || !style.display + ? 'inline' + : 'none'; + + if (!this.$("datasourceLogo").className) + this.$("datasourceLogo").className = "on"; + else + this.$("datasourceLogo").className = ""; + + }, + + onChangeBranch: function() { if (this.$("branch").value == "master"||"test"||"dev") { this.$("branchButton").className = this.$("branch").value; this.$("branch").className = this.$("branch").value; @@ -197,6 +265,18 @@ var App = { this.$('user').focus(); }, + onChangeDatasource: function() { + if (this.$("datasource").value == "production"||"test"||"dev") { + this.$("datasourceButton").className = this.$("datasource").value; + this.$("datasource").className = this.$("datasource").value; + } else { + this.$("datasourceButton").className = null; + this.$("datasource").className = null; + } + this.updateDatasource(this.$("datasource").value); + this.$('user').focus(); + }, + cleanCache: function() { if (this.fso.folderExists(this.moduleDir)) { var folder = this.fso.getFolder(this.moduleDir); @@ -245,13 +325,16 @@ var App = { var user = this.$('user').value; var password = this.$('password').value; var branch = this.$('branch').value; + var datasource = this.$('datasource').value; if (!user || user === '') throw new Error(_('Enter a user name')); if (!password || password === '') throw new Error(_('Enter a password')); if (!branch || branch === '') - throw new Error(_('Select a branch')); + throw new Error(_('Select a branch')); + if (!datasource || datasource === '') + throw new Error(_('Select a datasource')); this.regWrite(Conf.dsPath, 'UID', user); this.regWrite(Conf.dsPath, 'PWD', password); @@ -262,7 +345,7 @@ var App = { var remoteFile = version ? '.archive/'+ this.module +'/'+ version +'.7z' : this.module +'.7z?'+ new Date().getTime(); - remoteFile = Conf.remoteUrl +'/'+ remoteFile; + remoteFile = Conf.cdnURL +'/'+ remoteFile; var request = new ActiveXObject("MSXML2.XMLHTTP"); request.open('GET', remoteFile, true); request.onreadystatechange = function() { @@ -334,9 +417,6 @@ var App = { rs.close(); mysqlConn.close(); - if (this.$('previous-version').checked && version > 1) - version -= 1; - // Checks if it's already open if (this.fso.fileExists(this.lockFile)) try { @@ -368,7 +448,6 @@ var App = { ? version : null; }, - mdbGetValue: function(query, field, parseFn) { var value; @@ -393,14 +472,12 @@ var App = { return value; }, - getOdbcString: function(options) { var optionsArray = []; for (var option in options) optionsArray.push(option +'='+ options[option]); return optionsArray.join(';'); }, - onRequestReady: function(request) { if (request.readyState !== 4) return; @@ -438,10 +515,9 @@ var App = { this.catchError(e); } }, - openMdb: function() { - var remember = !!this.$('remember').checked; - this.regWrite(Conf.regPath, 'remember', remember); + var notSignOut = !!this.$('notSignOut').checked; + this.regWrite(Conf.regPath, 'notSignOut', notSignOut); var programFiles = this.getEnv('ProgramFiles'); var accessBin = programFiles +'\\Microsoft Office\\OFFICE11\\MSACCESS.EXE'; @@ -452,18 +528,16 @@ var App = { this.shell.exec('"'+ accessBin +'" "'+ this.mdbFile +'"'); window.close(); }, - catchError: function(err) { var clearPassword = err.name == 'BadLogin'; - if (!this.$('remember').checked || clearPassword) + if (!this.$('notSignOut').checked || clearPassword) this.regWrite(Conf.dsPath, 'PWD', ''); this.disableUi(false); this.showMessage(err.message, 'error'); this.resetForm(clearPassword); }, - /** * Displays a non-intrusive message. * @@ -475,7 +549,6 @@ var App = { App.showMessageAsync(message, className); }); }, - showMessageAsync: function(message, className) { if (this.messageTimeout) clearTimeout(this.messageTimeout); @@ -488,11 +561,9 @@ var App = { App.hideMessage(); }, 10000); }, - onBodyClick: function() { this.hideMessage(); }, - /** * Hides the last displayed non-intrusive message. */ @@ -503,7 +574,6 @@ var App = { this.messageTimeout = null; } }, - /** * Obtains a DOM element by it's identifier. * @@ -512,18 +582,15 @@ var App = { $: function(id) { return document.getElementById(id); }, - run: function(command, wait) { if (!wait) wait = false; this.shell.run(command, 0, wait); }, - getEnv: function(varName) { return this.shell.expandEnvironmentStrings('%'+ varName +'%'); }, - regRead: function(path, key) { try { var value = this.shell.regRead(path +'\\'+ key); @@ -533,7 +600,6 @@ var App = { return value; }, - regWrite: function(path, key, value, type) { if (!type) switch (typeof (value)) @@ -547,16 +613,16 @@ var App = { break; default: type = 'REG_SZ'; + if (!value) + value = ''; } - this.shell.regWrite(path +'\\'+ key, value.toString(), type); + this.shell.regWrite(path + '\\' + key, value.toString(), type); }, - regWrites: function(path, values, type) { for(var key in values) this.regWrite(path, key, values[key], type); }, - regDelete: function(path) { try { this.shell.regDelete(path); @@ -573,7 +639,20 @@ var App = { 'branch', String ); return branch || Conf.defaultBranch; - } + }, + getDatasource: function() { + var datasource = this.regRead( + 'HKCU\\SOFTWARE\\Verdnatura\\vn-access', + 'currentDatasource' + ); + return datasource || Conf.defaultDatasource; + }, + updateDatasource: function(datasource) { + this.regWrite(Conf.regPath, 'currentDatasource', datasource); + }, + createDatasources: function() { + + }, }; App.init(); diff --git a/src/style.css b/src/style.css index 45102e3..3d22740 100755 --- a/src/style.css +++ b/src/style.css @@ -1,13 +1,13 @@ body { + font-family: 'Poppins', 'Verdana', 'Sans'; font-size: 18px; padding: .8em; overflow: hidden; color: #222; - font-family: Roboto; } a { text-decoration: none; - color: #44f; + color: black; } /* Login form */ @@ -15,8 +15,8 @@ a { #logo { display: block; margin: 0 auto; - margin-bottom: 2.5em; - width: 80%; + margin-bottom: 4em; + width: 62%; } button, input { @@ -28,21 +28,12 @@ select { font-size: 1em; background-color: #8d8d8d; } -select.master { - background-color: #c20000; -} -select.test { - background-color: #31a527; -} -select.dev { - background-color: #a59827; -} option { color: white; } #fields { - max-width: 11em; - margin: 0 auto; + max-width: 13em; + margin-left: 3.32em; } #inputs > div { margin-top: 1em; @@ -74,17 +65,10 @@ input[type='text']:focus, input[type='password']:focus { border-bottom: 1px solid black; } -input[type='text']::selection, -input[type='password']::selection { - background-color: #97d700; -} -#rememberMe { +#notSignOut { margin-top: 1em; font-size: .9em; -} -#oldVersion { - margin-top: .5em; - font-size: .9em; + margin-bottom: 2.5em; } #submit { margin-top: 1em; @@ -104,15 +88,16 @@ input[type='password']::selection { } button { color: #FFF; - background-color: #f7931e; - padding: .7em; - padding-right: 2.5em; - padding-left: 2.5em; + background-color: black; + padding: 1em; + padding-right: 4.5em; + padding-left: 4.5em; border: none; border-radius: 25px; + font-size: .9em; } button:hover { - background-color: #eb8b1d; + background-color: #3d3f42; cursor: pointer; } @@ -124,14 +109,12 @@ button:hover { #branchLogo { cursor: pointer; padding-top: .4em; - padding-bottom: .2em; padding-left: .4em; padding-right: .4em; } #branch { border: none; cursor: pointer; - margin-left: .4em; float: right; } #branchSelector { @@ -145,7 +128,7 @@ button:hover { float: left; border-radius: 25px; color: black; - box-shadow: 0px 0px 5px 0px #000000; + box-shadow: 0px 0px 5px 0px black; background-color: #8d8d8d; } #branchButton:hover { @@ -160,36 +143,105 @@ button:hover { #branchButton.dev { background-color: #a59827; } +select.master { + background-color: #c20000; +} +select.test { + background-color: #31a527; +} +select.dev { + background-color: #a59827; +} + +/* Datasource */ + +#datasourceOptions { + margin-top: 1em; + margin-left: 17.3em; +} +#datasourceLogo { + cursor: pointer; + padding-top: .4em; + padding-left: .4em; + padding-right: .4em; +} +#datasourceLogo.on { + cursor: pointer; + padding-top: .4em; + padding-left: .4em; + padding-right: .4em; + margin-left: 7em; +} +#datasource { + border: none; + cursor: pointer; + margin-right: 1.5em; + float: left; +} +#datasourceSelector { + float: right; + display: none; + padding-right: .8em; + margin-right: 0.5em; + margin-top: -1.91em; +} +#datasourceButton { + float: right; + border-radius: 25px; + color: black; + box-shadow: 0px 0px 5px 0px #000000; + background-color: #8d8d8d; +} +#datasourceButton:hover { + box-shadow: none; +} +#datasourceButton.production { + background-color: #c20000; +} +#datasourceButton.test { + background-color: #31a527; +} +#datasourceButton.dev { + background-color: #a59827; +} +select.production { + background-color: #c20000; +} +select.test { + background-color: #31a527; +} +select.dev { + background-color: #a59827; +} /* Message */ #message { z-index: 2; position: absolute; - top: 2em; - left: 49.2%; - width: 16em; + top: 1.8em; + left: 11.8em; + width: 20em; padding: .5em; margin-left: -8.25em; margin-top: 2em; - border: 1px solid #644; background-color: #EBB; color: #644; text-align: center; - font-size: .9em; + font-size: .8em; display: none; - border-radius: 25px; - box-shadow: 0px 0px 5px 0px #000000 + border-radius: 5px; + box-shadow: 0 0 0.4em rgba(1,1,1,0.6); } #message.error { border-color: black; - background-color: #a52727; - color: white; + background-color: #ffcdd2; + color: #bf0000; } #message.notice { border-color: black; - background-color: #2773a5; - color: white; + background-color: #d0cdff; + color: #0d00bf; ; } @@ -202,7 +254,7 @@ button:hover { height: 100%; background-color: black; opacity: 0.7; - filter: alpha(opacity=70); + filter: alpha(opacity=50); top: 0; left: 0; display: none; @@ -214,7 +266,7 @@ button:hover { width: 10em; height: 5em; margin-top: -4em; - margin-left: -5.9em; + margin-left: -6.1em; top: 50%; left: 50%; background-color: white; @@ -233,4 +285,4 @@ button:hover { } #loading-message { font-size: .9em; -} +} \ No newline at end of file diff --git a/src/vn-access.hta b/src/vn-access.hta index ef4b4ea..6702814 100755 --- a/src/vn-access.hta +++ b/src/vn-access.hta @@ -41,38 +41,27 @@ -
- - -
-
- - +
+ +
- +
- - Limpiar caché - + Limpiar caché
- @@ -80,8 +69,25 @@
-
+
+
+ +
+ +
+
+