Commit 4e27d660 by Owen Ryan Ang

initial commit for ui update

parent f7d141dc
......@@ -10,11 +10,20 @@ import { fingerprintCapture, getLocation, imageCapture, videoCapture } from "./A
import { processCapture } from "./ImageCapture/captureImage.js";
import { processFingerprint } from "./FingerprintCapture/captureFingerprint.js";
import { processVideoCapture } from "./VideoCapture/captureVideo.js";
import { IS_RETRIEVE_FROM_BPO } from "../config.js";
import { returnElementBPO } from "../BPO/returnElement.js";
let newOption;
export let schema;
export async function generateFields(inputSchema, containerId) {
if(IS_RETRIEVE_FROM_BPO){
let elementId = sessionStorage.getItem("element_id");
window.addEventListener('beforeunload', function (event) {
returnElementBPO(elementId);
});
}
window.populateFields = populateFields;
schema = inputSchema;
let divContainer = document.getElementById(containerId);
......@@ -2197,7 +2206,7 @@ export async function populateFields() {
if (resp[0] != null && 'DocType' in resp[0]) {
var doctype = resp[0].DocType;
var section = resp[0].Section;
var section = Object.keys(schema[doctype])[0];
saveXMLToStorage(parseInt(sessionStorage.getItem("display_counter")), resp[0].fields);
sessionStorage.removeItem("doctype");
......
export const FOLDER_PATH = "/WebGde-Widgets/ImageViewerWidget/modules/imageViewer";
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Hello, world!</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="description" content="" />
<link rel="icon" href="favicon.png">
<link rel="stylesheet" href="./modules/imageViewer/imageViewer.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.min.js"></script>
<script src="https://cdn.rawgit.com/seikichi/tiff.js/master/tiff.min.js"></script>
</head>
<body>
<style>
#imageViewerContainer{
width: 70vh;
height: 80vh;
}
</style>
<div id="imageViewerContainer"></div>
</body>
<script type="module" src="./script.js"></script>
</html>
\ No newline at end of file
import { HIGHLIGHT_OBJECT } from "../../../globalVariable.js";
export function hightlightEventListeners(){
$(document).on('keyup', '.select2.select2-container', function (e) {
if (e.which == 9) {
//gets the id of the focused select element by using Tab key
const idArr = e.target.childNodes[0].id.split(/-container|select2-/);
//array created ALWAYS has empty characters on its first and last chars ["", "Civil Status", ""],
//so index 1 is used to get select element ID
HIGHLIGHT_OBJECT.highlight(idArr[1]);
HIGHLIGHT_OBJECT.currIdVal = idArr[1];
}
});
window.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.shiftKey && e.key === "H") {
HIGHLIGHT_OBJECT.flipXHighlightCanvas(HIGHLIGHT_OBJECT.currIdVal);
HIGHLIGHT_OBJECT.isInitialPositioning = false;
}
})
window.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.shiftKey && e.key === "V") {
HIGHLIGHT_OBJECT.flipYHighlightCanvas(HIGHLIGHT_OBJECT.currIdVal);
}
})
//waits for flip buttons to be created before adding event listeners for adjusting highlights
const flipBtnObserver = new MutationObserver(function (mutations, mutationInstance){
const flipBtnX = document.getElementById("TiffViewer_FlipX");
const flipBtnY = document.getElementById("TiffViewer_FlipY");
if(flipBtnX){
flipBtnX.addEventListener("click", function(){
HIGHLIGHT_OBJECT.flipXHighlightCanvas(HIGHLIGHT_OBJECT.currIdVal);
});
flipBtnY.addEventListener("click", function(){
HIGHLIGHT_OBJECT.flipYHighlightCanvas(HIGHLIGHT_OBJECT.currIdVal);
});
mutationInstance.disconnect();
}
});
flipBtnObserver.observe(document, {
childList: true,
subtree: true
});
//waits for fields to be created before adding event listeners
const fieldObserver = new MutationObserver(function (mutations, mutationInstance) {
//find input elements inside div element with id='fields'
const fields = document.getElementById('fields').querySelectorAll('input, textarea');
if (fields.length>0) {
fields.forEach((field) => {
//event listener when a field is focused
field.addEventListener('focus', (e) =>{
// flippedH = false;
HIGHLIGHT_OBJECT.highlight(e.target.id);
HIGHLIGHT_OBJECT.currIdVal = e.target.id;
})
field.addEventListener('mouseover', (e) =>{
// flippedH = false;
HIGHLIGHT_OBJECT.highlight(e.target.id);
HIGHLIGHT_OBJECT.currIdVal = e.target.id;
})
});
//open dropdown list event listener
//find select elements in div with id='fields'
$('#fields').find('select').each(function() {
$(this).on('select2:open', function (e) {
HIGHLIGHT_OBJECT.highlight($(this)[0].id);
HIGHLIGHT_OBJECT.currIdVal = $(this)[0].id;
});
});
mutationInstance.disconnect();
}
});
fieldObserver.observe(document, {
childList: true,
subtree: true
});
// //waits until image is loaded, since its size is based on the displayed image
// const observer = new MutationObserver(function (mutations, mutationInstance) {
// var TIFFimg = document.getElementById(sessionStorage.getItem("TiffViewer_current"));
// var parentDivPDF;
// var canvasPDF;
// if(sessionStorage.getItem("file_Name").endsWith(PDF_EXTENSION)){
// parentDivPDF = document.getElementById("pdf-container");
// canvasPDF = parentDivPDF.getElementsByTagName('canvas')[0];
// TIFFimg = canvasPDF;
// }
// var parentDivIMG;
// var canvasIMG;
// if(sessionStorage.getItem("file_Name").endsWith(JPG_EXTENSION) || sessionStorage.getItem("file_Name").endsWith(PNG_EXTENSION) ){
// var parentDivIMG = document.getElementById("img-container");
// var canvasIMG = parentDivIMG.getElementsByTagName('canvas')[0];
// TIFFimg = canvasIMG;
// }
// if (TIFFimg != null) {
// //waits until width and height has been assigned
// var sizeObserver = new window.ResizeObserver(entries => {
// if(sessionStorage.getItem("file_Name").endsWith(PDF_EXTENSION)){
// if(isCanvasNotCreated){
// HIGHLIGHT_OBJECT.rect = canvasPDF.getBoundingClientRect();
// HIGHLIGHT_OBJECT.createHighlight(entries[0].contentRect.width, entries[0].contentRect.height);
// HIGHLIGHT_OBJECT.isCanvasNotCreated = false;
// HIGHLIGHT_OBJECT.ctx.clearRect(0, 0, canvasPDF.width, canvasPDF.height);
// }
// else{
// HIGHLIGHT_OBJECT.rect = canvasPDF.getBoundingClientRect();
// if(HIGHLIGHT_OBJECT.isInitialPositioning){
// HIGHLIGHT_OBJECT.resizeHighlightCanvas(entries[0].contentRect.width, entries[0].contentRect.height, (rect.left-263));
// }
// else{
// HIGHLIGHT_OBJECT.resizeHighlightCanvas(entries[0].contentRect.width, entries[0].contentRect.height, (rect.left));
// HIGHLIGHT_OBJECT.isInitialPositioning = true;
// }
// }
// }
// else if(sessionStorage.getItem("file_Name").endsWith(JPG_EXTENSION) || sessionStorage.getItem("file_Name").endsWith(PNG_EXTENSION)){
// if(isCanvasNotCreated){
// rect = canvasIMG.getBoundingClientRect();
// createHighlight(entries[0].contentRect.width, entries[0].contentRect.height);
// isCanvasNotCreated = false;
// ctx.clearRect(0, 0, canvasIMG.width, canvasIMG.height);
// }
// else{
// rect = canvasIMG.getBoundingClientRect();
// if(isInitialPositioning){
// resizeHighlightCanvas(entries[0].contentRect.width, entries[0].contentRect.height, (rect.left-263));
// }
// else{
// resizeHighlightCanvas(entries[0].contentRect.width, entries[0].contentRect.height, (rect.left));
// isInitialPositioning = true;
// }
// }
// }
// else{
// if(isCanvasNotCreated){
// rect = document.getElementById(sessionStorage.getItem("TiffViewer_current")).getBoundingClientRect();
// // createHighlight(entries[0].contentRect.width, entries[0].contentRect.height);
// createHighlight(entries[0].contentRect.width, entries[0].contentRect.height);
// isCanvasNotCreated = false;
// ctx.clearRect(0, 0, highlightCanvas.width, highlightCanvas.height);
// }
// else{
// rect = document.getElementById(sessionStorage.getItem("TiffViewer_current")).getBoundingClientRect();
// if(isInitialPositioning){
// resizeHighlightCanvas(entries[0].contentRect.width, entries[0].contentRect.height, (rect.left-263));
// }
// else{
// resizeHighlightCanvas(entries[0].contentRect.width, entries[0].contentRect.height, (rect.left));
// isInitialPositioning = true;
// }
// }
// }
// $(document).ready(function () {
// $('form:first *:input[type!=hidden]:first').focus(); // Run code
// });
// });
// sizeObserver.observe(TIFFimg);
// mutationInstance.disconnect();
// }
// });
// observer.observe(document, {
// childList: true,
// subtree: true
// });
// }
}
This source diff could not be displayed because it is too large. You can view the blob instead.
import { FOLDER_PATH } from "../../config.js";
export class ImageDocument {
imageFile = null;
imageID = null;
imageType = null;
imageStatus = null;
imageFileName = null;
/*@param
imageFile --- image Blob
id --- element id
fileFormat --- attribute for the element
imageStatus --- 200 to display image, 415 for unsupported file , 500 for unable to display image
*/
constructor(imageFile, id, fileName, fileFormat, imageStatus) {
this.imageFile = imageFile;
this.imageID = id;
this.imageType = fileFormat;
this.imageStatus = imageStatus;
this.imageFileName = fileName;
}
async init() {
switch (this.imageStatus){
case 200:
let imageContainer = document.createElement("div");
imageContainer.setAttribute("class", "row");
imageContainer.setAttribute("id", this.imageID);
imageContainer.setAttribute("num-of-pages", "1");
imageContainer.setAttribute("file-type", this.imageType);
imageContainer.setAttribute("file-name", this.imageFileName);
let imageElement = document.createElement("img");
imageElement.setAttribute("class", "image");
imageElement.src = this.imageFile;
imageContainer.appendChild(imageElement);
// let canvas = document.getElementById('canvas');
// let ctx = imageContainer.getContext('2d');
// imageContainer.width = imageElement.width;
// imageContainer.height = imageElement.height;
// ctx.drawImage(imageElement, 200, 200);
return imageContainer;
case 415: // unsupported file
return this.createUnsupportedFileDisplay(this.imageID, this.imageType);
case 500: // unable to display image
return this.createErrorImageDisplay(this.imageID);
}
}
createUnsupportedFileDisplay(id, format) {
let container = document.createElement("div");
container.setAttribute("class", "row unsupported-file");
container.setAttribute("id", id);
container.setAttribute("num-of-pages", "1");
container.setAttribute("file-type", format);
container.setAttribute("file-name", this.imageFileName);
let imageElement = document.createElement("img");
imageElement.setAttribute("class", "image unsupported-file");
imageElement.src = "."+ FOLDER_PATH +"/resources/question_mark.png";
let p = document.createElement("p");
p.textContent = format.toUpperCase()+" file is not supported.";
container.appendChild(imageElement);
container.appendChild(p);
return container;
}
createErrorImageDisplay(id) {
let container = document.createElement("div");
container.setAttribute("class", "row error-image");
container.setAttribute("id", id);
container.setAttribute("num-of-pages", "1");
container.setAttribute("file-type", "");
container.setAttribute("file-name", this.imageFileName);
let imageElement = document.createElement("img");
imageElement.setAttribute("class", "image error-image");
imageElement.src = "."+ FOLDER_PATH + "/resources/error_icon.png";
let p = document.createElement("p");
p.textContent = "Ooops! Sorry unable to display image."
container.appendChild(imageElement);
//container.appendChild(h3);
container.appendChild(p);
return container;
}
}
*{
box-sizing: border-box;
padding: 0%;
margin: 0%;
font-family: 'Varela Round', sans-serif;
}
body {
margin: 0;
}
.image-viewer-container{
background-color: #BFBFBF;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
}
.image-container{
height: 90%;
width: 100%;
overflow: auto;
margin: auto;
background-color: #BFBFBF;
display: flex;
flex-wrap: nowrap;
align-items: flex-start;
justify-content: center;
position: relative;
}
.image{
height: 100%;
width: 100%;
border: 1px solid #000;
}
.unsupported-file, .error-image{
height: 40%;
width: 40%;
margin: auto;
border: 0px !important;
display: flex;
justify-content: center;
flex-wrap: wrap;
}
.image.unsupported-file{
height: 50% !important;
width: 40% !important;
border: 0px !important;
margin: auto;
}
.unsupported-file p{
font-size: 14px;
color: #000;
margin: auto;
word-wrap: break-word;
width: 100%;
text-align: center;
}
.image.error-image{
height: 70% !important;
width: 70% !important;
border: 0px !important;
margin: auto;
}
.error-image p{
font-size: 14px;
color: #000;
margin: auto;
word-wrap: break-word;
width: 100%;
text-align: center;
}
.image-controls{
/* position: sticky;
bottom:1vh;
left: 0%; */
width: 100%;
height: fit-content;
padding: 2px;
background-color: #000000a1;
display: flex;
justify-content: space-between;
}
.image-controls .row{
display: flex;
justify-content: center;
flex-wrap: nowrap;
position: sticky;
z-index: 15;
}
.image-controls .row .button{
margin: 3px;
}
.image-btn-control{
width: fit-content;
border: 0px solid #fff;
color: white;
height: 5vh;
width: 5vh;
border-radius: 5px;
}
div.fit-content{
width: auto;
height: inherit;
object-fit: cover;
margin: auto;
}
canvas.fit-content{
max-height: 100%;
max-width: 100%;
object-fit: cover;
margin: auto;
}
#fitContentBtn{
background: no-repeat center/90% url("./resources/fullscreen_icon.png");
}
#flipVerticalBtn{
background: no-repeat center/90% url("./resources/flip_vertical_icon.png");
}
#flipHorizontalBtn{
background: no-repeat center/90% url("./resources/flip_horizontal_icon.png");
}
#leftRotateBtn{
background: no-repeat center/90% url("./resources/rotate_left_icon.png");
}
#rightRotateBtn{
background: no-repeat center/90% url("./resources/rotate_right_icon.png");
}
#zoomInBtn{
background: no-repeat center/90% url("./resources/zoom_in_icon.png");
}
#zoomOutBtn{
background: no-repeat center/90% url("./resources/zoom_out_icon.png");
}
#previousRecordImage{
background: no-repeat center/90% url("./resources/previous_rec.png");
margin-left: 1px;
}
#nextRecordImage{
background: no-repeat center/90% url("./resources/next_rec.png");
margin-right: 2px;
}
#imageViewerHeader{
width: 100%;
height: fit-content;
display: flex;
background-color: #000000a1;
padding: 5px;
align-items: center;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
}
#previousPageBtn{
background: no-repeat center/90% url("./resources/previous_icon.png");
}
#nextPageBtn{
background: no-repeat center/90% url("./resources/next_icon.png");
}
#refreshCurrentImage{
background: no-repeat center/90% url("./resources/refresh_icon.png") ;
}
#imageViewerHeader .row{
display: flex;
align-items: center;
max-height: 6vh;
}
#imageViewerHeader .row .label{
font-size: 2vh;
color: #fff;
}
#imageViewerHeader .button{
height: 3vh;
width: 3vh;
}
#nextImage #previousImageID{
display: none;
}
/* .progress-bar__container {
width: 80%;
height: 2rem;
border-radius: 2rem;
position: relative;
overflow: hidden;
transition: all 0.5s;
will-change: transform;
box-shadow: 0 0 5px #e76f51;
}
.progress-bar {
position: absolute;
height: 100%;
width: 100%;
content: "";
background-color: #e76f51;
top:0;
bottom: 0;
left: -100%;
border-radius: inherit;
display: flex;
justify-content: center;
align-items:center;
color: white;
font-family: sans-serif;
}
.progress-bar__text {
display: none;
} */
\ No newline at end of file
import { FOLDER_PATH } from "../../config.js";
export class PDFDocument {
pdfDoc = null;
pageNum = 1;
pageRendering = false;
pageNumPending = null;
scale = 1.5;
canvas = null;
ctx = null;
imageURL=null;
pdfContainerID = null;
fileName=null;
constructor(url, id, fileName){
this.imageURL = url;
this.pdfContainerID = id;
this.fileName = fileName;
}
async init() {
let _this = this;
let pdfCanvas = document.createElement("canvas");
var imageContainer = document.getElementById("imageContainer");
imageContainer.classList.add("pdf-canvas");
this.canvas = pdfCanvas;
this.ctx = this.canvas.getContext('2d');
// Loaded via <script> tag, create shortcut to access PDF.js exports.
var pdfjsLib = window['pdfjs-dist/build/pdf'];
// The workerSrc property shall be specified.
pdfjsLib.GlobalWorkerOptions.workerSrc = '.'+ FOLDER_PATH +'/assets/pdf.worker.js';
pdfCanvas.setAttribute("id", this.pdfContainerID);
/**
* Asynchronously downloads PDF.
*/
await pdfjsLib.getDocument(this.imageURL).promise.then(function (pdfDoc_) {
_this.pdfDoc = pdfDoc_;
// Initial/first page rendering
_this.renderPage(1);
pdfCanvas.setAttribute("num-of-pages", _this.pdfDoc.numPages);
pdfCanvas.setAttribute("file-type", "pdf");
_this.setPDFDoc(_this.pdfDoc);
pdfCanvas.setAttribute("file-name", _this.fileName);
// sessionStorage.setItem("current_page", 1);
// sessionStorage.setItem("total_pages", _this.pdfDoc.numPages);
});
return pdfCanvas;
}
setPDFDoc(pdfDoc){
this.pdfDoc = pdfDoc;
}
/**
* Get page info from document, resize canvas accordingly, and render page.
* @param num Page number.
*/
async renderPage(num) {
let _this = this;
_this.pageRendering = true;
// Using promise to fetch the page
var page = await _this.pdfDoc.getPage(num);
var viewport = page.getViewport({ scale: _this.scale });
_this.canvas.height = viewport.height;
_this.canvas.width = viewport.width;
// Render PDF page into canvas context
var renderContext = {
canvasContext: _this.ctx,
viewport: viewport
};
await page.render(renderContext);
// Wait for rendering to finish
_this.pageRendering = false;
if (_this.pageNumPending !== null && !isNaN(_this.pageNumPending) && num !== _this.pageNumPending) {
// New page rendering is pending
_this.renderPage(_this.pageNumPending);
_this.pageNumPending = null;
}
}
/**
* If another page rendering in progress, waits until the rendering is
* finised. Otherwise, executes rendering immediately.
*/
queueRenderPage(num) {
if (this.pageRendering) {
this.pageNumPending = num;
} else {
this.renderPage(num);
}
}
}
// /**
// * Displays previous page.
// */
// export function onPrevPage(PDFDocument) {
// //const _this = this;
// }
// /**
// * Displays next page.
// */
// export function onNextPage(PDFDocument) {
// const _this = this;
// let pageNum = parseInt(sessionStorage.getItem("current_page"));
// let numPages = parseInt(sessionStorage.getItem("total_pages"));
// if (pageNum != numPages) {
// pageNum++;
// document.getElementById("nextPageBtn").style.visibility = "visible";
// document.getElementById("previousPageBtn").style.visibility = "visible";
// sessionStorage.setItem("current_page", pageNum);
// PDFDocument.queueRenderPage(pageNum);
// }
// if (pageNum === numPages) {
// document.getElementById("nextPageBtn").style.visibility = "hidden";
// }
// }
\ No newline at end of file
export class TiffDocument{
filenameWithoutExt;
blob;
tiffImageName;
tiffID;
constructor(blob, url, filename, id){
this.tiffImageName = filename;
this.tiffID = id;
this.blob = blob;
//this.init(blob.arrayBuffer(), filename, id);
}
async init() {
Tiff.initialize({
TOTAL_MEMORY: 16777216 * 10
});
var arraybuffer;
var fileReader = new FileReader();
fileReader.onload = function (event) {
arraybuffer = event.target.result;
};
fileReader.readAsArrayBuffer(this.blob);
var buffer = await this.blob.arrayBuffer();
var TiffViewerImageName = this.tiffImageName;
const parts = TiffViewerImageName.split(".");
parts.pop();
this.filenameWithoutExt = parts.join(".");
let TiffViewer_pages = 0; //page count
let TiffViewer_current = 1; // TiffViewer_current page number
var tiff = new Tiff({
buffer: buffer
}); //get TIFF data via buffer
TiffViewer_pages = tiff.countDirectory(); //count TIFF image TiffViewer_pages
let tiffContainer = document.createElement("div");
tiffContainer.setAttribute("class", "tiff-container");
tiffContainer.setAttribute("id", this.tiffID);
tiffContainer.setAttribute("num-of-pages", TiffViewer_pages);
tiffContainer.setAttribute("file-type", "tiff");
tiffContainer.setAttribute("file-name", this.tiffImageName);
//creating blank image containers for each page and setting TIFF data as image source
for (var i = 1; i <= TiffViewer_pages; i++) {
var img = document.createElement('img');
img.id = this.filenameWithoutExt + i;
if (i != 1) {
img.setAttribute("class", "image tiff-images");
tiff.setDirectory(i - 1);
img.src = tiff.toCanvas().toDataURL();
img.style.display = "none";
tiffContainer.append(img);
} else {
let firstImage = document.createElement("img");
firstImage.src = tiff.toCanvas().toDataURL();
firstImage.setAttribute("class", "image");
firstImage.id = this.filenameWithoutExt + i;
tiffContainer.prepend(firstImage);
}
}
return tiffContainer;
}
}
// export function onPrevPage() {
// let TiffViewer_current = parseInt(sessionStorage.getItem("current_page"));
// if (TiffViewer_current != 1) {
// document.getElementById(_this.filenameWithoutExt + `${TiffViewer_current}`).style.display = "none";
// TiffViewer_current--;
// document.getElementById(_this.filenameWithoutExt + `${TiffViewer_current}`).style.display = "block";
// sessionStorage.setItem("current_page", TiffViewer_current);
// //CURRENT_PAGE_ELEMENT.textContent = TiffViewer_current;
// document.getElementById("nextPageBtn").style.visibility = "visible";
// //document.getElementById("TiffViewer_PageCount").innerHTML = "Page: " + TiffViewer_current + " / " + TiffViewer_pages;
// }
// if (TiffViewer_current === 1) {
// document.getElementById("previousPageBtn").style.visibility = "hidden";
// }
// }
// export function nextPage() {
// let TiffViewer_current = parseInt(sessionStorage.getItem("current_page"));
// let TiffViewer_pages = parseInt(sessionStorage.getItem("total_pages"));
// if (TiffViewer_current != TiffViewer_pages) {
// document.getElementById(_this.filenameWithoutExt + `${TiffViewer_current}`).style = "display: none";
// TiffViewer_current++;
// sessionStorage.setItem("current_page", TiffViewer_current);
// //CURRENT_PAGE_ELEMENT.textContent = TiffViewer_current;
// document.getElementById(_this.filenameWithoutExt + `${TiffViewer_current}`).style.display = "block";
// document.getElementById("previousPageBtn").style.visibility = "visible";
// // document.getElementById("TiffViewer_PageCount").innerHTML = "Page: " + TiffViewer_current + " / " + TiffViewer_pages;
// }
// if (TiffViewer_current === TiffViewer_pages) {
// document.getElementById("nextPageBtn").style.visibility = "hidden";
// }
// }
export const displayTiff = async (blob, url, filename, id) => {
Tiff.initialize({
TOTAL_MEMORY: 16777216 * 10
});
var startIndex = (url.indexOf('\\') >= 0 ? url.lastIndexOf('\\') : url.lastIndexOf('/'));
var TiffViewerImageName = url.substring(startIndex);
if (TiffViewerImageName.indexOf('\\') === 0 || TiffViewerImageName.indexOf('/') === 0) {
if (TiffViewerImageName.length > 40) {
TiffViewerImageName = decodeURI(TiffViewerImageName); /* ADDED: replaces the %20 that replaces the spaces when file name is displayed */
TiffViewerImageName = TiffViewerImageName.substring(1, 40);
TiffViewerImageName = TiffViewerImageName.concat("...");
} else {
TiffViewerImageName = TiffViewerImageName.substring(1);
}
}
var arraybuffer;
var fileReader = new FileReader();
fileReader.onload = function (event) {
arraybuffer = event.target.result;
};
fileReader.readAsArrayBuffer(blob);
TIFFViewer(await blob.arrayBuffer(), filename, id);
// await makeRequest(url, filename, id);
}
let Current_page = 0;
let filenameWithoutExt;
async function makeRequest(url, filename, id) {
return new Promise(function (resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.responseType = 'arraybuffer';
xhr.open('get', url, true);
xhr.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var startIndex = (xhr.responseURL.indexOf('\\') >= 0 ? xhr.responseURL.lastIndexOf('\\') : xhr.responseURL.lastIndexOf('/'));
var TiffViewerImageName = xhr.responseURL.substring(startIndex);
if (TiffViewerImageName.indexOf('\\') === 0 || TiffViewerImageName.indexOf('/') === 0) {
if (TiffViewerImageName.length > 40) {
TiffViewerImageName = decodeURI(TiffViewerImageName); /* ADDED: replaces the %20 that replaces the spaces when file name is displayed */
TiffViewerImageName = TiffViewerImageName.substring(1, 40);
TiffViewerImageName = TiffViewerImageName.concat("...");
} else {
TiffViewerImageName = TiffViewerImageName.substring(1);
}
}
TIFFViewer(xhr.response, filename, id);
}
};
xhr.send();
});
}
//Main Widget
function TIFFViewer(xhr, TiffViewerImageName, id) {
var buffer = xhr;
var TiffViewerImageName = TiffViewerImageName;
const parts = TiffViewerImageName.split(".");
parts.pop();
filenameWithoutExt = parts.join(".");
let TiffViewer_pages = 0; //page count
let TiffViewer_current = 1; // TiffViewer_current page number
//sessionStorage.setItem("TiffViewer_current", filenameWithoutExt + TiffViewer_current);
if (localStorage.getItem("prev") == 1) {
Current_page = Current_page - 1;
} else {
if (localStorage.getItem("submit") == 1 || Current_page == 0) {
Current_page = Current_page + 1;
}
}
var tiff = new Tiff({
buffer: buffer
}); //get TIFF data via buffer
TiffViewer_pages = tiff.countDirectory(); //count TIFF image TiffViewer_pages
let tiffContainer = document.createElement("div");
tiffContainer.setAttribute("class", "tiff-container");
tiffContainer.setAttribute("id", id);
tiffContainer.setAttribute("num-of-pages", TiffViewer_pages);
tiffContainer.setAttribute("file-type", "tiff");
//creating blank image containers for each page and setting TIFF data as image source
for (var i = 1; i <= TiffViewer_pages; i++) {
var img = document.createElement('img');
img.id = filenameWithoutExt + i;
if (i != 1) {
img.setAttribute("class", "image tiff-images");
tiff.setDirectory(i - 1);
img.src = tiff.toCanvas().toDataURL();
img.style.display = "none";
tiffContainer.append(img);
} else {
let firstImage = document.createElement("img");
firstImage.src = tiff.toCanvas().toDataURL();
firstImage.setAttribute("class", "image");
firstImage.id = filenameWithoutExt + i;
tiffContainer.prepend(firstImage);
}
}
DISPLAY_CONTAINER.appendChild(tiffContainer);
DISPLAY_CONTAINER.classList.add("pdf-canvas");
}
\ No newline at end of file
import { GDE_URL } from "../../../config.js";
export class IndexedDBStorage{
defaultGetStoreFunc;
dbName;
storeName;
constructor(dbName, tblName){
this.dbName = dbName;
this.storeName = tblName;
this.defaultGetStore();
}
promisifyRequest(request) {
return new Promise((resolve, reject) => {
request.oncomplete = request.onsuccess = () => resolve(request.result);
request.onabort = request.onerror = () => reject(request.error);
});
}
createStore() {
const request = indexedDB.open(this.dbName);
request.onupgradeneeded = () => request.result.createObjectStore(this.storeName);
const dbp = this.promisifyRequest(request);
return (txMode, callback) =>
dbp.then((db) =>
callback(db.transaction(this.storeName, txMode).objectStore(this.storeName)),
);
}
async storeImageFile(url, key){
const blob = await this.createBlob(url);
if (blob) {
await this.set(key, blob);
}
}
set(key, value, customStore = this.defaultGetStore()) {
return customStore('readwrite', (store) => {
store.put(value, key);
return this.promisifyRequest(store.transaction);
});
}
getStoreFile(key, customStore =this.defaultGetStore()){
return customStore('readonly', (store) => this.promisifyRequest(store.get(key)));
}
removeFile(key, customStore = this.defaultGetStore()){
if (this.getStoreFile("record" + key)) {
return customStore('readwrite', (store) => this.promisifyRequest(store.delete("record" + key)));
}
}
getAllBlobs(customStore = this.defaultGetStore()) {
return customStore('readonly', (store) => this.promisifyRequest(store.getAll()));
}
clear(customStore = this.defaultGetStore()) {
return customStore('readwrite', (store) => this.promisifyRequest(store.clear()));
}
defaultGetStore() {
if (!this.defaultGetStoreFunc) {
this.defaultGetStoreFunc = this.createStore(this.dbName, this.storeName);
}
return this.defaultGetStoreFunc;
}
async createBlob(url) {
try {
let data = {"dir": url};
if(url.startsWith("file")){
let response = await fetch(GDE_URL +"/fetch-local",{
// mode: 'no-cors',
method: "POST",
headers: {
'Content-Type': 'application/json',
//'Access-Control-Allow-Origin':'*'
},
body: JSON.stringify(data),
}
)
if(response && response.status === 200){
const data = await response.blob();
return data;
}
}
if(url.startsWith("http")){
let response = await fetch(url);
if (response && response.status === 200) {
const data = await response.blob();
return data;
}
}
return null;
} catch (error) {
return null;
}
}
}
// export const getFiles = async () => {
// let current_record = CURRENT_RECORD_INDEX;
// let total_record = parseInt(sessionStorage.getItem("total_records"));
// total_record = isNaN(total_record) ? 0 : total_record;
// if (current_record === 0) {
// await clear();
// let max_rec = (total_record - 1) >= 3 ? 3 : total_record - 1;
// while (current_record <= max_rec) {
// let url = ELEMENT.records[current_record].imagename;
// let recNo = ELEMENT.records[current_record].recNo;
// const blob = await createBlob(url);
// if (blob) {
// await set("record" + recNo, blob);
// }
// current_record++;
// }
// } else {
// let max = current_record + 2 < total_record ?max:total_record;
// let min = current_record - 2 < 0 ? 0: current_record - 2;
// let recNos =[];
// for (let index = min; index < max; index++) {
// recNos.push(ELEMENT.records[index].recNo);
// }
// for (const blobs in getAllBlobs()) {
// if(!recNos.includes(blobs.key)){
// removeFile(blobs.key);
// }
// }
// if (max < total_record) {
// let recNo = ELEMENT.records[max].recNo;
// const maxBlob = await getStoreFile("record" + recNo );
// if (!maxBlob) {
// let url = ELEMENT.records[max].imagename;
// const blob = await createBlob(url);
// if (blob) {
// await set("record" + recNo, blob);
// }
// }
// }
// if (min >= 0 && min < total_record) {
// let recNo = ELEMENT.records[min].recNo;
// const minBlob = await getStoreFile("record" + recNo);
// if (!minBlob) {
// let url = ELEMENT.records[min].imagename;
// const blob = await createBlob(url);
// if (blob) {
// await set("record" + recNo, blob);
// }
// }
// }
// }
// };
import { ImageViewer } from "./modules/imageViewer/imageViewer.js";
import { IndexedDBStorage } from "./modules/storage/indexedDBStorage.js";
document.addEventListener("DOMContentLoaded", async ()=>{
let indexedDB = new IndexedDBStorage("ImageDB", "images");
let urls = ["https://svicomph-my.sharepoint.com/:i:/g/personal/llizardo_svi_com_ph/EXfLFZAjzPdJvAfoRTgPKa0BuGSNkTGAtgQ22GCuaNPwag?e=raEKQM",
"https://cdn.filestackcontent.com/wcrjf9qPTCKXV3hMXDwK",
"https://images.unsplash.com/photo-1631193079266-4af74b218c86?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY4NjY2MjUwNA&ixlib=rb-4.0.3&q=80&utm_campaign=api-credit&utm_medium=referral&utm_source=unsplash_source&w=1080",
"https://images.unsplash.com/source-404?fit=crop&fm=jpg&h=800&q=60&w=1200",
"https://images.unsplash.com/source-404?fit=crop&fm=jpg&h=800&q=60&w=1200"
];
for (let index = 0; index < urls.length; index++) {
const url = urls[index];
indexedDB.storeImageFile(url, 'imageNum'+index);
}
let imageBlob = await indexedDB.getStoreFile("imageNum2");
let imageViewer = new ImageViewer("imageViewerContainer");
const image = await imageViewer.addImage("currentImage", "jpeg", "sampleIImage.jpeg", imageBlob);
});
\ No newline at end of file
export const createLoadingModal = (titleTxt, message, type, btnTxt, callBackFunc) => {
let modal = document.getElementById("modal-container");
if(modal){
removePrompt;
}
createPrompt();
modal = document.getElementById("modal-container");
let modalHeader = document.getElementById("modal-header");
modalHeader.classList.add("clear-background");
modalHeader.classList.add("no-border");
modalHeader.style.display= "none";
let title = document.getElementById("modal-title");
title.textContent = "";
let modalBody = document.getElementById("modal-body");
modalBody.innerHTML = "";
let div = document.createElement("div");
div.setAttribute("class", "row prompt-message center-objects");
let iconBox = document.getElementById("iconBox");
if (iconBox) {
iconBox.remove();
}
iconBox = document.createElement("div");
iconBox.setAttribute("id", "iconBox");
iconBox.setAttribute("class", "icon-box")
iconBox.innerHTML = "";
if (!type) {
// let loading = document.createElement("div");
// loading.setAttribute("class", "dot-bricks");
// iconBox.classList.add("primary");
let loaderContainer = document.createElement("div");
loaderContainer.setAttribute("id", "loaderContainer");
let loader1 = document.createElement("div");
loader1.setAttribute("class", "loader");
loader1.setAttribute("id", "loader");
loaderContainer.appendChild(loader1);
div.appendChild(loaderContainer);
//iconBox.appendChild(loader1);
} else {
let icon = document.createElement("p");
icon.setAttribute("class", "prompt-icon");
switch (type) {
case "info":
iconBox.classList.add("primary");
icon.innerHTML = "&#x2139;";
break;
case "warning":
iconBox.classList.add("warning");
icon.innerHTML = "&#x26A0;";
break;
case "error":
iconBox.classList.add("error");
icon.innerHTML = "&#10006;";
break;
case "success":
iconBox.classList.add("success");
icon.innerHTML = '&#x2713';
break;
}
iconBox.appendChild(icon);
div.appendChild(iconBox);
}
///modalHeader.appendChild(iconBox);
let h3 = document.createElement("h3");
h3.textContent = titleTxt;
let p = document.createElement("p");
p.textContent = message;
div.appendChild(h3);
div.appendChild(p);
modalBody.appendChild(div);
let footerModal = document.getElementById("modal-footer");
footerModal.innerHTML = '';
footerModal.classList.add("center-objects");
if (btnTxt && callBackFunc) {
let closeModalBtn = document.createElement("button");
closeModalBtn.setAttribute("class", "button btn-" + type + " btn-md");
closeModalBtn.setAttribute("id", "close-btn-modal");
closeModalBtn.textContent = btnTxt;
closeModalBtn.addEventListener("click", function () {
modal.style.display = 'none';
// callBackFunc();
logoutKeycloak();
});
footerModal.appendChild(closeModalBtn);
}
modal.style.display = 'block';
}
export const removePrompt = () => {
let modal = document.getElementById("modal-container");
modal.remove();
}
function createPrompt(){
let modalContainer = document.createElement("div");
modalContainer.setAttribute("class", "modal-container");
modalContainer.setAttribute("id", "modal-container");
let modal = document.createElement("div");
modal.setAttribute("class", "modal");
modal.setAttribute("id", "modal");
let modalHeader = document.createElement("div");
modalHeader.setAttribute("class", "modal-header");
modalHeader.setAttribute("id", "modal-header");
let modalTitle = document.createElement("h3");
modalTitle.setAttribute("class", "modal-title");
modalTitle.setAttribute("id", "modal-title");
modalHeader.appendChild(modalTitle);
let modalBody = document.createElement("div");
modalBody.setAttribute("class", "modal-body");
modalBody.setAttribute("id", "modal-body");
let modalFooter = document.createElement("div");
modalFooter.setAttribute("class", "modal-footer");
modalFooter.setAttribute("id", "modal-footer");
let closeButton = document.createElement("button");
closeButton.setAttribute("class","close-btn-modal");
closeButton.setAttribute("id","close-btn-modal");
closeButton.textContent = "Close";
modalFooter.appendChild(closeButton);
modal.appendChild(modalHeader);
modal.appendChild(modalBody);
modal.appendChild(modalFooter);
modalContainer.appendChild(modal);
document.body.appendChild(modalContainer);
}
\ No newline at end of file
.loading-spinner{
width:30px;
height:30px;
border:2px solid indigo;
border-radius:50%;
border-top-color:#0001;
display:inline-block;
animation:loadingspinner .7s linear infinite;
}
@keyframes loadingspinner{
0%{
transform:rotate(0deg)
}
100%{
transform:rotate(360deg)
}
}
\ No newline at end of file
import { fetchSchema } from "./WebGde-Widgets/DataInputWidget/fetchSchema.js";
import { displayField } from "./WebGde-Widgets/DataInputWidget/displayFieldClass.js";
import { ImageViewer } from "./WebGde-Widgets/ImageViewerWidget/modules/imageViewer/imageViewer.js";
import { IndexedDBStorage } from "./WebGde-Widgets/ImageViewerWidget/modules/storage/indexedDBStorage.js";
import { createModal } from "./WebGde-Widgets/genericPopup/genericPopup.js";
import { hightlightEventListeners } from "./WebGde-Widgets/ImageViewerWidget/modules/highlight/highlightUtil.js";
import { HIGH_LIGHT_SCHEMA } from "./WebGde-Widgets/config.js";
import { Highlight } from "./WebGde-Widgets/ImageViewerWidget/modules/highlight/highlightClass.js";
import { BPO } from "./WebGde-Widgets/BPO/getElement.js";
import { DocumentControlWidget } from "./WebGde-Widgets/documentControlWidget/documentControlWidget.js";
import { INDEXED_DB_STORAGE , HIGHLIGHT_OBJECT, IMAGE_VIEWER_OBJECT } from "./WebGde-Widgets/globalVariable.js";
document.addEventListener("DOMContentLoaded", async ()=>{
await initializeWebGDE();
});
async function initializeWebGDE(){
sessionStorage.setItem("user_id", "worker1");
const BPOObject = new BPO();
let isElement = await BPOObject.getRandomElement();
if (isElement){
INDEXED_DB_STORAGE = new IndexedDBStorage("ImageDB", "images");
let urls = JSON.parse(sessionStorage.getItem("dir_files"));
// let urls = ["https://svicomph-my.sharepoint.com/:i:/g/personal/llizardo_svi_com_ph/EXfLFZAjzPdJvAfoRTgPKa0BuGSNkTGAtgQ22GCuaNPwag?e=raEKQM",
// "https://cdn.filestackcontent.com/wcrjf9qPTCKXV3hMXDwK",
// "https://images.unsplash.com/photo-1631193079266-4af74b218c86?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY4NjY2MjUwNA&ixlib=rb-4.0.3&q=80&utm_campaign=api-credit&utm_medium=referral&utm_source=unsplash_source&w=1080",
// "https://images.unsplash.com/source-404?fit=crop&fm=jpg&h=800&q=60&w=1200",
// "https://images.unsplash.com/source-404?fit=crop&fm=jpg&h=800&q=60&w=1200"
// ];
let maxImagesToStore =urls.length<=3 ? urls.length : 3;
for (let index = 0; index < maxImagesToStore; index++) {
const url = urls[index];
await INDEXED_DB_STORAGE.storeImageFile(url, 'imageNum_' + index);
}
await createWebGdeInterface(null);
if(maxImagesToStore>1){
const url = urls[0];
let filename = url.split('/').pop();
let imageBlob = await INDEXED_DB_STORAGE.getStoreFile("imageNum_0");
await IMAGE_VIEWER_OBJECT.createCurrentImage(filename.split(".").pop(), filename, imageBlob);
sessionStorage.setItem("current_page", 1);
const nextUrl = urls[1];
let nextFilename = nextUrl.split('/').pop();
let nextImageBlob = await INDEXED_DB_STORAGE.getStoreFile("imageNum_1");
await IMAGE_VIEWER_OBJECT.createNextImage(nextFilename.split(".").pop(), nextFilename, nextImageBlob);
}else{
const url = urls[0];
let filename = url.split('/').pop();
let imageBlob = await INDEXED_DB_STORAGE.getStoreFile("imageNum_0");
await IMAGE_VIEWER_OBJECT.addImage("currentImage", filename.split(".").pop(), filename, imageBlob);
sessionStorage.setItem("current_page", 1);
}
HIGHLIGHT_OBJECT = new Highlight("imageContainer", "currentImage", HIGH_LIGHT_SCHEMA)
HIGHLIGHT_OBJECT.createHighlight();
hightlightEventListeners();
let controls = new DocumentControlWidget();
document.getElementById("input-field-container").appendChild(controls.getWidget());
}
}
async function createWebGdeInterface(GDEContainer) {
let gdeContainer = document.createElement("div");
gdeContainer.setAttribute("class", "container web-gde-container");
let imageViewerContainer = document.createElement("div");
imageViewerContainer.setAttribute("id", "imageViewerContainer");
let dataInputContainer = document.createElement("div");
dataInputContainer.setAttribute("id", "input-field-container");
// dataInputContainer.setAttribute("class", "sidebar");
gdeContainer.appendChild(imageViewerContainer);
gdeContainer.appendChild(dataInputContainer);
if (GDEContainer) {
document.getElementById("GDEContainer").appendChild(gdeContainer);
} else {
document.body.appendChild(gdeContainer);
}
await createImageViewer();
await createInputForm();
}
async function createInputForm(){
const schema = await fetchSchema();
const containerId = 'input-field-container';
// Instantiate widget and assign it to a container
const displayFieldClass = new displayField(schema, containerId);
// Call Function to generate fields with given schema to provided container
await displayFieldClass.generateFields();
// displayFieldClass.editHeader(element-id)
displayFieldClass.updateHeaderText(0, "User: " + sessionStorage.getItem("user_id"));
displayFieldClass.updateHeaderText(1, "Element ID: " + sessionStorage.getItem("element_id"));
displayFieldClass.updateHeaderText(2, "");
}
async function createImageViewer() {
IMAGE_VIEWER_OBJECT = new ImageViewer("imageViewerContainer");
await IMAGE_VIEWER_OBJECT.init();
};
*{
-webkit-font-smoothing: auto;
font-size: 11px;
letter-spacing: 0.1em;
text-rendering: optimizeLegibility;
font-weight: normal;
font-family: OpenSans, sans-serif;
font-style: normal;
}
.field-header {
color: white;
text-align: center;
}
h1{
margin: 20px;
}
h2{
margin-top: 20px;
margin-bottom: 20px;
}
h3{
margin-bottom: 20px;
}
/* #imageViewerContainer{
width: 70vh;
height: 80vh;
} */
#imageViewerContainer{
width: 70%;
height: 99%;
}
.sidebar {
position: absolute;
right: 0;
display: flex;
flex-direction: column;
height: 100%;
width: 30%;
background-image: linear-gradient(to bottom, #23569f, #00a8c0);
}
#input-field-container{
/* height : 600px;
width : 400px; */
height : 100%;
width : 30%;
display: flex;
flex-direction: column;
overflow: auto;
background-image: linear-gradient(to bottom, #23569f, #00a8c0);
}
#input-field-container::-webkit-scrollbar {
width: 10px;
}
#input-field-container::-webkit-scrollbar-track {
background-color: #f1f1f1;
}
#input-field-container::-webkit-scrollbar-thumb {
background-color: #888;
}
#input-field-container::-webkit-scrollbar-thumb:hover {
background-color: #555;
}
#inputs {
display: flex;
flex-direction: column;
min-width: 500px;
}
input[type=text] {
width: 100%;
}
/* .SECTION1.inputField {
width: 100%;
height: 100%;
}
.SECTION2.inputField {
width: 100%;
height: 100%;
} */
.inputField {
width: 100%;
height: 100%;
}
.select2 {
width: 100% !important;
}
.fieldContainer {
/* layout config */
display: flex;
flex-direction: row;
/* border config */
border-style: solid;
border-width: thin;
border-color:#446397;
padding: 0px 0px 0px 4px;
flex-wrap: nowrap;
}
#fields *:not([type=submit]):focus {
background-color: yellow;
}
#fields {
width: auto;
display: flex;
flex: 1;
max-height: 100vh;
display: inline-block;
overflow-y: auto;
}
#fields>div {
background-color:white;
}
.submitButtons {
font-weight: 600;
display: block;
margin: auto;
font-size: 13px;
width: 93px;
margin-top: 10px;
cursor: pointer;
}
.labelContainer {
display: flex;
flex-direction: row;
width: 98px;
padding: 3px;
margin-top: 4px;
}
.inputContainer {
display: inline-block;
width: 100%;
padding-left: 3px;
overflow-x: clip;
flex-wrap: nowrap;
}
.input-invalid {
border-color: #ff3333 !important;
border-style: solid;
}
.input-valid {
/* border-color: #000000 !important; */
border-style: solid;
}
input:focus, textarea:focus{
/* background-color: yellow; */
border: 0px;
}
input[type=text] {
width: 100%;
}
select {
width: 100%;
height: 28px;
color: #444;
}
.select2 {
width: 100% !important;
}
.select2-container--default .select2-selection--single{
border-radius:0px !important;
}
textarea{
resize: none;
}
#text-area{width: 91%;font-size: 11px;padding: 9px 9px;margin-left: 15px;margin-top: 5px;margin-bottom: 5px;height: 103px;}
.ctrl-buttons {
background-color: transparent !important;
display: flex !important;
justify-content: space-evenly !important;
}
.ctrl-buttons .buttonRightClass {
margin: 1vh;
padding: 1vh;
}
.web-gde-container{
width: 100%;
height: 100vh;
display: flex;
flex-direction: row;
align-items: flex-start;
justify-content: flex-start;
}
#counter {
height: 11px;
/* font-size: 22px;
padding: 10px;
position: absolute;
z-index: 1;
right: 199px;
bottom: -6px;
text-shadow:
-1px -1px 0 #000,
0 -1px 0 #000,
1px -1px 0 #000,
1px 0 0 #000,
1px 1px 0 #000,
0 1px 0 #000,
-1px 1px 0 #000,
-1px 0 0 #000; */
}
.green{
color: green;
}
.red{
color: red;
}
\ No newline at end of file
......@@ -7,8 +7,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="./style.css">
<link rel="stylesheet" href="./WebGde-Widgets/ImageViewerWidget/modules/imageViewer/imageViewer.css">
<link rel="stylesheet" href="./WebGde-Widgets/ElementListWidget/ElementListWidget.css">
<link rel="stylesheet" href="./WebGde-Widgets/LoadingModal/LoadingModalStyle.css">
<link id="loginStylesheet" rel="stylesheet" href="./WebGde-Widgets/LogInWidget/LoginStyle.css">
<script type="module" src="./startup.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
......@@ -16,13 +16,10 @@
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"
type="text/javascript"></script>
<link rel="stylesheet" href="./WebGde-Widgets/ImageViewerWidget/modules/imageViewer/imageViewer.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.min.js"></script>
<script src="https://cdn.rawgit.com/seikichi/tiff.js/master/tiff.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/jszip.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/xlsx.js"></script>
<!-- <script src="https://auth.svi.cloud/auth/js/keycloak.js"></script>
<script type="text/javascript" src="./keycloak-login.js"></script> -->
</head>
......
......@@ -22,32 +22,6 @@ export async function startApplication() {
}
async function initializeWebGDE() {
// Create and append the new link elements for the first two stylesheets
// const styleSheet1 = document.createElement('link');
// styleSheet1.rel = 'stylesheet';
// styleSheet1.href = './style.css';
// const styleSheet2 = document.createElement('link');
// styleSheet2.rel = 'stylesheet';
// styleSheet2.href = './WebGde-Widgets/ImageViewerWidget/modules/imageViewer/imageViewer.css';
// Append the new link elements to the head of the document
// document.head.appendChild(styleSheet1);
// document.head.appendChild(styleSheet2);
// Remove login stylesheet
// const stylesheetToRemove = document.getElementById("loginStylesheet");
// if (stylesheetToRemove) {
// stylesheetToRemove.parentNode.removeChild(stylesheetToRemove);
// }
// sessionStorage.setItem('user_id','worker1')
// await createWebGdeInterface(null);
// setDocumentControlObject(new DocumentControlWidget());
// document.getElementById("input-field-container").appendChild(DOCUMENT_CONTROL_OBJECT.getWidget());
// UNCOMMENTED BY ADAM 9/25/2023
if(IS_RETRIEVE_FROM_BPO){
if (!BPO_OBJECT) {
......
import { createLoadingModal } from "./WebGde-Widgets/LoadingModal/LoadingModal.js";
import { fallbackLogin, loginGde } from "./WebGde-Widgets/LogInWidget/LoginJavaInterface.js";
const scriptElement = document.createElement("script");
......@@ -5,6 +6,7 @@ scriptElement.type = "module";
scriptElement.src = "script.js";
document.addEventListener("DOMContentLoaded", function() {
window.createLoadingModal = createLoadingModal;
window.fallbackLogin = fallbackLogin;
window.loginGde = loginGde;
// const LOG_IN_COMPONENT = new LogInClass(startApplication);
......
......@@ -320,6 +320,7 @@ public class GDEWebServices {
try {
return Response.ok(XMLUtil.getFieldsFromSingleRecord(xml)).build();
} catch (Exception e) {
e.printStackTrace();
return Response.status(500).entity("Fail").build();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment