code merge : RV

This commit is contained in:
venkateswaran ubuntu 2023-12-08 16:23:35 +05:30
commit b8cffded4d
9 changed files with 1741 additions and 231 deletions

View File

@ -164,6 +164,8 @@ function QuestionPaperPreview(jsonData){
GroupQuestionTilteAlign =40
}else if(question_id_length == 6) {
GroupQuestionTilteAlign =54
}else if(question_id_length == 2){
GroupQuestionTilteAlign =23
}
@ -199,7 +201,7 @@ function QuestionPaperPreview(jsonData){
// questionGroupMark = questionGroupMark.replace('<p id="group_marks">', '<p id="group_marks" hidden>')
// }
questionPaper += `<div class="text-group-align" style="margin-left:-1px;">${questionId})${questionGroupmodify}</div>`
questionPaper += `<div class="text-group-align" style="margin-left:0px;">${questionId})${questionGroupmodify}</div>`
questionPaper += `<div class="group_marks_attmpt">${questionGroupAttempt}${questionGroupMark}</div>`;
// questionPaper += `<div class="group_attempt_any">${questionGroupAttempt}</div>`;
@ -286,9 +288,9 @@ function QuestionPaperPreview(jsonData){
const answerA = answers[i] ? `${optionA}. ${convertToLatex(answers[i].choice_name, math)}` : '';
// const answerB = answers[i + 1] ? `${optionB}. ${convertToLatex(answers[i + 1].choice_name, mathstatus)}` : '';
if (multipleAnswer == 'false') {
questionPaper += `<div class="text-option-align" style="margin-left:${choisealgin}px"><input type="radio" name="answer" value="A"> ${answerA.padEnd(10)}</div>`;
questionPaper += `<div class="text-option-align" style="margin-left:${choisealgin}px"><input type="radio" name="answer" value="A"> <p class="ChoiceOption">${answerA.padEnd(10)}</p></div>`;
}else{
questionPaper += `<div class="text-option-align" style="margin-left:${choisealgin}px"><input type="checkbox" name="answer" value="A"> ${answerA.padEnd(10)}</div>`;
questionPaper += `<div class="text-option-align" style="margin-left:${choisealgin}px"><input type="checkbox" name="answer" value="A"> <p class="ChoiceOption"> ${answerA.padEnd(10)}</p></div>`;
}
}
}

View File

