diff --git a/app/api/qSubSection.json b/app/api/qSubSection.json index 3970044..11a9c9a 100644 --- a/app/api/qSubSection.json +++ b/app/api/qSubSection.json @@ -28,7 +28,8 @@ { "name": ":P1", "value": "{{$_GET.subid}}", - "test": "11" + "test": "1", + "recid": 1 } ] } diff --git a/public/PDF/dummyFunctions.js b/public/PDF/dummyFunctions.js index ae7d77b..f38bbda 100644 --- a/public/PDF/dummyFunctions.js +++ b/public/PDF/dummyFunctions.js @@ -21,3 +21,24 @@ async function toBase64(filePath) { return img } + + + +const terminal = document.getElementById('terminal'); + +// Function to add a line to the terminal +function addLine(text) { + const line = document.createElement('p'); + line.className = 'line'; + line.textContent = text; + terminal.appendChild(line); + + // Automatically scroll to the bottom + terminal.scrollTop = terminal.scrollHeight; +} + +// Simulate adding lines +let lineCount = 0; +setInterval(() => { + addLine(`Line ${++lineCount}: This is a test log.`); +}, 500); // Add a new line every 500ms \ No newline at end of file diff --git a/public/dmxAppConnect/config.js b/public/dmxAppConnect/config.js index 62003a9..6478ec0 100644 --- a/public/dmxAppConnect/config.js +++ b/public/dmxAppConnect/config.js @@ -44,7 +44,21 @@ dmx.config({ } ], "local": {} - } + }, + "datastore1": [ + { + "type": "text", + "name": "numSection" + }, + { + "type": "text", + "name": "description" + }, + { + "type": "text", + "name": "Points" + } + ] }, "index": { "global": [ diff --git a/public/js/libSavePDFbytes.js b/public/js/libSavePDFbytes.js index aff3cd5..1a58a47 100644 --- a/public/js/libSavePDFbytes.js +++ b/public/js/libSavePDFbytes.js @@ -1,2 +1,40 @@ // JavaScript Document +const sqlite3 = require('sqlite3').verbose(); + +async function insertPdfBytesIntoDb(pdfBytes) { + // Create or open the database + const db = new sqlite3.Database('example.db'); + + // Ensure the table exists + const createTableQuery = ` + CREATE TABLE IF NOT EXISTS PDFdata ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + pdfByteData BLOB + ) + `; + + // Execute the table creation query + await new Promise((resolve, reject) => { + db.run(createTableQuery, (err) => { + if (err) return reject(err); + resolve(); + }); + }); + + // Insert the PDF bytes into the table + const insertQuery = ` + INSERT INTO PDFdata (pdfByteData) VALUES (?) + `; + + await new Promise((resolve, reject) => { + db.run(insertQuery, pdfBytes, function (err) { + if (err) return reject(err); + console.log(`Inserted PDF bytes with ID: ${this.lastID}`); + resolve(this.lastID); // Return the last inserted ID + }); + }); + + // Close the database + db.close(); +} diff --git a/views/observationPage.ejs b/views/observationPage.ejs index 313872c..2f4bafe 100644 --- a/views/observationPage.ejs +++ b/views/observationPage.ejs @@ -266,8 +266,8 @@ - - +