SERIALNOCHECK : AADHAVAN
This commit is contained in:
parent
e4663c28b2
commit
69bc96d7db
155
addform.html
155
addform.html
@ -4,7 +4,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>Project-B</title>
|
<title>Project-</title>
|
||||||
|
|
||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
@ -1513,7 +1513,6 @@ var previewbutton = document.getElementById("editPreview");
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (FileName) {
|
if (FileName) {
|
||||||
console.log("if");
|
|
||||||
const saveButton = document.getElementById('SaveButton');
|
const saveButton = document.getElementById('SaveButton');
|
||||||
if (saveButton) {
|
if (saveButton) {
|
||||||
// if (count != 0) {
|
// if (count != 0) {
|
||||||
@ -1526,7 +1525,6 @@ var previewbutton = document.getElementById("editPreview");
|
|||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
saveButton.click();
|
saveButton.click();
|
||||||
console.log(saveButton);
|
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var popupInput = document.getElementById("swal2-input");
|
var popupInput = document.getElementById("swal2-input");
|
||||||
@ -1539,7 +1537,6 @@ var previewbutton = document.getElementById("editPreview");
|
|||||||
if (anchorElement) {
|
if (anchorElement) {
|
||||||
anchorElement.click();
|
anchorElement.click();
|
||||||
saveButton.click();
|
saveButton.click();
|
||||||
console.log("ghj");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1638,7 +1635,7 @@ function loadXML(xmlFileName) {
|
|||||||
} else{
|
} else{
|
||||||
jsonDecodeData = data;
|
jsonDecodeData = data;
|
||||||
localStorage.setItem('json_Decode_Data_For_Mcq_Crt_Ans', jsonDecodeData);
|
localStorage.setItem('json_Decode_Data_For_Mcq_Crt_Ans', jsonDecodeData);
|
||||||
console.log('jsonDecodeData', jsonDecodeData);
|
// console.log('jsonDecodeData', jsonDecodeData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1658,7 +1655,7 @@ function loadXML(xmlFileName) {
|
|||||||
} else{
|
} else{
|
||||||
decodeData = data;
|
decodeData = data;
|
||||||
}
|
}
|
||||||
console.log('jsonDecodeData : ', jsonDecodeData);
|
// console.log('jsonDecodeData : ', jsonDecodeData);
|
||||||
xml2json(decodeData);
|
xml2json(decodeData);
|
||||||
|
|
||||||
|
|
||||||
@ -1671,8 +1668,8 @@ function loadXML(xmlFileName) {
|
|||||||
|
|
||||||
// Function for Save the XML File
|
// Function for Save the XML File
|
||||||
function saveFile(flag=0) {
|
function saveFile(flag=0) {
|
||||||
console.log("flag = ", flag);
|
// console.log("flag = ", flag);
|
||||||
console.log("SaveFile");
|
// console.log("SaveFile");
|
||||||
var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
|
var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
|
||||||
|
|
||||||
var count = "";
|
var count = "";
|
||||||
@ -1690,7 +1687,7 @@ function saveFile(flag=0) {
|
|||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
check_Empty_Question()
|
check_Empty_Question()
|
||||||
console.log("check Empty");
|
// console.log("check Empty");
|
||||||
} else {
|
} else {
|
||||||
html2json();
|
html2json();
|
||||||
json2xml();
|
json2xml();
|
||||||
@ -2512,7 +2509,7 @@ function addQuestionGroup(idObj)
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-12 col-md-12">
|
<div class="col-lg-12 col-md-12">
|
||||||
<div class="form_box">
|
<div class="form_box">
|
||||||
<label class="titleSpace">Questions Group Title:<span id='partOf_${QuestionGroup_ID}'></span> <input contenteditable="true" style="border: 2px solid #EEECFE;height:34px;width: 200px !important;;margin-left:4px;" class="QuestionsGroupIdset" id="Questions_Group_id_${QuestionGroup_ID}" value="${group_question_id}" placeholder="SNo..."> </label>
|
<label class="titleSpace">Questions Group Title:<span id='partOf_${QuestionGroup_ID}'></span> <input contenteditable="true" style="border: 2px solid #EEECFE;height:34px;width: 200px !important;;margin-left:4px;" class="QuestionsGroupIdset SerialNo" id="Questions_Group_id_${QuestionGroup_ID}" value="${group_question_id}" placeholder="SNo..."> </label>
|
||||||
<div class="richText" id="subSection_title_text_${QuestionGroup_ID}" contenteditable="true" style=" border: 2px solid #EEECFE; margin-top: 4px;">${idObj.hasOwnProperty('question_group_obj') ? idObj.question_group_obj.group_title : ""}</div>
|
<div class="richText" id="subSection_title_text_${QuestionGroup_ID}" contenteditable="true" style=" border: 2px solid #EEECFE; margin-top: 4px;">${idObj.hasOwnProperty('question_group_obj') ? idObj.question_group_obj.group_title : ""}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -2978,7 +2975,7 @@ function groupQuestion(question_id = false, section_id = false , group_question_
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 col-md-12" style="margin-top: -20px">
|
<div class="col-lg-12 col-md-12" style="margin-top: -20px">
|
||||||
<div class="form_box">
|
<div class="form_box">
|
||||||
<label class="titleSpace">Question:<span id='partOf_${addChoiceAreaId}'> <input style=" width: 200px !important;border: 2px solid #EEECFE;height: 37px; margin-left: 4px; margin-top: -29px;" id="QuestionChoiceId_${addChoiceAreaId}" class="QuestionChoiceId" contenteditable="true" value="${questionIdS}" placeholder="SNo...."></label>
|
<label class="titleSpace">Question:<span id='partOf_${addChoiceAreaId}'> <input style=" width: 200px !important;border: 2px solid #EEECFE;height: 37px; margin-left: 4px; margin-top: -29px;" id="QuestionChoiceId_${addChoiceAreaId}" class="QuestionChoiceId SerialNo" contenteditable="true" value="${questionIdS}" placeholder="SNo...."></label>
|
||||||
<div class="richText" id="textQuestionName_${addChoiceAreaId}" contenteditable="true" style=" border: 2px solid #EEECFE; margin-top: 4px;">${questionTitle ? questionTitle : ''}</div>
|
<div class="richText" id="textQuestionName_${addChoiceAreaId}" contenteditable="true" style=" border: 2px solid #EEECFE; margin-top: 4px;">${questionTitle ? questionTitle : ''}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -3797,7 +3794,7 @@ textQuestion +=
|
|||||||
<div class="col-lg-12 col-md-12" style="margin-top: -20px">
|
<div class="col-lg-12 col-md-12" style="margin-top: -20px">
|
||||||
<input type="hidden" id="Text_Question_UUID_ID_${addTextQuestionId}" value="${QuestionObj.hasOwnProperty('questionUUID') ? QuestionObj.questionUUID : Text_Question_UUID}">
|
<input type="hidden" id="Text_Question_UUID_ID_${addTextQuestionId}" value="${QuestionObj.hasOwnProperty('questionUUID') ? QuestionObj.questionUUID : Text_Question_UUID}">
|
||||||
<div class="form_box">
|
<div class="form_box">
|
||||||
<label class="titleSpace">Question:<span id='partOf_${addTextQuestionId}'> <input type='text'style="border: 2px solid #EEECFE; height:34px;width: 200px !important;margin-left: 4px;" id='QuestionTextIdSet_${addTextQuestionId}' class='QuestionTextIdSet' contenteditable="true" value="${ssa}" placeholder="SNo...."></label>
|
<label class="titleSpace">Question:<span id='partOf_${addTextQuestionId}'> <input type='text'style="border: 2px solid #EEECFE; height:34px;width: 200px !important;margin-left: 4px;" id='QuestionTextIdSet_${addTextQuestionId}' class='QuestionTextIdSet SerialNo' contenteditable="true" value="${ssa}" placeholder="SNo...."></label>
|
||||||
<div type="text" class="richText" id="textQuestionName_${addTextQuestionId}" contenteditable="true" style=" border: 2px solid #EEECFE; margin-top: 4px;">${QuestionObj.hasOwnProperty('questionTitle') ? QuestionObj.questionTitle : ''}</div>
|
<div type="text" class="richText" id="textQuestionName_${addTextQuestionId}" contenteditable="true" style=" border: 2px solid #EEECFE; margin-top: 4px;">${QuestionObj.hasOwnProperty('questionTitle') ? QuestionObj.questionTitle : ''}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -4236,7 +4233,7 @@ function collect_Empty_Question_Id(arrayString, ID) {
|
|||||||
|
|
||||||
function check_Empty_Question()
|
function check_Empty_Question()
|
||||||
{
|
{
|
||||||
console.log("Check Empty Enter");
|
// console.log("Check Empty Enter");
|
||||||
var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
|
var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
|
||||||
if (title_id) {
|
if (title_id) {
|
||||||
var parsedArray = JSON.parse(title_id);
|
var parsedArray = JSON.parse(title_id);
|
||||||
@ -4245,7 +4242,8 @@ function check_Empty_Question()
|
|||||||
|
|
||||||
if (index === array.length - 1) {
|
if (index === array.length - 1) {
|
||||||
var idclass= document.getElementById(Id).className;
|
var idclass= document.getElementById(Id).className;
|
||||||
if ( idclass === 'QuestionTextIdSet' || idclass === 'QuestionsGroupIdset' || idclass === 'QuestionChoiceId' ) {
|
// console.log(idclass == "QuestionTextIdSet SerialNo");
|
||||||
|
if ( idclass === 'QuestionTextIdSet SerialNo' || idclass === 'QuestionsGroupIdset' || idclass === 'QuestionChoiceId' ) {
|
||||||
attrId = document.getElementById(Id).innerHTML
|
attrId = document.getElementById(Id).innerHTML
|
||||||
}else if(idclass === 'multipleAnswerorNot'){
|
}else if(idclass === 'multipleAnswerorNot'){
|
||||||
attrId ="";
|
attrId ="";
|
||||||
@ -4256,17 +4254,17 @@ function check_Empty_Question()
|
|||||||
}
|
}
|
||||||
if(attrId === '<p><br></p>')
|
if(attrId === '<p><br></p>')
|
||||||
{
|
{
|
||||||
console.log("Check empty if");
|
// console.log("Check empty if");
|
||||||
scrollToElementWithoutLink(Id);
|
scrollToElementWithoutLink(Id);
|
||||||
document.getElementById(Id).focus();
|
document.getElementById(Id).focus();
|
||||||
}else if(attrId == ''){
|
}else if(attrId == ''){
|
||||||
console.log("Check empty else if");
|
// console.log("Check empty else if");
|
||||||
|
|
||||||
scrollToElementWithoutLink(Id);
|
scrollToElementWithoutLink(Id);
|
||||||
document.getElementById(Id).focus();
|
document.getElementById(Id).focus();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
console.log("Check empty Last else");
|
// console.log("Check empty Last else");
|
||||||
scrollToElementWithoutLink(Id);
|
scrollToElementWithoutLink(Id);
|
||||||
document.getElementById(Id).focus();
|
document.getElementById(Id).focus();
|
||||||
}
|
}
|
||||||
@ -4338,7 +4336,7 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}else if (DeleteElement) {
|
}else if (DeleteElement) {
|
||||||
console.log("section");
|
// console.log("section");
|
||||||
// console.log(parsedArray);
|
// console.log(parsedArray);
|
||||||
if (Id === IdToRemove ) {
|
if (Id === IdToRemove ) {
|
||||||
|
|
||||||
@ -4631,7 +4629,7 @@ function removeSection(RandomId, IndexValue) {
|
|||||||
|
|
||||||
var jsonData = JSON.parse(localStorage.getItem('JSON_FOR_NAV'));
|
var jsonData = JSON.parse(localStorage.getItem('JSON_FOR_NAV'));
|
||||||
var count = jsonData.sections.length;
|
var count = jsonData.sections.length;
|
||||||
console.log(`Count of sections: ${count}`);
|
// console.log(`Count of sections: ${count}`);
|
||||||
|
|
||||||
if(count > 1)
|
if(count > 1)
|
||||||
{
|
{
|
||||||
@ -5178,41 +5176,41 @@ setInterval(imagebuttonidset,3000)
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function findInputByValue(value) {
|
function findInputByValue(value) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
value.forEach(function (param, index) {
|
value.forEach(function (param, index) {
|
||||||
var choiceId = param;
|
var choiceId = param;
|
||||||
const inputs = document.getElementsByTagName('input');
|
const inputs = document.getElementsByTagName('input');
|
||||||
|
|
||||||
for (let i = 0; i < inputs.length; i++) {
|
for (let i = 0; i < inputs.length; i++) {
|
||||||
if (inputs[i].value === choiceId[0]) {
|
if (inputs[i].value === choiceId[0]) {
|
||||||
inputs[i].checked = true;
|
inputs[i].checked = true;
|
||||||
// function findInputByValue(value) {
|
// function findInputByValue(value) {
|
||||||
|
|
||||||
// console.log('test', value);
|
// console.log('test', value);
|
||||||
// value.forEach(function (param,index) {
|
// value.forEach(function (param,index) {
|
||||||
// // console.log('correctanswer 2', param);
|
// // console.log('correctanswer 2', param);
|
||||||
// // var choiceId = param.correct_answer;
|
// // var choiceId = param.correct_answer;
|
||||||
// const inputs = document.getElementsByTagName('input');
|
// const inputs = document.getElementsByTagName('input');
|
||||||
// // console.log(inputs);
|
// // console.log(inputs);
|
||||||
// for (let i = 0; i < inputs.length; i++) {
|
// for (let i = 0; i < inputs.length; i++) {
|
||||||
|
|
||||||
// // console.log(choiceId);
|
// // console.log(choiceId);
|
||||||
// if (inputs[i].value === param) {
|
// if (inputs[i].value === param) {
|
||||||
// // return inputs[i];
|
// // return inputs[i];
|
||||||
// inputs[i].checked= true
|
// inputs[i].checked= true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 2000); // Introduce a delay of one second (adjust as needed)
|
}, 2000); // Introduce a delay of one second (adjust as needed)
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function sendthe_full_div_for_multiple_or_not(params) {
|
function sendthe_full_div_for_multiple_or_not(params) {
|
||||||
var aa= document.querySelectorAll('.multipleAnswerorNot')
|
var aa= document.querySelectorAll('.multipleAnswerorNot')
|
||||||
@ -5227,7 +5225,7 @@ function findInputByValue(value) {
|
|||||||
}
|
}
|
||||||
setInterval(sendthe_full_div_for_multiple_or_not,1000)
|
setInterval(sendthe_full_div_for_multiple_or_not,1000)
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<!-- <script>
|
<!-- <script>
|
||||||
@ -5266,7 +5264,7 @@ function findInputByValue(value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setInterval(addBorderRemoveTable,2000)
|
setInterval(addBorderRemoveTable,2000)
|
||||||
</script>
|
</script>
|
||||||
<!-- End this for RTE Table Insert Romove Table No Border -->
|
<!-- End this for RTE Table Insert Romove Table No Border -->
|
||||||
|
|
||||||
|
|
||||||
@ -5285,13 +5283,13 @@ function findInputByValue(value) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
setInterval(addTitleforTable,2000)
|
setInterval(addTitleforTable,2000)
|
||||||
</script>
|
</script>
|
||||||
<!-- End this for RTE Table ToolTip Add -->
|
<!-- End this for RTE Table ToolTip Add -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Start the Choice Question Mandatory Check -->
|
<!-- Start the Choice Question Mandatory Check -->
|
||||||
<script>
|
<script>
|
||||||
function checkChoicesNotSelect(element){
|
function checkChoicesNotSelect(element){
|
||||||
var ChoiceChecks =element.querySelectorAll('.correctAnswerBox')
|
var ChoiceChecks =element.querySelectorAll('.correctAnswerBox')
|
||||||
var count =0;
|
var count =0;
|
||||||
@ -5330,34 +5328,49 @@ function findInputByValue(value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<!-- End the Choice Question Mandatory Check -->
|
<!-- End the Choice Question Mandatory Check -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <script>
|
<!-- Start Add All Serial Number is null -->
|
||||||
|
<script>
|
||||||
function name(params) {
|
|
||||||
|
|
||||||
var drags = document.querySelector('.fa-grip-horizontal')
|
|
||||||
var a =drags.parentNode.parentNode
|
|
||||||
|
|
||||||
drags.addEventListener('dragstart', function(event){
|
|
||||||
// a.draggable = true
|
|
||||||
|
|
||||||
|
function addSerialNotoLocalStorage() {
|
||||||
|
var elements= document.querySelectorAll('.SerialNo')
|
||||||
|
var title_i = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
|
||||||
|
var array_of_Ids =[];
|
||||||
|
var againpushlist =[];
|
||||||
|
var parsedArra ='';
|
||||||
|
elements.forEach(function (element) {
|
||||||
|
if (element.value == '') {
|
||||||
|
if (title_i == null || title_i == '[]') {
|
||||||
|
array_of_Ids.push(element.id)
|
||||||
|
parsedArra = JSON.stringify(array_of_Ids);
|
||||||
|
}else{
|
||||||
|
parsedArra = JSON.parse(title_i);
|
||||||
|
parsedArra.forEach(function (para,index){
|
||||||
|
againpushlist.push(para)
|
||||||
|
if (index == 0) {
|
||||||
|
againpushlist.push(element.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
array_of_Ids=againpushlist;
|
||||||
|
let uniqueArray = [...new Set(array_of_Ids)];
|
||||||
|
parsedArra = JSON.stringify(uniqueArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
if (parsedArra) {
|
||||||
drags.addEventListener('dragend', function(event){
|
collect_Empty_Question_Id(parsedArra)
|
||||||
a.draggable = false
|
}
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
setInterval(name, 2000)
|
setInterval(addSerialNotoLocalStorage, 1000)
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<!-- End Add All Serial Number is null -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script> -->
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -10,8 +10,10 @@ function decode(encryptedDataFilePath) {
|
|||||||
// console.log('encryptedDataFilePath :', encryptedDataFilePath);
|
// console.log('encryptedDataFilePath :', encryptedDataFilePath);
|
||||||
// const privateKeyPath = process.env.PRIVATE_KEY_PATH;
|
// const privateKeyPath = process.env.PRIVATE_KEY_PATH;
|
||||||
|
|
||||||
const privateKeyPath = configObject.PRIVATE_KEY_PATH;
|
|
||||||
|
|
||||||
|
const privateKeyPathTemp = configObject.PRIVATE_KEY_PATH;
|
||||||
|
const privateKeyPath = path.join(__dirname,privateKeyPathTemp);
|
||||||
|
|
||||||
const encryptedFileContent = fs.readFileSync(encryptedDataFilePath);
|
const encryptedFileContent = fs.readFileSync(encryptedDataFilePath);
|
||||||
|
|
||||||
// Extract the encrypted AES key, IV, and ciphertext
|
// Extract the encrypted AES key, IV, and ciphertext
|
||||||
|
|||||||
@ -13,16 +13,21 @@ function encode(inputString, downloadFilePath = false) {
|
|||||||
|
|
||||||
var certificatePath = '';
|
var certificatePath = '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(downloadFilePath !== false)
|
if(downloadFilePath !== false)
|
||||||
{
|
{
|
||||||
// certificatePath = process.env.DOWNLOAD_PUBLIC_KEY_PATH;
|
// certificatePath = process.env.DOWNLOAD_PUBLIC_KEY_PATH;
|
||||||
certificatePath = configObject.DOWNLOAD_PUBLIC_KEY_PATH;
|
var certificatePathTemp = configObject.DOWNLOAD_PUBLIC_KEY_PATH;
|
||||||
|
certificatePath = path.join(__dirname,certificatePathTemp);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// certificatePath = process.env.PUBLIC_KEY_PATH;
|
// certificatePath = process.env.PUBLIC_KEY_PATH;
|
||||||
certificatePath = configObject.PUBLIC_KEY_PATH;
|
var certificatePathTemp = configObject.PUBLIC_KEY_PATH;
|
||||||
|
certificatePath = path.join(__dirname,certificatePathTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const aesKey = crypto.randomBytes(16); // Change the byte length for different key lengths
|
const aesKey = crypto.randomBytes(16); // Change the byte length for different key lengths
|
||||||
|
|||||||
20
xml2json.js
20
xml2json.js
@ -4,7 +4,7 @@ function xml2json(xmlData) {
|
|||||||
// console.log(xmlData);
|
// console.log(xmlData);
|
||||||
|
|
||||||
var jsonDecodeData = localStorage.getItem('json_Decode_Data_For_Mcq_Crt_Ans');
|
var jsonDecodeData = localStorage.getItem('json_Decode_Data_For_Mcq_Crt_Ans');
|
||||||
console.log(jsonDecodeData);
|
// console.log(jsonDecodeData);
|
||||||
|
|
||||||
function getAttributesOfXMLNode(node)
|
function getAttributesOfXMLNode(node)
|
||||||
{
|
{
|
||||||
@ -22,11 +22,11 @@ function getAttributesOfXMLNode(node)
|
|||||||
|
|
||||||
function getQuestionsNodes(questionNode,type)
|
function getQuestionsNodes(questionNode,type)
|
||||||
{
|
{
|
||||||
console.log(type);
|
// console.log(type);
|
||||||
var questionObj = {};
|
var questionObj = {};
|
||||||
if(type == 1)
|
if(type == 1)
|
||||||
{
|
{
|
||||||
console.log(questionNode);
|
// console.log(questionNode);
|
||||||
questionObj['question_id'] = questionNode.childNodes[0].firstChild !== null? questionNode.childNodes[0].firstChild.nodeValue : "" ;
|
questionObj['question_id'] = questionNode.childNodes[0].firstChild !== null? questionNode.childNodes[0].firstChild.nodeValue : "" ;
|
||||||
questionObj['question'] = questionNode.childNodes[1].firstChild.nodeValue;
|
questionObj['question'] = questionNode.childNodes[1].firstChild.nodeValue;
|
||||||
questionObj['question_description'] = (questionNode.childNodes[2].firstChild !== null? questionNode.childNodes[2].firstChild.nodeValue : "");
|
questionObj['question_description'] = (questionNode.childNodes[2].firstChild !== null? questionNode.childNodes[2].firstChild.nodeValue : "");
|
||||||
@ -54,7 +54,7 @@ function getQuestionsNodes(questionNode,type)
|
|||||||
questionObj['correct_answer'] = [];
|
questionObj['correct_answer'] = [];
|
||||||
|
|
||||||
var choiceList = questionNode.childNodes[7].childNodes;
|
var choiceList = questionNode.childNodes[7].childNodes;
|
||||||
console.log(questionNode);
|
// console.log(questionNode);
|
||||||
if(choiceList.length > 0)
|
if(choiceList.length > 0)
|
||||||
{
|
{
|
||||||
for (let k = 0; k < choiceList.length ;k++)
|
for (let k = 0; k < choiceList.length ;k++)
|
||||||
@ -72,7 +72,7 @@ function getQuestionsNodes(questionNode,type)
|
|||||||
{
|
{
|
||||||
var jsonParsedData = JSON.parse(jsonDecodeData);
|
var jsonParsedData = JSON.parse(jsonDecodeData);
|
||||||
|
|
||||||
console.log('jsonParsedData : ', jsonParsedData)
|
// console.log('jsonParsedData : ', jsonParsedData)
|
||||||
|
|
||||||
// Iterate over each question
|
// Iterate over each question
|
||||||
for (const question of jsonParsedData.questions) {
|
for (const question of jsonParsedData.questions) {
|
||||||
@ -123,17 +123,17 @@ function getQuestionGroupNodes(questionGroup)
|
|||||||
var questionType = questionList[q].getAttribute("xsi:type");
|
var questionType = questionList[q].getAttribute("xsi:type");
|
||||||
if(questionType == 'DescriptiveQuestion')
|
if(questionType == 'DescriptiveQuestion')
|
||||||
{
|
{
|
||||||
console.log(questionList[q]);
|
// console.log(questionList[q]);
|
||||||
questionGroupObj['questions'].push(getQuestionsNodes(questionList[q],1));
|
questionGroupObj['questions'].push(getQuestionsNodes(questionList[q],1));
|
||||||
}
|
}
|
||||||
else if(questionType == 'MultiChoiceQuestion')
|
else if(questionType == 'MultiChoiceQuestion')
|
||||||
{
|
{
|
||||||
console.log(questionList[q]);
|
// console.log(questionList[q]);
|
||||||
questionGroupObj['questions'].push(getQuestionsNodes(questionList[q],2));
|
questionGroupObj['questions'].push(getQuestionsNodes(questionList[q],2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
console.log(questionList[q]);
|
// console.log(questionList[q]);
|
||||||
questionGroupObj['questions'].push(getQuestionGroupNodes(questionList[q]));
|
questionGroupObj['questions'].push(getQuestionGroupNodes(questionList[q]));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ function getQuestionGroupNodes(questionGroup)
|
|||||||
|
|
||||||
//busi logic start
|
//busi logic start
|
||||||
var xmlString = xmlData;
|
var xmlString = xmlData;
|
||||||
console.log(xmlString);
|
// console.log(xmlString);
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
|
|
||||||
// Parse the XML string into an XML document
|
// Parse the XML string into an XML document
|
||||||
@ -207,7 +207,7 @@ jsonObj['sections'] = [];
|
|||||||
var jsonData = JSON.stringify(jsonObj);
|
var jsonData = JSON.stringify(jsonObj);
|
||||||
// console.log('Xml to Json Conversion ');
|
// console.log('Xml to Json Conversion ');
|
||||||
// console.log('jsonData : ', jsonData);
|
// console.log('jsonData : ', jsonData);
|
||||||
console.log(jsonObj);
|
// console.log(jsonObj);
|
||||||
jsonToHtml(jsonObj);
|
jsonToHtml(jsonObj);
|
||||||
// console.log(jsonToHtml(jsonObj))
|
// console.log(jsonToHtml(jsonObj))
|
||||||
// localStorage.removeItem('json_Decode_Data_For_Mcq_Crt_Ans');
|
// localStorage.removeItem('json_Decode_Data_For_Mcq_Crt_Ans');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user