@ -44,34 +44,61 @@
<!-- <link href='https://fonts.googleapis.com/css?family=Titillium+Web:400,600' rel='stylesheet' type='text/css'> -->
<link rel="stylesheet" href="./node_modules/bootstrap-icons/font/bootstrap-icons.css">
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css"> -->
<link rel="stylesheet" href="./node_modules/quill/dist/quill.snow.css" type="text/css" media="all" />
<link rel="stylesheet" href="assets/css/quillTable.css" type="text/css" media="all" />
<style>
table {
border-collapse: collapse; /* Set to 'collapse' for adjacent cell borders to collapse into one */
text-indent: 0; /* Reset text indentation */
border-spacing: 0; /* Set to '0' to eliminate any spacing between cells */
}
table td{
border: 1px solid black !important;
.ql-align-right-add{
display: flow-root;
}
.ql-align-left-add{
/* margin-left: -704px !important; */
margin-top: 22px;
display: flex;
}
.ChoiceOption{
display: flex;
align-items: center;
}
.ql-align-right.table-border{
width: 167px !important;
}
.ql-align-center.table-border{
width: 152px !important;
}
.group_Text{
margin-top: -28px;
padding-bottom: 15px;
}
.table-border{
/* border: 1px solid black; */
margin-left:10px;
margin-right: 10px !important;
width: 80px;
inline-size: 80px;
text-wrap: wrap;
}
.ql-align-justify{
}
.td-q .ql-align-right{
float: right;
}
.ql-align-right{
inline-size: 700px;
text-wrap: wrap;
/* margin-top: -27px !important; */
text-align: right;
}
.ql-align-center {
inline-size: 700px;
text-wrap: wrap;
/* margin-top: -27px !important; */
text-align: center;
}
tr{
display: flex !important;
/* border: 1px solid black; */
}
.question-Group-Description{
margin-top: -14px;
}
@ -439,33 +466,32 @@ color: #1d3557 !important;
<script src="decode.js"></script>
<script>
<script>
$("#overlay").show();
const fs = require('fs');
const path =require('path');
$("#overlay").show();
const fs = require('fs');
const path =require('path');
// require('dotenv').config();
//get value from .env
// require('dotenv').config();
//get value from .env
// const convertBaseToString =require('./envConvertBasetoString');
var configObject = convertBaseToString();
// const convertBaseToString =require('./envConvertBasetoString');
var configObject = convertBaseToString();
const isEncrypted = configObject.ENCRYPTED.trim();
const isEncrypted = configObject.ENCRYPTED.trim();
// const isEncrypted = process.env.ENCRYPTED;
// const isEncrypted = process.env.ENCRYPTED;
const url = new URL(window.location.href);// Get the URL of the current page for JSON
const params = new URLSearchParams(url.search);// Create a URLSearchParams object from the query string
const xmlFileName = params.get('filename');// Get the value of a specific parameter
loadXML(xmlFileName)
const url = new URL(window.location.href);// Get the URL of the current page for JSON
const params = new URLSearchParams(url.search);// Create a URLSearchParams object from the query string
const xmlFileName = params.get('filename');// Get the value of a specific parameter
loadXML(xmlFileName)
//Preview edit button
document.getElementById("editlink").href = "addform.html?filename=" + xmlFileName;
//Preview edit button
document.getElementById("editlink").href = "addform.html?filename=" + xmlFileName;
//XmlPath get from .env
//XmlPath get from .env
// const decode = require('./decode');
// const decode = require('./decode');
// Function to load XML from a file
function loadXML(xmlFileName) {
@ -559,71 +585,132 @@ try {
</script>
<script>
$(document).ready(function() {
setTimeout(() => {
var parentDiv = $('.text-qus-align');
var firstParagraph = parentDiv.find('.question_Text:first-child');
// console.log(parentDiv);
// Remove the style attribute from the first <p> tag
if (firstParagraph.length > 0) {
firstParagraph.removeAttr('style');
}
}, 1000);
});
</script>
<script>
function thisclassnameWhenPaste() {
var elements = document.querySelectorAll('.ql-align-justify');
<script>
$(document).ready(function() {
setTimeout(() => {
var parentDiv = $('.text-qus-align');
var firstParagraph = parentDiv.find('.question_Text:first-child');
if (firstParagraph.length > 0) {
firstParagraph.removeAttr('style');
}
}, 1000);
});
</script>
<script>
function thisclassnameWhenPaste() {
var a =document.querySelectorAll('.text-qus-align');
a.forEach(function (aa) {
var elements = aa.querySelectorAll('.ql-align-justify');
elements.forEach(function(element) {
element.classList.add('question_Text');
});
})
a.forEach(function (aa) {
var elements = aa.querySelectorAll('.ql-align-right');
elements.forEach(function(element) {
element.classList.add('question_Text');
});
})
a.forEach(function (aa) {
var elements = aa.querySelectorAll('.ql-align-center');
elements.forEach(function(element) {
element.classList.add('question_Text');
});
})
}
setInterval(thisclassnameWhenPaste, 1000);
</script>
elements.forEach(function(element) {
element.classList.add('question_Text');
element.classList.remove('ql-align-justify')
});
}
setInterval(thisclassnameWhenPaste, 1000);
</script>
<script>
var counter = 0;
function quilltableclassname() {
var hb = document.querySelectorAll('.td-q');
hb.forEach(function (param,index) {
// Assuming param contains the HTML of each .td-q element
var doc = document.createElement('div');
doc.innerHTML = param.innerHTML;
var pElement = doc.querySelector('p');
if (pElement) {
pElement.classList.add('table-border');
pElement.classList.remove('question_Text');
param.innerHTML = doc.innerHTML;
}
});
counter++;
if (counter === 1) {
clearInterval(intervalId);
}
}
var intervalId = setInterval(quilltableclassname, 1000);
</script>
<script>
var counter = 0;
function quilltableclassname() {
var hb = document.querySelectorAll('.td-q');
hb.forEach(function (param,index) {
var doc = document.createElement('div');
doc.innerHTML = param.innerHTML;
var pElement = doc.querySelector('p');
if (pElement) {
pElement.classList.add('table-border');
pElement.classList.remove('question_Text');
param.innerHTML = doc.innerHTML;
}
});
counter++;
if (counter === 1) {
clearInterval(intervalId);
}
}
var intervalId = setInterval(quilltableclassname, 1000);
</script>
<script>
function thisclassnameWhenPaste() {
var textGroupAligns =document.querySelectorAll('.text-group-align');
textGroupAligns.forEach(function (textGroupAlign) {
var elements = textGroupAlign.querySelectorAll('.ql-align-justify');
elements.forEach(function(element) {
element.classList.add('group_Text');
element.style.paddingLeft = '15px';
});
})
textGroupAligns.forEach(function (textGroupAlign) {
var elements = textGroupAlign.querySelectorAll('.ql-align-right');
elements.forEach(function(element) {
element.classList.add('group_Text');
element.style.paddingLeft = '15px';
});
})
textGroupAligns.forEach(function (textGroupAlign) {
var elements = textGroupAlign.querySelectorAll('.ql-align-center');
elements.forEach(function(element) {
element.classList.add('group_Text');
element.style.paddingLeft = '15px';
});
})
}
setInterval(thisclassnameWhenPaste, 1000);
</script>
<!-- Start In Preview Image Alignment is Correct -->
<script>
function ImageAlignmentChange() {
var imgTags = document.getElementsByTagName('img');
var imgArray = Array.from(imgTags);
imgArray.forEach(function(imgElement) {
var alignelement= imgElement.getAttribute('align');
var parentelement= imgElement.parentNode
var computedStyle = window.getComputedStyle(imgElement);
var floatPropertyValue = computedStyle.getPropertyValue('float');
if (alignelement == 'center') {
imgElement.classList.add('ql-align-center-add');
}else if (alignelement == 'right') {
imgElement.classList.add('ql-align-right-add');
}else if (floatPropertyValue == 'left') {
imgElement.removeAttribute('style');
imgElement.classList.add('ql-align-left-add');
imgElement.removeAttribute('align');
}else if (floatPropertyValue == 'right') {
imgElement.classList.add('ql-align-right-add');
}
});
}
setInterval(ImageAlignmentChange, 1000)
</script>
<!-- End In Preview Image Alignment is Correct -->
</body>
</html>

View File

@ -54,12 +54,26 @@
<script id="MathJax-script" async src="./node_modules/mathjax/es5/tex-mml-chtml.js"></script>
<style>
/* Start custom css for table icon options in RTE editor */
.ql-picker.ql-table:nth-of-type(1) .ql-picker-options {
width: 310px !important;
}
/* End custom css for table icon options in RTE editor */
/* start custom css for Alignment icon options in RTE editor */
.ql-icon-picker .ql-picker-item{
width: 24px !important;
}
/* End custom css for Alignment icon options in RTE editor */
/* [data-value="remove-table"] {
border: 1px solid black !important;
} */
.ql-picker-options{
/* .ql-picker-options{
width: 310px !important;
}
} */
.ql-picker-item{
width: 95px !important;
}
@ -823,7 +837,7 @@ h1.title{
<ul>
<li><a href="dashboard.html"><img class="addPageMenu" src="assets/images/home.svg" alt="">Home</a></li>
<li><a href="#" class="myBtn" onclick="saveFile()" id="SaveButton"><img class="addPageMenu" src="assets/images/save.svg" alt="">Save</a></li>
<li><a href="#" id="editPreview" ><img class="addPageMenu" src="assets/images/preview.svg" alt="">Preview</a></li>
<li><a id="editPreview" onclick="editPreview()"><img class="addPageMenu" src="assets/images/preview.svg" alt="">Preview</a></li>
</ul>
</div>
</div>
@ -1329,11 +1343,19 @@ function clearMessage() {
var mathJaxContainer = document.getElementById('workarea_math');
var quillContainer = document.getElementById('workarea');
var quillInstance = new Quill('#workarea');
quillInstance.setText('');
var quillInstance = quillContainer.querySelector('.ql-editor');
if (quillInstance.innerHTML.trim() !== '<p><br></p>') {
quillInstance.innerHTML = '<p><br></p>';
}
// var quillInstance = new Quill('#workarea');
// quillInstance.setText('');
// console.log(mathJaxContainer);
// console.log(quillContainer);
mathJaxContainer.value = "";
};
@ -1440,51 +1462,90 @@ document.addEventListener('DOMContentLoaded', function () {
//EditPreview and Create Preview
var previewbutton = document.getElementById("editPreview");
previewbutton.addEventListener("click", async () => {
if (FileName)
{
const saveButton = document.getElementById('SaveButton');
if (saveButton) {
saveButton.click();
setTimeout(function() {
var popupInput = document.getElementById("swal2-input");
var submitButton = document.querySelector(".swal2-confirm.swal2-styled");
submitButton.addEventListener("click", function() {
FileName = popupInput.value;
FileName += ".xml"
if(FileName){
var anchorElement = document.getElementById("editPreview");
if (anchorElement) {
anchorElement.click();
}
}
});
}, 3000);
// previewbutton.addEventListener("click", async () => {
function editPreview() {
var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
var count = "";//XmlPath get from .env
// const decode = require('./decode');
if(title_id !== '' && title_id !== null)
{
var parsedArray = JSON.parse(title_id);
var count = parsedArray.length;
// console.log('count - ' + count)
}
previewbutton.href = "QuestionPreview.html?filename=" + FileName;
}
else
{
const saveButton = document.getElementById('SaveButton');
if (saveButton) {
saveButton.click();
setTimeout(function() {
var popupInput = document.getElementById("swal2-input");
var submitButton = document.querySelector(".swal2-confirm.swal2-styled");
submitButton.addEventListener("click", function() {
FileName = popupInput.value;
FileName += ".xml"
if(FileName){
var anchorElement = document.getElementById("editPreview");
if (anchorElement) {
anchorElement.click();
else
{
count = 0
}
if (FileName) {
console.log("if");
const saveButton = document.getElementById('SaveButton');
if (saveButton) {
// if (count != 0) {
// const Swal = require('sweetalert2');
// Swal.fire({
// title : 'Alert!!!',
// text : 'First Save And Preview.',
// icon : 'info',
// confirmButtonText: 'OK'
// });
// }
saveButton.click();
console.log(saveButton);
if (count == 0) {
setTimeout(function() {
var popupInput = document.getElementById("swal2-input");
var submitButton = document.querySelector(".swal2-confirm.swal2-styled");
submitButton.addEventListener("click", function() {
FileName = popupInput.value;
FileName += ".xml"
if(FileName){
var anchorElement = document.getElementById("editPreview");
if (anchorElement) {
anchorElement.click();
saveButton.click();
console.log("ghj");
}
}
});
}, 3000);
}
}
if (count == 0) {
previewbutton.href = '#';
previewbutton.href = "QuestionPreview.html?filename=" + FileName;
}
// check_Empty_Question();
// const saveButto = document.getElementById('SaveButton');
// saveButto.click();
} else {
const saveButton = document.getElementById('SaveButton');
if (saveButton) {
saveButton.click();
setTimeout(function() {
var popupInput = document.getElementById("swal2-input");
var submitButton = document.querySelector(".swal2-confirm.swal2-styled");
if (submitButton) {
submitButton.addEventListener("click", function() {
FileName = popupInput.value;
FileName += ".xml"
if(FileName){
var anchorElement = document.getElementById("editPreview");
if (anchorElement) {
anchorElement.click();
}
}
});
}
});
}, 1000);
}, 1000);
}
}
}
})
@ -1576,7 +1637,7 @@ function loadXML(xmlFileName) {
// Function for Save the XML File
function saveFile(flag=0) {
console.log("SaveFile");
var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
var count = "";
@ -1594,6 +1655,7 @@ function saveFile(flag=0) {
if (count > 0) {
check_Empty_Question()
console.log("check Empty");
} else {
html2json();
json2xml();
@ -2336,7 +2398,7 @@ function addQuestionGroup(idObj)
var sectionRandomID = localStorage.getItem('sectionId');
var group_question_i = `${idObj.hasOwnProperty('question_group_obj') ? idObj.question_group_obj.question_id : "<p><br></p>"}`
var group_question_id = (group_question_i.replace('<p>','').replace('</p>','').replace('<br>',''))
// console.log(group_question_i);
// console.log(group_question_i);subSection_title_text_1
// console.log(group_question_id);
addQuestionGroup +=
@ -2676,10 +2738,15 @@ markCalculation()
confirmButtonText: 'OK'
});
var textQuestionSerialNo = substringToRemove+QuestionGroup_ID;
check_Remove_Empty_Question(textQuestionSerialNo,1);
element.parentNode.removeChild(element);
// localStorage.removeItem('yourKey');
// console.log(element)
// console.log("Div removed successfully.");
}
// end of find QG level script
@ -2707,7 +2774,7 @@ function groupQuestion(question_id = false, section_id = false , group_question_
// console.log(CorrectAnswer);
const ChoiceGroupFixed_UUID = uuidv4();
console.log('CorrectAnswer', CorrectAnswer);
// console.log('CorrectAnswer', CorrectAnswer);
const ChoiceGroupFixed_UUIDforMultiornot = uuidv4();
// inputAreaCheck(Choice)
@ -4097,6 +4164,7 @@ function collect_Empty_Question_Id(arrayString, ID) {
function check_Empty_Question()
{
console.log("Check Empty Enter");
var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
if (title_id) {
var parsedArray = JSON.parse(title_id);
@ -4104,10 +4172,7 @@ function check_Empty_Question()
parsedArray.forEach(function(Id, index,array) {
if (index === array.length - 1) {
// console.log(Id);
// console.log(document.getElementById(Id));
var idclass= document.getElementById(Id).className;
console.log(idclass)
if ( idclass === 'QuestionTextIdSet' || idclass === 'QuestionsGroupIdset' || idclass === 'QuestionChoiceId' ) {
attrId = document.getElementById(Id).innerHTML
}else if(idclass === 'multipleAnswerorNot'){
@ -4119,18 +4184,22 @@ function check_Empty_Question()
}
if(attrId === '<p><br></p>')
{
console.log("Check empty if");
scrollToElementWithoutLink(Id);
document.getElementById(Id).focus();
}else if(attrId == ''){
console.log("Check empty else if");
scrollToElementWithoutLink(Id);
document.getElementById(Id).focus();
}
else{
console.log("Check empty Last else");
scrollToElementWithoutLink(Id);
document.getElementById(Id).focus();
}
var ele = document.getElementById(Id)
ele.scrollIntoView({ behavior: "smooth", block: "center" });
}
});
}
@ -4149,7 +4218,7 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
if (DeleteElement != 1) {
var a = IdToRemove;
var newVariableWithoutNumbers = a.replace(/\d/g, ''); // This removes all digits
}
}
@ -4171,8 +4240,8 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
const input_text_value = document.getElementById(IdToRemove);
if (newVariableWithoutNumbers == 'removeAndCloneQroupQuestion_') {
attrId= '';
} else {
attrId= 'choice';
} else if(DeleteElement != 1){
attrId = input_text_value.querySelector('.ql-editor')?.innerHTML;
}
var parsedArray = [];
@ -4190,7 +4259,7 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
}
if (Id === IdToRemove && DeleteElement ==0) {
console.log("Id == Idremove");
//console.log("Id == Idremove");
if (attrId !== '<p><br></p>' && attrId !== "") {
parsedArray.splice(i, 1);
i--;
@ -4198,12 +4267,20 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
}else if (DeleteElement) {
console.log("section");
console.log(parsedArray);
// console.log(parsedArray);
if (Id === IdToRemove ) {
parsedArray.splice(i, 1);
console.log(parsedArray);
//console.log(parsedArray);
i--;
}else{
console.log("last part");
}
}else if(Id === IdToRemove){
parsedArray.splice(i, 1);
i--;
}
else{
// console.log("last part");
var newArray = parsedArray.push(IdToRemove);
const newArrayString = JSON.stringify(newArray);
// console.log(newArrayString);
@ -4332,6 +4409,7 @@ function scrollToElementWithoutLink(elementId) {
const element = document.getElementById(elementId);
if (element) {
// console.log(element);
element.scrollIntoView({ behavior: "smooth", block: "center" });
if (modifiedA == 'removeAndCloneQroupQuestion_') {
// alert('Please Choose the Correct Answer')
@ -4343,6 +4421,8 @@ function scrollToElementWithoutLink(elementId) {
confirmButtonText: 'OK'
});
}
// alert(element)
element.focus()
}
@ -5063,6 +5143,7 @@ function findInputByValue(value) {
var fullParentDiv = pa.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
getidoffulldiv(fullParentDiv)
radioButtonselectOne(fullParentDiv)
checkChoicesNotSelect(fullParentDiv)
})
}
}
@ -5071,7 +5152,7 @@ function findInputByValue(value) {
</script>
<script>
<!-- <script>
function removeDuplicatesparams_in_localstorage() {
var existingData = localStorage.getItem('JSON_FOR_EMPTY_QUESTION') ? JSON.parse(localStorage.getItem('JSON_FOR_EMPTY_QUESTION')) : [];
@ -5083,13 +5164,20 @@ function findInputByValue(value) {
}
removeDuplicates();
}
setInterval(removeDuplicatesparams_in_localstorage,2000)
</script>
-->
<!-- this for table insert romove table no border -->
<!-- Start this for RTE Table Insert Romove Table No Border -->
<script>
function addBorderRemoveTable() {
const elements = document.querySelectorAll('[data-value="remove-table"]');
@ -5101,38 +5189,13 @@ function findInputByValue(value) {
}
setInterval(addBorderRemoveTable,2000)
</script>
<!-- End this for RTE Table Insert Romove Table No Border -->
<!-- <script>
document.addEventListener('DOMContentLoaded', function() {
// Introduce a delay of one second (1000 milliseconds) before executing the code
setTimeout(function() {
var multipleAnswers = document.querySelectorAll('.multipleAnswerorNot')
multipleAnswers.forEach(function (multipleAnswer) {
multipleAnswer.checked=false;
console.log(multipleAnswer.checked);
})
}, 1000);
});
</script> -->
<!-- Start this for RTE Table ToolTip Add -->
<script>
function addTitleforTable() {
// const elements = document.querySelectorAll('[aria-controls="ql-picker-options-3"]');
// if (elements) {
// elements.forEach(function (element) {
// element.setAttribute('title', 'Modify Table');
// })
// }
// const elements2 = document.querySelectorAll('[aria-controls="ql-picker-options-2"]');
// if (elements2) {
// elements2.forEach(function (element2) {
// element2.setAttribute('title', 'Add Table');
// })
// }
const elements = document.querySelectorAll('.ql-picker-label');
elements.forEach(function (element) {
@ -5145,16 +5208,52 @@ function findInputByValue(value) {
}
setInterval(addTitleforTable,2000)
</script>
<!-- End this for RTE Table ToolTip Add -->
<!-- <script>
function name(params) {
var elements= document.querySelectorAll('.multipleAnswerorNot')
elements.forEach(function (element) {
console.log(element.checked);
<!-- Start the Choice Question Mandatory Check -->
<script>
function checkChoicesNotSelect(element){
var ChoiceChecks =element.querySelectorAll('.correctAnswerBox')
var count =0;
var array_of_Ids =[];
var ChoiceCount =0 ;
ChoiceChecks.forEach(function (ChoiceCheck) {
if(ChoiceCheck.checked == true){
count= count +1
}
})
if (count == 0) {
var title_i = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
var parsedArra = JSON.parse(title_i);
var againpushlist =[];
if (parsedArra.length != 0) {
parsedArra.forEach(function (para,index){
if (para == element.id) {
ChoiceCount=1;
}
againpushlist.push(para)
if (index == 0) {
againpushlist.push(element.id)
}
})
array_of_Ids=againpushlist;
}else{
againpushlist.push(element.id)
array_of_Ids=againpushlist;
}
const arrayString = JSON.stringify(array_of_Ids);
if (ChoiceCount == 0) {
collect_Empty_Question_Id(arrayString);
}
}
}
setInterval(name,5000)
</script> -->
</script>
<!-- End the Choice Question Mandatory Check -->
</body>
</html>

1311
assets/css/quillTable.css Normal file

File diff suppressed because it is too large Load Diff

View File

@ -303,7 +303,7 @@ function html2json() {
});
// console.log((formData));
console.log((formData));
// console.log(JSON.stringify(formData, null, 1));
localStorage.setItem("json", JSON.stringify((formData)));
console.log(JSON.stringify(formData));

View File

@ -2,7 +2,7 @@ function json2xml() {
// console.clear();
var obj = localStorage.getItem("json");
// console.log(obj);
console.log(obj);
// console.log('***********************************************************');
function createXMLDocument(namespace = null) {
@ -83,6 +83,7 @@ function json2xml() {
var is_math_enabled = createElementWithText(doc, element, 'Math', (question['is_math_enabled'] === true ? 'true' : 'false'), {});
if (question['question_type'] == 'group') {
separateCorrectAnswerFromMcqAsJson(question)
var hasMultipleAnswers = createElementWithText(doc, element, 'HasMultipleAnswers', (question['question_sub_type'] === true ? 'true' : 'false'), {});
var choicesElement = createElementWithText(doc, element, 'Choices', '', {});
for (choice in question['answers']) {
@ -102,6 +103,7 @@ function json2xml() {
function getXMLNodesOfGroupQuestionData(singleQuestion){
console.log(singleQuestion);
//create question group title related xml nodes
var {
doc,
@ -122,7 +124,7 @@ function json2xml() {
// 'No': singleQuestion['group_title'],
// 'Order': 0
// });
var groupQuestionId = createElementWithText(doc, element, 'Text', singleQuestion['group_id']);
var groupQuestionId = createElementWithText(doc, element, 'Text', singleQuestion['question_id']);
var groupQuestionTitle = createElementWithText(doc, element, 'Text', singleQuestion['group_title']);
var groupQuestionDesc = createElementWithText(doc, element, 'Subtext', singleQuestion['group_description']);
var groupQuestionMarks = createElementWithText(doc, element, 'Marks', singleQuestion['group_marks']);
@ -133,6 +135,7 @@ function json2xml() {
//gather questions data inside question group
if (singleQuestion['questions'].length != 0) {
var tempGroupQuestions = singleQuestion['questions'];
console.log(tempGroupQuestions);
//looping each questions indise question group and attach it to group items node
for (gquestion in tempGroupQuestions) {
var singleGQuestion = tempGroupQuestions[gquestion];
@ -214,18 +217,20 @@ function json2xml() {
//for Separate Correct Answer From MCQ
if(singleQuestion.question_type == 'group'){
console.log(singleQuestion);
separateCorrectAnswerFromMcqAsJson(singleQuestion)
}
if (singleQuestion.hasOwnProperty('question_type')) // normal questions
{
var singleQuestionElement = getXMLNodesOfQuestionData(singleQuestion);
//attach each single question into section item node
sectionItemElement.appendChild(singleQuestionElement);
} else // handle question group
{
var groupQuestionElement = getXMLNodesOfGroupQuestionData(singleQuestion);
sectionItemElement.appendChild(groupQuestionElement);
}
@ -250,6 +255,7 @@ const outputJson = { questions: [] };
function separateCorrectAnswerFromMcqAsJson(tempSection) {
console.log(tempSection);
const questionId = tempSection.choice_question_uuid;
const answers = tempSection.correct_answer;
@ -262,7 +268,7 @@ outputJson.questions.push({
// Convert the output object to JSON string
const outputJsonString = JSON.stringify(outputJson, null, 2);
localStorage.setItem("Correct_Answer_Json", outputJsonString);
// console.log('outputJsonString : ', outputJsonString);
console.log('outputJsonString : ', outputJsonString);
}

View File

@ -22,9 +22,9 @@ function navpane() {
// return html.replace(/<p>/g, '').replace(/<\/p>/g, '');
var html = html.replace(/<[^>]*>/g, '');
// if (html.length >= 30) {
// html=html.slice(0, 25) + '...';
// }
if (html.length >= 30) {
html=html.slice(0,30 ) + '...';
}
return html
}
@ -53,7 +53,7 @@ function navpane() {
// Truncate the content
var truncatedContent = "";
if(textContent.length > 20)
if(textContent.length > 30)
{
truncatedContent = textContent.substring(0, maxLength) + '...';
}
@ -69,7 +69,7 @@ function navpane() {
const heading = document.createElement('a');
heading.style.color = '#1D3557';
// const truncatedTitle = treeTitle.length > 20 ? treeTitle.substring(0, 20) + '.....' : treeTitle;
const truncatedTitle = treeTitle.length > 30 ? treeTitle + '..' : treeTitle;
const truncatedTitle = treeTitle.length > 30 ? treeTitle + '' : treeTitle;
heading.innerHTML = truncatedTitle;
container.appendChild(heading);
createTree(data, container);
@ -493,7 +493,7 @@ function navpane() {
// }
questionLink.innerHTML = removeTagsAndTruncate(nodeData.question, 20);
questionLink.innerHTML = removeTagsAndTruncate(nodeData.question, 25);
// console.log('questionLink : ', questionLink)

27
package-lock.json generated
View File

@ -364,9 +364,9 @@
}
},
"node_modules/@types/node": {
"version": "18.18.13",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.13.tgz",
"integrity": "sha512-vXYZGRrSCreZmq1rEjMRLXJhiy8MrIeVasx+PCVlP414N7CJLHnMf+juVvjdprHyH+XRy3zKZLHeNueOpJCn0g==",
"version": "18.19.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.2.tgz",
"integrity": "sha512-6wzfBdbWpe8QykUkXBjtmO3zITA0A3FIjoy+in0Y2K4KrCiRhNYJIdwAPDffZ3G6GnaKaSLSEa9ZuORLfEoiwg==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
@ -403,7 +403,8 @@
"node_modules/abab": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
"integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA=="
"integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==",
"deprecated": "Use your platform's native atob() and btoa() methods instead"
},
"node_modules/acorn": {
"version": "5.7.4",
@ -1288,9 +1289,9 @@
}
},
"node_modules/electron": {
"version": "26.6.1",
"resolved": "https://registry.npmjs.org/electron/-/electron-26.6.1.tgz",
"integrity": "sha512-4Vz9u0Jt/khPa/en2l8Jv6SWEfsK/ieWYtchl5j0clbNSjdeTucnEFOhz9B9WwsAmfQjxBnpuMZpmdBuyxq+wg==",
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/electron/-/electron-26.6.2.tgz",
"integrity": "sha512-OWxzVtCJwN9en34bnLupw2dTRsDTBzQZyz0Wx0zjeJ2wgUVlpqavtVDpt50aaJpJR/5GcHH/apIa3uvGWz/ABQ==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@ -1384,9 +1385,9 @@
}
},
"node_modules/electron-packager/node_modules/fs-extra": {
"version": "11.1.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz",
"integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==",
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
"integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
"dev": true,
"dependencies": {
"graceful-fs": "^4.2.0",
@ -3770,9 +3771,9 @@
}
},
"node_modules/quill-better-table": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/quill-better-table/-/quill-better-table-1.1.0.tgz",
"integrity": "sha512-B0ZZGsPzWpLEOlZ7oPeBflSxmTd4dCBY2TvyCaIqVsAGOHRyRk2hkwLJX52itBNFqJ6+2XH70ev/mTEU0zkZDA=="
"version": "1.2.10",
"resolved": "https://registry.npmjs.org/quill-better-table/-/quill-better-table-1.2.10.tgz",
"integrity": "sha512-CFwxAQzt4EPCQuynQ65R/FU7Yu//kcDBb/rmBBOsFfO758+q50zvG/PDt4Lenv9DcrSgwnyNkfo4yeA5fzzVYQ=="
},
"node_modules/quill-better-table-picker": {
"version": "1.0.2",

View File

@ -22,9 +22,11 @@ function getAttributesOfXMLNode(node)
function getQuestionsNodes(questionNode,type)
{
console.log(type);
var questionObj = {};
if(type == 1)
{
console.log(questionNode);
questionObj['question_id'] = questionNode.childNodes[0].firstChild !== null? questionNode.childNodes[0].firstChild.nodeValue : "" ;
questionObj['question'] = questionNode.childNodes[1].firstChild.nodeValue;
questionObj['question_description'] = (questionNode.childNodes[2].firstChild !== null? questionNode.childNodes[2].firstChild.nodeValue : "");
@ -52,13 +54,12 @@ function getQuestionsNodes(questionNode,type)
questionObj['correct_answer'] = [];
var choiceList = questionNode.childNodes[7].childNodes;
console.log(questionNode);
if(choiceList.length > 0)
{
for (let k = 0; k < choiceList.length ;k++)
{
var tempChoiceobj = {};
// console.log(choiceList)
tempChoiceobj['id'] = choiceList[k].childNodes[0].firstChild.nodeValue;
tempChoiceobj['no'] = (choiceList[k].childNodes[1].firstChild !== null ? choiceList[k].childNodes[1].firstChild.nodeValue : "");
tempChoiceobj['choice_name'] = (choiceList[k].childNodes[2].firstChild !== null ? choiceList[k].childNodes[2].firstChild.nodeValue : "");
@ -122,14 +123,17 @@ function getQuestionGroupNodes(questionGroup)
var questionType = questionList[q].getAttribute("xsi:type");
if(questionType == 'DescriptiveQuestion')
{
console.log(questionList[q]);
questionGroupObj['questions'].push(getQuestionsNodes(questionList[q],1));
}
else if(questionType == 'MultiChoiceQuestion')
{
console.log(questionList[q]);
questionGroupObj['questions'].push(getQuestionsNodes(questionList[q],2));
}
else
{
console.log(questionList[q]);
questionGroupObj['questions'].push(getQuestionGroupNodes(questionList[q]));
}
@ -203,7 +207,7 @@ jsonObj['sections'] = [];
var jsonData = JSON.stringify(jsonObj);
// console.log('Xml to Json Conversion ');
// console.log('jsonData : ', jsonData);
// console.log(jsonObj);
console.log(jsonObj);
jsonToHtml(jsonObj);
// console.log(jsonToHtml(jsonObj))
// localStorage.removeItem('json_Decode_Data_For_Mcq_Crt_Ans');