feat: refs #5308 Upgrade to v7 #6

Merged
guillermo merged 5 commits from 5308-hideDeveloperOptions into master 2024-02-23 12:31:39 +00:00
29 changed files with 477 additions and 447 deletions

View File

@ -1,4 +1,4 @@
Copyright (C) 2023 - Verdnatura Levante S.L. Copyright (C) 2024 - Verdnatura Levante S.L.
This package is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 959 KiB

After

Width:  |  Height:  |  Size: 959 KiB

View File

@ -1,6 +1,6 @@
#define MyAppName "Verdnatura" #define MyAppName "Verdnatura"
#define MyAppVersion "6" #define MyAppVersion "7"
#define MyAppPublisher "Verdnatura" #define MyAppPublisher "Verdnatura"
#define MyAppURL "https://www.verdnatura.es/" #define MyAppURL "https://www.verdnatura.es/"
@ -17,8 +17,8 @@ AppUpdatesURL={#MyAppURL}
CreateAppDir=yes CreateAppDir=yes
DefaultDirName={commonpf}\{#MyAppName} DefaultDirName={commonpf}\{#MyAppName}
DefaultGroupName={#MyAppName} DefaultGroupName={#MyAppName}
WizardSmallImageFile=iss\wizard-small.bmp WizardSmallImageFile=img\iss\wizard-small.bmp
WizardImageFile=iss\wizard.bmp WizardImageFile=img\iss\wizard.bmp
LicenseFile=src\LICENSE.txt LicenseFile=src\LICENSE.txt
SetupIconFile=src\icon.ico SetupIconFile=src\icon.ico
UninstallDisplayIcon={app}\icon.ico UninstallDisplayIcon={app}\icon.ico
@ -48,13 +48,13 @@ Source: "odbc\*"; \
DestDir: {tmp}; Flags: deleteafterinstall; AfterInstall: InstallMsi; DestDir: {tmp}; Flags: deleteafterinstall; AfterInstall: InstallMsi;
Source: "src\*"; \ Source: "src\*"; \
DestDir: "{app}"; Flags: ignoreversion DestDir: "{app}"; Flags: ignoreversion
Source: "branches\*"; \ Source: "img\branches\*"; \
DestDir: "{app}\branches"; Flags: ignoreversion DestDir: "{app}branches"; Flags: ignoreversion
Source: "datasources\*"; \ Source: "img\datasources\*"; \
DestDir: "{app}\datasources"; Flags: ignoreversion DestDir: "{app}datasources"; Flags: ignoreversion
Source: "apiSources\*"; \ Source: "img\api-sources\*"; \
DestDir: "{app}\apiSources"; Flags: ignoreversion DestDir: "{app}api-sources"; Flags: ignoreversion
Source: "icons\*"; \ Source: "img\app-icons\*"; \
DestDir: "{app}\icons"; Flags: ignoreversion DestDir: "{app}\icons"; Flags: ignoreversion
Source: "ocx\*"; \ Source: "ocx\*"; \
DestDir: {sys}; Flags: onlyifdoesntexist regserver 32bit DestDir: {sys}; Flags: onlyifdoesntexist regserver 32bit

Binary file not shown.

View File

@ -1,25 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIEQzCCAyugAwIBAgIJAJimL+J4jUaQMA0GCSqGSIb3DQEBBQUAMIG2MQswCQYD
VQQGEwJFUzEdMBsGA1UECAwUQ29tdW5pZGFkIFZhbGVuY2lhbmExETAPBgNVBAcM
CFZhbGVuY2lhMR4wHAYDVQQKDBVWZXJkbmF0dXJhIExldmFudGUgU0wxFDASBgNV
BAsMC0luZm9ybWF0aWNhMRYwFAYDVQQDDA12ZXJkbmF0dXJhLmVzMScwJQYJKoZI
hvcNAQkBFhhob3N0bWFzdGVyQHZlcmRuYXR1cmEuZXMwIBcNMTMwNjExMTE1MjQ1
WhgPMjA2MzA1MzAxMTUyNDVaMIG2MQswCQYDVQQGEwJFUzEdMBsGA1UECAwUQ29t
dW5pZGFkIFZhbGVuY2lhbmExETAPBgNVBAcMCFZhbGVuY2lhMR4wHAYDVQQKDBVW
ZXJkbmF0dXJhIExldmFudGUgU0wxFDASBgNVBAsMC0luZm9ybWF0aWNhMRYwFAYD
VQQDDA12ZXJkbmF0dXJhLmVzMScwJQYJKoZIhvcNAQkBFhhob3N0bWFzdGVyQHZl
cmRuYXR1cmEuZXMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsqq+h
1kUfZE19Inm3M2XF1ytIqXeIsXsiZ5T9aVdedQrF2xcVOr4dvJyE5zp9g7NNxy9T
FyAHPXiPWKSoX3w0uoQfLW9Hm19QZYu40hBD5oRrJy5m6l4JU3Gj0tnkvYc4m8Fl
2uEUT3ain0FE2I1XjKpL6eQi9TKjhgmWNRgDJUbllAB3lsQLkNfB6EFo2QJykiKl
aRi4UaHdSkd3zkUJyYRdcG7IxCFvsViKpwr3JF+TLXSN/oronLFgG8cKedrn+sMW
pBm2FZQKAh8hLT3QQQqQgGpQ2y4t2EVJkYVdcGBXCyWYDKegMXgJR10WunICFCaD
kM0P3pYQdtbgr7e9AgMBAAGjUDBOMB0GA1UdDgQWBBQ9+iZdf7pLNQItxs4o43dN
FZD0CTAfBgNVHSMEGDAWgBQ9+iZdf7pLNQItxs4o43dNFZD0CTAMBgNVHRMEBTAD
AQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAcFzJhm3jjuexZf9tTgQfzwtsafLLsYkrm
EZOTkhvZFJYbBd8UngL5UPF1M3buSEV1VqsWCALLrFkxzbmjk5uM8cswZR/3J6un
7GFYWTEllVgkD8KmNA2b6j5uSuGCQmOccsR4069vwNjrvTbtQpEpEAAnDf6d5/N4
MXuDozHq3iEYi7qyGf++5mp4D+82y2ONSUsiLgxqnMT5JX/yhDKI1IiX1ndyt+6r
ie2i2fzdOgovlAILuTM4hoUjPYFOxwmUwpxU2EAjPqo9Bi7bQiH+fv0QBzbpQ9on
DRHo7NuXaDG49nvatJjuf4DiDELBCTMeKBOk5hG7kyWCIwp5wr+w
-----END CERTIFICATE-----

View File

@ -13,7 +13,7 @@ var Conf = {
maxCorruptSize: 600, maxCorruptSize: 600,
odbcDriver: 'MySQL ODBC 8.0 Unicode Driver', odbcDriver: 'MySQL ODBC 8.0 Unicode Driver',
driverPath: '\\MySQL\\Connector ODBC 8.0\\myodbc8w.dll', driverPath: '\\MySQL\\Connector ODBC 8.0\\myodbc8w.dll',
version: 6, version: 7,
cdnURL: 'https://cdn.verdnatura.es/vn-access', cdnURL: 'https://cdn.verdnatura.es/vn-access',
identifier: '.vn', identifier: '.vn',
productionDatasource: 'production.vn' productionDatasource: 'production.vn'
@ -51,11 +51,10 @@ var Locale = {
var App = { var App = {
shell: new ActiveXObject('WScript.Shell'), shell: new ActiveXObject('WScript.Shell'),
fso: new ActiveXObject('scripting.filesystemobject'), fso: new ActiveXObject('scripting.filesystemobject'),
init: function() { init: function() {
// Specify the size of window // Specify the size of window
var width = 450; var width = 450;
var height = 595; var height = 610;
window.resizeTo(width, height); window.resizeTo(width, height);
window.moveTo((screen.width - width) / 2, (screen.height - height) / 2); window.moveTo((screen.width - width) / 2, (screen.height - height) / 2);
}, },
@ -76,12 +75,18 @@ var App = {
this.certFile = this.appDir +'\\cacert.pem'; this.certFile = this.appDir +'\\cacert.pem';
this.lockFile = this.moduleDir +'\\' + this.module +'.ldb'; this.lockFile = this.moduleDir +'\\' + this.module +'.ldb';
this.mdbFile = this.moduleDir +'\\' + this.module +'.mdb'; this.mdbFile = this.moduleDir +'\\' + this.module +'.mdb';
this.hasDeveloperMode = this.regRead(Conf.regPath, 'hasDeveloperMode');
document.title = "vn-access v" + Conf.version + " (" + this.module + ")";
var mdbDsName = this.mdbGetValue( var mdbDsName = this.mdbGetValue(
'SELECT dsName FROM TblConfig', 'SELECT dsName FROM TblConfig',
'dsName', String 'dsName', String
); );
var userDefaultDatasource = this.regRead(Conf.regPath, 'defaultDatasource'); var userDefaultDatasource = this.regRead(Conf.regPath, 'defaultDatasource');
this.dsName = mdbDsName || userDefaultDatasource || Conf.defaultDatasource; this.dsName = mdbDsName || userDefaultDatasource || Conf.defaultDatasource;
this.heartClicks = 0;
// Change title
document.title = document.title + ' - ' + this.module;
// Creates the necessary registry entries // Creates the necessary registry entries
var lastVersion = this.regRead(Conf.regPath, 'lastExecutedVersion'); var lastVersion = this.regRead(Conf.regPath, 'lastExecutedVersion');
@ -110,8 +115,7 @@ var App = {
this.regWrite(Conf.regPath, 'remoteURL', Conf.defaultRemoteURL); this.regWrite(Conf.regPath, 'remoteURL', Conf.defaultRemoteURL);
this.regWrite(Conf.regPath, 'lastExecutedVersion', Conf.version); this.regWrite(Conf.regPath, 'lastExecutedVersion', Conf.version);
this.regWrite(Conf.regPath, 'selectedApiSource', Conf.defaultApiSource); this.regWrite(Conf.regPath, 'selectedApiSource', Conf.defaultApiSource);
this.regWrite(Conf.regPath + '\\apiSources', Conf.defaultApiSource, Conf.defaultRemoteURL); this.regWrite(Conf.regPath + '\\api-sources', Conf.defaultApiSource, Conf.defaultRemoteURL);
this.createODBC( this.createODBC(
Conf.odbcPath, Conf.odbcPath,
Conf.productionDatasource, Conf.productionDatasource,
@ -158,6 +162,7 @@ var App = {
userDefaultBranch = this.regRead(Conf.regPath, 'defaultBranch'); userDefaultBranch = this.regRead(Conf.regPath, 'defaultBranch');
branch = userDefaultBranch || Conf.defaultBranch; branch = userDefaultBranch || Conf.defaultBranch;
} }
this.$('branch').value = branch; this.$('branch').value = branch;
this.onChangeBranch(); this.onChangeBranch();
@ -177,6 +182,11 @@ var App = {
} }
this.$('datasource').value = this.dsName; this.$('datasource').value = this.dsName;
if (this.regRead(Conf.regPath, 'autoDisplayDevOptions') && this.hasDeveloperMode)
App.openOptions()
this.refreshDeveloperMode();
if (autoLogin) { if (autoLogin) {
this.onChangeDatasource(); this.onChangeDatasource();
this.onEnterClick(); this.onEnterClick();
@ -204,17 +214,16 @@ var App = {
this.$('password').select(); this.$('password').select();
}, },
createODBC: function(path, dsName, driverName, description) { createODBC: function(path, dsName, driverName, description) {
var driverPath = this.getEnv('ProgramFiles') + Conf.driverPath;
var params = { var params = {
Driver: driverPath, Driver: this.getEnv('ProgramFiles') + Conf.driverPath,
DESCRIPTION: description, DESCRIPTION: description,
SERVER: Conf.defaultServer, SERVER: Conf.defaultServer,
DATABASE: Conf.dbName, DATABASE: Conf.dbName,
SSLCA: this.certFile, SSLCA: this.certFile,
SSLMODE: 'VERIFY_IDENTITY', SSLMODE: 'REQUIRED',
SSLCIPHER: 'AES256-SHA',
AUTO_RECONNECT: 1, AUTO_RECONNECT: 1,
NO_PROMPT: 1, NO_PROMPT: 1,
NO_BIGINT: 1
}; };
this.regWrite(path + 'ODBC Data Sources', dsName, driverName); this.regWrite(path + 'ODBC Data Sources', dsName, driverName);
@ -259,6 +268,18 @@ var App = {
this.$('datasourceLogo').className = ''; this.$('datasourceLogo').className = '';
}, },
onHeartClick: function() {
this.heartClicks++
if (this.heartClicks >= 5) {
var action = this.hasDeveloperMode ? 'disabled' : 'enabled'
var isActive = !this.hasDeveloperMode ? true : false
this.regWrite(Conf.regPath, 'hasDeveloperMode', isActive)
this.hasDeveloperMode = isActive;
this.showMessage(_('Developer mode ' + action), 'notice');
this.refreshDeveloperMode();
this.heartClicks = 0;
}
},
refreshLogout: function() { refreshLogout: function() {
var style = this.$('logout').style; var style = this.$('logout').style;
var password = this.regRead(this.getOdbcPath(), 'PWD'); var password = this.regRead(this.getOdbcPath(), 'PWD');
@ -267,6 +288,15 @@ var App = {
else else
style.display = 'none'; style.display = 'none';
}, },
refreshDeveloperMode: function() {
var stylesName = ['branchOptions', 'datasourceOptions'];
for (var n in stylesName) {
var style = this.$(stylesName[n]).style;
style.visibility = this.regRead(Conf.regPath, 'hasDeveloperMode')
Outdated
Review
style.visibility = this.regRead(Conf.regPath, 'hasDeveloperMode')
		? 'visible'
		: 'hidden';
``` style.visibility = this.regRead(Conf.regPath, 'hasDeveloperMode') ? 'visible' : 'hidden'; ```
? 'visible'
: 'hidden';
}
},
onChangeBranch: function() { onChangeBranch: function() {
if (this.$('branch').value == 'master'||'test'||'dev') { if (this.$('branch').value == 'master'||'test'||'dev') {
this.$('branchButton').className = this.$('branch').value; this.$('branchButton').className = this.$('branch').value;
@ -716,7 +746,7 @@ var App = {
err.status = status; err.status = status;
err.req = req; err.req = req;
if (status >= 400 && status < 600) if (status >= 400 && status < 600)
err.error = JSON.parse(req.responseText); alert(_('Bad request') +': '+ err);
cb(err); cb(err);
} }

View File

@ -117,7 +117,8 @@ select {
/* Branch */ /* Branch */
#branchOptions { #branchOptions {
margin-top: 2em; margin-top: 1em;
visibility: hidden;
} }
#branchLogo { #branchLogo {
cursor: pointer; cursor: pointer;
@ -171,8 +172,9 @@ select.dev {
/* Datasource */ /* Datasource */
#datasourceOptions { #datasourceOptions {
margin-top: 2em; margin-top: 1em;
margin-left: 17.3em; margin-left: 17.3em;
visibility: hidden;
} }
#datasourceLogo { #datasourceLogo {
cursor: pointer; cursor: pointer;
@ -229,6 +231,20 @@ select.development {
background-color: #31a527; background-color: #31a527;
} }
/* Footer */
#footer {
width: 100%;
text-align: center;
font-size: 14px;
margin-top: 6em;
color: #303030
}
#heart {
color: #97d700;
}
/* Message */ /* Message */
#message { #message {
@ -243,7 +259,7 @@ select.development {
background-color: #EBB; background-color: #EBB;
color: #644; color: #644;
text-align: center; text-align: center;
font-size: .8em; font-size: 1em;
display: none; display: none;
border-radius: 5px; border-radius: 5px;
box-shadow: 0 0 .4em rgba(1,1,1,.6); box-shadow: 0 0 .4em rgba(1,1,1,.6);
@ -288,13 +304,14 @@ select.development {
text-align: center; text-align: center;
border: 1px solid black; border: 1px solid black;
border-radius: 25px; border-radius: 25px;
font-size: 18px;
} }
#spinner * { #spinner * {
vertical-align: middle; vertical-align: middle;
} }
#spinner img { #spinner img {
width: 2.5em; width: 2.7em;
height: 2.5em; height: 2.7em;
margin-top: .5em; margin-top: .5em;
} }
#loading-message { #loading-message {

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9"/> <meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=9"/>
<title>v6</title> <title>.</title>
<link rel="stylesheet" href="style.css"/> <link rel="stylesheet" href="style.css"/>
<script type="text/javascript" src="main.js"></script> <script type="text/javascript" src="main.js"></script>
<hta:application <hta:application
@ -69,6 +69,14 @@
</div> </div>
</div> </div>
</div> </div>
<div id="footer">
<span>
developed by Verdnatura with
<span id="heart" onclick="App.onHeartClick()">
&hearts;
</span>
</span>
<div>
<div id="background"></div> <div id="background"></div>
<div id="spinner"> <div id="spinner">
<img alt="Cargando..." src="spinner.gif"/> <img alt="Cargando..." src="spinner.gif"/>