From c386e7192ac8ca3545ad5d6f903eefdaaee23f3e Mon Sep 17 00:00:00 2001 From: Kilian Saffran Date: Fri, 22 Feb 2019 08:04:33 +0100 Subject: [PATCH] primary dropdown --- css/app.css | 6 +++ index.html | 1 - js/mainapp.js | 10 +++-- main.1.js | 116 -------------------------------------------------- renderer.js | 2 +- 5 files changed, 13 insertions(+), 122 deletions(-) delete mode 100644 main.1.js diff --git a/css/app.css b/css/app.css index d67f8b9..207a847 100644 --- a/css/app.css +++ b/css/app.css @@ -54,6 +54,12 @@ select.form-control { background-repeat: no-repeat; } +select.bg-primary, select.bg-primary:hover, select.bg-primary:active { + background-image: url("data:image/svg+xml;utf8,"); + color: #fff; +} + + input.right { text-align: right; } diff --git a/index.html b/index.html index d89e28b..05adc19 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,6 @@
Übersicht Rechnungen diff --git a/js/mainapp.js b/js/mainapp.js index 79a0066..c20f490 100644 --- a/js/mainapp.js +++ b/js/mainapp.js @@ -14,7 +14,7 @@ var browserapp = { //var appdata = browserapp.getconfig(); var params = "?"; for (var i in this.config){ - params += "&" + i +"=" + encodeURIComponent(appdata[i]); + params += "&" + i +"=" + encodeURIComponent(this.config[i]); } //console.log("modules/"+modulename+"/index.html"+params); $("#moduleframe").attr("src","modules/"+modulename+"/index.html"+ params); @@ -23,7 +23,7 @@ var browserapp = { //var appdata = browserapp.getconfig(); var params = "?"; for (var i in this.config){ - params += "&" + i +"=" + encodeURIComponent(appdata[i]); + params += "&" + i +"=" + encodeURIComponent(this.config[i]); } if (pageparams){ for (var i in pageparams){ @@ -34,6 +34,7 @@ var browserapp = { $("#moduleframe").attr("src","modules/"+modulename+"/"+ page +".html"+ params); }, setdatasets: function(myds){ + $("#globaldatasets").html(""); var ds = usersystem.getLocalDataSets(); for (var i in ds){ var prop = usersystem.getPreference(ds[i]); @@ -41,10 +42,11 @@ var browserapp = { } }, loaddataset: function(){ - if ($("globaldatasets").val() == ""){ + var gdset = $("#globaldatasets :selected").val(); + if (gdset == ""){ this.config = null; }else { - var ldata = usersystem.getPreference($("globaldatasets").val()); + var ldata = usersystem.getPreference(gdset); this.config={dbfile:ldata.dbfile,serviceurl:"http://"+ldata.server+":6060/"}; } } diff --git a/main.1.js b/main.1.js deleted file mode 100644 index 296c217..0000000 --- a/main.1.js +++ /dev/null @@ -1,116 +0,0 @@ -const {app, BrowserWindow} = require('electron') -const path = require('path') -const url = require('url') -const os = require('os') -const http = require('http') -const dialog = require('electron').dialog -const {ipcMain} = require('electron') -var child = require('child_process').execFile; - -// Keep a global reference of the window object, if you don't, the window will -// be closed automatically when the JavaScript object is garbage collected. -let win - -function createWindow () { - var executablePath = ""; - var parameters = []; - if (os.platform() == "win32"){ - executablePath = "C:\\Strawberry\\perl\\bin\\perl.exe"; - parameters = ["C:\\Users\\ksaff\\Workspace\\DKSService\\dkslocalserver.pl"]; - } else { //os.platform() == "darwin" - executablePath = "/Users/kilian/perl5/perlbrew/perls/perl-5.28.1/bin/perl"; - parameters = ["/Users/kilian/Workspace/DKSService/dkslocalserver.pl"]; - } - win = new BrowserWindow({show: false}) - win.setMenu(null) - win.maximize() - // child(executablePath, parameters, function(err, data) { - // if(err){ - // console.error('stderr',err); - // } else { - // // var test = app.getPath('USERPROFILE'); - // // console.log("Path:" + test); - // // console.log(data.toString()); - // win.show() - // } - - // }); - - // Create the browser window. - - - - // and load the index.html of the app. - win.loadURL(url.format({ - pathname: path.join(__dirname, 'index.html'), - protocol: 'file:' - })) - - // Open the DevTools. - win.webContents.openDevTools() - - // Emitted when the window is closed. - win.on('closed', () => { - // Dereference the window object, usually you would store windows - // in an array if your app supports multi windows, this is the time - // when you should delete the corresponding element. - win = null - }) - -// win.webContents.on('new-window', (event, urlx, frameName, disposition, options, additionalFeatures) => { -// console.log('Open New Window!'); -// //console.log(event); - -// console.log("URL:" + urlx); -// //if (frameName === 'modal') { -// // open window as modal -// event.preventDefault(); - -// event.newGuest = new BrowserWindow({show: false,parent: win,width: 600,height: 800}); -// event.newGuest.webContents.openDevTools() -// event.newGuest.loadURL(urlx) - -// event.newGuest.webContents.on('did-finish-load', () => { -// console.log("Finished loading print page!"); -// // event.newGuest.printToPDF({}, (error, data) => { -// // if (error) throw error -// // fs.writeFile('C:\\Users\\ksaff\\creorga.pdf', data, (error) => { -// // if (error) throw error -// // console.log('Write PDF successfully.') -// // }) -// // }) - - -// }) -// event.newGuest.show(); -// //} -// }) - - -} - -// This method will be called when Electron has finished -// initialization and is ready to create browser windows. -// Some APIs can only be used after this event occurs. -app.on('ready', createWindow) - -// Quit when all windows are closed. -app.on('window-all-closed', () => { - http.get('http://localhost:6060/server/unload', (resp) => { - // resp.on('end',() => {console.log("vpn disconnected!")}); - }); - // On macOS it is common for applications and their menu bar - // to stay active until the user quits explicitly with Cmd + Q - if (process.platform !== 'darwin') { - app.quit() - } -}) - -app.on('activate', () => { - // On macOS it's common to re-create a window in the app when the - // dock icon is clicked and there are no other windows open. - if (win === null) { - createWindow() - } -}) - diff --git a/renderer.js b/renderer.js index 8ad4921..25583a8 100644 --- a/renderer.js +++ b/renderer.js @@ -41,7 +41,7 @@ var usersystem = { var data = null; if (fs.existsSync(this.profilepath() + key + ".json")){ console.log("Read Key:" + key); - var data = fs.readFile(this.profilepath() + key + ".json", 'utf-8') + var data = fs.readFileSync(this.profilepath() + key + ".json", 'utf-8'); if (data.startsWith("{") || data.startsWith("[")){ data = JSON.parse(data); } -- 2.39.5