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

View File

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