diff --git a/src/main.js b/src/main.js index 3dfbd66..844c1ec 100755 --- a/src/main.js +++ b/src/main.js @@ -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); + }; + }, }; diff --git a/src/style.css b/src/style.css index 3d22740..33cb571 100755 --- a/src/style.css +++ b/src/style.css @@ -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; } diff --git a/src/vn-access.hta b/src/vn-access.hta index 6702814..3151c38 100755 --- a/src/vn-access.hta +++ b/src/vn-access.hta @@ -49,8 +49,8 @@
-
- Limpiar caché +
+ Limpiar caché