Commit 338fdef5 by Jorem Magcawas

commit last changes

parent a4efcb98
...@@ -32,3 +32,10 @@ const INPUT_FOLDER = "./input/" ...@@ -32,3 +32,10 @@ const INPUT_FOLDER = "./input/"
const OUTPUT_FILES = "../../output/" const OUTPUT_FILES = "../../output/"
//this determines if the images will be retrieved from the gfs
const DOMAIN = "http://35.169.23.0:8080"
const CONTEXTROOT = "gfs-explorer-ws"
const FOLDER_URL = DOMAIN + "/" + CONTEXTROOT + "/svc/gfs-rest/get-folder?parentPath="
const DOWNLOAD_URL = DOMAIN + "/" + CONTEXTROOT + "/svc/gfs-rest/get-download-link"
const IS_RETRIEVE_FROM_GFS = "Y"
var Dirfiles = <?php $arrFiles = array(); var Dirfiles = <?php $arrFiles = array();
$path = './input'; $path = './input';
$iterator = new FilesystemIterator($path); $iterator = new FilesystemIterator($path);
foreach($iterator as $entry) { foreach($iterator as $entry) {
$arrFiles[] = './input/' . $entry-> getFilename(); $arrFiles[] = './input/' . $entry-> getFilename();
} }
echo json_encode($arrFiles); echo json_encode($arrFiles);
?> ?>
\ No newline at end of file
...@@ -120,5 +120,5 @@ ...@@ -120,5 +120,5 @@
<script src="./src/endSession/endSession.js"></script> <script src="./src/endSession/endSession.js"></script>
<script src="./src/tiffViewer/tiffViewer.js"></script> <script src="./src/tiffViewer/tiffViewer.js"></script>
<script src="./src/highlight/highlight.js"></script> <script src="./src/highlight/highlight.js"></script>
<script src='config.php'></script>
</html> </html>
\ No newline at end of file
...@@ -237,4 +237,65 @@ function accessFile() { ...@@ -237,4 +237,65 @@ function accessFile() {
body: formData body: formData
}); });
} }
} }
\ No newline at end of file
function getFolder(url){
const promise = fetch(url, {
method: 'GET',
headers: {
'Authorization': kc.token
// 'Content-Type': 'application/x-www-form-urlencoded',
}
//body: JSON.stringify(myObject)
})
.then(function (response) {
if(response.status === 200){
response.json().then(function(data) {
//var parseData = JSON.parse(data);
// func(data);
console.log(data);
//displayData(parseData);
});
}else{
console.log("Error");
}
})
.catch(function (error) {
console.log('Request failed', error);
});
return promise;
}
function postServiceText(url, myObject, funcSuccess, funcFail){
const promise = fetch(url, {
method: 'post',
body: JSON.stringify(myObject),
headers: {
'Content-Type': 'application/json',
'Authorization': kc.token
// 'Content-Type': 'application/x-www-form-urlencoded',
}
})
.then(function (response) {
if(response.status === 200){
response.text().then(function(data) {
//var parseData = JSON.parse(data);
// funcSuccess(data);
console.log(data);
//alert(data);
//displayData(parseData);
});
}else{
console.log("Error");
funcFail();
}
})
.catch(function (error) {
console.log('Request failed', error);
});
return promise;
}
...@@ -211,9 +211,10 @@ function TIFFViewer(xhr, TiffViewerImageName) { ...@@ -211,9 +211,10 @@ function TIFFViewer(xhr, TiffViewerImageName) {
tiff.setDirectory(i); tiff.setDirectory(i);
var canvas = tiff.toCanvas().toDataURL(); var canvas = tiff.toCanvas().toDataURL();
document.getElementById(`IMG${i + 1}`).src = canvas; document.getElementById(`IMG${i + 1}`).src = canvas;
} }
//setting the style per page //setting the style per page
for (var j = 1; j <= TiffViewer_pages; ++j) { for (var j = 1; j <= TiffViewer_pages; ++j) {
var img = document.getElementById("IMG" + j); var img = document.getElementById("IMG" + j);
getMeta(canvas, function (width, height) { getMeta(canvas, function (width, height) {
wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/ wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/
...@@ -222,6 +223,8 @@ function TIFFViewer(xhr, TiffViewerImageName) { ...@@ -222,6 +223,8 @@ function TIFFViewer(xhr, TiffViewerImageName) {
origwidth = width; origwidth = width;
setwidth = width; setwidth = width;
setheight = height; setheight = height;
//to only display single page
if (setheight > 800 && setwidth > 1000) { if (setheight > 800 && setwidth > 1000) {
if (setheight > setwidth) { if (setheight > setwidth) {
img.style = "width: 600; height: 800"; img.style = "width: 600; height: 800";
...@@ -255,11 +258,13 @@ function TIFFViewer(xhr, TiffViewerImageName) { ...@@ -255,11 +258,13 @@ function TIFFViewer(xhr, TiffViewerImageName) {
flippedX.push(1); flippedX.push(1);
flippedY.push(1); flippedY.push(1);
rot.push(0); rot.push(0);
if (j === 1) { if (j === 1) {
img.style.display = "flex"; img.style.display = "flex";
} }
} }
//getting the metadata of each TIFF page //getting the metadata of each TIFF page
function getMeta(url, callback) { function getMeta(url, callback) {
var img = new Image(); var img = new Image();
...@@ -556,6 +561,11 @@ function TIFFViewer(xhr, TiffViewerImageName) { ...@@ -556,6 +561,11 @@ function TIFFViewer(xhr, TiffViewerImageName) {
} }
editedwidth = image.clientWidth; editedwidth = image.clientWidth;
editedheight = image.clientHeight; editedheight = image.clientHeight;
// document.getElementById(`IMG${TiffViewer_current + 1}`).style.display = 'none';
// document.getElementById("IMG2").style.display = 'none';
} }
/* ADDED: /* ADDED:
...@@ -604,5 +614,6 @@ function TIFFViewer(xhr, TiffViewerImageName) { ...@@ -604,5 +614,6 @@ function TIFFViewer(xhr, TiffViewerImageName) {
div.scrollTop += 20; div.scrollTop += 20;
} }
}); });
} }
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