code merge : RV
This commit is contained in:
commit
b8cffded4d
@ -164,6 +164,8 @@ function QuestionPaperPreview(jsonData){
|
|||||||
GroupQuestionTilteAlign =40
|
GroupQuestionTilteAlign =40
|
||||||
}else if(question_id_length == 6) {
|
}else if(question_id_length == 6) {
|
||||||
GroupQuestionTilteAlign =54
|
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>')
|
// 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_marks_attmpt">${questionGroupAttempt}${questionGroupMark}</div>`;
|
||||||
// questionPaper += `<div class="group_attempt_any">${questionGroupAttempt}</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 answerA = answers[i] ? `${optionA}. ${convertToLatex(answers[i].choice_name, math)}` : '';
|
||||||
// const answerB = answers[i + 1] ? `${optionB}. ${convertToLatex(answers[i + 1].choice_name, mathstatus)}` : '';
|
// const answerB = answers[i + 1] ? `${optionB}. ${convertToLatex(answers[i + 1].choice_name, mathstatus)}` : '';
|
||||||
if (multipleAnswer == 'false') {
|
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{
|
}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>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,34 +44,61 @@
|
|||||||
<!-- <link href='https://fonts.googleapis.com/css?family=Titillium+Web:400,600' rel='stylesheet' type='text/css'> -->
|
<!-- <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="./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="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>
|
<style>
|
||||||
|
.ql-align-right-add{
|
||||||
table {
|
display: flow-root;
|
||||||
border-collapse: collapse; /* Set to 'collapse' for adjacent cell borders to collapse into one */
|
}
|
||||||
text-indent: 0; /* Reset text indentation */
|
.ql-align-left-add{
|
||||||
border-spacing: 0; /* Set to '0' to eliminate any spacing between cells */
|
/* margin-left: -704px !important; */
|
||||||
}
|
margin-top: 22px;
|
||||||
table td{
|
display: flex;
|
||||||
border: 1px solid black !important;
|
}
|
||||||
|
.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{
|
.question-Group-Description{
|
||||||
margin-top: -14px;
|
margin-top: -14px;
|
||||||
}
|
}
|
||||||
@ -439,33 +466,32 @@ color: #1d3557 !important;
|
|||||||
<script src="decode.js"></script>
|
<script src="decode.js"></script>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$("#overlay").show();
|
$("#overlay").show();
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path =require('path');
|
const path =require('path');
|
||||||
|
// require('dotenv').config();
|
||||||
|
//get value from .env
|
||||||
|
|
||||||
// require('dotenv').config();
|
// const convertBaseToString =require('./envConvertBasetoString');
|
||||||
//get value from .env
|
var configObject = convertBaseToString();
|
||||||
|
|
||||||
// const convertBaseToString =require('./envConvertBasetoString');
|
const isEncrypted = configObject.ENCRYPTED.trim();
|
||||||
var configObject = convertBaseToString();
|
|
||||||
|
|
||||||
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
|
//Preview edit button
|
||||||
const params = new URLSearchParams(url.search);// Create a URLSearchParams object from the query string
|
document.getElementById("editlink").href = "addform.html?filename=" + xmlFileName;
|
||||||
const xmlFileName = params.get('filename');// Get the value of a specific parameter
|
|
||||||
loadXML(xmlFileName)
|
|
||||||
|
|
||||||
//Preview edit button
|
//XmlPath get from .env
|
||||||
document.getElementById("editlink").href = "addform.html?filename=" + xmlFileName;
|
|
||||||
|
|
||||||
//XmlPath get from .env
|
// const decode = require('./decode');
|
||||||
|
|
||||||
// const decode = require('./decode');
|
|
||||||
|
|
||||||
// Function to load XML from a file
|
// Function to load XML from a file
|
||||||
function loadXML(xmlFileName) {
|
function loadXML(xmlFileName) {
|
||||||
@ -559,71 +585,132 @@ try {
|
|||||||
|
|
||||||
</script>
|
</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>
|
<script>
|
||||||
function thisclassnameWhenPaste() {
|
$(document).ready(function() {
|
||||||
var elements = document.querySelectorAll('.ql-align-justify');
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
293
addform.html
293
addform.html
@ -54,12 +54,26 @@
|
|||||||
<script id="MathJax-script" async src="./node_modules/mathjax/es5/tex-mml-chtml.js"></script>
|
<script id="MathJax-script" async src="./node_modules/mathjax/es5/tex-mml-chtml.js"></script>
|
||||||
|
|
||||||
<style>
|
<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"] {
|
/* [data-value="remove-table"] {
|
||||||
border: 1px solid black !important;
|
border: 1px solid black !important;
|
||||||
} */
|
} */
|
||||||
.ql-picker-options{
|
/* .ql-picker-options{
|
||||||
width: 310px !important;
|
width: 310px !important;
|
||||||
}
|
} */
|
||||||
.ql-picker-item{
|
.ql-picker-item{
|
||||||
width: 95px !important;
|
width: 95px !important;
|
||||||
}
|
}
|
||||||
@ -823,7 +837,7 @@ h1.title{
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="dashboard.html"><img class="addPageMenu" src="assets/images/home.svg" alt="">Home</a></li>
|
<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="#" 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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -1329,11 +1343,19 @@ function clearMessage() {
|
|||||||
var mathJaxContainer = document.getElementById('workarea_math');
|
var mathJaxContainer = document.getElementById('workarea_math');
|
||||||
var quillContainer = document.getElementById('workarea');
|
var quillContainer = document.getElementById('workarea');
|
||||||
|
|
||||||
var quillInstance = new Quill('#workarea');
|
var quillInstance = quillContainer.querySelector('.ql-editor');
|
||||||
quillInstance.setText('');
|
|
||||||
|
if (quillInstance.innerHTML.trim() !== '<p><br></p>') {
|
||||||
|
quillInstance.innerHTML = '<p><br></p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// var quillInstance = new Quill('#workarea');
|
||||||
|
// quillInstance.setText('');
|
||||||
|
|
||||||
// console.log(mathJaxContainer);
|
// console.log(mathJaxContainer);
|
||||||
// console.log(quillContainer);
|
// console.log(quillContainer);
|
||||||
|
|
||||||
mathJaxContainer.value = "";
|
mathJaxContainer.value = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1440,51 +1462,90 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
|
|
||||||
//EditPreview and Create Preview
|
//EditPreview and Create Preview
|
||||||
var previewbutton = document.getElementById("editPreview");
|
var previewbutton = document.getElementById("editPreview");
|
||||||
previewbutton.addEventListener("click", async () => {
|
// previewbutton.addEventListener("click", async () => {
|
||||||
if (FileName)
|
function editPreview() {
|
||||||
{
|
var title_id = localStorage.getItem('JSON_FOR_EMPTY_QUESTION');
|
||||||
const saveButton = document.getElementById('SaveButton');
|
|
||||||
if (saveButton) {
|
var count = "";//XmlPath get from .env
|
||||||
saveButton.click();
|
|
||||||
setTimeout(function() {
|
// const decode = require('./decode');
|
||||||
var popupInput = document.getElementById("swal2-input");
|
if(title_id !== '' && title_id !== null)
|
||||||
var submitButton = document.querySelector(".swal2-confirm.swal2-styled");
|
{
|
||||||
submitButton.addEventListener("click", function() {
|
var parsedArray = JSON.parse(title_id);
|
||||||
FileName = popupInput.value;
|
var count = parsedArray.length;
|
||||||
FileName += ".xml"
|
// console.log('count - ' + count)
|
||||||
if(FileName){
|
|
||||||
var anchorElement = document.getElementById("editPreview");
|
|
||||||
if (anchorElement) {
|
|
||||||
anchorElement.click();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, 3000);
|
|
||||||
}
|
}
|
||||||
previewbutton.href = "QuestionPreview.html?filename=" + FileName;
|
else
|
||||||
}
|
{
|
||||||
else
|
count = 0
|
||||||
{
|
}
|
||||||
const saveButton = document.getElementById('SaveButton');
|
|
||||||
if (saveButton) {
|
if (FileName) {
|
||||||
saveButton.click();
|
console.log("if");
|
||||||
setTimeout(function() {
|
const saveButton = document.getElementById('SaveButton');
|
||||||
var popupInput = document.getElementById("swal2-input");
|
if (saveButton) {
|
||||||
var submitButton = document.querySelector(".swal2-confirm.swal2-styled");
|
// if (count != 0) {
|
||||||
submitButton.addEventListener("click", function() {
|
// const Swal = require('sweetalert2');
|
||||||
FileName = popupInput.value;
|
// Swal.fire({
|
||||||
FileName += ".xml"
|
// title : 'Alert!!!',
|
||||||
if(FileName){
|
// text : 'First Save And Preview.',
|
||||||
var anchorElement = document.getElementById("editPreview");
|
// icon : 'info',
|
||||||
if (anchorElement) {
|
// confirmButtonText: 'OK'
|
||||||
anchorElement.click();
|
// });
|
||||||
|
// }
|
||||||
|
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 for Save the XML File
|
||||||
function saveFile(flag=0) {
|
function saveFile(flag=0) {
|
||||||
|
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 = "";
|
||||||
@ -1594,6 +1655,7 @@ function saveFile(flag=0) {
|
|||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
check_Empty_Question()
|
check_Empty_Question()
|
||||||
|
console.log("check Empty");
|
||||||
} else {
|
} else {
|
||||||
html2json();
|
html2json();
|
||||||
json2xml();
|
json2xml();
|
||||||
@ -2336,7 +2398,7 @@ function addQuestionGroup(idObj)
|
|||||||
var sectionRandomID = localStorage.getItem('sectionId');
|
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_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>',''))
|
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);
|
// console.log(group_question_id);
|
||||||
|
|
||||||
addQuestionGroup +=
|
addQuestionGroup +=
|
||||||
@ -2676,10 +2738,15 @@ markCalculation()
|
|||||||
confirmButtonText: 'OK'
|
confirmButtonText: 'OK'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var textQuestionSerialNo = substringToRemove+QuestionGroup_ID;
|
||||||
|
check_Remove_Empty_Question(textQuestionSerialNo,1);
|
||||||
|
|
||||||
element.parentNode.removeChild(element);
|
element.parentNode.removeChild(element);
|
||||||
// localStorage.removeItem('yourKey');
|
// localStorage.removeItem('yourKey');
|
||||||
// console.log(element)
|
// console.log(element)
|
||||||
// console.log("Div removed successfully.");
|
// console.log("Div removed successfully.");
|
||||||
|
|
||||||
}
|
}
|
||||||
// end of find QG level script
|
// end of find QG level script
|
||||||
|
|
||||||
@ -2707,7 +2774,7 @@ function groupQuestion(question_id = false, section_id = false , group_question_
|
|||||||
// console.log(CorrectAnswer);
|
// console.log(CorrectAnswer);
|
||||||
const ChoiceGroupFixed_UUID = uuidv4();
|
const ChoiceGroupFixed_UUID = uuidv4();
|
||||||
|
|
||||||
console.log('CorrectAnswer', CorrectAnswer);
|
// console.log('CorrectAnswer', CorrectAnswer);
|
||||||
|
|
||||||
const ChoiceGroupFixed_UUIDforMultiornot = uuidv4();
|
const ChoiceGroupFixed_UUIDforMultiornot = uuidv4();
|
||||||
// inputAreaCheck(Choice)
|
// inputAreaCheck(Choice)
|
||||||
@ -4097,6 +4164,7 @@ function collect_Empty_Question_Id(arrayString, ID) {
|
|||||||
|
|
||||||
function check_Empty_Question()
|
function check_Empty_Question()
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
@ -4104,10 +4172,7 @@ function check_Empty_Question()
|
|||||||
parsedArray.forEach(function(Id, index,array) {
|
parsedArray.forEach(function(Id, index,array) {
|
||||||
|
|
||||||
if (index === array.length - 1) {
|
if (index === array.length - 1) {
|
||||||
// console.log(Id);
|
|
||||||
// console.log(document.getElementById(Id));
|
|
||||||
var idclass= document.getElementById(Id).className;
|
var idclass= document.getElementById(Id).className;
|
||||||
console.log(idclass)
|
|
||||||
if ( idclass === 'QuestionTextIdSet' || idclass === 'QuestionsGroupIdset' || idclass === 'QuestionChoiceId' ) {
|
if ( idclass === 'QuestionTextIdSet' || idclass === 'QuestionsGroupIdset' || idclass === 'QuestionChoiceId' ) {
|
||||||
attrId = document.getElementById(Id).innerHTML
|
attrId = document.getElementById(Id).innerHTML
|
||||||
}else if(idclass === 'multipleAnswerorNot'){
|
}else if(idclass === 'multipleAnswerorNot'){
|
||||||
@ -4119,18 +4184,22 @@ function check_Empty_Question()
|
|||||||
}
|
}
|
||||||
if(attrId === '<p><br></p>')
|
if(attrId === '<p><br></p>')
|
||||||
{
|
{
|
||||||
|
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");
|
||||||
|
|
||||||
scrollToElementWithoutLink(Id);
|
scrollToElementWithoutLink(Id);
|
||||||
document.getElementById(Id).focus();
|
document.getElementById(Id).focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else{
|
else{
|
||||||
|
console.log("Check empty Last else");
|
||||||
scrollToElementWithoutLink(Id);
|
scrollToElementWithoutLink(Id);
|
||||||
document.getElementById(Id).focus();
|
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) {
|
if (DeleteElement != 1) {
|
||||||
var a = IdToRemove;
|
var a = IdToRemove;
|
||||||
var newVariableWithoutNumbers = a.replace(/\d/g, ''); // This removes all digits
|
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);
|
const input_text_value = document.getElementById(IdToRemove);
|
||||||
|
|
||||||
if (newVariableWithoutNumbers == 'removeAndCloneQroupQuestion_') {
|
if (newVariableWithoutNumbers == 'removeAndCloneQroupQuestion_') {
|
||||||
attrId= '';
|
attrId= 'choice';
|
||||||
} else {
|
} else if(DeleteElement != 1){
|
||||||
attrId = input_text_value.querySelector('.ql-editor')?.innerHTML;
|
attrId = input_text_value.querySelector('.ql-editor')?.innerHTML;
|
||||||
}
|
}
|
||||||
var parsedArray = [];
|
var parsedArray = [];
|
||||||
@ -4190,7 +4259,7 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Id === IdToRemove && DeleteElement ==0) {
|
if (Id === IdToRemove && DeleteElement ==0) {
|
||||||
console.log("Id == Idremove");
|
//console.log("Id == Idremove");
|
||||||
if (attrId !== '<p><br></p>' && attrId !== "") {
|
if (attrId !== '<p><br></p>' && attrId !== "") {
|
||||||
parsedArray.splice(i, 1);
|
parsedArray.splice(i, 1);
|
||||||
i--;
|
i--;
|
||||||
@ -4198,12 +4267,20 @@ 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 ) {
|
||||||
|
|
||||||
|
|
||||||
parsedArray.splice(i, 1);
|
parsedArray.splice(i, 1);
|
||||||
console.log(parsedArray);
|
//console.log(parsedArray);
|
||||||
i--;
|
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);
|
var newArray = parsedArray.push(IdToRemove);
|
||||||
const newArrayString = JSON.stringify(newArray);
|
const newArrayString = JSON.stringify(newArray);
|
||||||
// console.log(newArrayString);
|
// console.log(newArrayString);
|
||||||
@ -4332,6 +4409,7 @@ function scrollToElementWithoutLink(elementId) {
|
|||||||
|
|
||||||
const element = document.getElementById(elementId);
|
const element = document.getElementById(elementId);
|
||||||
if (element) {
|
if (element) {
|
||||||
|
// console.log(element);
|
||||||
element.scrollIntoView({ behavior: "smooth", block: "center" });
|
element.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||||
if (modifiedA == 'removeAndCloneQroupQuestion_') {
|
if (modifiedA == 'removeAndCloneQroupQuestion_') {
|
||||||
// alert('Please Choose the Correct Answer')
|
// alert('Please Choose the Correct Answer')
|
||||||
@ -4343,6 +4421,8 @@ function scrollToElementWithoutLink(elementId) {
|
|||||||
confirmButtonText: 'OK'
|
confirmButtonText: 'OK'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// alert(element)
|
||||||
|
|
||||||
element.focus()
|
element.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5063,6 +5143,7 @@ function findInputByValue(value) {
|
|||||||
var fullParentDiv = pa.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
|
var fullParentDiv = pa.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
|
||||||
getidoffulldiv(fullParentDiv)
|
getidoffulldiv(fullParentDiv)
|
||||||
radioButtonselectOne(fullParentDiv)
|
radioButtonselectOne(fullParentDiv)
|
||||||
|
checkChoicesNotSelect(fullParentDiv)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5071,7 +5152,7 @@ function findInputByValue(value) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<!-- <script>
|
||||||
function removeDuplicatesparams_in_localstorage() {
|
function removeDuplicatesparams_in_localstorage() {
|
||||||
var existingData = localStorage.getItem('JSON_FOR_EMPTY_QUESTION') ? JSON.parse(localStorage.getItem('JSON_FOR_EMPTY_QUESTION')) : [];
|
var existingData = localStorage.getItem('JSON_FOR_EMPTY_QUESTION') ? JSON.parse(localStorage.getItem('JSON_FOR_EMPTY_QUESTION')) : [];
|
||||||
|
|
||||||
@ -5083,13 +5164,20 @@ function findInputByValue(value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeDuplicates();
|
removeDuplicates();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
setInterval(removeDuplicatesparams_in_localstorage,2000)
|
setInterval(removeDuplicatesparams_in_localstorage,2000)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
<!-- this for table insert romove table no border -->
|
|
||||||
|
|
||||||
|
<!-- Start this for RTE Table Insert Romove Table No Border -->
|
||||||
<script>
|
<script>
|
||||||
function addBorderRemoveTable() {
|
function addBorderRemoveTable() {
|
||||||
const elements = document.querySelectorAll('[data-value="remove-table"]');
|
const elements = document.querySelectorAll('[data-value="remove-table"]');
|
||||||
@ -5101,38 +5189,13 @@ function findInputByValue(value) {
|
|||||||
}
|
}
|
||||||
setInterval(addBorderRemoveTable,2000)
|
setInterval(addBorderRemoveTable,2000)
|
||||||
</script>
|
</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>
|
<script>
|
||||||
function addTitleforTable() {
|
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');
|
const elements = document.querySelectorAll('.ql-picker-label');
|
||||||
|
|
||||||
elements.forEach(function (element) {
|
elements.forEach(function (element) {
|
||||||
@ -5145,16 +5208,52 @@ function findInputByValue(value) {
|
|||||||
}
|
}
|
||||||
setInterval(addTitleforTable,2000)
|
setInterval(addTitleforTable,2000)
|
||||||
</script>
|
</script>
|
||||||
|
<!-- End this for RTE Table ToolTip Add -->
|
||||||
|
|
||||||
<!-- <script>
|
|
||||||
function name(params) {
|
|
||||||
var elements= document.querySelectorAll('.multipleAnswerorNot')
|
<!-- Start the Choice Question Mandatory Check -->
|
||||||
elements.forEach(function (element) {
|
<script>
|
||||||
console.log(element.checked);
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
1311
assets/css/quillTable.css
Normal file
1311
assets/css/quillTable.css
Normal file
File diff suppressed because it is too large
Load Diff
@ -303,7 +303,7 @@ function html2json() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log((formData));
|
console.log((formData));
|
||||||
// console.log(JSON.stringify(formData, null, 1));
|
// console.log(JSON.stringify(formData, null, 1));
|
||||||
localStorage.setItem("json", JSON.stringify((formData)));
|
localStorage.setItem("json", JSON.stringify((formData)));
|
||||||
console.log(JSON.stringify(formData));
|
console.log(JSON.stringify(formData));
|
||||||
|
|||||||
14
json2xml.js
14
json2xml.js
@ -2,7 +2,7 @@ function json2xml() {
|
|||||||
// console.clear();
|
// console.clear();
|
||||||
var obj = localStorage.getItem("json");
|
var obj = localStorage.getItem("json");
|
||||||
|
|
||||||
// console.log(obj);
|
console.log(obj);
|
||||||
// console.log('***********************************************************');
|
// console.log('***********************************************************');
|
||||||
|
|
||||||
function createXMLDocument(namespace = null) {
|
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'), {});
|
var is_math_enabled = createElementWithText(doc, element, 'Math', (question['is_math_enabled'] === true ? 'true' : 'false'), {});
|
||||||
|
|
||||||
if (question['question_type'] == 'group') {
|
if (question['question_type'] == 'group') {
|
||||||
|
separateCorrectAnswerFromMcqAsJson(question)
|
||||||
var hasMultipleAnswers = createElementWithText(doc, element, 'HasMultipleAnswers', (question['question_sub_type'] === true ? 'true' : 'false'), {});
|
var hasMultipleAnswers = createElementWithText(doc, element, 'HasMultipleAnswers', (question['question_sub_type'] === true ? 'true' : 'false'), {});
|
||||||
var choicesElement = createElementWithText(doc, element, 'Choices', '', {});
|
var choicesElement = createElementWithText(doc, element, 'Choices', '', {});
|
||||||
for (choice in question['answers']) {
|
for (choice in question['answers']) {
|
||||||
@ -102,6 +103,7 @@ function json2xml() {
|
|||||||
|
|
||||||
function getXMLNodesOfGroupQuestionData(singleQuestion){
|
function getXMLNodesOfGroupQuestionData(singleQuestion){
|
||||||
|
|
||||||
|
console.log(singleQuestion);
|
||||||
//create question group title related xml nodes
|
//create question group title related xml nodes
|
||||||
var {
|
var {
|
||||||
doc,
|
doc,
|
||||||
@ -122,7 +124,7 @@ function json2xml() {
|
|||||||
// 'No': singleQuestion['group_title'],
|
// 'No': singleQuestion['group_title'],
|
||||||
// 'Order': 0
|
// '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 groupQuestionTitle = createElementWithText(doc, element, 'Text', singleQuestion['group_title']);
|
||||||
var groupQuestionDesc = createElementWithText(doc, element, 'Subtext', singleQuestion['group_description']);
|
var groupQuestionDesc = createElementWithText(doc, element, 'Subtext', singleQuestion['group_description']);
|
||||||
var groupQuestionMarks = createElementWithText(doc, element, 'Marks', singleQuestion['group_marks']);
|
var groupQuestionMarks = createElementWithText(doc, element, 'Marks', singleQuestion['group_marks']);
|
||||||
@ -133,6 +135,7 @@ function json2xml() {
|
|||||||
//gather questions data inside question group
|
//gather questions data inside question group
|
||||||
if (singleQuestion['questions'].length != 0) {
|
if (singleQuestion['questions'].length != 0) {
|
||||||
var tempGroupQuestions = singleQuestion['questions'];
|
var tempGroupQuestions = singleQuestion['questions'];
|
||||||
|
console.log(tempGroupQuestions);
|
||||||
//looping each questions indise question group and attach it to group items node
|
//looping each questions indise question group and attach it to group items node
|
||||||
for (gquestion in tempGroupQuestions) {
|
for (gquestion in tempGroupQuestions) {
|
||||||
var singleGQuestion = tempGroupQuestions[gquestion];
|
var singleGQuestion = tempGroupQuestions[gquestion];
|
||||||
@ -214,18 +217,20 @@ function json2xml() {
|
|||||||
|
|
||||||
//for Separate Correct Answer From MCQ
|
//for Separate Correct Answer From MCQ
|
||||||
if(singleQuestion.question_type == 'group'){
|
if(singleQuestion.question_type == 'group'){
|
||||||
|
console.log(singleQuestion);
|
||||||
separateCorrectAnswerFromMcqAsJson(singleQuestion)
|
separateCorrectAnswerFromMcqAsJson(singleQuestion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (singleQuestion.hasOwnProperty('question_type')) // normal questions
|
if (singleQuestion.hasOwnProperty('question_type')) // normal questions
|
||||||
{
|
{
|
||||||
|
|
||||||
var singleQuestionElement = getXMLNodesOfQuestionData(singleQuestion);
|
var singleQuestionElement = getXMLNodesOfQuestionData(singleQuestion);
|
||||||
//attach each single question into section item node
|
//attach each single question into section item node
|
||||||
sectionItemElement.appendChild(singleQuestionElement);
|
sectionItemElement.appendChild(singleQuestionElement);
|
||||||
} else // handle question group
|
} else // handle question group
|
||||||
{
|
{
|
||||||
|
|
||||||
var groupQuestionElement = getXMLNodesOfGroupQuestionData(singleQuestion);
|
var groupQuestionElement = getXMLNodesOfGroupQuestionData(singleQuestion);
|
||||||
sectionItemElement.appendChild(groupQuestionElement);
|
sectionItemElement.appendChild(groupQuestionElement);
|
||||||
}
|
}
|
||||||
@ -250,6 +255,7 @@ const outputJson = { questions: [] };
|
|||||||
|
|
||||||
function separateCorrectAnswerFromMcqAsJson(tempSection) {
|
function separateCorrectAnswerFromMcqAsJson(tempSection) {
|
||||||
|
|
||||||
|
console.log(tempSection);
|
||||||
const questionId = tempSection.choice_question_uuid;
|
const questionId = tempSection.choice_question_uuid;
|
||||||
const answers = tempSection.correct_answer;
|
const answers = tempSection.correct_answer;
|
||||||
|
|
||||||
@ -262,7 +268,7 @@ outputJson.questions.push({
|
|||||||
// Convert the output object to JSON string
|
// Convert the output object to JSON string
|
||||||
const outputJsonString = JSON.stringify(outputJson, null, 2);
|
const outputJsonString = JSON.stringify(outputJson, null, 2);
|
||||||
localStorage.setItem("Correct_Answer_Json", outputJsonString);
|
localStorage.setItem("Correct_Answer_Json", outputJsonString);
|
||||||
// console.log('outputJsonString : ', outputJsonString);
|
console.log('outputJsonString : ', outputJsonString);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
nav_pane.js
12
nav_pane.js
@ -22,9 +22,9 @@ function navpane() {
|
|||||||
// return html.replace(/<p>/g, '').replace(/<\/p>/g, '');
|
// return html.replace(/<p>/g, '').replace(/<\/p>/g, '');
|
||||||
|
|
||||||
var html = html.replace(/<[^>]*>/g, '');
|
var html = html.replace(/<[^>]*>/g, '');
|
||||||
// if (html.length >= 30) {
|
if (html.length >= 30) {
|
||||||
// html=html.slice(0, 25) + '...';
|
html=html.slice(0,30 ) + '...';
|
||||||
// }
|
}
|
||||||
return html
|
return html
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ function navpane() {
|
|||||||
|
|
||||||
// Truncate the content
|
// Truncate the content
|
||||||
var truncatedContent = "";
|
var truncatedContent = "";
|
||||||
if(textContent.length > 20)
|
if(textContent.length > 30)
|
||||||
{
|
{
|
||||||
truncatedContent = textContent.substring(0, maxLength) + '...';
|
truncatedContent = textContent.substring(0, maxLength) + '...';
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ function navpane() {
|
|||||||
const heading = document.createElement('a');
|
const heading = document.createElement('a');
|
||||||
heading.style.color = '#1D3557';
|
heading.style.color = '#1D3557';
|
||||||
// const truncatedTitle = treeTitle.length > 20 ? treeTitle.substring(0, 20) + '.....' : treeTitle;
|
// 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;
|
heading.innerHTML = truncatedTitle;
|
||||||
container.appendChild(heading);
|
container.appendChild(heading);
|
||||||
createTree(data, container);
|
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)
|
// console.log('questionLink : ', questionLink)
|
||||||
|
|||||||
27
package-lock.json
generated
27
package-lock.json
generated
@ -364,9 +364,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "18.18.13",
|
"version": "18.19.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.13.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.2.tgz",
|
||||||
"integrity": "sha512-vXYZGRrSCreZmq1rEjMRLXJhiy8MrIeVasx+PCVlP414N7CJLHnMf+juVvjdprHyH+XRy3zKZLHeNueOpJCn0g==",
|
"integrity": "sha512-6wzfBdbWpe8QykUkXBjtmO3zITA0A3FIjoy+in0Y2K4KrCiRhNYJIdwAPDffZ3G6GnaKaSLSEa9ZuORLfEoiwg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~5.26.4"
|
"undici-types": "~5.26.4"
|
||||||
@ -403,7 +403,8 @@
|
|||||||
"node_modules/abab": {
|
"node_modules/abab": {
|
||||||
"version": "2.0.6",
|
"version": "2.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
|
"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": {
|
"node_modules/acorn": {
|
||||||
"version": "5.7.4",
|
"version": "5.7.4",
|
||||||
@ -1288,9 +1289,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/electron": {
|
"node_modules/electron": {
|
||||||
"version": "26.6.1",
|
"version": "26.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/electron/-/electron-26.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/electron/-/electron-26.6.2.tgz",
|
||||||
"integrity": "sha512-4Vz9u0Jt/khPa/en2l8Jv6SWEfsK/ieWYtchl5j0clbNSjdeTucnEFOhz9B9WwsAmfQjxBnpuMZpmdBuyxq+wg==",
|
"integrity": "sha512-OWxzVtCJwN9en34bnLupw2dTRsDTBzQZyz0Wx0zjeJ2wgUVlpqavtVDpt50aaJpJR/5GcHH/apIa3uvGWz/ABQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -1384,9 +1385,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/electron-packager/node_modules/fs-extra": {
|
"node_modules/electron-packager/node_modules/fs-extra": {
|
||||||
"version": "11.1.1",
|
"version": "11.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
|
||||||
"integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==",
|
"integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"graceful-fs": "^4.2.0",
|
"graceful-fs": "^4.2.0",
|
||||||
@ -3770,9 +3771,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/quill-better-table": {
|
"node_modules/quill-better-table": {
|
||||||
"version": "1.1.0",
|
"version": "1.2.10",
|
||||||
"resolved": "https://registry.npmjs.org/quill-better-table/-/quill-better-table-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/quill-better-table/-/quill-better-table-1.2.10.tgz",
|
||||||
"integrity": "sha512-B0ZZGsPzWpLEOlZ7oPeBflSxmTd4dCBY2TvyCaIqVsAGOHRyRk2hkwLJX52itBNFqJ6+2XH70ev/mTEU0zkZDA=="
|
"integrity": "sha512-CFwxAQzt4EPCQuynQ65R/FU7Yu//kcDBb/rmBBOsFfO758+q50zvG/PDt4Lenv9DcrSgwnyNkfo4yeA5fzzVYQ=="
|
||||||
},
|
},
|
||||||
"node_modules/quill-better-table-picker": {
|
"node_modules/quill-better-table-picker": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
|
|||||||
10
xml2json.js
10
xml2json.js
@ -22,9 +22,11 @@ function getAttributesOfXMLNode(node)
|
|||||||
|
|
||||||
function getQuestionsNodes(questionNode,type)
|
function getQuestionsNodes(questionNode,type)
|
||||||
{
|
{
|
||||||
|
console.log(type);
|
||||||
var questionObj = {};
|
var questionObj = {};
|
||||||
if(type == 1)
|
if(type == 1)
|
||||||
{
|
{
|
||||||
|
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 : "");
|
||||||
@ -52,13 +54,12 @@ 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);
|
||||||
if(choiceList.length > 0)
|
if(choiceList.length > 0)
|
||||||
{
|
{
|
||||||
for (let k = 0; k < choiceList.length ;k++)
|
for (let k = 0; k < choiceList.length ;k++)
|
||||||
{
|
{
|
||||||
var tempChoiceobj = {};
|
var tempChoiceobj = {};
|
||||||
// console.log(choiceList)
|
|
||||||
tempChoiceobj['id'] = choiceList[k].childNodes[0].firstChild.nodeValue;
|
tempChoiceobj['id'] = choiceList[k].childNodes[0].firstChild.nodeValue;
|
||||||
tempChoiceobj['no'] = (choiceList[k].childNodes[1].firstChild !== null ? choiceList[k].childNodes[1].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 : "");
|
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");
|
var questionType = questionList[q].getAttribute("xsi:type");
|
||||||
if(questionType == 'DescriptiveQuestion')
|
if(questionType == 'DescriptiveQuestion')
|
||||||
{
|
{
|
||||||
|
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]);
|
||||||
questionGroupObj['questions'].push(getQuestionsNodes(questionList[q],2));
|
questionGroupObj['questions'].push(getQuestionsNodes(questionList[q],2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
console.log(questionList[q]);
|
||||||
questionGroupObj['questions'].push(getQuestionGroupNodes(questionList[q]));
|
questionGroupObj['questions'].push(getQuestionGroupNodes(questionList[q]));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -203,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