CHANGE_QUILL_TO_JODIT_COMPLETE_FLOW : RV

This commit is contained in:
VENKATESHWARAN 2024-01-11 11:17:15 +05:30
parent 64dc8a7133
commit 9797075e88
12 changed files with 3299 additions and 2814 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path opacity="1" fill="#1E3050" d="M0 96C0 60.7 28.7 32 64 32H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6h96 32H424c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>

After

Width:  |  Height:  |  Size: 667 B

View File

@ -93,7 +93,7 @@ function envConverter(value) {
}
const args = process.argv.slice(2);
console.log(args);
// console.log(args);
envConverter(args[0]);
module.exports = convertBaseToString;

View File

@ -3,21 +3,34 @@ function html2json() {
$.fn.getTextQuestion = function(element_id) {
var questionTitleIdSet = document.getElementById('QuestionTextIdSet_'+element_id).value;
var questionTitle = document.getElementById('textQuestionName_' + element_id).querySelector('.ql-editor').innerHTML;
var marks = document.getElementById('Text_Question_Marks_Id_' + element_id).value;
var questionUUID = document.getElementById('Text_Question_UUID_ID_' + element_id).value;
var isMathEnabled = document.getElementById('math_' + element_id).checked;
var isMathEnabled2 = document.getElementById('titlemath_' + element_id).checked;
var displayMarks = document.getElementById('Text_Question_Display_Marks_Id_' + element_id).checked;
var questionTitle = "";
var questionSubTitle = "";
if(isMathEnabled == true)
{
//for Descriptive question Description math check
if(isMathEnabled == true){
questionSubTitle = document.getElementById('textQuestionSubtitle_math_' + element_id).value;
}else{
questionSubTitle = document.getElementById('textQuestionSubtitle_' + element_id).innerHTML;
}
else
{
questionSubTitle = document.getElementById('textQuestionSubtitle_' + element_id).querySelector('.ql-editor').innerHTML;
//for Descriptive question Title math check
if(isMathEnabled2 == true){
questionTitle = document.getElementById('textQuestiontitleMath_' + element_id).value;
}else{
questionTitle = document.getElementById('textQuestionName_' + element_id).innerHTML;
}
var questionType = document.getElementById('question_type_' + element_id).value;
// var questionSubType = document.getElementById('longAnswer_' + element_id).checked;
var questionSubType = 'false';
@ -28,6 +41,7 @@ function html2json() {
"question_type": questionType,
"question_sub_type": questionSubType,
"is_math_enabled": isMathEnabled,
"is_math_enabled2": isMathEnabled2,
"display_marks": displayMarks,
"marks":marks,
"text_question_uuid":questionUUID,
@ -37,24 +51,37 @@ function html2json() {
$.fn.getChoiceQuestion = function(element_id) {
var questionChoiceId = document.getElementById('QuestionChoiceId_' + element_id).value;
var questionTitle = document.getElementById('textQuestionName_' + element_id).querySelector('.ql-editor').innerHTML;
var questionTitle = document.getElementById('textQuestionName_' + element_id).innerHTML;
var marks = document.getElementById('Choice_Question_Marks_Id_' + element_id).value;
var questionUUID = document.getElementById('Choice_Question_UUID_ID_' + element_id).value;
var isMathEnabled = document.getElementById('math_' + element_id).checked;
var isMathEnabled2 = document.getElementById('titlemath_' + element_id).checked;
var displayMarks = document.getElementById('Choice_Question_Display_Marks_Id_' + element_id).checked;
var questionTitle = "";
var questionSubTitle = "";
// var choiceQuestiondiv = document.getElementById('removeAndCloneQroupQuestion_' + element_id)
var choiceQuestioncheckInput = document.getElementById('ChoiceCorrectAnswer_' + element_id)
//for MultiChoice question Description math check
if(isMathEnabled == true)
{
questionSubTitle = document.getElementById('textQuestionSubtitle_math_' + element_id).value;
}
else
{
questionSubTitle = document.getElementById('textQuestionSubtitle_' + element_id).querySelector('.ql-editor').innerHTML;
questionSubTitle = document.getElementById('textQuestionSubtitle_' + element_id).innerHTML;
}
//for MultiChoice question Title math check
if(isMathEnabled2 == true){
questionTitle = document.getElementById('textQuestiontitleMath_' + element_id).value;
}else{
questionTitle = document.getElementById('textQuestionName_' + element_id).innerHTML;
}
var questionType = document.getElementById('question_type_' + element_id).value;
// console.log(questionType);
var questionSubType = document.getElementById('multipleAnswer_' + element_id).checked;
@ -71,7 +98,7 @@ function html2json() {
}
else
{
choice_name = document.getElementById('choiceTextField_' + element_id).querySelector('.ql-editor').innerHTML;
choice_name = document.getElementById('choiceTextField_' + element_id).innerHTML;
}
var choice_group_fixed_uuid = document.getElementById('Choice_Group_Fixed_UUID_ID_' + element_id).value;
answers.push({
@ -113,7 +140,7 @@ function html2json() {
}
else
{
choice_name = document.getElementById('newChoiceTextField_' + groupChoiceId + '.' + individualChoiceId).querySelector('.ql-editor').innerHTML;
choice_name = document.getElementById('newChoiceTextField_' + groupChoiceId + '.' + individualChoiceId).innerHTML;
}
// console.log('choice_description id in the html to json script');
var id = document.getElementById('newChoiceCommentField_' + groupChoiceId + '.' + individualChoiceId);
@ -142,6 +169,7 @@ function html2json() {
"question_type": questionType,
"question_sub_type": questionSubType,
"is_math_enabled": isMathEnabled,
"is_math_enabled2": isMathEnabled2,
"display_marks": displayMarks,
"marks":marks,
"choice_question_uuid":questionUUID,
@ -215,8 +243,8 @@ function html2json() {
var group_attempt_any = document.getElementById('Question_Attempt_Any_Id_' + rand_id);
groupQuestion['question_id'] = ((typeof question_id !== null && question_id !== 'undefined') ? (question_id !== null ? question_id.value : null) : null);
groupQuestion['group_title'] = ((typeof group_title !== null && group_title !== 'undefined') ? (group_title !== null ? group_title.querySelector('.ql-editor').innerHTML : null) : null);
groupQuestion['group_description'] = ((typeof group_description !== null && group_description !== 'undefined') ? (group_description !== null ? group_description.querySelector('.ql-editor').innerHTML : null) : null);
groupQuestion['group_title'] = ((typeof group_title !== null && group_title !== 'undefined') ? (group_title !== null ? group_title.innerHTML : null) : null);
groupQuestion['group_description'] = ((typeof group_description !== null && group_description !== 'undefined') ? (group_description !== null ? group_description.innerHTML : null) : null);
groupQuestion['group_marks'] = ((typeof group_marks !== null && group_marks !== 'undefined') ? (group_marks !== null ? group_marks.value : null) : null);
groupQuestion['group_uuid'] = ((typeof group_uuid !== null && group_uuid !== 'undefined') ? (group_uuid !== null ? group_uuid.value : null) : null);
groupQuestion['group_display_marks'] = ((typeof group_display_marks !== null && group_display_marks !== 'undefined') ? (group_display_marks !== null ? group_display_marks.checked : null) : null);
@ -246,8 +274,8 @@ function html2json() {
var section_uuid = document.getElementById('Section_UUID_ID_' + rand_id);
var section_display_marks = document.getElementById('Section_Display_Marks_Id_' + rand_id);
var section_attempt_any = document.getElementById('Section_Attempt_Any_Id_' + rand_id);
section['section_title'] = ((typeof section_title !== null && section_title !== 'undefined') ? (section_title !== null ? section_title.querySelector('.ql-editor').innerHTML : null) : null);
section['section_description'] = ((typeof section_description !== null && section_description !== 'undefined') ? (section_description !== null ? section_description.querySelector('.ql-editor').innerHTML : null) : null);
section['section_title'] = ((typeof section_title !== null && section_title !== 'undefined') ? (section_title !== null ? section_title.innerHTML : null) : null);
section['section_description'] = ((typeof section_description !== null && section_description !== 'undefined') ? (section_description !== null ? section_description.innerHTML : null) : null);
section['section_marks'] = ((typeof section_marks !== null && section_marks !== 'undefined') ? (section_marks !== null ? section_marks.value : null) : null);
section['section_uuid'] = ((typeof section_uuid !== null && section_uuid !== 'undefined') ? (section_uuid !== null ? section_uuid.value : null) : null);
section['section_display_marks'] = ((typeof section_display_marks !== null && section_display_marks !== 'undefined') ? (section_display_marks !== null ? section_display_marks.checked : null) : null);
@ -265,8 +293,8 @@ function html2json() {
var formData = {};
var question_paper_title = document.getElementById('Question_title').querySelector('.ql-editor').innerHTML;
var question_paper_description = document.getElementById('Question_description').querySelector('.ql-editor').innerHTML;
var question_paper_title = document.getElementById('Question_title').innerHTML;
var question_paper_description = document.getElementById('Question_description').innerHTML;
var max_marks = document.getElementById('Max_Marks').value;
var course_ID = document.getElementById('Course_ID').value;
var course_Code = document.getElementById('Course_Code').value;
@ -303,10 +331,10 @@ function html2json() {
});
console.log((formData));
// console.log((formData));
// return false
// console.log(JSON.stringify(formData, null, 1));
localStorage.setItem("json", JSON.stringify((formData)));
console.log(JSON.stringify(formData));
// console.log(JSON.stringify(formData));
// console.log(OBJtoXML(({'question_paper' : formData})));
}

View File

@ -2,28 +2,54 @@ function json2nav() {
// console.clear();
$.fn.getTextQuestion = function(element_id) {
var questionTitle = document.getElementById('textQuestionName_' + element_id).querySelector('.ql-editor').innerHTML;
var textQuestionId = 'textQuestionName_' + element_id;
var marks = document.getElementById('Text_Question_Marks_Id_' + element_id).value;
// var questionType = 'Text';
var questionType = document.getElementById('question_type_' + element_id).value;
var isMathEnabled = document.getElementById('titlemath_' + element_id).checked;
var questionTitle = "";
if(isMathEnabled == true){
questionTitle = document.getElementById('textQuestiontitleMath_' + element_id).value;
}else{
const element = document.getElementById('textQuestionName_' + element_id)
const previousElement = element.previousElementSibling;
var questionTitleData = previousElement.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML;
questionTitle = questionTitleData;
}
return {
"question": questionTitle,
"question_Id":textQuestionId,
"marks":marks,
"isMathEnabled":isMathEnabled,
"question_type":questionType
}
}
$.fn.getChoiceQuestion = function(element_id) {
var questionTitle = document.getElementById('textQuestionName_' + element_id).querySelector('.ql-editor').innerHTML;
var choiceQuestionId = 'textQuestionName_' + element_id;
var marks = document.getElementById('Choice_Question_Marks_Id_' + element_id).value;
// var questionType = 'Group';
var questionType = document.getElementById('question_type_' + element_id).value;
var isMathEnabled = document.getElementById('titlemath_' + element_id).checked;
var questionTitle = "";
if(isMathEnabled == true){
questionTitle = document.getElementById('textQuestiontitleMath_' + element_id).value;
}else{
const element = document.getElementById('textQuestionName_' + element_id)
const previousElement = element.previousElementSibling;
var questionTitleData = previousElement.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML;
questionTitle = questionTitleData;
}
@ -31,6 +57,7 @@ function json2nav() {
"question": questionTitle,
"question_Id":choiceQuestionId,
"marks":marks,
"isMathEnabled":isMathEnabled,
"question_type":questionType
}
}
@ -85,11 +112,16 @@ function json2nav() {
// console.log(rand_id);
// console.log('section_title_text_'+rand_id);
var groupQuestion = {}
var group_title = document.getElementById('subSection_title_text_' + rand_id);
const groupelement = document.getElementById('subSection_title_text_' + rand_id);
const previousElement = groupelement.previousElementSibling;
var group_title_data = previousElement.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML;
var group_title = group_title_data;
var group_attempt_any = document.getElementById('Question_Attempt_Any_Id_' + rand_id);
var group_marks = document.getElementById('Question_Group_Marks_Id_' + rand_id);
groupQuestion['group_title'] = ((typeof group_title !== null && group_title !== 'undefined') ? (group_title !== null ? group_title.querySelector('.ql-editor').innerHTML : null) : null);
groupQuestion['group_title'] = ((typeof group_title !== null && group_title !== 'undefined') ? (group_title !== null ? group_title : null) : null);
groupQuestion['question_group_id'] = 'subSection_title_text_' + rand_id;
groupQuestion['group_attempt_any'] = ((typeof group_attempt_any !== null && group_attempt_any !== 'undefined') ? (group_attempt_any !== null ? group_attempt_any.value : null) : null);
groupQuestion['group_marks'] = ((typeof group_marks !== null && group_marks !== 'undefined') ? (group_marks !== null ? group_marks.value : null) : null);
@ -110,13 +142,19 @@ function json2nav() {
// console.log(rand_id);
// console.log('section_title_text_'+rand_id);
var section = {}
var section_title = document.getElementById('section_title_text_' + rand_id);
const sectionelement = document.getElementById('section_title_text_' + rand_id);
const previousElement = sectionelement.previousElementSibling;
var section_title_data = previousElement.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML;
var section_title = section_title_data;
var section_marks = document.getElementById('Section_Marks_Id_' + rand_id);
var section_attempt_any = document.getElementById('Section_Attempt_Any_Id_' + rand_id);
// console.log('section title in nav script');
// console.log(section_title);
// section['section_title'] = ((section_title !== null && section_title !== 'undefined') ? (section_title !== null ? section_title.querySelector('.ql-editor').innerHTML : null) : null);
section['section_title'] = (section_title && section_title.querySelector('.ql-editor') ? section_title.querySelector('.ql-editor').innerHTML : null);
// section['section_title'] = ((section_title !== null && section_title !== 'undefined') ? (section_title !== null ? section_title.innerHTML : null) : null);
section['section_title'] = ((typeof section_title !== null && section_title !== 'undefined') ? (section_title !== null ? section_title : null) : null);
section['section_id'] = 'section_title_text_' + rand_id;
section['section_attempt_any'] = ((typeof section_attempt_any !== null && section_attempt_any !== 'undefined') ? (section_attempt_any !== null ? section_attempt_any.value : null) : null);
section['section_marks'] = ((typeof section_marks !== null && section_marks !== 'undefined') ? (section_marks !== null ? section_marks.value : null) : null);
@ -133,7 +171,24 @@ function json2nav() {
var formData = {};
var question_paper_title = document.getElementById('Question_title').querySelector('.ql-editor').innerHTML;
var questionTitleElement = document.getElementById('questionTitleValue');
var questionTitleData = '';
if (questionTitleElement) {
var joditWysiwygElement = questionTitleElement.querySelector('.jodit-wysiwyg');
var questionTitleData = joditWysiwygElement.innerHTML;
} else {
questionTitleData = document.getElementById('Question_title').innerHTML;
}
// console.log(questionPaperTitleData);
var question_paper_title = questionTitleData;
formData['question_paper_title'] = question_paper_title;
formData['Question_title_id'] = 'Question_title';
formData['sections'] = [];

View File

@ -12,8 +12,8 @@ function jsonToHtml(jsonData) {
if(jsonData == "" || jsonData == null)
{
document.getElementById('Question_title').querySelector('.ql-editor').innerHTML = "";
document.getElementById('Question_description').querySelector('.ql-editor').innerHTML = "";
document.getElementById('Question_title').querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML = "";
document.getElementById('Question_description').querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML = "";
document.getElementById('Max_Marks').value = "";
document.getElementById('Course_ID').value = "";
document.getElementById('Course_Code').value = "";
@ -37,8 +37,10 @@ function jsonToHtml(jsonData) {
var paper_No = jsonData.attributes.PaperNo;
var subject_Name = jsonData.attributes.SubjectName;
var sub_Paper_Prefix = jsonData.attributes.SubPaperPrefix;
document.getElementById('Question_title').querySelector('.ql-editor').innerHTML = title;
document.getElementById('Question_description').querySelector('.ql-editor').innerHTML = description;
document.getElementById('questionTitleValue').querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML = title;
document.getElementById('questionTitleDescriptionValue').querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML = description;
document.getElementById('Question_title').innerHTML = title;
document.getElementById('Question_description').innerHTML = description;
document.getElementById('Max_Marks').value = max_marks;
document.getElementById('Course_ID').value = course_ID;
document.getElementById('Course_Code').value = course_Code;
@ -112,6 +114,8 @@ function QuestionsForEach(Question, questionAreaId, questionRandomNo,index){
var questionType = questionTypeFormets;
var questionSubType = Question.question_sub_type;
var mathEnabled = Question.is_math_enabled;
var titleMath = Question.titleMath;
var descriptionMath = Question.descriptionMath;
var questionMarks = Question.marks;
var questionUUID = Question.attributes.Id;
var questionDisplayMarks = Question.display_marks;
@ -129,7 +133,8 @@ function QuestionsForEach(Question, questionAreaId, questionRandomNo,index){
'questionDescription' :Question.question_description,
'questionType' :questionTypeFormets,
'questionSubType' :Question.question_sub_type,
'mathEnabled' :Question.is_math_enabled,
'titleMath' :Question.titleMath,
'descriptionMath' :Question.descriptionMath,
'questionMarks' :Question.marks,
'questionUUID' :Question.attributes.Id,
'questionDisplayMarks' :Question.display_marks,
@ -145,7 +150,7 @@ function QuestionsForEach(Question, questionAreaId, questionRandomNo,index){
}
else if (questionType == 'group')
{
groupQuestion(false, false, false, questionTitle, questionDescription, questionType, questionSubType, mathEnabled, Choice, questionAreaId, questionRandomNo, questionMarks, questionUUID, questionDisplayMarks,questionId,CorrectAnswer[0]);
groupQuestion(false, false, false, questionTitle, questionDescription, questionType, questionSubType, descriptionMath, Choice, questionAreaId, questionRandomNo, questionMarks, questionUUID, questionDisplayMarks,questionId,CorrectAnswer[0], titleMath);
Choice = Choice.slice(1);
Choice.forEach(function(choicenames, indexs) {
var choiceName = choicenames.choice_name;

View File

@ -77,7 +77,9 @@ function json2xml() {
var questionTitle = createElementWithText(doc, element, 'Text', question['question']);
questionTitle.setAttribute('xsi:type',(question['is_math_enabled2'] === true ? 'Math' : ''));
var questionDesc = createElementWithText(doc, element, 'Subtext', question['question_description']);
questionDesc.setAttribute('xsi:type',(question['is_math_enabled'] === true ? 'Math' : ''));
var marks = createElementWithText(doc, element, 'Marks', question['marks']);
var display_marks = createElementWithText(doc, element, 'DispalyMarks', (question['display_marks'] === true ? 'true' : 'false'), {});
var is_math_enabled = createElementWithText(doc, element, 'Math', (question['is_math_enabled'] === true ? 'true' : 'false'), {});
@ -92,6 +94,7 @@ function json2xml() {
var id = createElementWithText(doc, choiceElement, 'Id', question['answers'][choice]['choice_uuid'], {});
var no = createElementWithText(doc, choiceElement, 'No', question['answers'][choice]['no'], {});
var text = createElementWithText(doc, choiceElement, 'Text', question['answers'][choice]['choice_name'], {});
text.setAttribute('xsi:type',(question['answers'][choice]['is_math_enabled'] === true ? 'Math' : 'Text'));
var is_math_enabled = createElementWithText(doc, choiceElement, 'Math', (question['answers'][choice]['is_math_enabled'] === true ? 'true' : 'false'), {});
}
@ -113,7 +116,7 @@ function json2xml() {
'xsi:type': 'QuestionGroup',
'Id': singleQuestion['group_uuid'],
'Type': 'QuestionGroup',
'No': singleQuestion['group_title'],
'No': '',
'Order': 0
}, '');
@ -198,7 +201,7 @@ function json2xml() {
'xsi:type': 'QuestionPaperSection',
'Id': tempSection['section_uuid'],
'Type': 'Section',
'No': tempSection['section_title'],
'No': '',
'Order': 0
});

View File

@ -1,4 +1,6 @@
const { css } = require("jquery");
// const { css } = require("jquery");
// const mathJaxPath = require.resolve('./node_modules/mathjax/es5/latest.js');
// require(mathJaxPath);
// Initialize an array to store the expanded section data-ids
const expandedSections = [];
@ -65,6 +67,7 @@ function navpane() {
}
function createTreeWithHeading(data, container) {
const treeTitle = removeParagraphTags(data.question_paper_title);
const heading = document.createElement('a');
heading.style.color = '#1D3557';
@ -499,9 +502,18 @@ function navpane() {
// questionLink.innerHTML = removeParagraphTags(nodeData.question);
// }
questionLink.innerHTML = removeTagsAndTruncate(nodeData.question, 25);
var htmlTagRemovedQuestionTitle = removeTagsAndTruncate(nodeData.question, 25);
var Latex = convertToLatex(htmlTagRemovedQuestionTitle);
var data = ''
if(nodeData.isMathEnabled){
data = Latex;
}else{
data = htmlTagRemovedQuestionTitle;
}
questionLink.innerHTML = data;
// console.log('questionLink : ', questionLink)
@ -820,37 +832,48 @@ function navpane() {
// Function to scroll to the specified element with smooth behavior
function scrollToElement(elementId) {
const element = document.getElementById(elementId);
const previousElement = element.previousElementSibling;
var focus = previousElement.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg');
if (element) {
element.scrollIntoView({ behavior: "smooth", block: "center" });
focus.scrollIntoView({ behavior: "smooth", block: "center" });
}
}
function convertToLatex(text, mathstatus) {
// Parse mathstatus into a boolean
const mathStatusBoolean = true;
// Check if the text contains <p> tags
if (!/<p>|<\/p>/i.test(text)) {
// Use MathJax to convert the text to LaTeX if mathStatusBoolean is true
var val = mathStatusBoolean ? MathJax.tex2chtml(text).outerHTML : text;
return convertMathJaxToLatex(val)
} else {
// Use MathJax to convert the text to LaTeX if it contains <p> tags
var val2 = MathJax.tex2chtml(text).outerHTML;
return convertMathJaxToLatex(val2)
}
}
let draggedItemGroup = null;
let draggedItemQuestion = null;
let dropTarget = null;
function convertMathJaxToLatex(mathJaxCode) {
// Replace MathJax-specific tags and attributes
let latexCode = mathJaxCode
.replace(/<mjx-container[^>]*>/g, '')
.replace(/<\/mjx-container>/g, '')
.replace(/<mjx-math[^>]*>/g, '')
.replace(/<\/mjx-math>/g, '')
.replace(/<mjx-mi[^>]*>/g, '')
.replace(/<\/mjx-mi>/g, '')
.replace(/<mjx-c[^>]*>/g, '')
.replace(/<\/mjx-c>/g, '')
.replace(/<mjx-assistive-mml[^>]*>/g, '')
.replace(/<\/mjx-assistive-mml>/g, '')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>');
return latexCode;
}
// Event listener for .drag-handle elements within questions
document.addEventListener('mousedown', function (e) {
const dragHandle = e.target.closest('.content visible');
// alert(dragHandle);
if (dragHandle) {
// If the click is inside a drag handle, find the corresponding .question
const questionElement = dragHandle.closest('.navDrag');
if (questionElement) {
// console.log("draggHandle:",dragHandle);
// Initiate the drag operation for the .question
draggedItemQuestion = questionElement;
// Add a dragStart event listener to set data
draggedItemQuestion.addEventListener('dragstart', function (e) {
e.dataTransfer.setData('text/plain', draggedItemQuestion.id);
// console.log(draggedItemQuestion.id);
});
}
}
});

View File

@ -2,11 +2,13 @@ function rtc_hide_and_show(rtcid) {
var id = localStorage.getItem('rtc');
var hideid = document.getElementById(id);
// console.log('hideid : ', hideid);
// console.log('hide id :' + id)
$(hideid).hide();
console.log('hide id :' + id);
var showid = document.getElementById(rtcid);
console.log('hide id :' + id)
$(showid).show();
console.log('Show id :' + rtcid)
localStorage.setItem('rtc',rtcid);
};

View File

@ -3819,3 +3819,9 @@ font-size: 14px;
.is-hide{
display:none;
}
math {
position: relative;
top: 6px;
}

View File

@ -7,7 +7,9 @@ var jsonDecodeData = localStorage.getItem('json_Decode_Data_For_Mcq_Crt_Ans');
// console.log(jsonDecodeData);
function getAttributesOfXMLNode(node)
{
{
// console.log('xmal attributes');
// console.log(node);
// Get attributes of the node (if any)
attributes = {};
if (node.attributes.length > 0) {
@ -20,6 +22,22 @@ function getAttributesOfXMLNode(node)
return attributes;
}
function getAttributesOfXMLNodeWithoutArray(node)
{
// console.log('xmal attributes');
// console.log(node);
// Get attributes of the node (if any)
attributes = {};
if (node.attributes.length > 0) {
for (let i = 0; i < node.attributes.length; i++) {
const attribute = node.attributes[i];
attributes = attribute.nodeValue;
}
}
return attributes;
}
function getQuestionsNodes(questionNode,type)
{
// console.log(type);
@ -28,10 +46,12 @@ function getQuestionsNodes(questionNode,type)
{
// 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'] = (questionNode.childNodes[1].firstChild !== null? questionNode.childNodes[1].firstChild.nodeValue : "");
questionObj['question_description'] = (questionNode.childNodes[2].firstChild !== null? questionNode.childNodes[2].firstChild.nodeValue : "");
questionObj['question_type'] = 'text';
questionObj['attributes'] = getAttributesOfXMLNode(questionNode);
questionObj['titleMath'] = getAttributesOfXMLNodeWithoutArray(questionNode.childNodes[1]);
questionObj['descriptionMath'] = getAttributesOfXMLNodeWithoutArray(questionNode.childNodes[2]);
questionObj['question_sub_type'] = 'false';
questionObj['marks'] = (questionNode.childNodes[3].firstChild !== null ? questionNode.childNodes[3].firstChild.nodeValue : "");
questionObj['display_marks'] = questionNode.childNodes[4].firstChild.nodeValue;
@ -42,10 +62,12 @@ function getQuestionsNodes(questionNode,type)
else
{
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 !== null? questionNode.childNodes[1].firstChild.nodeValue : "");
questionObj['question_description'] = (questionNode.childNodes[2].firstChild !== null? questionNode.childNodes[2].firstChild.nodeValue : "");
questionObj['question_type'] = 'group';
questionObj['attributes'] = getAttributesOfXMLNode(questionNode);
questionObj['titleMath'] = getAttributesOfXMLNodeWithoutArray(questionNode.childNodes[1]);
questionObj['descriptionMath'] = getAttributesOfXMLNodeWithoutArray(questionNode.childNodes[2]);
questionObj['question_sub_type'] = questionNode.childNodes[6].firstChild.nodeValue;
questionObj['marks'] = (questionNode.childNodes[3].firstChild !== null ? questionNode.childNodes[3].firstChild.nodeValue : "");
questionObj['display_marks'] = questionNode.childNodes[4].firstChild.nodeValue;
@ -64,7 +86,8 @@ function getQuestionsNodes(questionNode,type)
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['is_math_enabled'] = (choiceList[k].childNodes[3].firstChild !== null ? choiceList[k].childNodes[3].firstChild.nodeValue : "");
// console.log(tempChoiceobj);
tempChoiceobj['ChoiceMath'] = getAttributesOfXMLNodeWithoutArray(choiceList[k].childNodes[2]);
// console.log(tempChoiceobj);
questionObj['answers'].push(tempChoiceobj);
}
}
@ -106,8 +129,8 @@ function getQuestionsNodes(questionNode,type)
function getQuestionGroupNodes(questionGroup)
{
var questionGroupObj = {};
questionGroupObj['question_id'] = questionGroup.childNodes[0].firstChild.nodeValue;
questionGroupObj['group_title'] = questionGroup.childNodes[1].firstChild.nodeValue;
questionGroupObj['question_id'] = (questionGroup.childNodes[0].firstChild !== null ? questionGroup.childNodes[0].firstChild.nodeValue : "");
questionGroupObj['group_title'] = (questionGroup.childNodes[1].firstChild !== null ? questionGroup.childNodes[1].firstChild.nodeValue : "");
questionGroupObj['group_description'] = (questionGroup.childNodes[2].firstChild !== null ? questionGroup.childNodes[2].firstChild.nodeValue : "");
questionGroupObj['group_marks'] = (questionGroup.childNodes[3].firstChild !== null ? questionGroup.childNodes[3].firstChild.nodeValue : "");
questionGroupObj['group_display_marks'] = questionGroup.childNodes[4].firstChild.nodeValue;
@ -153,9 +176,11 @@ const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
const jsonObj = {};
jsonObj['question_paper_title'] = xmlDoc.getElementsByTagName("Title")[0].childNodes[0].nodeValue;
jsonObj['question_paper_description'] = xmlDoc.getElementsByTagName("Subtitle")[0].childNodes[0].nodeValue;
//get attributes of root/question paper element
// jsonObj['question_paper_title'] = xmlDoc.getElementsByTagName("Title")[0].childNodes[0].nodeValue || ' ';
jsonObj['question_paper_title'] = xmlDoc.getElementsByTagName("Title")[0] && xmlDoc.getElementsByTagName("Title")[0].childNodes[0] ? xmlDoc.getElementsByTagName("Title")[0].childNodes[0].nodeValue : '';// console.log('question_paper_description');
// console.log(xmlDoc.getElementsByTagName("Subtitle")[0].childNodes[0].nodeValue)
// jsonObj['question_paper_description'] = xmlDoc.getElementsByTagName("Subtitle")[0].childNodes[0].nodeValue || ' ';
jsonObj['question_paper_description'] = xmlDoc.getElementsByTagName("Subtitle")[0] && xmlDoc.getElementsByTagName("Subtitle")[0].childNodes[0] ? xmlDoc.getElementsByTagName("Subtitle")[0].childNodes[0].nodeValue : null;//get attributes of root/question paper element
jsonObj['attributes'] = getAttributesOfXMLNode(xmlDoc.documentElement);
jsonObj['sections'] = [];
@ -170,9 +195,9 @@ jsonObj['sections'] = [];
// console.log('Section :' + i + '-' + sectionsList[i].childNodes[0]);
tempObj['section_title'] = (sectionsList[i].childNodes[0].firstChild !== null ? sectionsList[i].childNodes[0].firstChild.nodeValue : "");
tempObj['section_description'] = sectionsList[i].childNodes[1].firstChild.nodeValue;
tempObj['section_description'] = (sectionsList[i].childNodes[1].firstChild !== null ? sectionsList[i].childNodes[1].firstChild.nodeValue : "");
tempObj['section_marks'] = (sectionsList[i].childNodes[2].firstChild !== null ? sectionsList[i].childNodes[2].firstChild.nodeValue : "");
tempObj['section_display_marks'] = sectionsList[i].childNodes[3].firstChild.nodeValue;
tempObj['section_display_marks'] = (sectionsList[i].childNodes[3].firstChild !== null ? sectionsList[i].childNodes[3].firstChild.nodeValue : "");
tempObj['section_attempt_any'] = (sectionsList[i].childNodes[4].firstChild !== null && sectionsList[i].childNodes[4].firstChild !== undefined ? sectionsList[i].childNodes[4].firstChild.nodeValue : "");
tempObj['attributes'] = getAttributesOfXMLNode(sectionsList[i]);
tempObj['questions'] = [];

View File

@ -25,7 +25,7 @@ function getQuestionsNodes(questionNode,type)
if(type == 1)
{
questionObj['questionId'] = questionNode.childNodes[0].firstChild !== null ? questionNode.childNodes[0].firstChild.nodeValue : "";
questionObj['question'] = questionNode.childNodes[1].firstChild.nodeValue;
questionObj['question'] = (questionNode.childNodes[1].firstChild !== null? questionNode.childNodes[1].firstChild.nodeValue : "");
questionObj['question_description'] = (questionNode.childNodes[2].firstChild !== null? questionNode.childNodes[2].firstChild.nodeValue : "");
questionObj['question_type'] = 'text';
questionObj['attributes'] = getAttributesOfXMLNode(questionNode);
@ -37,8 +37,8 @@ function getQuestionsNodes(questionNode,type)
}
else
{
questionObj['questionId'] = questionNode.childNodes[0].firstChild.nodeValue;
questionObj['question'] = questionNode.childNodes[1].firstChild.nodeValue;
questionObj['questionId'] = (questionNode.childNodes[0].firstChild !== null? questionNode.childNodes[0].firstChild.nodeValue : "");
questionObj['question'] = (questionNode.childNodes[1].firstChild !== null? questionNode.childNodes[1].firstChild.nodeValue : "");
questionObj['question_description'] = (questionNode.childNodes[2].firstChild !== null? questionNode.childNodes[2].firstChild.nodeValue : "");
questionObj['question_type'] = 'group';
questionObj['attributes'] = getAttributesOfXMLNode(questionNode);
@ -74,7 +74,7 @@ function getQuestionGroupNodes(questionGroup)
var questionGroupObj = {};
questionGroupObj['question_id'] = (questionGroup.childNodes[0].firstChild !== null ? questionGroup.childNodes[0].firstChild.nodeValue : "");
questionGroupObj['group_title'] = questionGroup.childNodes[1].firstChild.nodeValue;
questionGroupObj['group_title'] = (questionGroup.childNodes[1].firstChild !== null ? questionGroup.childNodes[1].firstChild.nodeValue : "");
questionGroupObj['group_description'] = (questionGroup.childNodes[2].firstChild !== null ? questionGroup.childNodes[2].firstChild.nodeValue : "");
questionGroupObj['group_marks'] = (questionGroup.childNodes[3].firstChild !== null ? questionGroup.childNodes[3].firstChild.nodeValue : "");
questionGroupObj['group_display_marks'] = questionGroup.childNodes[4].firstChild.nodeValue;
@ -116,8 +116,8 @@ const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
const jsonObj = {};
jsonObj['question_paper_title'] = xmlDoc.getElementsByTagName("Title")[0].childNodes[0].nodeValue;
jsonObj['question_paper_description'] = xmlDoc.getElementsByTagName("Subtitle")[0].childNodes[0].nodeValue;
jsonObj['question_paper_title'] = xmlDoc.getElementsByTagName("Title")[0] && xmlDoc.getElementsByTagName("Title")[0].childNodes[0] ? xmlDoc.getElementsByTagName("Title")[0].childNodes[0].nodeValue : null;
jsonObj['question_paper_description'] = xmlDoc.getElementsByTagName("Subtitle")[0] && xmlDoc.getElementsByTagName("Subtitle")[0].childNodes[0] ? xmlDoc.getElementsByTagName("Subtitle")[0].childNodes[0].nodeValue : null;
//get attributes of root/question paper element
jsonObj['attributes'] = getAttributesOfXMLNode(xmlDoc.documentElement);
jsonObj['sections'] = [];
@ -130,8 +130,8 @@ jsonObj['sections'] = [];
var tempObj = {};
// console.log('Section :' + i + '-' + sectionsList[i].childNodes[0].firstChild.nodeValue);
tempObj['section_title'] = sectionsList[i].childNodes[0].firstChild.nodeValue;
tempObj['section_description'] = sectionsList[i].childNodes[1].firstChild.nodeValue;
tempObj['section_title'] = (sectionsList[i].childNodes[0].firstChild !== null ? sectionsList[i].childNodes[0].firstChild.nodeValue : "");
tempObj['section_description'] = (sectionsList[i].childNodes[1].firstChild !== null ? sectionsList[i].childNodes[1].firstChild.nodeValue : "");
tempObj['section_marks'] = (sectionsList[i].childNodes[2].firstChild !== null ? sectionsList[i].childNodes[2].firstChild.nodeValue : "");
tempObj['section_display_marks'] = sectionsList[i].childNodes[3].firstChild.nodeValue;
tempObj['section_attempt_any'] = (sectionsList[i].childNodes[4].firstChild !== null && sectionsList[i].childNodes[4].firstChild !== undefined ? sectionsList[i].childNodes[4].firstChild.nodeValue : "");