Commit 275b82d2 by Jorem Magcawas

change code of getting the encoded fields from the xml to form fields

parent 57713be7
......@@ -26,23 +26,7 @@
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
......
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="WebGde-0.0.1-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/annotations"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<property name="java-output-path" value="/WebGde/build/classes"/>
<property name="context-root" value="WebGde"/>
</wb-module>
</project-modules>
......@@ -22,9 +22,9 @@
// schema with 5 fields and all possible collections
//const SCHEMA_FILE = "./src/sample_schema/5_field_schema.json"
var SCHEMA_FILE = "./src/sample_schema/HR Speed Test schema.json"
/*var SCHEMA_FILE = "./src/sample_schema/SC Schema.json"*/
// const SCHEMA_FILE = "./src/sample_schema/Sample_Schema.json"
var SCHEMA_FILE = "./src/sample_schema/HR Speed Test schema.json"
//const INPUT_FILES = ["./input/Ong, Mae Janica - Application Form.TIFF","./input/Magalona, Rowell James - Application Form.TIFF","./input/Felizardo, Brylle Theodure - Application Form.TIFF","./input/Laxamana, Conrad John - Application Form.TIFF"] // list of URLs
......
......@@ -18,7 +18,7 @@ async function initGetElement() {
let dir = await lst.data;
dir = [...dir];
Dirfiles = dir.slice(dir.indexOf(lastImage) + 1);
Dirfiles = dir;
sessionStorage.setItem("dir_files", JSON.stringify(Dirfiles));
sessionStorage.setItem("element_id", retElement.element.elementId);
......@@ -183,8 +183,29 @@ async function getWaitingElement() {
return json;
}
async function getFieldData(){
let elementId = sessionStorage.getItem("element_id");
let xmlData = {
"imageName": File_Path,
"outputDir": sessionStorage.getItem("element_file_loc") + "/" + (ENCODING_PASS == "PASS1" ? elementId + ".DTA" : elementId + ".DTB")
}
let response = await fetch(urlGetFields, {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(xmlData)
});
let json = await response.json();
return json;
}
async function createOutputXml(fields, metrics, doctype, section) {
let elementId = sessionStorage.getItem("element_id");
let xmlData = {
"projCode": PROJECT_CODE,
"userId": sessionStorage.getItem("user_id"),
......
......@@ -3,4 +3,5 @@ let urlGetXml = GFS_URL + "/" + "get-xml";
let urlWriteXml = GFS_URL + "/" + "write-xml";
let urlUpdateEob = GFS_URL + "/" + "update-eob";
let urlUpdateException = GFS_URL + "/" + "update-exception";
let urlWriteMetrics = GFS_URL + "/" + "write-metrics";
\ No newline at end of file
let urlWriteMetrics = GFS_URL + "/" + "write-metrics";
let urlGetFields = GFS_URL + "/" + "get-fields";
\ No newline at end of file
......@@ -86,7 +86,6 @@ async function accessFile() {
// localStorage.setItem("submit", "0");
// localStorage.setItem("display_counter", parseInt(localStorage.getItem("display_counter")) + 1); //update how many have been fetched
// var file = new File([blob], filename + ".TIFF", {type: "img"}); //uplaod to uploadimgfolder //scanned images
// uploadFile(file);
};
}
......@@ -161,18 +160,17 @@ async function accessFile() {
let totalImages = JSON.parse(sessionStorage.getItem("dir_files")).length;
count.onsuccess = async function() {
if (count.result == 0 && (localStorage.length) == 0) {
var formArray = [];
sessionStorage.setItem('formArray', JSON.stringify(formArray));
if (count.result == 0 && (localStorage.length) == 0) {
store.put({ id: count.result + 1, address: blob , name:filename, path:img});
url = URL.createObjectURL(blob);
window.addEventListener("load", loadDoc(url, TIFFViewer,filename), false);
localStorage.setItem("display_counter", 1);
size = size + total;
File_Name = filename;
File_Path = img;
var file = new File([blob], filename + ".TIFF", {type: "img"}); //uplaod to uploadimgfolder //scanned images
uploadFile(file);
File_Path = img;
populateFields();
var file = new File([blob], filename + ".TIFF", {type: "img"}); //uplaod to uploadimgfolder //scanned images
} else if (count.result == 1 && (localStorage.length) == 1) {
document.getElementById('prev').setAttribute('disabled','true');
......@@ -183,36 +181,38 @@ async function accessFile() {
localStorage.setItem("sfIndex", 1);
size = size + total;
var file = new File([blob], filename + ".TIFF", {type: "img"}); //uplaod to uploadimgfolder //scanned images
uploadFile(file);
} else if(totalImages != (parseInt(localStorage.getItem("sfIndex"))) && img == null && count.result >= 2 && (localStorage.length) >= 2 && localStorage.getItem("submit") == 1){ //if only one file left
const idQuery = store.get(parseInt(localStorage.getItem("display_counter")));
document.getElementById('prev').removeAttribute('disabled');
idQuery.onsuccess = function () {
idQuery.onsuccess = async function () {
//url = URL.createObjectURL(idQuery.result.address);
//window.addEventListener("load", loadDoc(url, TIFFViewer,idQuery.result.name), false);
File_Name = idQuery.result.name;
File_Path = idQuery.result.path;
File_Path = idQuery.result.path;
populateFields();
localStorage.setItem("submit", "0");
if (localStorage.getItem("prev") == 1) {
localStorage.setItem("prev", "0");
document.getElementById('next').removeAttribute('disabled');
populateForm(parseInt(localStorage.getItem("sfIndex")));
localStorage.setItem("display_counter", parseInt(localStorage.getItem("display_counter")) + 1);
} else {
document.getElementById('next').setAttribute('disabled', 'true');
localStorage.setItem("sfIndex", parseInt(localStorage.getItem("sfIndex")) + 1);
localStorage.setItem("display_counter", parseInt(localStorage.getItem("display_counter")) + 1);
var formArray = JSON.parse(sessionStorage.getItem('formArray'));
if (typeof formArray[parseInt(localStorage.getItem("sfIndex")) - 1] !== 'undefined') {
populateForm(parseInt(localStorage.getItem("sfIndex")));
}
//store.clear();
//localStorage.setItem("nofilesleft", "1");
//promptNoFilesLeft();
}
if (localStorage.getItem("prev") == 1) {
localStorage.setItem("prev", "0");
document.getElementById('next').removeAttribute('disabled');
populateFields();
//populateForm(parseInt(localStorage.getItem("sfIndex")));
localStorage.setItem("display_counter", parseInt(localStorage.getItem("display_counter")) + 1);
} else {
document.getElementById('next').setAttribute('disabled', 'true');
localStorage.setItem("sfIndex", parseInt(localStorage.getItem("sfIndex")) + 1);
localStorage.setItem("display_counter", parseInt(localStorage.getItem("display_counter")) + 1);
populateFields();
/*var formArray = JSON.parse(sessionStorage.getItem('formArray'));
if (typeof formArray[parseInt(localStorage.getItem("sfIndex")) - 1] !== 'undefined') {
populateForm(parseInt(localStorage.getItem("sfIndex")));
}*/
//store.clear();
//localStorage.setItem("nofilesleft", "1");
//promptNoFilesLeft();
}
};
} else if(img == null && count.result >= 2 && (localStorage.length) >= 2 && localStorage.getItem("submit") == 1){//no files left
// alert("No Files Left");
......@@ -232,36 +232,39 @@ async function accessFile() {
} else if (count.result >= 2 && (localStorage.length) >= 2 && localStorage.getItem("submit") == 1) {
const idQuery = store.get(parseInt(localStorage.getItem("display_counter")));
idQuery.onsuccess = function () {
idQuery.onsuccess = async function () {
document.getElementById('prev').removeAttribute('disabled');
document.getElementById('next').removeAttribute('disabled');
// url = URL.createObjectURL(idQuery.result.address);
// window.addEventListener("load", loadDoc(url, TIFFViewer,idQuery.result.name), false);
document.getElementById('prev').removeAttribute('disabled');
File_Name = idQuery.result.name;
File_Path = idQuery.result.path;
File_Path = idQuery.result.path;
populateFields();
localStorage.setItem("submit", "0");
if(localStorage.getItem("prev") == 1){
localStorage.setItem("prev", "0");
populateForm(parseInt(localStorage.getItem("sfIndex")));
populateFields();
//populateForm(parseInt(localStorage.getItem("sfIndex")));
localStorage.setItem("display_counter", parseInt(localStorage.getItem("display_counter")) + 1); //update how many have been fetched
} else {
//store.delete(parseInt(localStorage.getItem("display_counter")) - 1);
store.put({ id: parseInt(localStorage.getItem("display_counter")) + 1, address: blob , name:filename, path:img});
localStorage.setItem("display_counter", parseInt(localStorage.getItem("display_counter")) + 1); //update how many have been fetched
localStorage.setItem("sfIndex", parseInt(localStorage.getItem("sfIndex")) + 1);
var file = new File([blob], filename + ".TIFF", {type: "img"}); //uplaod to uploadimgfolder //scanned images
uploadFile(file);
var formArray = JSON.parse(sessionStorage.getItem('formArray'));
//var file = new File([blob], filename + ".TIFF", {type: "img"}); //uplaod to uploadimgfolder //scanned images
/*var formArray = JSON.parse(sessionStorage.getItem('formArray'));
if(typeof formArray[parseInt(localStorage.getItem("sfIndex")) - 1] !== 'undefined') {
populateForm(parseInt(localStorage.getItem("sfIndex")));
}
}*/
populateFields();
}
if(parseInt(localStorage.getItem("sfIndex"))<=1){
document.getElementById('prev').setAttribute('disabled','true');
}
//var file = new File([blob], filename + ".TIFF", {type: "img"}); //uplaod to uploadimgfolder //scanned images
//uploadFile(file);
};
size = size + total;
......@@ -343,15 +346,6 @@ async function accessFile() {
return urls;
}
function uploadFile(file) {
let formData = new FormData();
formData.append("file", file);
fetch('./src/accessFile/uploadimg.php',{
method: "POST",
body: formData
});
}
function getFolder(url){
const promise = fetch(url, {
method: 'GET',
......@@ -533,6 +527,7 @@ function refreshImage() {
File_Name = idQuery.result.name;
File_Path = idQuery.result.path;
};
}
}
......@@ -559,10 +554,23 @@ function promptNoFilesLeft(){
    var okButton = document.createElement('button');
    okButton.innerHTML = 'ok';
    okButton.onclick = function() {
    genericDiv.remove();
sessionStorage.clear();
localStorage.clear();
logoutKeycloak();
    genericDiv.remove();
var DBdeleteRequest = window.indexedDB.deleteDatabase("ImageDatabase");
DBdeleteRequest.addEventListener('blocked', function(e) {
console.log("Database cleared.");
});
DBdeleteRequest.addEventListener('upgradeneeded', function(e) {
console.log("Upgrade needed in deleting database");
});
DBdeleteRequest.addEventListener('error', function(e) {
console.log("Error in deleting database");
});
DBdeleteRequest.addEventListener('success', function(e) {
console.log("Database cleared.");
});
sessionStorage.clear();
localStorage.clear();
logoutKeycloak();
        /*promptMain.style.display = 'none';*/
    };
    promptMain.appendChild(message);
......
......@@ -3,20 +3,20 @@ let closerWindow;
let endButton = document.getElementById("endBtn");
function checkForm(form){
var inputs = form.getElementsByTagName("input");
var selects = form.getElementsByTagName("select");
inputsBlankCount = inputs.length;
selectsBlankCount = selects.length - 2;
for(var i=0; i<inputs.length; i++){
if(inputs[i].value == "") inputsBlankCount--;
}
for(var i=0; i<selects.length; i++){
if(selects[i].options[selects[i].selectedIndex].value === "null") selectsBlankCount--;
}
if(inputsBlankCount==0 && selectsBlankCount==0) return true;
function checkForm(form) {
var inputs = form.getElementsByTagName("input");
var selects = form.getElementsByTagName("select");
inputsBlankCount = inputs.length;
selectsBlankCount = selects.length - 2;
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].value == "") inputsBlankCount--;
}
for (var i = 0; i < selects.length; i++) {
if (selects[i].options[selects[i].selectedIndex].value === "null") selectsBlankCount--;
}
if (inputsBlankCount == 0 && selectsBlankCount == 0) return true;
}
/*endButton.addEventListener("click", function(){
......@@ -26,87 +26,86 @@ function checkForm(form){
*/
function createEndSessionWindow(){
let overlay = document.createElement("div");
overlay.classList.add("genericPopup");
function createEndSessionWindow() {
let overlay = document.createElement("div");
overlay.classList.add("genericPopup");
let endWindow = document.createElement('div');
endWindow.id = 'end_window';
endWindow.classList.add("parent_Window")
let endBodyDiv = document.createElement('div');
endBodyDiv.id = 'endBodyDiv';
endBodyDiv.id = 'endBodyDiv';
let endLabel = document.createElement('p');
endLabel.innerText = "Session will end. Current Element will be Returned.";
let endContinue = document.createElement('p');
endContinue.innerText = "Continue Y/N?";
let endOkCnclDiv = document.createElement('div');
endOkCnclDiv.id = 'endOkCnclCont';
let okEnd = document.createElement('button');
okEnd.classList.add("emphasizeButton");
okEnd.innerHTML = 'ok';
okEnd.id = 'okEndButtn';
okEnd.onclick = async function () {
if(checkForm(form)){
var DBdeleteRequest = window.indexedDB.deleteDatabase("ImageDatabase");
DBdeleteRequest.addEventListener('blocked', function(e){
console.log("Database cleared.");
});
DBdeleteRequest.addEventListener('upgradeneeded', function(e){
console.log("Upgrade needed in deleting database");
});
DBdeleteRequest.addEventListener('error', function(e){
console.log("Error in deleting database");
});
DBdeleteRequest.addEventListener('success', function(e){
console.log("Database cleared.");
});
let returnElem = await returnElementLogout(sessionStorage.getItem("element_id"));
if( returnElem == 200){
returnSaveXML();
endWindow.style.display = 'none';
localStorage.clear();
sessionStorage.clear();
logoutKeycloak();
submitted = false;
}
}
else{
alert("Fields are not empty. Submit or clear fields first.");
overlay.remove();
}
endWindow.style.display = 'none';
}
okEnd.onclick = async function() {
if (checkForm(form)) {
var DBdeleteRequest = window.indexedDB.deleteDatabase("ImageDatabase");
DBdeleteRequest.addEventListener('blocked', function(e) {
console.log("Database cleared.");
});
DBdeleteRequest.addEventListener('upgradeneeded', function(e) {
console.log("Upgrade needed in deleting database");
});
DBdeleteRequest.addEventListener('error', function(e) {
console.log("Error in deleting database");
});
DBdeleteRequest.addEventListener('success', function(e) {
console.log("Database cleared.");
});
let returnElem = await returnElementLogout(sessionStorage.getItem("element_id"));
if (returnElem == 200) {
returnSaveXML();
endWindow.style.display = 'none';
localStorage.clear();
sessionStorage.clear();
logoutKeycloak();
submitted = false;
}
} else {
alert("Fields are not empty. Submit or clear fields first.");
overlay.remove();
}
endWindow.style.display = 'none';
}
let cancelEnd = document.createElement('button');
cancelEnd.classList.add("normalButton");
cancelEnd.innerHTML = 'cancel';
cancelEnd.id = 'cnclEndButton';
endOkCnclDiv.appendChild(okEnd);
endOkCnclDiv.appendChild(cancelEnd);
endBodyDiv.appendChild(endLabel);
endBodyDiv.appendChild(endContinue);
endBodyDiv.appendChild(endOkCnclDiv);
endWindow.appendChild(endBodyDiv);
cancelEnd.addEventListener("click", function () {
overlay.remove();
});
overlay.append(endWindow);
document.body.append(overlay);
}
cancelEnd.addEventListener("click", function() {
overlay.remove();
});
overlay.append(endWindow);
document.body.append(overlay);
}
\ No newline at end of file
......@@ -53,7 +53,8 @@ const displayFields = async (parentID) => {
if (doctype == null && section == null) {
Object.keys(schema).every(function(key) {
let doctypes = schema[key];
sessionStorage.setItem("currentDoctype", key);
let underscoredKey = key.replaceAll(" ", "_");
sessionStorage.setItem("currentDoctype", underscoredKey);
const {
valid,
error
......@@ -62,17 +63,24 @@ const displayFields = async (parentID) => {
div.textContent = error
div.style.color = '#ff3333'
}
for (let key in doctypes) {
sessionStorage.setItem("currentSection", key);
for (let sec in doctypes) {
let underscoredSec = sec.replaceAll(" ", "_");
sessionStorage.setItem("currentSection", underscoredSec);
createDocTypeDropdown('DocType', div, schema);
createSection('Section', div, doctypes, key);
div = deconstruct(doctypes[key], div, key)
createSection('Section', div, doctypes, underscoredKey);
div = deconstruct(doctypes[sec], div, underscoredSec)
const submit = document.createElement('input')
submit.classList.add("submitButtons");
submit.classList.add(underscoredSec);
submit.type = 'submit'
div.appendChild(submit)
return false;
}
});
} else {
let doctypes = schema[doctype];
sessionStorage.setItem("currentDoctype", doctype);
let underscoredDoctype = doctype.replaceAll(" ", "_");
sessionStorage.setItem("currentDoctype", underscoredDoctype);
const {
valid,
error
......@@ -81,12 +89,72 @@ const displayFields = async (parentID) => {
div.textContent = error
div.style.color = '#ff3333'
}
sessionStorage.setItem("currentSection", section);
let underscoredSection = section.replaceAll(" ", "_");
sessionStorage.setItem("currentSection", underscoredSection);
createDocTypeDropdown('DocType', div, schema);
createSection('Section', div, doctypes, section);
div = deconstruct(doctypes[section], div, section)
createSection('Section', div, doctypes, underscoredDoctype);
div = deconstruct(doctypes[section], div, underscoredSection)
const submit = document.createElement('input')
submit.classList.add("submitButtons");
submit.classList.add(underscoredSection);
submit.type = 'submit'
div.appendChild(submit)
}
$(document.body).on("change","#DocType",function(){
const elements = document.getElementsByClassName(sessionStorage.getItem("currentSection"));
while(elements.length > 0){
elements[0].parentNode.removeChild(elements[0]);
}
const secElements = document.getElementsByClassName(sessionStorage.getItem("currentDoctype"));
while(secElements.length > 0){
secElements[0].parentNode.removeChild(secElements[0]);
}
let doctypes = schema[this.value];
let underscoredValue = this.value.replaceAll(" ","_");
sessionStorage.setItem("currentDoctype", underscoredValue);
const { valid, error } = validateSchema()
if(!valid){
div.textContent = error
div.style.color = '#ff3333'
}
for (let key in doctypes) {
let underscoredKey = key.replaceAll(" ", "_");
sessionStorage.setItem("currentSection", underscoredKey);
createSection('Section', div, doctypes, underscoredValue);
div = deconstruct(doctypes[key], div, underscoredKey)
const submit = document.createElement('input')
submit.classList.add("submitButtons");
submit.classList.add(underscoredKey);
submit.type = 'submit'
div.appendChild(submit)
break;
}
});
$(document.body).on("change","#Section",function(){
const elements = document.getElementsByClassName(sessionStorage.getItem("currentSection"));
while(elements.length > 0){
elements[0].parentNode.removeChild(elements[0]);
}
let underscoredKey = this.value.replaceAll(" ", "_");
sessionStorage.setItem("currentSection", underscoredKey);
div = deconstruct(schema[sessionStorage.getItem("currentDoctype").replaceAll("_", " ")][this.value], div, underscoredKey)
const submit = document.createElement('input')
submit.classList.add("submitButtons");
submit.classList.add(underscoredKey);
submit.type = 'submit'
div.appendChild(submit)
});
/* const { ACCOUNTING_DOCUMENTS } = schema
//getDocType = DOC_TYPE1 ;
......@@ -104,13 +172,13 @@ const displayFields = async (parentID) => {
const { HR_FILES } = schema
const { SECTION3 } = HR_FILES
div = deconstruct(SECTION3, div, 'SECTION3')*/
div = deconstruct(SECTION3, div, 'SECTION3')
const submit = document.createElement('input')
submit.classList.add("submitButtons");
submit.type = 'submit'
div.appendChild(submit)
div.appendChild(submit)*/
// add handler event handler for dropdown
// separate handler is used to fit with the library used 'select2'
......@@ -679,7 +747,7 @@ function saveForm(index){
});
index--;
var formArray = JSON.parse(sessionStorage.getItem('formArray'));
/* var formArray = JSON.parse(sessionStorage.getItem('formArray'));
//formArray.push(formValues);
if(typeof formArray[index] !== 'undefined') {
formArray.splice(index, 1, values)
......@@ -687,7 +755,7 @@ function saveForm(index){
formArray.splice(index, 0, values)
}
sessionStorage.setItem('formArray', JSON.stringify(formArray));
sessionStorage.setItem('formArray', JSON.stringify(formArray));*/
}
function populateForm(index){
......@@ -705,7 +773,45 @@ function populateForm(index){
document.getElementById(field).value = currForm[field];
}
}
}
async function populateFields(){
var data = [];
data.push(await getFieldData());
sessionStorage.setItem('formArray', JSON.stringify(data));
var formArray = JSON.parse(sessionStorage.getItem('formArray'));
var doctype = formArray[0].DocType;
var section = formArray[0].Section;
}
\ No newline at end of file
if (formArray[0] != null) {
var currForm = formArray[0];
for (let field in currForm) {
//document.getElementById(field).value = currForm[field];
if(field == "DocType"){
const mySelect = document.getElementById(field);
const selectedOption = mySelect.options[mySelect.selectedIndex];
selectedOption.value = doctype;
}
if(field == "Section"){
const mySelect = document.getElementById(field);
const selectedOption = mySelect.options[mySelect.selectedIndex];
selectedOption.value = section;
}
if(field == "fields"){
let fieldsobj = currForm[field];
for (let [k,v] of Object.entries(fieldsobj)) {
for(let key of Object.keys(schema[doctype][section])) {
if(schema[doctype][section][key].aka == "field"+k) {
var fieldId = schema[doctype][section][key].fieldLabel;
var currId = fieldId.replace(" ", "_")
document.getElementById(currId).value = v;
}
}
}
}
}
}
}
......@@ -3,7 +3,6 @@ const init = () => {
displayFields("fields");
accessFile();
window.onkeydown = (key) => {
if (!started_flag) {
if (searchStringInArray(`${key.key}`, keyArray) == true || key.ctrlKey && key.key) {
......@@ -23,7 +22,7 @@ const refresh = () => {
let started_flag = false;
displayFields("fields");
displayFields("fields");
refreshImage();
window.onkeydown = (key) => {
if (!started_flag) {
......
{
"ACCOUNTING_DOCUMENTS":
"ACCOUNTING DOCUMENTS":
{
"SECTION1":
{
......@@ -52,7 +52,7 @@
}
},
"BANK_APPLICATION_FORMS":
"BANK APPLICATION FORMS":
{
"SECTION2":
{
......@@ -94,7 +94,7 @@
}
},
"HR_FILES":
"HR FILES":
{
"SECTION3":
{
......
{
"ENVELOPE":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
},
"Sex":
{
"fieldLabel": "Sex",
"aka": "field5",
"validation":
{
"fieldLength": 6,
"collection": "alphabet",
"mandatory": true
}
},
"Birthdate":
{
"fieldLabel": "Birthdate",
"aka": "field6",
"validation":
{
"fieldLength": 10,
"collection": "datepicker",
"mandatory": true
}
},
"Civil_Status":
{
"fieldLabel": "Civil Status",
"aka": "field7",
"validation":
{
"fieldLength": 50,
"collection": "alphabet",
"mandatory": true
}
},
"Address":
{
"fieldLabel": "Address",
"aka": "field8",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@$%^*_+={}[]|\\:;\"<>?",
"mandatory": true
}
}
},
"EDUCATION":
{
"Name_of_Secondary_School":
{
"fieldLabel": "Name of Secondary School",
"aka": "field9",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@$%^*_+={}[]|\\:;\"<>?",
"mandatory": true
}
},
"Second_Year_Graduated":
{
"fieldLabel": "Second Year Graduated",
"aka": "field10",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@$%^*_+={}[]|\\:;\"<>?",
"mandatory": true
}
},
"Name_of_Pre-law_School":
{
"fieldLabel": "Name of Pre-law School",
"aka": "field11",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@$%^*_+={}[]|\\:;\"<>?",
"mandatory": true
}
},
"Pre-law_Year_Graduated":
{
"fieldLabel": "Pre-law Year Graduated",
"aka": "field12",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@$%^*_+={}[]|\\:;\"<>?",
"mandatory": true
}
},
"Name_of_Law_School":
{
"fieldLabel": "Name of Law School",
"aka": "field13",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@$%^*_+={}[]|\\:;\"<>?",
"mandatory": true
}
},
"Law_Proper_Year_Graduated":
{
"fieldLabel": "Law Proper Year Graduated",
"aka": "field14",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@$%^*_+={}[]|\\:;\"<>?",
"mandatory": true
}
}
},
"BAR EXAMINATION":
{
"Year_Passed_the_Bar":
{
"fieldLabel": "Year Passed the Bar",
"aka": "field15",
"validation":
{
"fieldLength": 4,
"collection": "numeric",
"mandatory": true
}
},
"Number_of_Bar_Exams_taken_(1-5)":
{
"fieldLabel": "Number of Bar Exams taken (1-5)",
"aka": "field16",
"validation":
{
"fieldLength": 1,
"collection": "numeric",
"mandatory": true
}
},
"Previous_Bar_Exam_Year_1":
{
"fieldLabel": "Previous Bar Exam Year 1",
"aka": "field17",
"validation":
{
"fieldLength": 4,
"collection": "numeric",
"mandatory": true
}
},
"Previous_Bar_Exam_Year_2":
{
"fieldLabel": "Previous Bar Exam Year 2",
"aka": "field18",
"validation":
{
"fieldLength": 4,
"collection": "numeric",
"mandatory": true
}
},
"Previous_Bar_Exam_Year_3":
{
"fieldLabel": "Previous Bar Exam Year 3",
"aka": "field19",
"validation":
{
"fieldLength": 4,
"collection": "numeric",
"mandatory": true
}
},
"Previous_Bar_Exam_Year_4":
{
"fieldLabel": "Previous Bar Exam Year 4",
"aka": "field20",
"validation":
{
"fieldLength": 4,
"collection": "numeric",
"mandatory": true
}
},
"Previous_Bar_Exam_Year_5":
{
"fieldLabel": "Previous Bar Exam Year 5",
"aka": "field21",
"validation":
{
"fieldLength": 4,
"collection": "numeric",
"mandatory": true
}
}
},
"ATTORNEY BASIC INFORMATION":
{
"Roll_No":
{
"fieldLabel": "Roll No",
"aka": "field22",
"validation":
{
"fieldLength": 50,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"'<>,.?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"mandatory": true
}
},
"Date_Admitted":
{
"fieldLabel": "Date Admitted",
"aka": "field23",
"validation":
{
"fieldLength": 10,
"collection": "datepicker",
"mandatory": false
}
},
"Disbarred":
{
"fieldLabel": "Disbarred",
"aka": "field24",
"validation":
{
"fieldLength": 100,
"collection": "alphabet",
"mandatory": false
}
},
"Date_Disbarred":
{
"fieldLabel": "Date Disbarred",
"aka": "field25",
"validation":
{
"fieldLength": 10,
"collection": "datepicker",
"mandatory": false
}
},
"Expired":
{
"fieldLabel": "Expired",
"aka": "field26",
"validation":
{
"fieldLength": 100,
"collection": "alphabet",
"mandatory": false
}
},
"Date_Died":
{
"fieldLabel": "Date Died",
"aka": "field27",
"validation":
{
"fieldLength": 10,
"collection": "datepicker",
"mandatory": false
}
}
}
},
"OBC FORM":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
},
"CASES INVOLVING THE ATTORNEY AS PARTY LITIGANT OR AS COUNSEL":
{
"Cases_–_None_Pending":
{
"fieldLabel": "Cases – None Pending",
"aka": "field39",
"validation":
{
"fieldLength": 100,
"collection": "alphabet",
"mandatory": false
}
},
"Cases_–_Has_Pending":
{
"fieldLabel": "Cases – Has Pending",
"aka": "field40",
"validation":
{
"fieldLength": 100,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"COVER PAGE (PERSONAL RECORD)":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
},
"BAR EXAMINATION":
{
"Bar_Exam_Year":
{
"fieldLabel": "Bar Exam Year",
"aka": "field28",
"validation":
{
"fieldLength": 4,
"collection": "numeric",
"mandatory": true
}
}
}
},
"VERIFICATION SLIP (CHECKLIST)":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"VERIFIED PETITION":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
},
"BAR EXAMINATION":
{
"Bar_Exam_Year":
{
"fieldLabel": "Bar Exam Year",
"aka": "field28",
"validation":
{
"fieldLength": 4,
"collection": "numeric",
"mandatory": true
}
}
}
},
"PSA BIRTH CERTIFICATE":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"PSA MARRIAGE CERTIFICATE":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"TESTIMONIAL OF GOOD MORAL CHARACTER":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"TRANSCRIPT OF RECORD: PRE-LAW DEGREE":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"TRANSCRIPT OF RECORD: LAW DEGREE":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"LEB CERTIFICATION":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"C2 (CHED)":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"CERTIFICATION OF NO DEROGATORY RECORDS":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"LATEST PHOTOS WITH PRINTED NAME":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"CERTIFICATION: REFRESHER COURSE":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"CERTIFICATION: PRE-BAR REVIEW COURSE":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"CERTIFICATION THAT PROFESSORS ARE BONA-FIDE":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"CERTIFIED TRUE COPY OF COMPLAINT/INFORMATION":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"CERTIFICATE OF PENDENCY OF THE CASE":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"CERTIFICATE OF STATUS":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"CERTIFIED TRUE COPY OF DECISION/RESOLUTION":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"CERTIFICATE OF FINALITY OF DECISION":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"CLEARANCE FROM THE COURT/PROSECUTOR’S OFFICE/OMBUDSMAN":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"RECORD OF RATING":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
},
"BAR EXAMINATION":
{
"Bar_Exam_Year":
{
"fieldLabel": "Bar Exam Year",
"aka": "field28",
"validation":
{
"fieldLength": 4,
"collection": "numeric",
"mandatory": true
}
},
"B.E._No._(Bar Examination Number)":
{
"fieldLabel": "B.E. No. (Bar Examination Number)",
"aka": "field29",
"validation":
{
"fieldLength": 50,
"collection": "numeric",
"mandatory": true
}
},
"Average_Grade":
{
"fieldLabel": "Average Grade",
"aka": "field30",
"validation":
{
"fieldLength": 7,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()-_+={}[]|\\/:;\"'<>,?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"mandatory": true
}
},
"Grade_–_Political_and_International_Law":
{
"fieldLabel": "Grade – Political and International Law",
"aka": "field31",
"validation":
{
"fieldLength": 7,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()-_+={}[]|\\/:;\"'<>,?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"mandatory": true
}
},
"Grade_–_Labor_Law_and_Social_Legislation":
{
"fieldLabel": "Grade – Labor Law and Social Legislation",
"aka": "field32",
"validation":
{
"fieldLength": 7,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()-_+={}[]|\\/:;\"'<>,?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"mandatory": true
}
},
"Grade_–_Civil_Law":
{
"fieldLabel": "Grade – Civil Law",
"aka": "field33",
"validation":
{
"fieldLength": 7,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()-_+={}[]|\\/:;\"'<>,?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"mandatory": true
}
},
"Grade_–_Taxation":
{
"fieldLabel": "Grade – Taxation",
"aka": "field34",
"validation":
{
"fieldLength": 7,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()-_+={}[]|\\/:;\"'<>,?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"mandatory": true
}
},
"Grade_–_Mercantile_Law":
{
"fieldLabel": "Grade – Mercantile Law",
"aka": "field35",
"validation":
{
"fieldLength": 7,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()-_+={}[]|\\/:;\"'<>,?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"mandatory": true
}
},
"Grade_–_Criminal_Law":
{
"fieldLabel": "Grade – Criminal Law",
"aka": "field36",
"validation":
{
"fieldLength": 7,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()-_+={}[]|\\/:;\"'<>,?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"mandatory": true
}
},
"Grade_–_Remedial_Law":
{
"fieldLabel": "Grade – Remedial Law",
"aka": "field37",
"validation":
{
"fieldLength": 7,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()-_+={}[]|\\/:;\"'<>,?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"mandatory": true
}
},
"Grade_–_Legal_Ethics_and_Practical_Exercises":
{
"fieldLabel": "Grade – Legal Ethics and Practical Exercises",
"aka": "field38",
"validation":
{
"fieldLength": 7,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()-_+={}[]|\\/:;\"'<>,?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
"mandatory": true
}
}
}
},
"NOTICE OF ADMISSION":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"UNDERTAKING":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"ACKNOWLEDGEMENT RECEIPT":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
},
"OTHERS":
{
"PERSONAL DATA":
{
"Last_Name":
{
"fieldLabel": "Last Name",
"aka": "field1",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"First_Name":
{
"fieldLabel": "First Name",
"aka": "field2",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": true
}
},
"Middle_Name":
{
"fieldLabel": "Middle Name",
"aka": "field3",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "~`!@#$%^&*()_+={}[]|\\/:;\"<>,.?0123456789",
"mandatory": false
}
},
"Suffix":
{
"fieldLabel": "Suffix",
"aka": "field4",
"validation":
{
"fieldLength": 3,
"collection": "alphabet",
"mandatory": false
}
}
}
}
}
\ No newline at end of file
......@@ -78,8 +78,8 @@ const submitForm = (e) => {
});
document.getElementById("counter").innerHTML = "";
clearTimeout(interval);
sessionStorage.removeItem("section");
sessionStorage.removeItem("doctype");
/* sessionStorage.removeItem("section");
sessionStorage.removeItem("doctype");*/
isCanvasNotCreated = true;
if(IS_RETRIEVE_FROM_GFS != "Y"){
......
......@@ -54,738 +54,756 @@ var span = document.getElementsByClassName("TiffModalClose")[0];
let Current_page = 0;
//XHR to Load Test TIFF Image
function loadDoc(url, cFunction,filename) {
Tiff.initialize({ TOTAL_MEMORY: 16777216 * 10 });
var xhr = new XMLHttpRequest();
xhr.responseType = 'arraybuffer';
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);
function loadDoc(url, cFunction, filename) {
Tiff.initialize({
TOTAL_MEMORY: 16777216 * 10
});
var xhr = new XMLHttpRequest();
xhr.responseType = 'arraybuffer';
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);
}
}
cFunction(xhr.response, filename);
}
}
cFunction(xhr.response, filename);
}
};
xhr.open('GET', url, true);
xhr.send();
};
xhr.open('GET', url, true);
xhr.send();
}
//Main Widget
function TIFFViewer(xhr, TiffViewerImageName) {
var buffer = xhr;
var TiffViewerImageName = TiffViewerImageName;
var flippedX = new Array(), flippedY = new Array(), rot = new Array(), checker = new Array();
var width = 0, height = 0; //changing variable for width and height
var origwidth = 0, origheight = 0, changedwidth = 0; changedheight = 0;
var setwidth = 0, setheight = 0; //constant variable for width and height
var editedwidth = 0, editedheight = 0; //checker of width and height change
var hpercent = 0, wpercent = 0; //set of percent increase or decrease per zoom
var hzoom = new Array(), wzoom = new Array(); //zoom data per page
let changed = false;
let TiffViewer_pages = 0; //page count
let TiffViewer_current = 1; // TiffViewer_current page number
sessionStorage.setItem("TiffViewer_current", "IMG" + TiffViewer_current);
if(localStorage.getItem("prev") == 1){
Current_page = Current_page - 1;
} else {
Current_page = Current_page + 1;
}
//declaration of HTML Contents
const TiffViewer_detailcont = document.createElement("div");
TiffViewer_detailcont.id = "TiffViewerDetailscontainer";
TiffViewer_detailcont.classList.add("TiffViewercontainer");
const TiffViewer_filedetail = document.createElement("div");
TiffViewer_filedetail.id = "TiffViewerImageName";
TiffViewer_filedetail.style.display = "none";
TiffViewer_filedetail.textContent = "Filename: ";
const TiffViewer_pagedetail = document.createElement('div');
TiffViewer_pagedetail.id = "TiffViewer_PageCount";
TiffViewer_pagedetail.style.display = "none";
TiffViewer_pagedetail.innerHTML = "Page: ";
const TiffViewer_filecont = document.createElement("div");
TiffViewer_filecont.id = "TiffViewer_FileContainer";
TiffViewer_filecont.classList.add("TiffViewercontainer");
const TiffViewer_scrncont = document.createElement("div");
TiffViewer_scrncont.id = "TiffViewer_Screen";
const TiffViewer_imgcont = document.createElement("div");
TiffViewer_imgcont.id = "TiffViewer_ImageContainer"
const TiffViewer_btncont = document.createElement("div");
TiffViewer_btncont.id = "TiffViewer_ButtonContainer";
TiffViewer_btncont.classList.add("TiffViewercontainer");
const TiffViewer_hflip = document.createElement("div");
TiffViewer_hflip.id = "TiffViewer_FlipX";
TiffViewer_hflip.classList.add("TiffViewer_ButtonClass");
TiffViewer_hflip.title = "Horizontal Flip";
const hflipIcon = document.createElement("img");
hflipIcon.classList.add("tiffViewerIcons");
hflipIcon.src = "/WebGde/assets/flip_horizontal_icon.png";
hflipIcon.alt = "horizontal-flip";
const TiffViewer_vflip = document.createElement("div");
TiffViewer_vflip.id = "TiffViewer_FlipY";
TiffViewer_vflip.classList.add("TiffViewer_ButtonClass");
TiffViewer_vflip.title = "Vertical Flip"
const vflipIcon = document.createElement("img");
vflipIcon.classList.add("tiffViewerIcons");
vflipIcon.src = "/WebGde/assets/flip_vertical_icon.png";
vflipIcon.alt = "vertical-flip";
const TiffViewer_Rrotate = document.createElement("div");
TiffViewer_Rrotate.id = "TiffViewer_RotateR";
TiffViewer_Rrotate.classList.add("TiffViewer_ButtonClass");
TiffViewer_Rrotate.title = "Rotate Right"
const RrotateIcon = document.createElement("img");
RrotateIcon.classList.add("tiffViewerIcons");
RrotateIcon.src = "/WebGde/assets/rotate_right_icon.png";
RrotateIcon.alt = "rotate-right";
const TiffViewer_Lrotate = document.createElement("div");
TiffViewer_Lrotate.id = "TiffViewer_RotateL";
TiffViewer_Lrotate.classList.add("TiffViewer_ButtonClass");
TiffViewer_Lrotate.title = "Rotate Left"
const LrotateIcon = document.createElement("img");
LrotateIcon.classList.add("tiffViewerIcons");
LrotateIcon.src = "/WebGde/assets/rotate_left_icon.png";
LrotateIcon.alt = "rotate-left";
const TiffViewer_Pzoom = document.createElement("button");
TiffViewer_Pzoom.id = "TiffViewer_ZoomP";
TiffViewer_Pzoom.classList.add("TiffViewer_ButtonClass");
TiffViewer_Pzoom.innerHTML = "+";
const TiffViewer_zoomIn = document.createElement("div");
TiffViewer_zoomIn.id = "TiffViewer_ZoomP";
TiffViewer_zoomIn.classList.add("TiffViewer_ButtonClass");
TiffViewer_zoomIn.title = "Zoom In";
const zoomInIcon = document.createElement("img");
zoomInIcon.classList.add("tiffViewerIcons");
zoomInIcon.src = "/WebGde/assets/zoom_in_icon.png";
zoomInIcon.alt = "zoom-in";
const TiffViewer_zoomOut = document.createElement("div");
TiffViewer_zoomOut.id = "TiffViewer_ZoomM";
TiffViewer_zoomOut.classList.add("TiffViewer_ButtonClass");
TiffViewer_zoomOut.title = "Zoom Out";
const zoomOutIcon = document.createElement("img");
zoomOutIcon.classList.add("tiffViewerIcons");
zoomOutIcon.src = "/WebGde/assets/zoom_out_icon.png";
zoomOutIcon.alt = "zoom-out";
const TiffViewer_Pbtn = document.createElement("button");
TiffViewer_Pbtn.id = "TiffViewer_PrevButton";
TiffViewer_Pbtn.classList.add("multiTiffViewer_ButtonClass");
TiffViewer_Pbtn.innerHTML = "<";
TiffViewer_Pbtn.style.display = "none";
const TiffViewer_Nbtn = document.createElement("button");
TiffViewer_Nbtn.id = "TiffViewer_NextButton";
TiffViewer_Nbtn.classList.add("multiTiffViewer_ButtonClass");
TiffViewer_Nbtn.innerHTML = ">";
TiffViewer_Nbtn.style.display = "none";
const TiffViewer_Fscrn = document.createElement("div");
TiffViewer_Fscrn.id = "TiffViewer_FullscreenButton";
TiffViewer_Fscrn.classList.add("TiffViewer_ButtonClass");
TiffViewer_Fscrn.title = "Fullscreen";
const FscrnIcon = document.createElement("img");
FscrnIcon.classList.add("tiffViewerIcons");
FscrnIcon.src = "/WebGde/assets/fullscreen_icon.png";
FscrnIcon.alt = "full-screen";
const TiffViewer_Fit = document.createElement("div");
TiffViewer_Fit.id = "TiffViewer_FitButton";
TiffViewer_Fit.classList.add("TiffViewer_ButtonClass");
TiffViewer_Fit.title = "FitContent";
const FitIcon = document.createElement("img");
FitIcon.classList.add("tiffViewerIcons");
FitIcon.src = "/WebGde/assets/full_content_icon.png";
FitIcon.alt = "full-screen";
const zoom = document.createElement("div");
zoom.classList.add("viewerSizeLabel");
let ofTotal = JSON.parse(sessionStorage.getItem("dir_files")).length;
document.getElementById("totalPageValue").innerHTML = Current_page + ' of ' + ofTotal;
//append all content declarations to modal
let multiTiffDiv = document.createElement("div");
multiTiffDiv.classList.add("multiTiffDiv");
let multiTiffButtonDiv = document.createElement("div");
multiTiffButtonDiv.classList.add("multiTiffButtonDiv")
multiTiffButtonDiv.append(TiffViewer_Pbtn);
multiTiffButtonDiv.append(TiffViewer_Nbtn);
multiTiffDiv.append(TiffViewer_pagedetail);
var buffer = xhr;
var TiffViewerImageName = TiffViewerImageName;
var flippedX = new Array(),
flippedY = new Array(),
rot = new Array(),
checker = new Array();
var width = 0,
height = 0; //changing variable for width and height
var origwidth = 0,
origheight = 0,
changedwidth = 0;
changedheight = 0;
var setwidth = 0,
setheight = 0; //constant variable for width and height
var editedwidth = 0,
editedheight = 0; //checker of width and height change
var hpercent = 0,
wpercent = 0; //set of percent increase or decrease per zoom
var hzoom = new Array(),
wzoom = new Array(); //zoom data per page
let changed = false;
let TiffViewer_pages = 0; //page count
let TiffViewer_current = 1; // TiffViewer_current page number
sessionStorage.setItem("TiffViewer_current", "IMG" + TiffViewer_current);
if (localStorage.getItem("prev") == 1) {
Current_page = Current_page - 1;
} else {
Current_page = Current_page + 1;
}
//declaration of HTML Contents
const TiffViewer_detailcont = document.createElement("div");
TiffViewer_detailcont.id = "TiffViewerDetailscontainer";
TiffViewer_detailcont.classList.add("TiffViewercontainer");
const TiffViewer_filedetail = document.createElement("div");
TiffViewer_filedetail.id = "TiffViewerImageName";
TiffViewer_filedetail.style.display = "none";
TiffViewer_filedetail.textContent = "Filename: ";
const TiffViewer_pagedetail = document.createElement('div');
TiffViewer_pagedetail.id = "TiffViewer_PageCount";
TiffViewer_pagedetail.style.display = "none";
TiffViewer_pagedetail.innerHTML = "Page: ";
const TiffViewer_filecont = document.createElement("div");
TiffViewer_filecont.id = "TiffViewer_FileContainer";
TiffViewer_filecont.classList.add("TiffViewercontainer");
const TiffViewer_scrncont = document.createElement("div");
TiffViewer_scrncont.id = "TiffViewer_Screen";
const TiffViewer_imgcont = document.createElement("div");
TiffViewer_imgcont.id = "TiffViewer_ImageContainer"
const TiffViewer_btncont = document.createElement("div");
TiffViewer_btncont.id = "TiffViewer_ButtonContainer";
TiffViewer_btncont.classList.add("TiffViewercontainer");
const TiffViewer_hflip = document.createElement("div");
TiffViewer_hflip.id = "TiffViewer_FlipX";
TiffViewer_hflip.classList.add("TiffViewer_ButtonClass");
TiffViewer_hflip.title = "Horizontal Flip";
const hflipIcon = document.createElement("img");
hflipIcon.classList.add("tiffViewerIcons");
hflipIcon.src = "/WebGde/assets/flip_horizontal_icon.png";
hflipIcon.alt = "horizontal-flip";
const TiffViewer_vflip = document.createElement("div");
TiffViewer_vflip.id = "TiffViewer_FlipY";
TiffViewer_vflip.classList.add("TiffViewer_ButtonClass");
TiffViewer_vflip.title = "Vertical Flip"
const vflipIcon = document.createElement("img");
vflipIcon.classList.add("tiffViewerIcons");
vflipIcon.src = "/WebGde/assets/flip_vertical_icon.png";
vflipIcon.alt = "vertical-flip";
const TiffViewer_Rrotate = document.createElement("div");
TiffViewer_Rrotate.id = "TiffViewer_RotateR";
TiffViewer_Rrotate.classList.add("TiffViewer_ButtonClass");
TiffViewer_Rrotate.title = "Rotate Right"
const RrotateIcon = document.createElement("img");
RrotateIcon.classList.add("tiffViewerIcons");
RrotateIcon.src = "/WebGde/assets/rotate_right_icon.png";
RrotateIcon.alt = "rotate-right";
const TiffViewer_Lrotate = document.createElement("div");
TiffViewer_Lrotate.id = "TiffViewer_RotateL";
TiffViewer_Lrotate.classList.add("TiffViewer_ButtonClass");
TiffViewer_Lrotate.title = "Rotate Left"
const LrotateIcon = document.createElement("img");
LrotateIcon.classList.add("tiffViewerIcons");
LrotateIcon.src = "/WebGde/assets/rotate_left_icon.png";
LrotateIcon.alt = "rotate-left";
const TiffViewer_Pzoom = document.createElement("button");
TiffViewer_Pzoom.id = "TiffViewer_ZoomP";
TiffViewer_Pzoom.classList.add("TiffViewer_ButtonClass");
TiffViewer_Pzoom.innerHTML = "+";
const TiffViewer_zoomIn = document.createElement("div");
TiffViewer_zoomIn.id = "TiffViewer_ZoomP";
TiffViewer_zoomIn.classList.add("TiffViewer_ButtonClass");
TiffViewer_zoomIn.title = "Zoom In";
const zoomInIcon = document.createElement("img");
zoomInIcon.classList.add("tiffViewerIcons");
zoomInIcon.src = "/WebGde/assets/zoom_in_icon.png";
zoomInIcon.alt = "zoom-in";
const TiffViewer_zoomOut = document.createElement("div");
TiffViewer_zoomOut.id = "TiffViewer_ZoomM";
TiffViewer_zoomOut.classList.add("TiffViewer_ButtonClass");
TiffViewer_zoomOut.title = "Zoom Out";
const zoomOutIcon = document.createElement("img");
zoomOutIcon.classList.add("tiffViewerIcons");
zoomOutIcon.src = "/WebGde/assets/zoom_out_icon.png";
zoomOutIcon.alt = "zoom-out";
const TiffViewer_Pbtn = document.createElement("button");
TiffViewer_Pbtn.id = "TiffViewer_PrevButton";
TiffViewer_Pbtn.classList.add("multiTiffViewer_ButtonClass");
TiffViewer_Pbtn.innerHTML = "<";
TiffViewer_Pbtn.style.display = "none";
const TiffViewer_Nbtn = document.createElement("button");
TiffViewer_Nbtn.id = "TiffViewer_NextButton";
TiffViewer_Nbtn.classList.add("multiTiffViewer_ButtonClass");
TiffViewer_Nbtn.innerHTML = ">";
TiffViewer_Nbtn.style.display = "none";
const TiffViewer_Fscrn = document.createElement("div");
TiffViewer_Fscrn.id = "TiffViewer_FullscreenButton";
TiffViewer_Fscrn.classList.add("TiffViewer_ButtonClass");
TiffViewer_Fscrn.title = "Fullscreen";
const FscrnIcon = document.createElement("img");
FscrnIcon.classList.add("tiffViewerIcons");
FscrnIcon.src = "/WebGde/assets/fullscreen_icon.png";
FscrnIcon.alt = "full-screen";
const TiffViewer_Fit = document.createElement("div");
TiffViewer_Fit.id = "TiffViewer_FitButton";
TiffViewer_Fit.classList.add("TiffViewer_ButtonClass");
TiffViewer_Fit.title = "FitContent";
const FitIcon = document.createElement("img");
FitIcon.classList.add("tiffViewerIcons");
FitIcon.src = "/WebGde/assets/full_content_icon.png";
FitIcon.alt = "full-screen";
const zoom = document.createElement("div");
zoom.classList.add("viewerSizeLabel");
let ofTotal = JSON.parse(sessionStorage.getItem("dir_files")).length;
document.getElementById("totalPageValue").innerHTML = Current_page + ' of ' + ofTotal;
//append all content declarations to modal
let multiTiffDiv = document.createElement("div");
multiTiffDiv.classList.add("multiTiffDiv");
let multiTiffButtonDiv = document.createElement("div");
multiTiffButtonDiv.classList.add("multiTiffButtonDiv")
multiTiffButtonDiv.append(TiffViewer_Pbtn);
multiTiffButtonDiv.append(TiffViewer_Nbtn);
multiTiffDiv.append(TiffViewer_pagedetail);
multiTiffDiv.append(multiTiffButtonDiv);
TiffViewer_Fit.append(FitIcon)
TiffViewer_Fscrn.append(FscrnIcon)
TiffViewer_zoomOut.append(zoomOutIcon)
TiffViewer_zoomIn.append(zoomInIcon)
TiffViewer_Lrotate.append(LrotateIcon)
TiffViewer_Rrotate.append(RrotateIcon)
TiffViewer_hflip.append(hflipIcon)
TiffViewer_vflip.append(vflipIcon)
TiffViewer_Header.append(TiffViewer_detailcont);
TiffViewer_Body.append(multiTiffDiv);
TiffViewer_Body.append(TiffViewer_filecont);
TiffViewer_Footer.append(zoom, TiffViewer_btncont);
//append Contents to containers
TiffViewer_detailcont.append(TiffViewer_filedetail);
TiffViewer_filecont.appendChild(TiffViewer_scrncont);
TiffViewer_scrncont.appendChild(TiffViewer_imgcont);
TiffViewer_btncont.append(TiffViewer_Fscrn, TiffViewer_Fit, TiffViewer_hflip, TiffViewer_vflip, TiffViewer_Rrotate, TiffViewer_Lrotate, TiffViewer_zoomIn, TiffViewer_zoomOut);
//get Content placeholders
const wrapper = document.querySelector("#TiffViewer_Screen"), header = wrapper.querySelector("#TiffViewer_ImageContainer");
var TiffViewer_scrn = document.getElementById('TiffViewer_Screen');
var TiffViewer_file = document.getElementById("TiffViewerImageName");
TiffViewer_file.append(TiffViewerImageName); //Append Filename to div placeholder
TiffViewer_file.style.display = "block"; //Show Filename
var tiff = new Tiff({ buffer: buffer }); //get TIFF data via buffer
TiffViewer_pages = tiff.countDirectory(); //count TIFF image TiffViewer_pages
//if TIFF page is greater than one, display Previous and TiffViewer_NextButton buttons
if (TiffViewer_pages > 1) {
document.getElementById("TiffViewer_PrevButton").style.display = "block";
document.getElementById("TiffViewer_NextButton").style.display = "block";
var TiffViewer_PageCount = document.getElementById("TiffViewer_PageCount");
var pageappend = TiffViewer_current + " / " + TiffViewer_pages;
TiffViewer_PageCount.append(pageappend); //display of page number
TiffViewer_PageCount.style.display = "inline-block";
}
document.getElementById('TestTIFFDisplay').src = tiff.toCanvas().toDataURL();
//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 = `IMG${i}`;
if (i != 1) {
img.style.display = "none";
wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/
hzoom[TiffViewer_current - 1] = changedheight;
Edited();
TiffViewer_Fit.append(FitIcon)
TiffViewer_Fscrn.append(FscrnIcon)
TiffViewer_zoomOut.append(zoomOutIcon)
TiffViewer_zoomIn.append(zoomInIcon)
TiffViewer_Lrotate.append(LrotateIcon)
TiffViewer_Rrotate.append(RrotateIcon)
TiffViewer_hflip.append(hflipIcon)
TiffViewer_vflip.append(vflipIcon)
TiffViewer_Header.append(TiffViewer_detailcont);
TiffViewer_Body.append(multiTiffDiv);
TiffViewer_Body.append(TiffViewer_filecont);
TiffViewer_Footer.append(zoom, TiffViewer_btncont);
//append Contents to containers
TiffViewer_detailcont.append(TiffViewer_filedetail);
TiffViewer_filecont.appendChild(TiffViewer_scrncont);
TiffViewer_scrncont.appendChild(TiffViewer_imgcont);
TiffViewer_btncont.append(TiffViewer_Fscrn, TiffViewer_Fit, TiffViewer_hflip, TiffViewer_vflip, TiffViewer_Rrotate, TiffViewer_Lrotate, TiffViewer_zoomIn, TiffViewer_zoomOut);
//get Content placeholders
const wrapper = document.querySelector("#TiffViewer_Screen"),
header = wrapper.querySelector("#TiffViewer_ImageContainer");
var TiffViewer_scrn = document.getElementById('TiffViewer_Screen');
var TiffViewer_file = document.getElementById("TiffViewerImageName");
TiffViewer_file.append(TiffViewerImageName); //Append Filename to div placeholder
TiffViewer_file.style.display = "block"; //Show Filename
var tiff = new Tiff({
buffer: buffer
}); //get TIFF data via buffer
TiffViewer_pages = tiff.countDirectory(); //count TIFF image TiffViewer_pages
//if TIFF page is greater than one, display Previous and TiffViewer_NextButton buttons
if (TiffViewer_pages > 1) {
document.getElementById("TiffViewer_PrevButton").style.display = "block";
document.getElementById("TiffViewer_NextButton").style.display = "block";
var TiffViewer_PageCount = document.getElementById("TiffViewer_PageCount");
var pageappend = TiffViewer_current + " / " + TiffViewer_pages;
TiffViewer_PageCount.append(pageappend); //display of page number
TiffViewer_PageCount.style.display = "inline-block";
}
document.getElementById('TiffViewer_ImageContainer').append(img);
img.classList.add("TiffViewer_imgclass");
tiff.setDirectory(i - 1);
var canvas = tiff.toCanvas().toDataURL();
document.getElementById(`IMG${i}`).src = canvas;
}
//setting the style per page
for (var j = 1; j <= TiffViewer_pages; j++) {
var img = document.getElementById("IMG" + j);
getMeta(canvas, function (width, height) {
wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/
hzoom[TiffViewer_current - 1] = changedheight;
Edited();
origheight = height;
origwidth = width;
setwidth = width;
setheight = height;
//to only display single page
if (setheight > 800 && setwidth > 1000) {
if (setheight > setwidth) {
// img.style = "width: 870px; height: 1160px";
img.style = "width: 600; height: 800";
} else {
// img.style = "width: 800; height: 600";
//img.style = "width: 600; height: 800";
img.style = "width: 800; height: 600";
document.getElementById('TestTIFFDisplay').src = tiff.toCanvas().toDataURL();
//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 = `IMG${i}`;
if (i != 1) {
img.style.display = "none";
wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/
hzoom[TiffViewer_current - 1] = changedheight;
Edited();
}
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 (changed) {
if(TiffViewer_pages > 1){
hpercent = (parseInt(setheight, 10) * (10 / 100));
wpercent = (parseInt(setwidth, 10) * (10 / 100));
}
setwidth = parseInt(img.style.width, 10);
setheight = parseInt(img.style.height, 10);
document.getElementById("TiffViewer_FitButton").style.display = "inherit";
}
changedheight = setheight;
changedwidth = setwidth;
hpercent = (parseInt(setheight, 10) * (10 / 100));
wpercent = (parseInt(setwidth, 10) * (10 / 100));
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};`;
});
checker.push(0);
flippedX.push(1);
flippedY.push(1);
rot.push(0);
if (j === 1) {
img.style.display = "flex";
}
document.getElementById('TiffViewer_ImageContainer').append(img);
img.classList.add("TiffViewer_imgclass");
tiff.setDirectory(i - 1);
var canvas = tiff.toCanvas().toDataURL();
document.getElementById(`IMG${i}`).src = canvas;
}
if(TiffViewer_pages > 1){
for (var j = 1; j <= TiffViewer_pages; j++) {
var img = document.getElementById("IMG" + j).style.display = "none";
}
}
//getting the metadata of each TIFF page
function getMeta(url, callback) {
var img = new Image();
img.src = url;
img.onload = function () { callback(this.width, this.height); }
}
//display image in fullscreen
document.getElementById("TiffViewer_FullscreenButton").onclick = function () {
var image = document.getElementById(`IMG${TiffViewer_current}`);
if (image.requestFullscreen) {
image.requestFullscreen();
}
else if (image.msRequestFullscreen) {
imagej.msRequestFullscreen();
}
else if (divObj.mozRequestFullScreen) {
image.mozRequestFullScreen();
}
else if (image.webkitRequestFullscreen) {
image.webkitRequestFullscreen();
} else {
console.log("Fullscreen API is not supported");
}
};
//Flip Horizontal
const flipH = document.getElementById("TiffViewer_FlipX");
flipH.addEventListener("click", flipHorizontal);
document.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.shiftKey && e.key.toUpperCase() === "H") {
e.preventDefault();
flipHorizontal();
}
})
//setting the style per page
for (var j = 1; j <= TiffViewer_pages; j++) {
var img = document.getElementById("IMG" + j);
getMeta(canvas, function(width, height) {
wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/
hzoom[TiffViewer_current - 1] = changedheight;
Edited();
origheight = height;
origwidth = width;
setwidth = width;
setheight = height;
//to only display single page
if (setheight > 800 && setwidth > 1000) {
if (setheight > setwidth) {
// img.style = "width: 870px; height: 1160px";
img.style = "width: 600; height: 800";
} 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 (changed) {
if (TiffViewer_pages > 1) {
hpercent = (parseInt(setheight, 10) * (10 / 100));
wpercent = (parseInt(setwidth, 10) * (10 / 100));
}
setwidth = parseInt(img.style.width, 10);
setheight = parseInt(img.style.height, 10);
document.getElementById("TiffViewer_FitButton").style.display = "inherit";
}
changedheight = setheight;
changedwidth = setwidth;
hpercent = (parseInt(setheight, 10) * (10 / 100));
wpercent = (parseInt(setwidth, 10) * (10 / 100));
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};`;
});
checker.push(0);
flippedX.push(1);
flippedY.push(1);
rot.push(0);
if (j === 1) {
img.style.display = "flex";
}
function flipHorizontal() {
if (flippedX[TiffViewer_current - 1] == 1) {
flippedX[TiffViewer_current - 1] = -1;
Edited();
}
else {
flippedX[TiffViewer_current - 1] = 1;
Edited();
}
};
//Flip Vertical
const flipV = document.getElementById("TiffViewer_FlipY");
flipV.addEventListener("click", flipVertical);
document.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.shiftKey && e.key.toUpperCase() === "V") {
e.preventDefault();
flipVertical();
}
})
function flipVertical() {
if (flippedY[TiffViewer_current - 1] == '1') {
flippedY[TiffViewer_current - 1] = -1;
Edited();
}
else {
flippedY[TiffViewer_current - 1] = 1;
Edited();
}
};
//Rotate 90 degrees
const rotateR = document.getElementById("TiffViewer_RotateR");
rotateR.addEventListener("click", rotateClockwise);
document.addEventListener("keydown", (e) => {
if (e.shiftKey && e.key === "PageUp") {
e.preventDefault();
rotateClockwise();
}
})
function rotateClockwise() {
rot[TiffViewer_current - 1] += 90;
if ((rot[TiffViewer_current - 1] % 360) == 0) {
rot[TiffViewer_current - 1] = 0
}
Edited();
};
//Rotate -90 degrees
const rotateL = document.getElementById("TiffViewer_RotateL");
rotateL.addEventListener("click", rotateCounterClockwise);
document.addEventListener("keydown", (e) => {
if (e.shiftKey && e.key === "PageDown") {
e.preventDefault();
rotateCounterClockwise();
if (TiffViewer_pages > 1) {
for (var j = 1; j <= TiffViewer_pages; j++) {
var img = document.getElementById("IMG" + j).style.display = "none";
}
}
})
function rotateCounterClockwise() {
rot[TiffViewer_current - 1] -= 90;
if (rot[TiffViewer_current - 1] < 0) {
checker[TiffViewer_current - 1] = rot[TiffViewer_current - 1] * (-1);
}
if ((checker[TiffViewer_current - 1] % 360) == 0) {
rot[TiffViewer_current - 1] = 0
}
Edited();
};
//Zoom In
const zoomP = document.getElementById("TiffViewer_ZoomP");
zoomP.addEventListener("click", zoomIn);
document.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.key === "=") {
e.preventDefault();
zoomIn();
}
})
function zoomIn() {
hzoom[TiffViewer_current - 1] += hpercent;
wzoom[TiffViewer_current - 1] += wpercent;
Edited();
};
//Zoom Out
const zoomM = document.getElementById("TiffViewer_ZoomM");
zoomM.addEventListener("click", zoomOut);
document.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.key === "-") {
e.preventDefault();
zoomOut();
}
})
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;
}
Edited();
};
//Previous Page
const prevB = document.getElementById("TiffViewer_PrevButton");
prevB.addEventListener("click", previousPage);
document.addEventListener("keydown", (e) => {
if (e.key === "F11") {
e.preventDefault();
previousPage();
//getting the metadata of each TIFF page
function getMeta(url, callback) {
var img = new Image();
img.src = url;
img.onload = function() {
callback(this.width, this.height);
}
}
})
function previousPage() {
if (TiffViewer_pages > 1) {
if (TiffViewer_current != 1) {
document.getElementById("TiffViewer_ImageContainer").classList.remove("active");
document.getElementById(`IMG${TiffViewer_current}`).style.display = "none";
TiffViewer_current--;
sessionStorage.setItem("TiffViewer_current", "IMG" + TiffViewer_current);
document.getElementById("TiffViewer_PageCount").innerHTML = "Page: " + TiffViewer_current + " / " + TiffViewer_pages;
//display image in fullscreen
document.getElementById("TiffViewer_FullscreenButton").onclick = function() {
var image = document.getElementById(`IMG${TiffViewer_current}`);
if (image.requestFullscreen) {
image.requestFullscreen();
} else if (image.msRequestFullscreen) {
imagej.msRequestFullscreen();
} else if (divObj.mozRequestFullScreen) {
image.mozRequestFullScreen();
} else if (image.webkitRequestFullscreen) {
image.webkitRequestFullscreen();
} else {
console.log("Fullscreen API is not supported");
}
};
//Flip Horizontal
const flipH = document.getElementById("TiffViewer_FlipX");
flipH.addEventListener("click", flipHorizontal);
document.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.shiftKey && e.key.toUpperCase() === "H") {
e.preventDefault();
flipHorizontal();
}
})
function flipHorizontal() {
if (flippedX[TiffViewer_current - 1] == 1) {
flippedX[TiffViewer_current - 1] = -1;
Edited();
} else {
flippedX[TiffViewer_current - 1] = 1;
Edited();
}
};
//Flip Vertical
const flipV = document.getElementById("TiffViewer_FlipY");
flipV.addEventListener("click", flipVertical);
document.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.shiftKey && e.key.toUpperCase() === "V") {
e.preventDefault();
flipVertical();
}
})
function flipVertical() {
if (flippedY[TiffViewer_current - 1] == '1') {
flippedY[TiffViewer_current - 1] = -1;
Edited();
} else {
flippedY[TiffViewer_current - 1] = 1;
Edited();
}
};
//Rotate 90 degrees
const rotateR = document.getElementById("TiffViewer_RotateR");
rotateR.addEventListener("click", rotateClockwise);
document.addEventListener("keydown", (e) => {
if (e.shiftKey && e.key === "PageUp") {
e.preventDefault();
rotateClockwise();
}
})
function rotateClockwise() {
rot[TiffViewer_current - 1] += 90;
if ((rot[TiffViewer_current - 1] % 360) == 0) {
rot[TiffViewer_current - 1] = 0
}
Edited();
initHighlight();
}
}
};
//Next Page
const nextB = document.getElementById("TiffViewer_NextButton");
nextB.addEventListener("click", nextPage);
document.addEventListener("keydown", (e) => {
if (e.key === "F12") {
e.preventDefault();
nextPage();
}
})
function nextPage() {
if (TiffViewer_pages > 1) {
if (TiffViewer_current != TiffViewer_pages) {
};
//Rotate -90 degrees
const rotateL = document.getElementById("TiffViewer_RotateL");
rotateL.addEventListener("click", rotateCounterClockwise);
document.addEventListener("keydown", (e) => {
if (e.shiftKey && e.key === "PageDown") {
e.preventDefault();
rotateCounterClockwise();
}
})
function rotateCounterClockwise() {
rot[TiffViewer_current - 1] -= 90;
if (rot[TiffViewer_current - 1] < 0) {
checker[TiffViewer_current - 1] = rot[TiffViewer_current - 1] * (-1);
}
if ((checker[TiffViewer_current - 1] % 360) == 0) {
rot[TiffViewer_current - 1] = 0
}
Edited();
};
//Zoom In
const zoomP = document.getElementById("TiffViewer_ZoomP");
zoomP.addEventListener("click", zoomIn);
document.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.key === "=") {
e.preventDefault();
zoomIn();
}
})
function zoomIn() {
hzoom[TiffViewer_current - 1] += hpercent;
wzoom[TiffViewer_current - 1] += wpercent;
Edited();
};
//Zoom Out
const zoomM = document.getElementById("TiffViewer_ZoomM");
zoomM.addEventListener("click", zoomOut);
document.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.key === "-") {
e.preventDefault();
zoomOut();
}
})
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;
}
Edited();
};
//Previous Page
const prevB = document.getElementById("TiffViewer_PrevButton");
prevB.addEventListener("click", previousPage);
document.addEventListener("keydown", (e) => {
if (e.key === "F11") {
e.preventDefault();
previousPage();
}
})
function previousPage() {
if (TiffViewer_pages > 1) {
if (TiffViewer_current != 1) {
document.getElementById("TiffViewer_ImageContainer").classList.remove("active");
document.getElementById(`IMG${TiffViewer_current}`).style.display = "none";
TiffViewer_current--;
sessionStorage.setItem("TiffViewer_current", "IMG" + TiffViewer_current);
document.getElementById("TiffViewer_PageCount").innerHTML = "Page: " + TiffViewer_current + " / " + TiffViewer_pages;
Edited();
initHighlight();
}
}
};
//Next Page
const nextB = document.getElementById("TiffViewer_NextButton");
nextB.addEventListener("click", nextPage);
document.addEventListener("keydown", (e) => {
if (e.key === "F12") {
e.preventDefault();
nextPage();
getImageField();
}
})
function nextPage() {
if (TiffViewer_pages > 1) {
if (TiffViewer_current != TiffViewer_pages) {
document.getElementById("TiffViewer_ImageContainer").classList.remove("active");
document.getElementById(`IMG${TiffViewer_current}`).style = "display: none";
TiffViewer_current++;
sessionStorage.setItem("TiffViewer_current", "IMG" + TiffViewer_current);
document.getElementById("TiffViewer_PageCount").innerHTML = "Page: " + TiffViewer_current + " / " + TiffViewer_pages;
Edited();
initHighlight();
} else {
alert("No more image to be fetched");
}
}
};
//Fit Content
const fitB = document.getElementById("TiffViewer_FitButton");
fitB.addEventListener("click", fitResize);
// document.addEventListener("keydown", (e) => {
// if (e.shiftKey && e.key === "F") {
// fitResize();
// }
// })
function fitResize() {
var FitText = this.textContent || this.innerHTML;
document.getElementById("TiffViewer_ImageContainer").classList.remove("active");
document.getElementById(`IMG${TiffViewer_current}`).style = "display: none";
TiffViewer_current++;
sessionStorage.setItem("TiffViewer_current", "IMG" + TiffViewer_current);
document.getElementById("TiffViewer_PageCount").innerHTML = "Page: " + TiffViewer_current + " / " + TiffViewer_pages;
if (FitText === "fc") {
setheight = origheight;
setwidth = origwidth;
wzoom[TiffViewer_current - 1] = origwidth;
hzoom[TiffViewer_current - 1] = origheight;
} else {
setheight = changedheight;
setwidth = changedwidth;
wzoom[TiffViewer_current - 1] = changedwidth;
hzoom[TiffViewer_current - 1] = changedheight;
}
Edited();
initHighlight();
}else{
alert("No more image to be fetched");
}
}
};
//Fit Content
const fitB = document.getElementById("TiffViewer_FitButton");
fitB.addEventListener("click", fitResize);
// document.addEventListener("keydown", (e) => {
// if (e.shiftKey && e.key === "F") {
// fitResize();
// }
// })
function fitResize() {
var FitText = this.textContent || this.innerHTML;
document.getElementById("TiffViewer_ImageContainer").classList.remove("active");
if (FitText === "fc") {
setheight = origheight;
setwidth = origwidth;
wzoom[TiffViewer_current - 1] = origwidth;
hzoom[TiffViewer_current - 1] = origheight;
} else {
setheight = changedheight;
setwidth = changedwidth;
wzoom[TiffViewer_current - 1] = changedwidth;
hzoom[TiffViewer_current - 1] = changedheight;
}
Edited();
}
//Set Style per button click
function Edited() {
var TiffViewer_imgclass = document.getElementById("TiffViewer_FileContainer");
var TiffViewer_Screen = document.getElementById("TiffViewer_Screen");
var TiffViewer_ImageContainer = document.getElementById("TiffViewer_ImageContainer");
var image = document.getElementById(`IMG${TiffViewer_current}`);
//if the image is rotated 90 degrees
if (rot[TiffViewer_current - 1] == 90 || rot[TiffViewer_current - 1] == 270 || rot[TiffViewer_current - 1] == -90 || rot[TiffViewer_current - 1] == -270) {
image.style = `display: flex;
//Set Style per button click
function Edited() {
var TiffViewer_imgclass = document.getElementById("TiffViewer_FileContainer");
var TiffViewer_Screen = document.getElementById("TiffViewer_Screen");
var TiffViewer_ImageContainer = document.getElementById("TiffViewer_ImageContainer");
var image = document.getElementById(`IMG${TiffViewer_current}`);
//if the image is rotated 90 degrees
if (rot[TiffViewer_current - 1] == 90 || rot[TiffViewer_current - 1] == 270 || rot[TiffViewer_current - 1] == -90 || rot[TiffViewer_current - 1] == -270) {
image.style = `display: flex;
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
border: 0px groove white;
transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`;
image.style = `display: flex;
image.style = `display: flex;
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
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 = `display: flex;
image.style = `display: flex;
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
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;
TiffViewer_ImageContainer.style = `display: flex;
width: ${setheight};
height: ${setwidth};
position: relative;
justify-content: center;
align-items: center;`;
TiffViewer_Screen.style = `display: flex;
TiffViewer_Screen.style = `display: flex;
width: ${setheight};
height: ${setwidth};
position: relative;
justify-content: center;
align-items: center;`;
TiffViewer_imgclass.style = `display: flex;
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 = `display: flex;
width = TiffViewer_Screen.clientHeight;
height = TiffViewer_Screen.clientWidth;
} else {
image.style = `display: flex;
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
border: 0px groove white;
transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`;
image.style = `display: flex;
image.style = `display: flex;
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
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 = `display: flex;
-ms-transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`; // IE
image.style = `display: flex;
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
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;
-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;
TiffViewer_Screen.style = `display: flex;
width: ${setwidth};
height: ${setheight};
position: relative;
justify-content: center;
align-items: center;`;
TiffViewer_imgclass.style = `display: flex;
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;
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 + "%";
// document.getElementById(`IMG${TiffViewer_current + 1}`).style.display = 'none';
// document.getElementById("IMG2").style.display = 'none';
}
editedwidth = image.clientWidth;
editedheight = image.clientHeight;
let zoomPercentage = Math.round(100 + (hzoom[TiffViewer_current - 1] / setheight * 100));
zoom.innerHTML = zoomPercentage == 100 || isNaN(zoomPercentage) ? "" : zoomPercentage + "%";
// document.getElementById(`IMG${TiffViewer_current + 1}`).style.display = 'none';
// document.getElementById("IMG2").style.display = 'none';
}
document.getElementById("refresh").addEventListener('click',
function() {
refreshDiv();
}
);
function refreshDiv(){
document.getElementById("TiffViewer_ImageContainer").classList.remove("active");
var FitText = fitB.textContent || fitB.innerHTML;
if (FitText !== "FitContent") {
setheight = changedheight;
setwidth = changedwidth;
wzoom[TiffViewer_current - 1] = changedwidth;
hzoom[TiffViewer_current - 1] = changedheight;
}
if (flippedX[TiffViewer_current - 1] != 1) {
flippedX[TiffViewer_current - 1] = 1;
}
if (flippedY[TiffViewer_current - 1] != '1') {
flippedY[TiffViewer_current - 1] = 1;
}
rot[TiffViewer_current - 1] = 0
hzoom[TiffViewer_current - 1] = changedheight;
wzoom[TiffViewer_current - 1] = changedwidth;
Edited();
if (File_Path.endsWith("pdf")){
myState.zoom = 1.5;
queueRenderPage(TiffViewer_current);
}
}
/* ADDED:
keyboard shortcut for fit/resize content
checks if the if it is the input field and if it is an alphanumeric/alphabet type
if so, keyboard shortcut will not bind
otherwise, the function will work
*/
document.addEventListener("keydown", function (e) {
if (e.shiftKey && e.key == 'F') {
if(e.target.tagName == "INPUT"){
// REMOVE COMMENT ONLY WHEN SPECIFIC FIELDS ARE NEEDED
// for (const key in getSection) {
// const validation = getValidation(key);
// if (`${key}` == e.target.id) {
// if (validation.collection == "alphanumeric" || validation.collection == "alphabet"){
// return;
// } else {
// console.log(`${key}`)
// console.log(e.target.id);
// fitResize();
// }
// }
// }
return;
}else{
fitResize();
}
}});
document.getElementById("refresh").addEventListener('click',
function() {
refreshDiv();
}
);
function refreshDiv() {
document.getElementById("TiffViewer_ImageContainer").classList.remove("active");
var FitText = fitB.textContent || fitB.innerHTML;
if (FitText !== "FitContent") {
setheight = changedheight;
setwidth = changedwidth;
wzoom[TiffViewer_current - 1] = changedwidth;
hzoom[TiffViewer_current - 1] = changedheight;
}
if (flippedX[TiffViewer_current - 1] != 1) {
flippedX[TiffViewer_current - 1] = 1;
}
if (flippedY[TiffViewer_current - 1] != '1') {
flippedY[TiffViewer_current - 1] = 1;
}
rot[TiffViewer_current - 1] = 0
hzoom[TiffViewer_current - 1] = changedheight;
wzoom[TiffViewer_current - 1] = changedwidth;
Edited();
if (File_Path.endsWith("pdf")) {
myState.zoom = 1.5;
queueRenderPage(TiffViewer_current);
}
}
/* ADDED:
keyboard shortcut for fit/resize content
checks if the if it is the input field and if it is an alphanumeric/alphabet type
if so, keyboard shortcut will not bind
otherwise, the function will work
*/
document.addEventListener("keydown", function(e) {
if (e.shiftKey && e.key == 'F') {
if (e.target.tagName == "INPUT") {
// REMOVE COMMENT ONLY WHEN SPECIFIC FIELDS ARE NEEDED
// for (const key in getSection) {
// const validation = getValidation(key);
// if (`${key}` == e.target.id) {
// if (validation.collection == "alphanumeric" || validation.collection == "alphabet"){
// return;
// } else {
// console.log(`${key}`)
// console.log(e.target.id);
// fitResize();
// }
// }
// }
return;
} else {
fitResize();
}
}
});
//scrolling shortcuts
document.addEventListener('keydown', function (e) {
let div = document.getElementById('TiffModalBody');
if (e.ctrlKey && e.keyCode === 37) {
e.preventDefault();
div.scrollLeft -= 20;
} else if (e.ctrlKey && e.keyCode === 38) {
e.preventDefault();
div.scrollTop -= 20;
} else if (e.ctrlKey && e.keyCode === 39) {
e.preventDefault();
div.scrollLeft += 20;
} else if (e.ctrlKey && e.keyCode === 40) {
e.preventDefault();
div.scrollTop += 20;
}
});
initHighlight();
}
document.addEventListener('keydown', function(e) {
let div = document.getElementById('TiffModalBody');
if (e.ctrlKey && e.keyCode === 37) {
e.preventDefault();
div.scrollLeft -= 20;
} else if (e.ctrlKey && e.keyCode === 38) {
e.preventDefault();
div.scrollTop -= 20;
} else if (e.ctrlKey && e.keyCode === 39) {
e.preventDefault();
div.scrollLeft += 20;
} else if (e.ctrlKey && e.keyCode === 40) {
e.preventDefault();
div.scrollTop += 20;
}
});
//initHighlight();
}
\ No newline at end of file
......@@ -66,7 +66,7 @@ const validateInput = (fieldID, value) => {
const getValidation = (fieldID) => {
// const { SECTION } = schema
let section = schema[sessionStorage.getItem("currentDoctype")][sessionStorage.getItem("currentSection")];
let section = schema[sessionStorage.getItem("currentDoctype").replaceAll("_"," ")][sessionStorage.getItem("currentSection").replaceAll("_"," ")];
try{
if (Object.keys(section).includes(fieldID)) return section[fieldID].validation;
......
const validateSchema = () => {
const validate = schema[sessionStorage.getItem("currentDoctype")]
const validate = schema[sessionStorage.getItem("currentDoctype").replaceAll("_"," ")]
if(!validate) return { valid: false, error: 'SECTION is missing!' }
return { valid: true }
......
......@@ -14,15 +14,16 @@ html {
}
#prompt{
background-color:white;
height: 10%;
position: absolute;
display: block;
margin: auto;
width: 42%;
top: 47%;
left: 31%;
text-align: center;
background-color: white;
height: 10%;
position: absolute;
display: block;
margin: auto;
width: 42%;
top: 47%;
left: 31%;
text-align: center;
padding: 30px;
}
/* The actual popup */
......@@ -919,6 +920,8 @@ input[type=text] {
select {
width: 100%;
height: 28px;
color: #444;
}
#fields *:not([type=submit]):focus {
......
......@@ -42,7 +42,7 @@
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
</dependencies>
<build>
<plugins>
<plugin>
......
......@@ -228,6 +228,19 @@ public class GDEWebServices {
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/get-fields")
public Response getFields(XMLContents xml) {
try {
return Response.ok(XMLUtil.getFields(xml)).build();
} catch (Exception e) {
return Response.status(500).entity("Fail").build();
}
}
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/update-exception")
public Response updateException(XMLContents xml) {
......
......@@ -33,6 +33,7 @@ import com.svi.webgde.restservice.object.Field;
import com.svi.webgde.restservice.object.Header;
import com.svi.webgde.restservice.object.OutputXML;
import com.svi.webgde.restservice.object.Record;
import com.svi.webgde.restservice.object.SubRecord;
import com.svi.webgde.restservice.object.XMLContents;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
......@@ -282,4 +283,47 @@ public class XMLUtil {
}
public static Map<String, Object> getFields(XMLContents xml)
throws ParserConfigurationException, SAXException, IOException {
Map<String, Object> records = new HashMap<>();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(xml.getOutputDir());
Map<String, Integer> imagenames = new HashMap<>();
for (int i = 0; i < document.getElementsByTagName("imagename").getLength(); i++) {
imagenames.put(document.getElementsByTagName("imagename").item(i).getTextContent(), i);
}
if (imagenames.containsKey(xml.getImageName())) {
Node imagename = document.getElementsByTagName("imagename").item(imagenames.get(xml.getImageName()));
Node xmlSubRecord = imagename.getParentNode().getLastChild().getPreviousSibling();
Map<String, String> fields = new HashMap<>();
records.put("DocType", imagename.getParentNode().getFirstChild().getNextSibling().getNextSibling()
.getNextSibling().getTextContent());
records.put("Section", imagename.getParentNode().getFirstChild().getNextSibling().getNextSibling()
.getNextSibling().getNextSibling().getNextSibling().getTextContent());
records.put("fields", fields);
for (int i = 0; i < xmlSubRecord.getChildNodes().getLength(); i++) {
if (xmlSubRecord.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE) {
for (int j = 0; j < xmlSubRecord.getChildNodes().item(i).getChildNodes().getLength(); j++) {
if (xmlSubRecord.getChildNodes().item(i).getChildNodes().item(j)
.getNodeType() == Node.ELEMENT_NODE) {
fields.put(
xmlSubRecord.getChildNodes().item(i).getAttributes().getNamedItem("no")
.getNodeValue(),
xmlSubRecord.getChildNodes().item(i).getChildNodes().item(j).getTextContent());
records.put("fields", fields);
}
}
}
}
}
return records;
}
}
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