refs #4975 Changes

This commit is contained in:
Guillermo Bonet 2022-12-22 14:59:02 +01:00
parent 79d578cf29
commit 65fc298955
3 changed files with 47 additions and 27 deletions

View File

@ -36,7 +36,7 @@ var Conf = {
PORT: '3307', PORT: '3307',
SSLMODE: 'DISABLED' SSLMODE: 'DISABLED'
}, },
local: { localhost: {
DESCRIPTION: 'local', DESCRIPTION: 'local',
SERVER: 'localhost', SERVER: 'localhost',
PORT: '3306', PORT: '3306',
@ -78,7 +78,6 @@ var App = {
init: function() { init: function() {
// Specify the size of window // Specify the size of window
var width = 420; var width = 420;
var height = 560; var height = 560;
window.resizeTo(width, height); window.resizeTo(width, height);
@ -91,7 +90,6 @@ var App = {
onLoad: function() { onLoad: function() {
// Initializes the global variables // Initializes the global variables
var split = Verdnatura.commandLine.match(/(?:[^\s"]+|"[^"]*")+/g); var split = Verdnatura.commandLine.match(/(?:[^\s"]+|"[^"]*")+/g);
if (split.length > 1) if (split.length > 1)
@ -114,7 +112,6 @@ var App = {
var path; var path;
// Creates the Access configuration entries // Creates the Access configuration entries
path = 'HKCU\\Software\\Microsoft\\Office\\11.0\\Access\\Settings'; path = 'HKCU\\Software\\Microsoft\\Office\\11.0\\Access\\Settings';
this.regWrites(path, { this.regWrites(path, {
'Confirm Document Deletions' : false, 'Confirm Document Deletions' : false,
@ -126,7 +123,6 @@ var App = {
this.regWrite(path, 'Level', 1); this.regWrite(path, 'Level', 1);
// Creates the MySQL ODBC connection // Creates the MySQL ODBC connection
var driverPath = this.getEnv('ProgramFiles') + Conf.driverPath; var driverPath = this.getEnv('ProgramFiles') + Conf.driverPath;
var params = { var params = {
@ -148,16 +144,14 @@ var App = {
params params
); );
// Upload the string value to version installed
this.regWrite(Conf.regPath, 'version', Conf.version);
}
//Datasources creations //Datasources creations
this.createDatasources(); this.createDatasources();
// Check the strings values and the respective keys // Upload the string value to version installed
this.regWrite(Conf.regPath, 'version', Conf.version);
}
// Check the strings values and the respective keys
var stringValues = [ var stringValues = [
'remoteURL', 'remoteURL',
'remoteUser', 'remoteUser',
@ -174,21 +168,10 @@ var App = {
if (!this.regRead(Conf.regPath, 'notSignOut')) if (!this.regRead(Conf.regPath, 'notSignOut'))
this.regWrite(Conf.regPath, 'notSignOut', 0); 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 notSignOut = this.regRead(Conf.regPath, 'notSignOut'); var notSignOut = this.regRead(Conf.regPath, 'notSignOut');
this.$('branch').value = this.getBranch(); this.$('user').value = this.regRead(Conf.dsPath, 'UID');
this.onChangeBranch(); this.$('password').value = this.regRead(Conf.dsPath, 'PWD');
this.$('datasource').value = this.getDatasource();
this.onChangeDatasource();
if (user)
this.$('user').value = user;
if (notSignOut && password) { if (notSignOut && password) {
this.$('password').value = password; this.$('password').value = password;
@ -196,6 +179,14 @@ var App = {
this.onEnterClick(); this.onEnterClick();
} else } else
this.resetForm(true); this.resetForm(true);
// Branch options
this.$('branch').value = this.getBranch();
this.onChangeBranch();
// Datasource options
this.$('datasource').value = this.getDatasource();
this.onChangeDatasource();
}, },
resetForm: function(clearPassword) { resetForm: function(clearPassword) {
@ -275,6 +266,16 @@ var App = {
} }
this.updateDatasource(this.$("datasource").value); this.updateDatasource(this.$("datasource").value);
this.$('user').focus(); this.$('user').focus();
var curDatasource = this.regRead(Conf.regPath, 'currentDatasource');
var datasourcePath = Conf.regPath + '\\datasources\\' + curDatasource;
var myUID = this.regRead(datasourcePath, 'UID');
var myPWD = this.regRead(datasourcePath, 'PWD');
if (myUID && myPWD) {
this.$('user').value = myUID;
this.$('password').value = myPWD;
}
}, },
cleanCache: function() { cleanCache: function() {
@ -651,6 +652,21 @@ var App = {
this.regWrite(Conf.regPath, 'currentDatasource', datasource); this.regWrite(Conf.regPath, 'currentDatasource', datasource);
}, },
createDatasources: function() { createDatasources: function() {
this.regWrite(Conf.regPath + '\\datasources');
var params = {
'UID': null,
'PWD': null
}
for (var datasource in Conf.datasources) {
for (var stringValues in Conf.datasources[datasource]) {
this.regWrite(Conf.regPath + '\\datasources\\' + datasource,
stringValues,
Conf.datasources[datasource][stringValues]
);
}
this.regWrites(Conf.regPath + '\\datasources\\' + datasource, params);
};
}, },
}; };

View File

@ -79,10 +79,14 @@ input[type='password']:focus {
text-align: center; text-align: center;
} }
#submit, #submit,
#clean { #cleanDiv {
text-align: center; text-align: center;
} }
#cleanDiv {
margin-top: 10px;
}
#clean:hover { #clean:hover {
text-decoration: underline; text-decoration: underline;
text-decoration-color: #44f; text-decoration-color: #44f;
} }

View File

@ -49,8 +49,8 @@
<div id="submit"> <div id="submit">
<button id="enter" onclick="App.onEnterClick()"> Iniciar sesión</button> <button id="enter" onclick="App.onEnterClick()"> Iniciar sesión</button>
</div> </div>
<div id="clean"> <div id="cleanDiv">
<a href="#" onclick="App.onCleanCacheClick()"> Limpiar caché </a> <a id="clean" href="#" onclick="App.onCleanCacheClick()"> Limpiar caché </a>
</div> </div>
<div id="branchOptions"> <div id="branchOptions">
<div id="branchButton"> <div id="branchButton">