Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Commit 0e10b26

Browse files
committed
v4.0.1 uncaught exception dialog now modal, fixed export formatting bug, commented out unused vars, ctrl+s saves now
1 parent ae2c78b commit 0e10b26

File tree

6 files changed

+60
-36
lines changed

6 files changed

+60
-36
lines changed

DECSV_project/assets/js/about.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ process.on('uncaughtException', function (err) {
1212
title: "Uncaught Exception",
1313
message: "Unknown error occurred!",
1414
detail: "Something unexpected happened! Please check wiki-page if this is a known problem:\r\n#### ERROR #####\r\n" + err,
15-
buttons: ["Close application", "Open Wiki"],
16-
browserWindow: electron.remote.getCurrentWindow()
15+
buttons: ["Close application", "Open Wiki"]
1716
};
1817

19-
uncaugetdia.showMessageBox(uncaughtoptions, function (index) {
18+
uncaugetdia.showMessageBox(electron.remote.getCurrentWindow(), uncaughtoptions, function (index) {
2019
// no need to deal with anything.... just notifying user
2120
if (index === 1) {
2221
//open wiki

DECSV_project/assets/js/file_export.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict';
2+
23
//////////////////////////////////// CUSTOM ERROR MESSAGE
34
process.on('uncaughtException', function (err) {
45
const electron = require('electron');
@@ -12,11 +13,10 @@ process.on('uncaughtException', function (err) {
1213
title: "Uncaught Exception",
1314
message: "Unknown error occurred!",
1415
detail: "Something unexpected happened! Please check wiki-page if this is a known problem:\r\n#### ERROR #####\r\n" + err,
15-
buttons: ["Close application", "Open Wiki"],
16-
browserWindow: electron.remote.getCurrentWindow()
16+
buttons: ["Close application", "Open Wiki"]
1717
};
1818

19-
uncaugetdia.showMessageBox(uncaughtoptions, function (index) {
19+
uncaugetdia.showMessageBox(electron.remote.getCurrentWindow(), uncaughtoptions, function (index) {
2020
// no need to deal with anything.... just notifying user
2121
if (index === 1) {
2222
//open wiki
@@ -31,17 +31,16 @@ process.on('uncaughtException', function (err) {
3131
});
3232
});
3333
////////////////////////////////////
34-
3534
const remote = require('electron').remote;
36-
const app = remote.app;
37-
const dialog = remote.dialog;
3835
const thiswindow = remote.getCurrentWindow();
36+
//const app = remote.app;
37+
const dialog = remote.dialog;
3938
const path = require('path');
4039
const fs = require('fs');
4140
//const Store = require('electron-config');
42-
const Store = require("electron-store");
41+
//const Store = require("electron-store");
4342
const htmlParser = require('html-parse-stringify2');
44-
const shell = remote.shell;
43+
//const shell = remote.shell;
4544
const parentwindow = thiswindow.getParentWindow();
4645
const getSettings = remote.getGlobal("getSettings");
4746
const ipcRenderer = require('electron').ipcRenderer;
@@ -223,10 +222,10 @@ function writeFile_csv(dataArray, targetFile) {// NEEDSTOBECHANGED
223222
}
224223

225224
if (currentKW.length === 0) {
226-
currentString = currentString + "\r\n"; // no KWs, adding newline
225+
currentString = currentString + ",\r\n"; // no KWs, adding newline
227226
} else {
228227
// KWs, adding them before newline
229-
var kwString = "";
228+
var kwString = ",";// since need something to separate C section answers and keywords
230229

231230
for (var q = 0; q < currentKW.length; q++) {
232231
kwString = kwString + currentKW[q] + ";";

DECSV_project/assets/js/importwizard.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict';
2+
23
//////////////////////////////////// CUSTOM ERROR MESSAGE
34
process.on('uncaughtException', function (err) {
45
const electron = require('electron');
@@ -12,11 +13,10 @@ process.on('uncaughtException', function (err) {
1213
title: "Uncaught Exception",
1314
message: "Unknown error occurred!",
1415
detail: "Something unexpected happened! Please check wiki-page if this is a known problem:\r\n#### ERROR #####\r\n" + err,
15-
buttons: ["Close application", "Open Wiki"],
16-
browserWindow: electron.remote.getCurrentWindow()
16+
buttons: ["Close application", "Open Wiki"]
1717
};
1818

19-
uncaugetdia.showMessageBox(uncaughtoptions, function (index) {
19+
uncaugetdia.showMessageBox(electron.remote.getCurrentWindow(), uncaughtoptions, function (index) {
2020
// no need to deal with anything.... just notifying user
2121
if (index === 1) {
2222
//open wiki
@@ -31,13 +31,12 @@ process.on('uncaughtException', function (err) {
3131
});
3232
});
3333
////////////////////////////////////
34-
3534
const electron = require('electron');
36-
const path = require('path');
3735
const remote = electron.remote;
38-
const shell = electron.shell;
39-
const dialog = remote.dialog;
4036
const thiswindow = remote.getCurrentWindow();
37+
const path = require('path');
38+
//const shell = electron.shell;
39+
const dialog = remote.dialog;
4140
const getSettings = remote.getGlobal("getSettings");
4241
const intUtils = require(path.join(__dirname, './intUtils.js'));
4342
const ipcRenderer = electron.ipcRenderer;
@@ -47,12 +46,11 @@ window.import_ready = false;
4746

4847
const { Menu, MenuItem } = remote;
4948

50-
const menu = new Menu()
51-
menu.append(new MenuItem({ label: 'Developer Tools', click() { thiswindow.toggleDevTools() } }))
49+
const menu = new Menu();
50+
menu.append(new MenuItem({ label: 'Developer Tools', click() { thiswindow.toggleDevTools(); console.error("\n\n\nNOTICE, PLEASE READ!\n\n\n\n\nThis is intended for debugging purposes, and you don't need to do anything here unless specifically told so! There is a possibility that things will break if you don't know what you're doing. \n\nIf someone told you to paste something here, please don't do that :)\n\n\n\n\n\n"); } }))
5251

5352
window.addEventListener('contextmenu', (e) => {
5453
e.preventDefault();
55-
logger.error("\n\n\nNOTICE, PLEASE READ!\n\n\n\n\nThis is intended for debugging purposes, and you don't need to do anything here unless specifically told so! There is a possibility that things will break if you don't know what you're doing. \n\nIf someone told you to paste something here, please don't do that :)\n\n\n\n\n\n");
5654
menu.popup({ window: thiswindow });
5755
}, false);
5856

DECSV_project/assets/js/init.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ process.on('uncaughtException', (err) => {
1414
title: "Uncaught Exception",
1515
message: "Unknown error occurred!",
1616
detail: "Something unexpected happened! Please check wiki-page if this is a known problem:\r\n#### ERROR #####\r\n" + err,
17-
buttons: ["Close application", "Open Wiki"],
18-
browserWindow: electron.remote.getCurrentWindow()
17+
buttons: ["Close application", "Open Wiki"]
1918
};
2019

21-
uncaugetdia.showMessageBox(uncaughtoptions, function (index) {
20+
uncaugetdia.showMessageBox(electron.remote.getCurrentWindow(), uncaughtoptions, function (index) {
2221
// no need to deal with anything.... just notifying user
2322
if (index === 1) {
2423
//open wiki
@@ -33,27 +32,29 @@ process.on('uncaughtException', (err) => {
3332
});
3433
});
3534
////////////////////////////////////
36-
3735
const electron = require('electron');
3836
const remote = electron.remote;
37+
const firstWindow = remote.getCurrentWindow();
38+
const electronLocalshortcut = require('electron-localshortcut');
3939
const ipcRenderer = electron.ipcRenderer;
4040
const BrowserWindow = remote.BrowserWindow;
4141
const dialog = remote.dialog;
42-
const firstWindow = remote.getCurrentWindow();
4342
var fileWizard = null;
4443
const fs = require('fs');
45-
const autoUpdater = remote.autoUpdater;
44+
//const autoUpdater = remote.autoUpdater;
4645
const path = require('path');
4746
const url = require('url');
48-
4947
const { Menu, MenuItem } = remote;
5048

51-
const menu = new Menu()
52-
menu.append(new MenuItem({ label: 'Developer Tools', click() { firstWindow.toggleDevTools()} }))
49+
const menu = new Menu();
50+
menu.append(new MenuItem({ label: 'Developer Tools', click() { firstWindow.toggleDevTools(); console.error("\n\n\nNOTICE, PLEASE READ!\n\n\n\n\nThis is intended for debugging purposes, and you don't need to do anything here unless specifically told so! There is a possibility that things will break if you don't know what you're doing. \n\nIf someone told you to paste something here, please don't do that :)\n\n\n\n\n\n"); } }));
51+
52+
electronLocalshortcut.register(firstWindow, 'CmdOrCtrl+S', () => {
53+
if ($("#save-cur-edits-btn").attr("disabled") !== "disabled" && window.currentProject !== undefined) { $("#save-cur-edits-btn").trigger("click"); }
54+
});
5355

5456
window.addEventListener('contextmenu', (e) => {
5557
e.preventDefault();
56-
logger.error("\n\n\nNOTICE, PLEASE READ!\n\n\n\n\nThis is intended for debugging purposes, and you don't need to do anything here unless specifically told so! There is a possibility that things will break if you don't know what you're doing. \n\nIf someone told you to paste something here, please don't do that :)\n\n\n\n\n\n");
5758
menu.popup({ window: firstWindow });
5859
}, false);
5960

@@ -749,7 +750,7 @@ document.getElementById("exportprojbutton").onclick = function () {// NEEDSTOBEC
749750
var options = {
750751
type: 'info',
751752
title: "Exporting files",
752-
message: "Events marked 'done' will now be exported.",
753+
message: "Export events marked 'DONE'?",
753754
detail: "Note: Only events that have 'permission for data to be used as part of SLIPPS' can be exported!",
754755
buttons: [i18n.__('conf-yes'), i18n.__('conf-no')]
755756
};

DECSV_project/package-lock.json

Lines changed: 27 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DECSV_project/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "teacher_tool",
33
"productName": "SLIPPS Teacher Tool",
44
"copyright": "Copyright (c) 2019 ${author}",
5-
"version": "4.0.0-beta",
5+
"version": "4.0.1-beta",
66
"description": "SLIPPS survey results review and edit application.",
77
"main": "app.js",
88
"scripts": {
@@ -69,6 +69,7 @@
6969
"chardet": "0.6.0",
7070
"charset-detector": "0.0.2",
7171
"cheerio": "^1.0.0-rc.3",
72+
"electron-localshortcut": "^3.1.0",
7273
"electron-log": "2.2.14",
7374
"electron-squirrel-startup": "1.0.0",
7475
"electron-store": "1.3.0",

0 commit comments

Comments
 (0)