primary dropdown
authorKilian Saffran <ksaffran@dks.lu>
Fri, 22 Feb 2019 07:04:33 +0000 (08:04 +0100)
committerKilian Saffran <ksaffran@dks.lu>
Fri, 22 Feb 2019 07:04:33 +0000 (08:04 +0100)
css/app.css
index.html
js/mainapp.js
main.1.js [deleted file]
renderer.js

index d67f8b9..207a847 100644 (file)
@@ -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,<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24' height='24' viewBox='0 0 24 24'><path fill='#fff' d='M7.406 7.828l4.594 4.594 4.594-4.594 1.406 1.406-6 6-6-6z'></path></svg>");
+  color: #fff;
+}
+
+
 input.right {
   text-align: right;
 }
index d89e28b..05adc19 100644 (file)
@@ -19,7 +19,6 @@
               <div class="sidebar-heading"><a href="javascript:location.href='index.html';"><img src="img/invoicejournal.png" style="width: 140px;"><br/>Invoice Journal</a></div>
               <div class="list-group list-group-flush">
                     <select class="form-control list-group-item list-group-item-action bg-primary text-white" id="globaldatasets" onchange="browserapp.loaddataset();">
-                      <option value=""></option>
                     </select>
                     <a  class="list-group-item list-group-item-action bg-light" href="javascript:browserapp.loadmodule('overview');">Übersicht</a>
                     <a  class="list-group-item list-group-item-action bg-light" href="javascript:browserapp.loadmodule('invoices');">Rechnungen</a>
index 79a0066..c20f490 100644 (file)
@@ -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 (file)
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()
-  }
-})
-
index 8ad4921..25583a8 100644 (file)
@@ -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);
             }