Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web-ui
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WEBGDE-Components
web-ui
Commits
c93b03e4
Commit
c93b03e4
authored
May 05, 2023
by
Daniel Bawag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WG-227 - Modified PDF viewer to accept blob
parent
1f0a7291
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
157 additions
and
120 deletions
+157
-120
.classpath
WebGde/.classpath
+5
-5
org.eclipse.wst.common.project.facet.core.xml
...e/.settings/org.eclipse.wst.common.project.facet.core.xml
+1
-1
rejectElement.js
WebGde/WebContent/src/BPO/rejectElement.js
+31
-14
accessFile.js
WebGde/WebContent/src/accessFile/accessFile.js
+8
-4
pdfv.js
WebGde/WebContent/src/pdfviewer/pdfv.js
+8
-8
tiffViewer.css
WebGde/WebContent/src/tiffViewer/tiffViewer.css
+1
-1
tiffViewer.js
WebGde/WebContent/src/tiffViewer/tiffViewer.js
+103
-87
No files found.
WebGde/.classpath
View file @
c93b03e4
...
...
@@ -11,11 +11,6 @@
<attribute
name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"con"
path=
"org.eclipse.payara.tools.lib.system"
>
<attributes>
<attribute
name=
"owner.project.facets"
value=
"jst.web"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"src"
output=
"target/test-classes"
path=
"src/test/java"
>
<attributes>
<attribute
name=
"optional"
value=
"true"
/>
...
...
@@ -29,5 +24,10 @@
<attribute
name=
"org.eclipse.jst.component.dependency"
value=
"/WEB-INF/lib"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"con"
path=
"org.eclipse.payara.tools.lib.system"
>
<attributes>
<attribute
name=
"owner.project.facets"
value=
"jst.web"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"output"
path=
"target/classes"
/>
</classpath>
WebGde/.settings/org.eclipse.wst.common.project.facet.core.xml
View file @
c93b03e4
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime
name=
"Payara Server 5 (5.202
2
.1)"
/>
<runtime
name=
"Payara Server 5 (5.202
1
.1)"
/>
<fixed
facet=
"jst.web"
/>
<fixed
facet=
"java"
/>
<fixed
facet=
"wst.jsdt.web"
/>
...
...
WebGde/WebContent/src/BPO/rejectElement.js
View file @
c93b03e4
...
...
@@ -121,18 +121,26 @@ function createRejectWindow(){
setRadioHandler
(
'MssgBox'
);
okButton
.
onclick
=
function
()
{
saveExceptionToXml
();
//save xml
rejectElement
();
//reject on bpo
screenMain
.
style
.
display
=
'none'
;
rejectButton
.
disabled
=
false
;
popUpDisplay
.
remove
();
var
fileName
=
sessionStorage
.
getItem
(
"file_Name"
);
if
(
fileName
!==
null
&&
fileName
!==
undefined
){
document
.
getElementById
(
"controlsContainer"
).
outerHTML
=
""
;
}
else
{
document
.
getElementById
(
"TiffViewer_ButtonContainer"
).
outerHTML
=
""
;
}
okButton
.
onclick
=
function
()
{
if
(
document
.
querySelector
(
'input[name="rejectRadio"]:checked'
).
value
!=
null
)
{
if
(
document
.
querySelector
(
'input[name="rejectRadio"]:checked'
).
value
.
trim
().
length
!=
0
)
{
saveExceptionToXml
();
//save xml
rejectElement
();
//reject on bpo
screenMain
.
style
.
display
=
'none'
;
rejectButton
.
disabled
=
false
;
popUpDisplay
.
remove
();
var
fileName
=
sessionStorage
.
getItem
(
"file_Name"
);
if
(
fileName
!==
null
&&
fileName
!==
undefined
){
document
.
getElementById
(
"controlsContainer"
).
outerHTML
=
""
;
}
else
{
document
.
getElementById
(
"TiffViewer_ButtonContainer"
).
outerHTML
=
""
;
}
return
;
}
}
document
.
getElementById
(
'MssgBox'
).
value
=
""
;
document
.
getElementById
(
'rejectSubmit'
).
click
();
}
cancelButton
.
onclick
=
function
()
{
...
...
@@ -304,19 +312,28 @@ function saveExceptionToXml(){
}
function
createMessageBox
(
id
){
let
form
=
document
.
createElement
(
'form'
);
var
mssgBox
=
document
.
createElement
(
'textarea'
);
mssgBox
.
id
=
id
;
mssgBox
.
name
=
"rejectRadio"
;
mssgBox
.
maxLength
=
"1000"
;
mssgBox
.
cols
=
"20"
;
mssgBox
.
rows
=
"5"
;
mssgBox
.
rows
=
"5"
;
mssgBox
.
required
=
true
;
mssgBox
.
disabled
=
true
;
mssgBox
.
onkeyup
=
function
()
{
let
radioFive
=
document
.
getElementById
(
'check5'
);
radioFive
.
value
=
mssgBox
.
value
;
}
return
mssgBox
;
let
submit
=
document
.
createElement
(
'input'
);
submit
.
id
=
'rejectSubmit'
;
submit
.
type
=
'submit'
;
submit
.
style
.
visibility
=
'hidden'
;
form
.
appendChild
(
mssgBox
);
form
.
appendChild
(
submit
);
return
form
;
}
...
...
WebGde/WebContent/src/accessFile/accessFile.js
View file @
c93b03e4
...
...
@@ -71,7 +71,8 @@ async function accessFile() {
TiffViewer_filedetail
.
textContent
=
"Filename: "
+
idQuery
.
result
.
name
;
TiffViewer_filedetail
.
title
=
"Filename: "
+
idQuery
.
result
.
name
;
TiffViewer_Header
.
append
(
TiffViewer_filedetail
);
displayPdf
(
idQuery
.
result
.
path
);
// displayPdf(idQuery.result.path);
displayPdf
(
url
);
}
else
{
console
.
log
(
"This is not a pdf file"
);
window
.
addEventListener
(
"load"
,
loadDoc
(
url
,
TIFFViewer
,
idQuery
.
result
.
name
),
false
);
...
...
@@ -90,7 +91,8 @@ async function accessFile() {
TiffViewer_filedetail
.
textContent
=
"Filename: "
+
idQuery
.
result
.
name
;
TiffViewer_filedetail
.
title
=
"Filename: "
+
idQuery
.
result
.
name
;
TiffViewer_Header
.
append
(
TiffViewer_filedetail
);
displayPdf
(
idQuery
.
result
.
path
);
// displayPdf(idQuery.result.path);
displayPdf
(
url
);
}
else
{
console
.
log
(
"This is not a pdf file"
);
window
.
addEventListener
(
"load"
,
loadDoc
(
url
,
TIFFViewer
,
idQuery
.
result
.
name
),
false
);
...
...
@@ -182,7 +184,8 @@ async function accessFile() {
TiffViewer_filedetail
.
textContent
=
"Filename: "
+
filename
;
TiffViewer_filedetail
.
title
=
"Filename: "
+
filename
;
TiffViewer_Header
.
append
(
TiffViewer_filedetail
);
displayPdf
(
img
);
// displayPdf(img);
displayPdf
(
url
);
}
else
{
window
.
addEventListener
(
"load"
,
loadDoc
(
url
,
TIFFViewer
,
filename
),
false
);
}
...
...
@@ -550,7 +553,8 @@ function refreshImage() {
TiffViewer_filedetail.textContent = "Filename: " + idQuery.result.name;
TiffViewer_filedetail.title = "Filename: " + idQuery.result.name;
TiffViewer_Header.append(TiffViewer_filedetail);
displayPdf(idQuery.result.path);
// displayPdf(idQuery.result.path);
displayPdf(url);
} else {
console.log("This is not a pdf file");
window.addEventListener("load", loadDoc(url, TIFFViewer,idQuery.result.name), false);
...
...
WebGde/WebContent/src/pdfviewer/pdfv.js
View file @
c93b03e4
...
...
@@ -188,24 +188,24 @@ var displayPdf = function(doc) {
fitContentButton
.
addEventListener
(
'click'
,
function
()
{
if
(
currentScale
!=
fitScale
)
{
/*
if (currentScale != fitScale) {
currentScale = fitScale;
renderPage(currentPage);
}
else
{
} else {
*/
currentScale
=
1.3
;
renderPage
(
currentPage
);
}
//
}
});
document
.
addEventListener
(
"keydown"
,
function
(
e
)
{
if
(
e
.
shiftKey
&&
e
.
key
==
'F'
)
{
if
(
currentScale
!=
fitScale
)
{
currentScale
=
fitScale
;
renderPage
(
currentPage
);
}
else
{
//
if (currentScale != fitScale) {
//
currentScale = fitScale;
//
renderPage(currentPage);
//
} else {
currentScale
=
1.3
;
renderPage
(
currentPage
);
}
//
}
}
});
...
...
WebGde/WebContent/src/tiffViewer/tiffViewer.css
View file @
c93b03e4
.tiffViewerContainer
{
margin
:
auto
;
height
:
calc
(
100%
-
60px
);
/* height: calc(100% - 60px); */
width
:
70%
;
position
:
relative
;
display
:
block
;
...
...
WebGde/WebContent/src/tiffViewer/tiffViewer.js
View file @
c93b03e4
...
...
@@ -107,6 +107,9 @@ function TIFFViewer(xhr, TiffViewerImageName) {
var editedwidth = 0,
editedheight = 0; //checker of width and height change
var initWidth = 100;
var widthHolder;
var hpercent = 0,
wpercent = 0; //set of percent increase or decrease per zoom
var hzoom = new Array(),
...
...
@@ -351,7 +354,7 @@ let fileName = document.getElementById("TiffViewerImageName");
//setting the style per page
for (var j = 1; j <= TiffViewer_pages; j++) {
var img = document.getElementById(filenameWithoutExt + j);
getMeta(canvas, function(width, height) {
getMeta(canvas, function(width, height
, img
) {
wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/
hzoom[TiffViewer_current - 1] = changedheight;
Edited();
...
...
@@ -361,26 +364,29 @@ let fileName = document.getElementById("TiffViewerImageName");
setheight = height;
//to only display single page
if (setheight > 800 && setwidth > 1000) {
if (setheight > setwidth) {
// img.style = "width: 870px; height: 1160px";
img.style = "width: 900; height: 1200";
} else {
// img.style = "width: 800; height: 600";
//img.style = "width: 600; height: 800";
img.style = "width: 800; height: 600";
}
changed = true;
} else if (setwidth > 1000 && setheight <= 800) {
img.style = "width: 1000;";
changed = true;
} else if (setheight > 800 && setwidth <= 1000) {
img.style = "width: 800;";
changed = true;
} else {
img.style = `width: {setwidth}; height: {setheight}`;
changed = true;
}
// if (setheight > 800 && setwidth > 1000) {
// if (setheight > setwidth) {
// // img.style = "width: 870px; height: 1160px";
// img.style = "width: 900; height: 1200";
// } else {
// // img.style = "width: 800; height: 600";
// //img.style = "width: 600; height: 800";
// img.style = "width: 800; height: 600";
// }
// changed = true;
// } else if (setwidth > 1000 && setheight <= 800) {
// img.style = "width: 1000;";
// changed = true;
// } else if (setheight > 800 && setwidth <= 1000) {
// img.style = "width: 800;";
// changed = true;
// } else {
// img.style = `width: {setwidth}; height: {setheight}`;
// changed = true;
// }
img.style = `width: ${initWidth}%;`;
changed = true;
if (changed) {
if (TiffViewer_pages > 1) {
...
...
@@ -396,15 +402,22 @@ let fileName = document.getElementById("TiffViewerImageName");
changedheight = setheight;
changedwidth = setwidth;
hpercent = (parseInt(setheight, 10) * (10 / 100));
wpercent = (parseInt(setwidth, 10) * (10 / 100));
// hpercent = (parseInt(setheight, 10) * (10 / 100));
// wpercent = (parseInt(setwidth, 10) * (10 / 100));
wpercent = 10;
hzoom.push(parseInt(setheight, 10));
wzoom.push(parseInt(setwidth, 10));
TiffViewer_scrn.style = `width: ${setwidth}; height: ${setheight};`;
document.getElementById("TiffViewer_FileContainer").style = `width: ${setwidth}; height: ${setheight};`;
TiffViewer_ImageContainer.style = `width: ${setwidth}; height: ${setheight};`;
//
TiffViewer_scrn.style = `width: ${setwidth}; height: ${setheight};`;
//
document.getElementById("TiffViewer_FileContainer").style = `width: ${setwidth}; height: ${setheight};`;
//
TiffViewer_ImageContainer.style = `width: ${setwidth}; height: ${setheight};`;
TiffViewer_scrn.style = `width: ${initWidth}%;`;
document.getElementById("TiffViewer_FileContainer").style = `width: calc(${initWidth}% - 10px);`;
TiffViewer_ImageContainer.style = `width: ${initWidth}%;`;
});
checker.push(0);
flippedX.push(1);
...
...
@@ -428,7 +441,7 @@ let fileName = document.getElementById("TiffViewerImageName");
var img = new Image();
img.src = url;
img.onload = function() {
callback(this.width, this.height);
callback(this.width, this.height
, img
);
}
}
...
...
@@ -538,8 +551,10 @@ let fileName = document.getElementById("TiffViewerImageName");
})
function zoomIn() {
hzoom[TiffViewer_current - 1] += hpercent;
wzoom[TiffViewer_current - 1] += wpercent;
// hzoom[TiffViewer_current - 1] += hpercent;
// wzoom[TiffViewer_current - 1] += wpercent;
initWidth += wpercent;
document.getElementById("TiffViewer_FileContainer").style = `width: calc(${initWidth}% - 10px);`;
Edited();
};
...
...
@@ -554,12 +569,15 @@ let fileName = document.getElementById("TiffViewerImageName");
})
function zoomOut() {
hzoom[TiffViewer_current - 1] -= hpercent;
wzoom[TiffViewer_current - 1] -= wpercent;
if ((setwidth + wzoom[TiffViewer_current - 1]) < wpercent && (setheight + hzoom[TiffViewer_current - 1]) < hpercent) {
hzoom[TiffViewer_current - 1] = hpercent - setheight;
wzoom[TiffViewer_current - 1] = wpercent - setwidth;
}
// hzoom[TiffViewer_current - 1] -= hpercent;
// wzoom[TiffViewer_current - 1] -= wpercent;
// if ((setwidth + wzoom[TiffViewer_current - 1]) < wpercent && (setheight + hzoom[TiffViewer_current - 1]) < hpercent) {
// hzoom[TiffViewer_current - 1] = hpercent - setheight;
// wzoom[TiffViewer_current - 1] = wpercent - setwidth;
// }
initWidth -= wpercent;
initWidth < 20 ? initWidth = 20 : initWidth;
document.getElementById("TiffViewer_FileContainer").style = `width: calc(${initWidth}% - 10px);`;
Edited();
};
...
...
@@ -627,7 +645,8 @@ let fileName = document.getElementById("TiffViewerImageName");
function fitResize() {
var FitText = this.textContent || this.innerHTML;
document.getElementById("TiffViewer_ImageContainer").classList.remove("active");
if (FitText === "fc") {
/*if (FitText === "fc") {
setheight = origheight;
setwidth = origwidth;
wzoom[TiffViewer_current - 1] = origwidth;
...
...
@@ -639,7 +658,10 @@ let fileName = document.getElementById("TiffViewerImageName");
wzoom[TiffViewer_current - 1] = changedwidth;
hzoom[TiffViewer_current - 1] = changedheight;
}
}*/
widthHolder = initWidth;
initWidth = 100;
document.getElementById("TiffViewer_FileContainer").style = `width: calc(${initWidth}% - 10px);`;
Edited();
}
...
...
@@ -654,82 +676,76 @@ let fileName = document.getElementById("TiffViewerImageName");
if (rot[TiffViewer_current - 1] == 90 || rot[TiffViewer_current - 1] == 270 || rot[TiffViewer_current - 1] == -90 || rot[TiffViewer_current - 1] == -270) {
image.style = `
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
width: 100%;
border: 0px groove white;
transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`;
image.style = `
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
width: 100%;
border: 0px groove white;
-ms-transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`; // IE
image.style = `
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
width: 100%;
border: 0px groove white;
-webkit-transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`; //Safari
TiffViewer_ImageContainer.style = `display: flex;
width: ${setheight};
height: ${setwidth};
position: relative;
justify-content: center;
align-items: center;`;
TiffViewer_Screen.style = `display: flex;
width: ${setheight};
height: ${setwidth};
position: relative;
justify-content: center;
align-items: center;`;
TiffViewer_imgclass.style = `display: flex;
width: ${(setheight + hzoom[TiffViewer_current - 1]) < setheight ? setheight : setheight + hzoom[TiffViewer_current - 1]};
height: ${(setwidth + wzoom[TiffViewer_current - 1]) < setwidth ? setwidth : setwidth + wzoom[TiffViewer_current - 1]};
position: relative;
justify-content: center;
align-items: center;`;
//
TiffViewer_ImageContainer.style = `display: flex;
//
width: ${setheight};
//
height: ${setwidth};
//
position: relative;
//
justify-content: center;
//
align-items: center;`;
//
TiffViewer_Screen.style = `display: flex;
//
width: ${setheight};
//
height: ${setwidth};
//
position: relative;
//
justify-content: center;
//
align-items: center;`;
//
TiffViewer_imgclass.style = `display: flex;
//
width: ${(setheight + hzoom[TiffViewer_current - 1]) < setheight ? setheight : setheight + hzoom[TiffViewer_current - 1]};
//
height: ${(setwidth + wzoom[TiffViewer_current - 1]) < setwidth ? setwidth : setwidth + wzoom[TiffViewer_current - 1]};
//
position: relative;
//
justify-content: center;
//
align-items: center;`;
width = TiffViewer_Screen.clientHeight;
height = TiffViewer_Screen.clientWidth;
} else {
image.style = `
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
width: 100%;
border: 0px groove white;
transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`;
image.style = `
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
width: 100%;
border: 0px groove white;
-ms-transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`; // IE
image.style = `
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
width: 100%;
border: 0px groove white;
-webkit-transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`; //Safari
TiffViewer_ImageContainer.style = `display: flex;
width: ${setwidth};
height: ${setheight};
position: relative;
justify-content: center;
align-items: center;`;
TiffViewer_Screen.style = `display: flex;
width: ${setwidth};
height: ${setheight};
position: relative;
justify-content: center;
align-items: center;`;
TiffViewer_imgclass.style = `display: flex;
width: ${(setwidth + wzoom[TiffViewer_current - 1]) < setwidth ? setwidth : setwidth + wzoom[TiffViewer_current - 1]};
height: ${(setheight + hzoom[TiffViewer_current - 1]) < setheight ? setheight : setheight + hzoom[TiffViewer_current - 1]};
position: relative;
justify-content: center;
align-items: center;`;
//
TiffViewer_ImageContainer.style = `display: flex;
//
width: ${setwidth};
//
height: ${setheight};
//
position: relative;
//
justify-content: center;
//
align-items: center;`;
//
TiffViewer_Screen.style = `display: flex;
//
width: ${setwidth};
//
height: ${setheight};
//
position: relative;
//
justify-content: center;
//
align-items: center;`;
//
TiffViewer_imgclass.style = `display: flex;
//
width: ${(setwidth + wzoom[TiffViewer_current - 1]) < setwidth ? setwidth : setwidth + wzoom[TiffViewer_current - 1]};
//
height: ${(setheight + hzoom[TiffViewer_current - 1]) < setheight ? setheight : setheight + hzoom[TiffViewer_current - 1]};
//
position: relative;
//
justify-content: center;
//
align-items: center;`;
width = TiffViewer_Screen.clientWidth;
height = TiffViewer_Screen.clientHeight;
}
editedwidth = image.clientWidth;
editedheight = image.clientHeight;
let zoomPercentage = Math.round(100 + (hzoom[TiffViewer_current - 1] / setheight * 100));
zoom.innerHTML =
zoomPercentage == 100 || isNaN(zoomPercentage) ? "" : zoomPercentage
+ "%";
//
let zoomPercentage = Math.round(100 + (hzoom[TiffViewer_current - 1] / setheight * 100));
zoom.innerHTML =
initWidth == 100 || isNaN(initWidth) ? "" : initWidth
+ "%";
// document.getElementById(`IMG${TiffViewer_current + 1}`).style.display = '
none
';
// document.getElementById("IMG2").style.display = '
none
';
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment