DUPLICATEQUESTIONPAPER APPSETTING : AADHAVAN
This commit is contained in:
parent
85526f8bbd
commit
f8bf6bf965
340
addform.html
340
addform.html
@ -63,8 +63,10 @@
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
<style>
|
||||
.focused {
|
||||
border: 2px solid rgba(253, 126, 20, .60);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@ -367,6 +369,7 @@
|
||||
.menu-symbol::before {
|
||||
content: '\2715';/* Unicode character for the menu symbol (x) */
|
||||
font-size: 25px;
|
||||
margin-left: 17px;
|
||||
/* position: absolute;
|
||||
left: 4px;
|
||||
top: 2px; */
|
||||
@ -434,10 +437,10 @@
|
||||
margin-top: 16px;
|
||||
overflow-y: auto;
|
||||
overflow-x: clip;
|
||||
max-height: 532px;
|
||||
max-height: 750px;
|
||||
padding:0 10px 20px;
|
||||
/* width: 314px; */
|
||||
width: 285px;
|
||||
width: 314px;
|
||||
/* width: 285px; */
|
||||
height: -webkit-fill-available;
|
||||
}
|
||||
|
||||
@ -1530,7 +1533,7 @@ $("#overlay").show();
|
||||
|
||||
$('#workarea_math').click(function(){
|
||||
// console.log('called');
|
||||
$('#workarea_math').css('margin-bottom', '300px');
|
||||
$('#workarea_math').css('margin-bottom', '346px');
|
||||
localStorage.setItem('workAreaMath', true);
|
||||
});
|
||||
|
||||
@ -2003,10 +2006,10 @@ function addSection(title = false, description = false, random_no = false, secti
|
||||
<div class=" button-group align-items-center">
|
||||
<div class="addButton buttons" style="display: none;" id="sectionAddButton_${sectionRandomID}">
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="TextQuestion" src="assets/images/text.svg" alt="" onclick="addNewQuestions(event, 1)" id="sidetextButton_${sectionRandomID}" title="Text Question"></div>
|
||||
<div class="addButtonIcons"><img title="TextQuestion" src="assets/images/text.svg" alt="" onclick="addNewQuestions(event, 1)" id="sidetextButton_${sectionRandomID}" title="TextQuestion"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="ChoiceQuestion" src="assets/images/choice.svg" alt="" onclick="addNewQuestions(event, 2)" id="sidechoiseButton_${sectionRandomID}" title="Choice Question"></div>
|
||||
<div class="addButtonIcons"><img title="ChoiceQuestion" src="assets/images/choice.svg" alt="" onclick="addNewQuestions(event, 2)" id="sidechoiseButton_${sectionRandomID}" title="ChoiceQuestion"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="QuestionGroup" src="assets/images/Group.svg" alt="" onclick="addNewGroupQuestions(event, 0)" id="sidegroupQuestionButton_${sectionRandomID}" title="Question Group"></div>
|
||||
@ -2372,7 +2375,7 @@ const targetId = 'section_title_text_' + sectionRandomID;
|
||||
localStorage.setItem('savePreventDefault', targetId)
|
||||
var EditScroll = localStorage.getItem('scroll')
|
||||
if(EditScroll !== '1' && scrollval == false){
|
||||
scrollToElementWithoutLink(targetId);
|
||||
// scrollToElementWithoutLink(targetId);
|
||||
}
|
||||
|
||||
// For Check Empty Question
|
||||
@ -2434,9 +2437,6 @@ function addQuestionGroup(idObj)
|
||||
<div class="sectionTitle" id="group_question_title_${QuestionGroup_ID}">
|
||||
<div class="col-lg-12 col-md-12">
|
||||
<div onmouseover="showButtons(this)" id="QuestionGroupButtons_${QuestionGroup_ID}" class="row question element">
|
||||
<div id="dragHandle" class="drag-handle" >
|
||||
<i class="fas fa-grip-horizontal" draggable="true"></i>
|
||||
</div>
|
||||
<h4 class="QuestionGroup-titleHead">Question Group</h4>
|
||||
<div class="items align-items-center hideondrag">
|
||||
<span onclick="ReArrangeQuestionsGroup(event)" id="forword_${QuestionGroup_ID}" class="fa fa-chevron-up up-icon"></span>
|
||||
@ -2449,10 +2449,10 @@ function addQuestionGroup(idObj)
|
||||
<div class=" button-group align-items-center">
|
||||
<div class="addButton QGButtons" style="display: none;" id="AddButton_${QuestionGroup_ID}">
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="Text Question" src="assets/images/text.svg" alt="" onclick="addNewGroupQuestions(event, 1)" id="textButtonSectionQroupside_${QuestionGroup_ID}" title="Text Question"></div>
|
||||
<div class="addButtonIcons"><img title="TextQuestion" src="assets/images/text.svg" alt="" onclick="addNewGroupQuestions(event, 1)" id="textButtonSectionQroupside_${QuestionGroup_ID}" title="TextQuestion"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="Choice Question" src="assets/images/choice.svg" alt="" onclick="addNewGroupQuestions(event, 2)" id="choiseButtonSectionQroupside_${QuestionGroup_ID}" title="Choice Question"></div>
|
||||
<div class="addButtonIcons"><img title="ChoiceQuestion" src="assets/images/choice.svg" alt="" onclick="addNewGroupQuestions(event, 2)" id="choiseButtonSectionQroupside_${QuestionGroup_ID}" title="ChoiceQuestion"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="Question Group" src="assets/images/Group.svg" alt="" onclick="MultiLevelQuestionGroup(event)" id="QuestionGroupButtonside_${QuestionGroup_ID}" title="Question Group"></div>
|
||||
@ -2528,7 +2528,9 @@ function addQuestionGroup(idObj)
|
||||
|
||||
|
||||
array_of_Id.push('Questions_Group_id_' + QuestionGroup_ID);
|
||||
array_of_Id.push('subSection_title_text_' + QuestionGroup_ID);
|
||||
array_of_Id.push('subSectionDescriptionWorkarea_' + QuestionGroup_ID);
|
||||
array_of_Id.push('subSection_title_text_' + QuestionGroup_ID);
|
||||
|
||||
|
||||
var addNewButtonId = 'addNewButtonSectionQroup_' + QuestionGroup_ID ;
|
||||
var textButtonId = 'textButtonSectionQroup_' + QuestionGroup_ID ;
|
||||
@ -2737,6 +2739,21 @@ function addQuestionGroup(idObj)
|
||||
localStorage.setItem('savePreventDefault', targetId);
|
||||
|
||||
});
|
||||
|
||||
var question_group_description = 'subSectionDescriptionWorkarea_'+ QuestionGroup_ID;
|
||||
var inputElemen = document.getElementById(question_group_description);
|
||||
attrId = document.getElementById('subSectionDescriptionWorkarea_'+ QuestionGroup_ID).innerHTML;
|
||||
|
||||
inputElemen.addEventListener("keyup", function(event) {
|
||||
|
||||
json2nav();
|
||||
clearSidebarWrapper();
|
||||
navpane();
|
||||
check_Remove_Empty_Question(question_group_description);
|
||||
// SetQuestionGroupTitle(QuestionGroup_ID, QuestionGroup_ID)
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
var question_groupi = 'Questions_Group_id_'+ QuestionGroup_ID;
|
||||
@ -2820,7 +2837,8 @@ function addQuestionGroup(idObj)
|
||||
const targetId = 'subSection_title_text_' + QuestionGroup_ID;
|
||||
localStorage.setItem('savePreventDefault', targetId);
|
||||
if(EditScroll !== '1'){
|
||||
scrollToElementWithoutLink(targetId);
|
||||
scrollToElementWithoutLink(`Questions_Group_id_${QuestionGroup_ID}`);
|
||||
// scrollToElementWithoutLink(targetId);
|
||||
}
|
||||
|
||||
const arrayString = JSON.stringify(array_of_Id);
|
||||
@ -2830,7 +2848,7 @@ function addQuestionGroup(idObj)
|
||||
|
||||
}
|
||||
|
||||
//Function for Create a New Choice Question in the Section and Question Group
|
||||
//Function for Create a New ChoiceQuestion in the Section and Question Group
|
||||
function groupQuestion(question_id = false, section_id = false , group_question_area_id = false, questionTitle = false, questionDescription = false, questionType = false, questionSubType = false, mathEnabled = false, Choice = false, questionAreaId = false, questionRandomNo = false, questionMarks = false, questionUUID = false, questionDisplayMarks = false,questionId, CorrectAnswer, titleMath)
|
||||
{
|
||||
// console.log(CorrectAnswer);
|
||||
@ -2912,9 +2930,6 @@ function groupQuestion(question_id = false, section_id = false , group_question_
|
||||
groupQuestion +=
|
||||
`<div class="question hidedrag element Question-Border-Top col-lg-12 choiceQuestion" draggable="" id="removeAndCloneQroupQuestion_${addChoiceAreaId}" style="" onclick="toggleClasses(this); multipleAnswerCheck(this); resetthe_radio(this)" onmouseover="showButtons(this); ">
|
||||
<div class="question-linestyle"><img src="assets/images/${lineImg}"/></div>
|
||||
<div id="dragHandle" class="drag-handle">
|
||||
<i class="fas fa-grip-horizontal" draggable="true"></i>
|
||||
</div>
|
||||
<div class="items hideondrag" style="display: none;">
|
||||
<i onclick="ReArrangeQuestions(event)" class="fa fa-chevron-up up-icon"></i>
|
||||
<i onclick="ReArrangeQuestions(event)" class="fa fa-chevron-down down-icon"></i>
|
||||
@ -2927,10 +2942,10 @@ function groupQuestion(question_id = false, section_id = false , group_question_
|
||||
<div class=" button-group align-items-center">
|
||||
<div class="addButton buttons" style="display: none;" id="AddButtons_${addChoiceAreaId}">
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="TextQuestion" src="assets/images/text.svg" alt="" onclick="addNewQuestions(event, 1)" id="sidetextButton_${sectionRandomID}" title="Text Question"></div>
|
||||
<div class="addButtonIcons"><img title="TextQuestion" src="assets/images/text.svg" alt="" onclick="addNewQuestions(event, 1)" id="sidetextButton_${sectionRandomID}" title="TextQuestion"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="ChoiceQuestion" src="assets/images/choice.svg" alt="" onclick="addNewQuestions(event, 2)" id="sidechoiseButton_${sectionRandomID}" title="Choice Question"></div>
|
||||
<div class="addButtonIcons"><img title="ChoiceQuestion" src="assets/images/choice.svg" alt="" onclick="addNewQuestions(event, 2)" id="sidechoiseButton_${sectionRandomID}" title="ChoiceQuestion"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="QuestionGroup" src="assets/images/Group.svg" alt="" onclick="addNewGroupQuestions(event, 0)" id="sidegroupQuestionButton_${sectionRandomID}" title="Question Group"></div>
|
||||
@ -2948,10 +2963,10 @@ function groupQuestion(question_id = false, section_id = false , group_question_
|
||||
<div class=" button-group align-items-center">
|
||||
<div class="addButton buttons onhover" style="display: none;" id="QuestionGRoupAddButtons_${addChoiceAreaId}">
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="TextQuestion" src="assets/images/text.svg" alt="" onclick="addNewGroupQuestions(event, 1)" id="textButtonSectionQroupside_${QuestionGroup_ID}" title="Question Group Text Question"></div>
|
||||
<div class="addButtonIcons"><img title="TextQuestion" src="assets/images/text.svg" alt="" onclick="addNewGroupQuestions(event, 1)" id="textButtonSectionQroupside_${QuestionGroup_ID}" title="Question Group TextQuestion"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="ChoiceQuestion" src="assets/images/choice.svg" alt="" onclick="addNewGroupQuestions(event, 2)" id="choiseButtonSectionQroupside_${QuestionGroup_ID}" title="Question Group Choice Question"></div>
|
||||
<div class="addButtonIcons"><img title="ChoiceQuestion" src="assets/images/choice.svg" alt="" onclick="addNewGroupQuestions(event, 2)" id="choiseButtonSectionQroupside_${QuestionGroup_ID}" title="Question Group ChoiceQuestion"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="QuestionGroup" src="assets/images/Group.svg" alt="" onclick="MultiLevelQuestionGroup(event)" id="QuestionGroupButtonside_${QuestionGroup_ID}" title="Question Group on Question Group"></div>
|
||||
@ -3626,7 +3641,8 @@ var EditScroll = localStorage.getItem('scroll')
|
||||
const targetId = 'textQuestionName_' + addChoiceAreaId;
|
||||
localStorage.setItem('savePreventDefault', targetId)
|
||||
if(EditScroll !== '1'){
|
||||
scrollToElementWithoutLink(targetId);
|
||||
scrollToElementWithoutLink(`QuestionChoiceId_${addChoiceAreaId}`);
|
||||
// scrollToElementWithoutLink(targetId);
|
||||
}
|
||||
const arrayString = JSON.stringify(array_of_Id);
|
||||
collect_Empty_Question_Id(arrayString, choiceid);
|
||||
@ -3642,7 +3658,7 @@ if(EditScroll !== '1'){
|
||||
// }
|
||||
}
|
||||
|
||||
//Function for Create a New Choice Field in a Choice Question
|
||||
//Function for Create a New Choice Field in a ChoiceQuestion
|
||||
function addNewChoice(NewaddChoiceAreaId = false, focusval = false, choiceName = false, questionRandomNo = false, choiceID = false, choice_mathEnabled= false,CorrectAnswer)
|
||||
{
|
||||
addChoice = "";
|
||||
@ -3922,9 +3938,6 @@ var ssa=ss.replace('<p>','').replace('</p>','').replace('<br>','');
|
||||
textQuestion +=
|
||||
`<div class="col-lg-12 question hidedrag element Question-Border-Top" draggable="" id="removeAndCloneTextQuestion_${addTextQuestionId}" style="" onclick="toggleClasses(this)" onmouseover="showButtons(this)">
|
||||
<div class="question-linestyle"><img src="assets/images/${lineImg}"/></div>
|
||||
<div id="dragHandle" class="drag-handle" >
|
||||
<i class="fas fa-grip-horizontal" draggable="true"></i>
|
||||
</div>
|
||||
|
||||
<div class="items align-items-center hideondrag" style="display: none;">
|
||||
<i onclick="ReArrangeQuestions(event)" id="forword_${addTextQuestionId}" class="fa fa-chevron-up up-icon" ></i>
|
||||
@ -3937,10 +3950,10 @@ textQuestion +=
|
||||
<div class=" button-group align-items-center">
|
||||
<div class="addButton buttons" style="display: none;" id="AddButtons_${addTextQuestionId}">
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="TextQuestion" src="assets/images/text.svg" alt="" onclick="addNewQuestions(event, 1)" id="sidetextButton_${sectionRandomID}" title="Text Question"></div>
|
||||
<div class="addButtonIcons"><img title="TextQuestion" src="assets/images/text.svg" alt="" onclick="addNewQuestions(event, 1)" id="sidetextButton_${sectionRandomID}" title="TextQuestion"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="ChoiceQuestion" src="assets/images/choice.svg" alt="" onclick="addNewQuestions(event, 2)" id="sidechoiseButton_${sectionRandomID}" title="Choice Question"></div>
|
||||
<div class="addButtonIcons"><img title="ChoiceQuestion" src="assets/images/choice.svg" alt="" onclick="addNewQuestions(event, 2)" id="sidechoiseButton_${sectionRandomID}" title="ChoiceQuestion"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="QuestionGroup" src="assets/images/Group.svg" alt="" onclick="addNewGroupQuestions(event, 0)" id="sidegroupQuestionButton_${sectionRandomID}" title="Question Group"></div>
|
||||
@ -3958,10 +3971,10 @@ textQuestion +=
|
||||
<div class=" button-group align-items-center">
|
||||
<div class="addButton buttons onhover" style="display: none;" id="QuestionGRoupAddButtons_${addTextQuestionId}">
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="TextQuestion" src="assets/images/text.svg" alt="" onclick="addNewGroupQuestions(event, 1)" id="textButtonSectionQroupside_${QuestionGroup_ID}" title="Question Group Text Question"></div>
|
||||
<div class="addButtonIcons"><img title="TextQuestion" src="assets/images/text.svg" alt="" onclick="addNewGroupQuestions(event, 1)" id="textButtonSectionQroupside_${QuestionGroup_ID}" title="Question Group TextQuestion"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="ChoiceQuestion" src="assets/images/choice.svg" alt="" onclick="addNewGroupQuestions(event, 2)" id="choiseButtonSectionQroupside_${QuestionGroup_ID}" title="Question Group Choice Question"></div>
|
||||
<div class="addButtonIcons"><img title="ChoiceQuestion" src="assets/images/choice.svg" alt="" onclick="addNewGroupQuestions(event, 2)" id="choiseButtonSectionQroupside_${QuestionGroup_ID}" title="Question Group ChoiceQuestion"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="addButtonIcons"><img title="QuestionGroup" src="assets/images/Group.svg" alt="" onclick="MultiLevelQuestionGroup(event)" id="QuestionGroupButtonside_${QuestionGroup_ID}" title="Question Group on Question Group"></div>
|
||||
@ -4195,8 +4208,19 @@ fileInput2.addEventListener("change", () => {
|
||||
const idParts = event.target.id.split('_')[1];
|
||||
const titleRTCID = 'textTitleRtc_'+idParts
|
||||
rtc_hide_and_show(titleRTCID);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// console.log("AAdhavj");
|
||||
// const textSerialNumber = document.getElementById(`QuestionTextIdSet_${addTextQuestionId}`);
|
||||
// if (textSerialNumber) {
|
||||
// console.log(textSerialNumber);
|
||||
// textSerialNumber.focus();
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
var Text_description_Div = $("#"+textQuestionSubtitleAttr).find('.jodit-toolbar__box');
|
||||
Text_description_Div_Id = "textDescriptionRtc_"+addTextQuestionId;
|
||||
@ -4457,7 +4481,8 @@ var EditScroll = localStorage.getItem('scroll');
|
||||
const targetId = 'textQuestionName_' + addTextQuestionId;
|
||||
localStorage.setItem('savePreventDefault', targetId);
|
||||
if(EditScroll !== '1'){
|
||||
scrollToElementWithoutLink(targetId);
|
||||
scrollToElementWithoutLink(`QuestionTextIdSet_${addTextQuestionId}`);
|
||||
// scrollToElementWithoutLink(targetId);
|
||||
}
|
||||
|
||||
const arrayString = JSON.stringify(array_of_Id);
|
||||
@ -4572,7 +4597,6 @@ function check_Empty_Question()
|
||||
var questionpapertitleid = 'Question_title';
|
||||
if (title_id) {
|
||||
var parsedArray = JSON.parse(title_id);
|
||||
// console.log(parsedArray);
|
||||
parsedArray.forEach(function(Id, index,array) {
|
||||
|
||||
var getMathFiled = Id.replace(/\d/g, '');
|
||||
@ -4580,14 +4604,17 @@ function check_Empty_Question()
|
||||
|
||||
if (index === array.length - 1) {
|
||||
var idclass= document.getElementById(Id);
|
||||
console.log(idclass);
|
||||
// console.log(idclass == "QuestionTextIdSet SerialNo");
|
||||
|
||||
if (idclass == '' || idclass == null) {
|
||||
check_Remove_Empty_Question(Id,1)
|
||||
attrId ="1";
|
||||
} else if ( idclass === 'QuestionTextIdSet SerialNo' || idclass === 'QuestionsGroupIdset SerialNo' || idclass === 'QuestionChoiceId SerialNo' ) {
|
||||
|
||||
attrId = document.getElementById(Id).innerHTML
|
||||
}else if(idclass === 'multipleAnswerorNot'){
|
||||
|
||||
attrId ="";
|
||||
var remove = Id.replace('multipleAnswer_','')
|
||||
Id ='ChoiceCorrectAnswer_'+remove;
|
||||
@ -4596,11 +4623,15 @@ function check_Empty_Question()
|
||||
var elementid = document.getElementById(Id);
|
||||
if(elementid.tagName == 'INPUT'){
|
||||
|
||||
|
||||
}else{
|
||||
console.log("else");
|
||||
const previousElement = elementid.previousElementSibling;
|
||||
if (previousElement == null) {
|
||||
console.log("inner if");
|
||||
attrId =elementid;
|
||||
} else {
|
||||
console.log("inner else");
|
||||
var value = ''
|
||||
if(getMathFiled == 'textQuestiontitleMath_' || Id == "Max_Marks"){
|
||||
value = elementid.value;
|
||||
@ -4611,11 +4642,14 @@ function check_Empty_Question()
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(attrId);
|
||||
if(attrId === '<p><br></p>' || attrId === '<p><br></p>')
|
||||
{
|
||||
// console.log("Check empty if");
|
||||
if(Id === 'Question_title'){
|
||||
var elementID = document.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg')
|
||||
var elementID = document.getElementById('Question_title_workarea')
|
||||
console.log(elementID);
|
||||
// var elementID = document.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg');
|
||||
elementID.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
elementID.focus();
|
||||
}else{
|
||||
@ -4679,18 +4713,25 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
|
||||
|
||||
const input_text_value = document.getElementById(IdToRemove);
|
||||
|
||||
if (newVariableWithoutNumbers == 'removeAndCloneQroupQuestion_') {
|
||||
attrId= 'choice';
|
||||
} else if(DeleteElement != 1){
|
||||
if(newVariableWithoutNumbers == 'QuestionTextIdSet_' || newVariableWithoutNumbers == 'QuestionChoiceId_' || newVariableWithoutNumbers == 'Questions_Group_id_' || newVariableWithoutNumbers == 'textQuestiontitleMath_' || IdToRemove == "Max_Marks"){
|
||||
attrId = input_text_value.value;
|
||||
}else{
|
||||
const previousElement = input_text_value.previousElementSibling;
|
||||
var focus = previousElement.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML;
|
||||
attrId = focus;
|
||||
}
|
||||
}
|
||||
console.log('attrId : ', attrId);
|
||||
if (newVariableWithoutNumbers == 'removeAndCloneQroupQuestion_') {
|
||||
attrId= 'choice';
|
||||
} else if(DeleteElement != 1){
|
||||
if(newVariableWithoutNumbers == 'QuestionTextIdSet_' || newVariableWithoutNumbers == 'QuestionChoiceId_' || newVariableWithoutNumbers == 'Questions_Group_id_' || newVariableWithoutNumbers == 'textQuestiontitleMath_' || IdToRemove == "Max_Marks"){
|
||||
attrId = input_text_value.value;
|
||||
}
|
||||
else if(newVariableWithoutNumbers == "subSectionDescriptionWorkarea_"){
|
||||
var subSectionDescription = document.getElementById(IdToRemove).querySelector('p').innerHTML;
|
||||
console.log(subSectionDescription != '<br>');
|
||||
if(subSectionDescription != '<br>' ){
|
||||
attrId= subSectionDescription;
|
||||
}
|
||||
}
|
||||
else{
|
||||
const previousElement = input_text_value.previousElementSibling;
|
||||
var focus = previousElement.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML;
|
||||
attrId = focus;
|
||||
}
|
||||
}
|
||||
|
||||
var parsedArray = [];
|
||||
|
||||
@ -4701,7 +4742,7 @@ function check_Remove_Empty_Question(IdToRemove , DeleteElement=0) {
|
||||
parsedArray = JSON.parse(title_id);
|
||||
console.log('attrId 2 : ', attrId);
|
||||
|
||||
if(attrId === '' || attrId === '<p><br></p>' || attrId === '<p><br></p>') {
|
||||
if(attrId === '' || attrId === '<p><br></p>' || attrId === '<p><br></p>' || attrId === '<br>') {
|
||||
|
||||
// alert('1');
|
||||
if (!parsedArray.includes(IdToRemove)) {
|
||||
@ -4961,7 +5002,7 @@ function MultiLevelQuestionGroup(e)
|
||||
|
||||
}
|
||||
|
||||
//Function for Add a Text and Choice Question in the Section Question Area
|
||||
//Function for Add a Text and ChoiceQuestion in the Section Question Area
|
||||
function addNewQuestions(e, type)
|
||||
{
|
||||
clone_id_time = e.target.id;
|
||||
@ -5002,7 +5043,7 @@ function addNewGroupQuestions(e, type)
|
||||
}
|
||||
}
|
||||
|
||||
//Function for Add Choice Field in the Choice Question Area
|
||||
//Function for Add Choice Field in the ChoiceQuestion Area
|
||||
function ConstructAddNewChoiceID(e){
|
||||
var addChoiceArea = e.target.id;
|
||||
var addChoiceAreaTime = addChoiceArea.split("_")[1];
|
||||
@ -5172,6 +5213,8 @@ function removeQuestionGroup(index) {
|
||||
if (element) {
|
||||
var GroupQuestionTitle = 'subSection_title_text_'+index;
|
||||
check_Remove_Empty_Question(GroupQuestionTitle,1);
|
||||
var GroupQuestionDescription = 'subSectionDescriptionWorkarea_'+index;
|
||||
check_Remove_Empty_Question(GroupQuestionDescription)
|
||||
var GroupQuestionSerialNo = 'idOfArrayQuestions_Group_id_'+index;
|
||||
check_Remove_Empty_Question(GroupQuestionSerialNo,1);
|
||||
element.remove();
|
||||
@ -5774,7 +5817,7 @@ setInterval(addTitleforTable,2000)
|
||||
</script>
|
||||
<!-- End this for RTE Table ToolTip Add -->
|
||||
|
||||
<!-- Start the Choice Question Mandatory Check -->
|
||||
<!-- Start the ChoiceQuestion Mandatory Check -->
|
||||
<script>
|
||||
function checkChoicesNotSelect(element){
|
||||
// console.log(element);
|
||||
@ -5816,7 +5859,7 @@ collect_Empty_Question_Id(arrayString);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<!-- End the Choice Question Mandatory Check -->
|
||||
<!-- End the ChoiceQuestion Mandatory Check -->
|
||||
|
||||
<!-- Start Add All Serial Number is null -->
|
||||
<script>
|
||||
@ -5928,8 +5971,195 @@ setInterval(removeNonExistentIdseveryTime, 1000)
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
function reduceSapceInMathLiveABC(params) {
|
||||
var elementName= document.querySelector('.ML__keyboard')
|
||||
if(elementName){
|
||||
if (elementName.style.cssText == "--_keyboard-height: calc(382px + var(--_padding-top) + var(--_padding-bottom) + env(safe-area-inset-bottom, 0));") {
|
||||
elementName.style.cssText = '--_keyboard-height: calc(314px + var(--_padding-top) + var(--_padding-bottom) + env(safe-area-inset-bottom, 0));'
|
||||
}
|
||||
}
|
||||
}
|
||||
setInterval(reduceSapceInMathLiveABC, 500)
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
mathDisableFunction();
|
||||
}, 1500);
|
||||
function mathDisableFunction() {
|
||||
const parentFolder = path.dirname(__filename);
|
||||
const filePath = path.join(parentFolder, 'mathEnable.json');
|
||||
fs.readFile(filePath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
console.error('Error reading file:', err);
|
||||
return;
|
||||
}
|
||||
const jsonObject = JSON.parse(data);
|
||||
|
||||
var aa= jsonObject.mathEnable;
|
||||
const inputString = aa[0];
|
||||
|
||||
const valuesArray = inputString.split(', ');
|
||||
valuesArray.forEach(value => {
|
||||
|
||||
if(value === 'WorkArea'){
|
||||
var workArea = document.getElementById('sidebarToggle2');
|
||||
if (workArea) {
|
||||
workArea.style.display = 'block';
|
||||
}
|
||||
}else if( value === 'SubTitle'){
|
||||
var subTitles= document.querySelectorAll('label')
|
||||
subTitles.forEach(function (subTitle){
|
||||
if (subTitle.innerHTML == "Subtitle:") {
|
||||
subTitle.parentElement.parentElement.style= "display:block";
|
||||
}
|
||||
})
|
||||
}else if(value === 'MathCheckbox'){
|
||||
|
||||
const mathNameValues =document.querySelectorAll('.mathQuestions');
|
||||
|
||||
mathNameValues.forEach(function (mathNameValue){
|
||||
mathNameValue.style="display:block";
|
||||
mathNameValue.nextSibling.nextSibling.style = "display:block;width:14px; height:14px";
|
||||
|
||||
})
|
||||
|
||||
const mathNameValuesChoices =document.querySelectorAll('.math');
|
||||
|
||||
mathNameValuesChoices.forEach(function (mathNameValuesChoice){
|
||||
mathNameValuesChoice.style="display:block;";
|
||||
mathNameValuesChoice.parentElement.style="display:flex";
|
||||
mathNameValuesChoice.previousSibling.previousSibling.style = "display:block;width:14px; height:14px";
|
||||
|
||||
})
|
||||
|
||||
}else if(value === 'TextQuestionButton'){
|
||||
var elements = document.querySelectorAll('[title="TextQuestion"]');
|
||||
elements.forEach(function(element) {
|
||||
// Do something with each element, for example, log its inner text
|
||||
var parentElement = element.parentElement;
|
||||
parentElement.style.display= 'block';
|
||||
});
|
||||
|
||||
}else if(value === 'MCQQuestionButton'){
|
||||
var elements = document.querySelectorAll('[title="ChoiceQuestion"]');
|
||||
|
||||
elements.forEach(function(element) {
|
||||
// Do something with each element, for example, log its inner text
|
||||
var parentElement = element.parentElement;
|
||||
|
||||
parentElement.style.display= 'block';
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
document.addEventListener('click', mathDisableFunction);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
//Start this for Fcous where drag and drop using Arrow
|
||||
<script>
|
||||
document.addEventListener('click', handleClick);
|
||||
|
||||
function handleClick(event) {
|
||||
const clickedElement = event.target;
|
||||
|
||||
if (clickedElement.classList.contains('fa-chevron-up')) {
|
||||
scrollToElementWithoutLink(clickedElement.parentElement.parentElement.id)
|
||||
} else if (clickedElement.classList.contains('fa-chevron-down')) {
|
||||
scrollToElementWithoutLink(clickedElement.parentElement.parentElement.id)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
//End this for Focus where drag and drop using Arrow
|
||||
|
||||
|
||||
//Start this for Highlight the All Div when its focus
|
||||
<script>
|
||||
document.addEventListener('focus', function(event) {
|
||||
if (event.target.className == "jodit-wysiwyg") {
|
||||
event.target.classList.add('focused');
|
||||
}
|
||||
}, true);
|
||||
document.addEventListener('blur', function(event) {
|
||||
event.target.classList.remove('focused');
|
||||
}, true);
|
||||
</script>
|
||||
//End this for Highlight the All Div when its focus
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
setTimeout(function() {
|
||||
hidethefunction();
|
||||
}, 1500);
|
||||
function hidethefunction() {
|
||||
|
||||
var workArea = document.getElementById('sidebarToggle2');
|
||||
workArea.style.display = 'none';
|
||||
|
||||
|
||||
var subTitles= document.querySelectorAll('label')
|
||||
subTitles.forEach(function (subTitle){
|
||||
if (subTitle.innerHTML == "Subtitle:") {
|
||||
subTitle.parentElement.style= "display:none";
|
||||
}
|
||||
})
|
||||
|
||||
const mathNameValues =document.querySelectorAll('.mathQuestions');
|
||||
|
||||
mathNameValues.forEach(function (mathNameValue){
|
||||
mathNameValue.style="display:none;";
|
||||
mathNameValue.nextSibling.nextSibling.style = "display:none;width:14px; height:14px";
|
||||
|
||||
})
|
||||
|
||||
|
||||
const mathNameValuesChoices =document.querySelectorAll('.math');
|
||||
|
||||
mathNameValuesChoices.forEach(function (mathNameValuesChoice){
|
||||
mathNameValuesChoice.style="display:none;";
|
||||
mathNameValuesChoice.previousSibling.previousSibling.style = "display:none;";
|
||||
|
||||
})
|
||||
|
||||
|
||||
var elements = document.querySelectorAll('[title="TextQuestion"]');
|
||||
elements.forEach(function(element) {
|
||||
// Do something with each element, for example, log its inner text
|
||||
var parentElement = element.parentElement;
|
||||
parentElement.style.display= 'none';
|
||||
});
|
||||
|
||||
|
||||
|
||||
var elements = document.querySelectorAll('[title="ChoiceQuestion"]');
|
||||
|
||||
elements.forEach(function(element) {
|
||||
// Do something with each element, for example, log its inner text
|
||||
var parentElement = element.parentElement;
|
||||
|
||||
parentElement.style.display= 'none';
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener('click', hidethefunction);
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
BIN
assets/images/Nexa_Author_Icon-Copy.png
Normal file
BIN
assets/images/Nexa_Author_Icon-Copy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
BIN
assets/images/calculator.png
Normal file
BIN
assets/images/calculator.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
1
assets/images/close.svg
Normal file
1
assets/images/close.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" width="12" height="12"><path d="M2.22 2.22a.749.749 0 0 1 1.06 0L6 4.939 8.72 2.22a.749.749 0 1 1 1.06 1.06L7.061 6 9.78 8.72a.749.749 0 1 1-1.06 1.06L6 7.061 3.28 9.78a.749.749 0 1 1-1.06-1.06L4.939 6 2.22 3.28a.749.749 0 0 1 0-1.06Z" style="fill: #BF303B;"></path></svg>
|
||||
|
After Width: | Height: | Size: 332 B |
3
assets/images/duplicate.svg
Normal file
3
assets/images/duplicate.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg id="Layer_1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" data-name="Layer 1">
|
||||
<path d="m460.256 204.036-112.732-123.706a7 7 0 0 0 -5.173-2.286h-18.8l-60.836-66.759a7 7 0 0 0 -5.174-2.285h-177.755c-16.47 0-29.868 14.4-29.868 32.094v360.767c0 17.7 13.4 32.1 29.867 32.1h54.944v36.949c0 17.7 13.4 32.1 29.867 32.1h267.618c16.47 0 29.868-14.4 29.868-32.1v-262.16a7 7 0 0 0 -1.826-4.714zm-21.024-2.286h-89.519l-.308-98.571zm-359.447 218.206c-8.749 0-15.867-8.117-15.867-18.1v-360.762c0-9.977 7.118-18.094 15.868-18.094h174.663l50.161 55.044h-140.01c-16.469 0-29.867 14.4-29.867 32.094v309.818zm352.429 69.044h-267.614c-8.749 0-15.867-8.117-15.867-18.1v-360.762c0-9.977 7.118-18.094 15.867-18.094h170.771l.363 116.728a7 7 0 0 0 7 6.978h105.348v255.155c0 9.978-7.118 18.095-15.868 18.095zm-35.2-227.25a7 7 0 0 1 -7 7h-183.221a7 7 0 0 1 0-14h183.224a7 7 0 0 1 7 7zm0 61a7 7 0 0 1 -7 7h-183.221a7 7 0 0 1 0-14h183.224a7 7 0 0 1 7 7zm0 61a7 7 0 0 1 -7 7h-183.221a7 7 0 0 1 0-14h183.224a7 7 0 0 1 7 7z" style="fill: #BF303B;" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
BIN
assets/images/paper.png
Normal file
BIN
assets/images/paper.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.0 KiB |
BIN
assets/images/settings.png
Normal file
BIN
assets/images/settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
385
dashboard.html
385
dashboard.html
@ -44,12 +44,97 @@
|
||||
<!-- <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"> -->
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
.switch-label {
|
||||
width: -webkit-fill-available;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.option {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.option + .switch-label {
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
.option + .switch-label::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 30px;
|
||||
height: 15px;
|
||||
background-color: #ccc;
|
||||
border-radius: 15px;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.option + .switch-label::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 7px;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%); /* Center vertically and horizontally */
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background-color: white;
|
||||
border-radius: 50%;
|
||||
transition: left 0.3s;
|
||||
}
|
||||
|
||||
.option:checked + .switch-label::before {
|
||||
background-color: #BF303B;
|
||||
}
|
||||
|
||||
.option:checked + .switch-label::after {
|
||||
left: calc(14% - 16px); /* Adjusted for circle size */
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
|
||||
#popupTitleId{
|
||||
text-align: center;
|
||||
font-size: 30px;
|
||||
/* color: black; */
|
||||
font-weight: bold;
|
||||
margin-top: 48px;
|
||||
}
|
||||
|
||||
.popup {
|
||||
width: 379px;
|
||||
height: 420px;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
/* width: 300px; */
|
||||
background-color: white;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.popup-content {
|
||||
padding: 20px;
|
||||
margin-top: 25px;
|
||||
margin-left: 57px;
|
||||
}
|
||||
|
||||
.blur-background {
|
||||
filter: blur(5px);
|
||||
}
|
||||
|
||||
|
||||
/* The Modal (background) */
|
||||
.modal {
|
||||
display: none; /* Hidden by default */
|
||||
@ -232,6 +317,7 @@ margin-left: -16px;
|
||||
<ul>
|
||||
<li><a href="addform.html"><img class="addPageMenu" src="assets/images/new.svg" alt="">New</a></li>
|
||||
<li><a href="#" id="myBtn"><img class="addPageMenu" src="assets/images/open.svg" alt="">Open</a></li>
|
||||
<li><a href="#" id="settingButton"><img class="addPageMenu" src="assets/images/settings.png" alt="" style="width: 19px;">Settings</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -608,6 +694,130 @@ if (fileList !== false) {
|
||||
|
||||
|
||||
|
||||
function duplicateFile(oldfilename) {
|
||||
|
||||
var filename ='';
|
||||
|
||||
Swal.fire({
|
||||
title: 'Enter Filename',
|
||||
input: 'text',
|
||||
inputValue: '.xml',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Submit',
|
||||
cancelButtonText: 'Cancel',
|
||||
inputValidator: (value) => {
|
||||
// console.log(value);
|
||||
const entervalue =value
|
||||
if (value == '.xml') {
|
||||
return 'You need to enter Filename!'
|
||||
}
|
||||
else if (value){
|
||||
|
||||
const xmlFilePath = `${xmlPath}`;
|
||||
const xmlFileNameParts = oldfilename.split('.xml');
|
||||
const xmlBaseName = xmlFileNameParts[0];
|
||||
const jsonFileName = `${xmlBaseName}_answer.json`;
|
||||
const jsonFilePath = `${xmlPath}${jsonFileName}`;
|
||||
|
||||
|
||||
const newXmlFileNameParts = entervalue.split('.xml');
|
||||
const newXmlBaseName = newXmlFileNameParts[0];
|
||||
const newJsonFileName = `${newXmlBaseName}_answer.json`;
|
||||
|
||||
var fileList = findFile(jsonFilePath);
|
||||
|
||||
const downloadsPath = xmlPath;
|
||||
|
||||
|
||||
const isEncrypted = configObject.ENCRYPTED.trim();
|
||||
|
||||
const filePathToSave = path.join(downloadsPath);
|
||||
const jsonFilePathToSave = path.join(downloadsPath);
|
||||
|
||||
|
||||
|
||||
if(isEncrypted == 'YES'){
|
||||
const decodeData = decode(xmlFilePath);
|
||||
const encodeData = encode(decodeData, filePathToSave);
|
||||
if(fileList !== false)
|
||||
{
|
||||
const jsonDecodeData = decode(jsonFilePath);
|
||||
const jsonEncodeData = encode(jsonDecodeData, jsonFilePathToSave);
|
||||
}
|
||||
}else{
|
||||
try {
|
||||
const content = fs.readFileSync(`${xmlFilePath}${oldfilename}`, 'utf-8');
|
||||
fs.writeFileSync(`${xmlFilePath}${entervalue}`, content, 'utf-8');
|
||||
Swal.fire({
|
||||
title: "File Duplicated",
|
||||
icon: "success"
|
||||
});
|
||||
} catch (err) {
|
||||
let errorMessage = "";
|
||||
if (err.code === 'EACCES') {
|
||||
errorMessage = `Permission Denied.<br> Path: ${filePathToSave}`;
|
||||
} else if (err.code === 'ENOENT') {
|
||||
errorMessage = `No Such File Directory. <br> Path: ${filePathToSave}`;
|
||||
} else {
|
||||
errorMessage = `Unknown Error. <br> Path: ${filePathToSave}`;
|
||||
}
|
||||
Swal.fire({
|
||||
title: "File Duplicate Failed",
|
||||
html: errorMessage,
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
|
||||
// Duplicate JSON File
|
||||
if (fileList !== false)
|
||||
{
|
||||
try {
|
||||
const content = fs.readFileSync(jsonFilePath, 'utf-8');
|
||||
// console.log('json', content);
|
||||
fs.writeFileSync(`${jsonFilePathToSave}${newJsonFileName}`, content, 'utf-8');
|
||||
Swal.fire({
|
||||
title: "File Duplicated",
|
||||
icon: "success"
|
||||
});
|
||||
} catch (err) {
|
||||
let errorMessage = "";
|
||||
if (err.code === 'EACCES') {
|
||||
errorMessage = `Permission Denied.<br> Path: ${jsonFilePathToSave}`;
|
||||
} else if (err.code === 'ENOENT') {
|
||||
errorMessage = `No Such File Directory. <br> Path: ${jsonFilePathToSave}`;
|
||||
} else {
|
||||
errorMessage = `Unknown Error. <br> Path: ${jsonFilePathToSave}`;
|
||||
}
|
||||
Swal.fire({
|
||||
title: "File Duplicate Failed",
|
||||
html: errorMessage,
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
const inputValue = result.value
|
||||
savexml(inputValue)
|
||||
}else if(result.isDenied){
|
||||
savexml(RawFileName)
|
||||
}
|
||||
window.location.reload();
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Function for Finding the JSON File in the folder
|
||||
function findFile(filePath) {
|
||||
try {
|
||||
@ -666,5 +876,176 @@ function copyFile(sourceFilePath, destinationFilePath) {
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
const settingBtn = document.getElementById('settingButton');
|
||||
const overlay = document.getElementById('overlay');
|
||||
|
||||
settingBtn.onclick = function() {
|
||||
openPopup();
|
||||
};
|
||||
|
||||
function openPopup() {
|
||||
const popup = document.createElement('div');
|
||||
popup.className = 'popup';
|
||||
|
||||
const iconElement = document.createElement('i');
|
||||
iconElement.className = 'fas fa-icon-class';
|
||||
iconElement.style = "margin-right: 15px; margin-top: 15px;float: right;";
|
||||
iconElement.onclick = closePopup;
|
||||
|
||||
const iconimage = document.createElement('img');
|
||||
iconimage.src= "assets/images/close.svg";
|
||||
iconimage.style="width: 25px";
|
||||
iconElement.appendChild(iconimage)
|
||||
|
||||
const popupTitle = document.createElement('p');
|
||||
popupTitle.id='popupTitleId';
|
||||
popupTitle.textContent = 'App Settings';
|
||||
|
||||
const popupContent = document.createElement('div');
|
||||
popupContent.className = 'popup-content';
|
||||
|
||||
const radioOptions = [
|
||||
{value: 'WorkArea', label: 'Work Area'},
|
||||
{value: 'SubTitle', label: 'Sub Title'},
|
||||
{value: 'MathCheckbox', label: 'Math'},
|
||||
{value: 'TextQuestionButton', label: 'Text Question Button'},
|
||||
{value: 'MCQQuestionButton', label: 'MCQ Question Button'}
|
||||
];
|
||||
|
||||
radioOptions.forEach(option => {
|
||||
const checkboxInput = document.createElement('input');
|
||||
checkboxInput.type = 'checkbox';
|
||||
checkboxInput.name = option.value; // Set name attribute if needed
|
||||
checkboxInput.value = option.value; // Set value attribute if needed
|
||||
checkboxInput.id = `switch-${option.value}`; // Set unique id for each checkbox
|
||||
checkboxInput.className = 'option'; // Add class name if needed
|
||||
popupContent.appendChild(checkboxInput);
|
||||
|
||||
// Create label for the checkbox
|
||||
const label = document.createElement('label');
|
||||
label.textContent = option.label; // Set label text
|
||||
label.setAttribute('for', `switch-${option.value}`); // Set for attribute to match the checkbox's id attribute
|
||||
label.className = 'switch-label'; // Add class name if needed
|
||||
popupContent.appendChild(label);
|
||||
|
||||
popupContent.appendChild(document.createElement('br'));
|
||||
});
|
||||
|
||||
// Add submit button
|
||||
const submitButton = document.createElement('button');
|
||||
submitButton.style=style="width: 142px; border-radius: 10px; margin-left: 41px; margin-top: 28px; border-color: #BF303B; /* color: #BF3054; */ /* background-color: #BF303B; */";
|
||||
submitButton.textContent = 'Submit';
|
||||
submitButton.type = 'button'; // Set type to button to prevent form submission
|
||||
submitButton.addEventListener('click', () => {
|
||||
submitValues();
|
||||
closePopup();
|
||||
});
|
||||
popupContent.appendChild(submitButton);
|
||||
|
||||
popup.appendChild(iconElement);
|
||||
popup.appendChild(popupTitle)
|
||||
popup.appendChild(popupContent);
|
||||
document.body.appendChild(popup);
|
||||
|
||||
// Show overlay
|
||||
overlay.style.display = 'block';
|
||||
}
|
||||
|
||||
// Function to close popup and hide overlay
|
||||
function closePopup() {
|
||||
const popup = document.querySelector('.popup');
|
||||
if (popup) {
|
||||
popup.parentNode.removeChild(popup);
|
||||
}
|
||||
// Hide overlay
|
||||
overlay.style.display = 'none';
|
||||
}
|
||||
|
||||
// Function to submit selected values to server
|
||||
function submitValues() {
|
||||
const selectedValues = Array.from(document.querySelectorAll('input[class=option]:checked')).map(input => input.value);
|
||||
|
||||
|
||||
const array = selectedValues;
|
||||
const string = array.join(', ');
|
||||
const jsonString = JSON.stringify(string);
|
||||
console.log(jsonString);
|
||||
const wrappedJsonString = `{"mathEnable":[${jsonString}]}`;
|
||||
|
||||
const newPath = xmlPath.replace(/\\xml\\/i, '\\');
|
||||
|
||||
fs.writeFileSync(`${newPath}mathEnable.json`, wrappedJsonString, 'utf-8');
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
function popupCheck() {
|
||||
const parentFolder = path.dirname(__filename);
|
||||
const filePath = path.join(parentFolder, 'mathEnable.json');
|
||||
fs.readFile(filePath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
console.error('Error reading file:', err);
|
||||
return;
|
||||
}
|
||||
const jsonObject = JSON.parse(data);
|
||||
|
||||
var aa= jsonObject.mathEnable;
|
||||
const inputString = aa[0];
|
||||
|
||||
const valuesArray = inputString.split(', ');
|
||||
valuesArray.forEach(value => {
|
||||
console.log(value);
|
||||
|
||||
if(value === 'WorkArea'){
|
||||
var elements = document.querySelector('[name="WorkArea"]');
|
||||
if (elements) {
|
||||
elements.checked = true;
|
||||
}
|
||||
|
||||
}else if( value === 'SubTitle'){
|
||||
var elements = document.querySelector('[name="SubTitle"]');
|
||||
if (elements) {
|
||||
elements.checked = true;
|
||||
}
|
||||
|
||||
}else if(value === 'MathCheckbox'){
|
||||
var elements = document.querySelector('[name="MathCheckbox"]');
|
||||
if (elements) {
|
||||
elements.checked = true;
|
||||
}
|
||||
}else if(value === 'TextQuestionButton'){
|
||||
var elements = document.querySelector('[name="TextQuestionButton"]');
|
||||
if (elements) {
|
||||
elements.checked = true;
|
||||
}
|
||||
}else if(value === 'MCQQuestionButton'){
|
||||
var elements = document.querySelector('[name="MCQQuestionButton"]');
|
||||
if (elements) {
|
||||
elements.checked = true;
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
var settingButtonParent = document.getElementById('settingButton').parentElement;
|
||||
|
||||
if (settingButtonParent) {
|
||||
settingButtonParent.addEventListener('click', function(event) {
|
||||
popupCheck();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// popupCheck();
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -8,7 +8,7 @@ function json2nav() {
|
||||
var isMathEnabled = document.getElementById('titlemath_' + element_id).checked;
|
||||
var questionTitle = "";
|
||||
var textQuestionId = "";
|
||||
|
||||
var element_serialnumber='';
|
||||
if(isMathEnabled == true){
|
||||
textQuestionId = 'textQuestiontitleMath_' + element_id;
|
||||
}else{
|
||||
@ -18,9 +18,13 @@ function json2nav() {
|
||||
if(isMathEnabled == true){
|
||||
|
||||
questionTitle = document.getElementById('textQuestiontitleMath_' + element_id).value;
|
||||
element_serialnumber = document.getElementById('QuestionTextIdSet_'+ element_id).value
|
||||
|
||||
}else{
|
||||
|
||||
const element = document.getElementById('textQuestionName_' + element_id)
|
||||
const element = document.getElementById('textQuestionName_' + element_id);
|
||||
element_serialnumber = document.getElementById('QuestionTextIdSet_'+ element_id).value
|
||||
|
||||
const previousElement = element.previousElementSibling;
|
||||
var questionTitleData = previousElement.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML;
|
||||
questionTitle = questionTitleData;
|
||||
@ -31,6 +35,7 @@ function json2nav() {
|
||||
|
||||
return {
|
||||
"question": questionTitle,
|
||||
"serial_Number": element_serialnumber,
|
||||
"question_Id":textQuestionId,
|
||||
"marks":marks,
|
||||
"isMathEnabled":isMathEnabled,
|
||||
@ -46,6 +51,7 @@ function json2nav() {
|
||||
var isMathEnabled = document.getElementById('titlemath_' + element_id).checked;
|
||||
var questionTitle = "";
|
||||
var choiceQuestionId = "";
|
||||
var serial_Number = "";
|
||||
|
||||
if(isMathEnabled == true){
|
||||
choiceQuestionId = 'textQuestiontitleMath_' + element_id;
|
||||
@ -58,7 +64,8 @@ function json2nav() {
|
||||
questionTitle = document.getElementById('textQuestiontitleMath_' + element_id).value;
|
||||
}else{
|
||||
|
||||
const element = document.getElementById('textQuestionName_' + element_id)
|
||||
const element = document.getElementById('textQuestionName_' + element_id);
|
||||
serial_Number = document.getElementById('QuestionChoiceId_'+element_id).value;
|
||||
const previousElement = element.previousElementSibling;
|
||||
var questionTitleData = previousElement.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML;
|
||||
questionTitle = questionTitleData;
|
||||
@ -68,6 +75,7 @@ function json2nav() {
|
||||
|
||||
return {
|
||||
"question": questionTitle,
|
||||
"serial_Number": serial_Number,
|
||||
"question_Id":choiceQuestionId,
|
||||
"marks":marks,
|
||||
"isMathEnabled":isMathEnabled,
|
||||
@ -130,10 +138,13 @@ function json2nav() {
|
||||
const previousElement = groupelement.previousElementSibling;
|
||||
var group_title_data = previousElement.querySelector('.jodit-workplace').querySelector('.jodit-wysiwyg').innerHTML;
|
||||
|
||||
var serial_Number = document.getElementById('Questions_Group_id_'+rand_id).value
|
||||
|
||||
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['serial_Number'] = serial_Number
|
||||
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);
|
||||
@ -150,7 +161,6 @@ function json2nav() {
|
||||
|
||||
$.fn.getSectionDataNavigation = function(element) {
|
||||
// console.log('getSectionData');
|
||||
// console.log(element.id);
|
||||
const rand_id = (element.id).split("_").slice(-1)[0];
|
||||
// console.log(rand_id);
|
||||
// console.log('section_title_text_'+rand_id);
|
||||
|
||||
18
index.js
18
index.js
@ -60,11 +60,11 @@ files.forEach((file) => {
|
||||
// Function to load and display XML files in a loop
|
||||
async function loadMultipleXMLs() {
|
||||
for (const xmlFile of filePaths) {
|
||||
console.log(xmlFile)
|
||||
try {
|
||||
const titleText = await loadList(xmlFile); // Initially load in list view
|
||||
|
||||
const dynamicId = `download-button-${Date.now()}`;
|
||||
const dynamicIdDownload = `download-button-${Date.now()}`;
|
||||
const dynamicIdDuplicate = `duplicate-button-${Date.now()}`
|
||||
|
||||
// Handle list view
|
||||
const html_for_list = `
|
||||
@ -75,9 +75,12 @@ async function loadMultipleXMLs() {
|
||||
<a class="icons" href="addform.html?filename=${xmlFile}" title="Edit">
|
||||
<i><img src="assets/images/edit.svg" alt=""></i>
|
||||
</a>
|
||||
<a class="icons" href="#" id="${dynamicId}" data-filename="${xmlFile}" title="Download">
|
||||
<a class="icons" href="#" id="${dynamicIdDownload}" data-filename="${xmlFile}" title="Download">
|
||||
<i><img src="assets/images/download.svg" alt=""></i>
|
||||
</a>
|
||||
<a class="icons" href="#" id="${dynamicIdDuplicate}" data-filename="${xmlFile}" title="Duplicate">
|
||||
<i><img src="assets/images/duplicate.svg" alt="" style="width: 25px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="resent-post-single-box">
|
||||
<div class="resent-thunb">
|
||||
@ -90,12 +93,19 @@ async function loadMultipleXMLs() {
|
||||
$('#list').append(html_for_list);
|
||||
|
||||
// Add event listener for download buttons
|
||||
$('#'+dynamicId).on('click',function (event) {
|
||||
$('#'+dynamicIdDownload).on('click',function (event) {
|
||||
event.preventDefault();
|
||||
const filename =$(this).data('filename');
|
||||
downloadFile(filename);
|
||||
});
|
||||
|
||||
|
||||
$('#'+dynamicIdDuplicate).on('click',function (event) {
|
||||
event.preventDefault();
|
||||
const filename =$(this).data('filename');
|
||||
duplicateFile(filename);
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error("Error loading XML:", error);
|
||||
}
|
||||
|
||||
@ -295,6 +295,7 @@ function navpane() {
|
||||
sectionDiv.appendChild(sectionLink);
|
||||
|
||||
section.questions.forEach(question => {
|
||||
// console.log(question);
|
||||
createTreeNode(question, contentDiv);
|
||||
});
|
||||
|
||||
@ -309,6 +310,7 @@ function navpane() {
|
||||
nodeDiv.classList.add('navDrag');
|
||||
nodeDiv.appendChild(nodeDivChildForIconAlgin)
|
||||
// nodeDiv.id = nodeData.textQuestion_Id || nodeData.choice_question_id;
|
||||
const nodeSerialNo = nodeData.serial_Number;
|
||||
const nodeDataId = nodeData.question_Id
|
||||
const nodeDataType = nodeData.question_type
|
||||
// console.log('nodeDataType:',nodeDataType);
|
||||
@ -540,7 +542,7 @@ function navpane() {
|
||||
// }
|
||||
|
||||
|
||||
var htmlTagRemovedQuestionTitle = removeTagsAndTruncate(nodeData.question, 25);
|
||||
var htmlTagRemovedQuestionTitle = removeTagsAndTruncate(nodeData.serial_Number, 25);
|
||||
var Latex = convertToLatex(htmlTagRemovedQuestionTitle);
|
||||
|
||||
var data = ''
|
||||
@ -832,10 +834,10 @@ function navpane() {
|
||||
|
||||
if (nodeData.group_title.length > 20) {
|
||||
// groupQuestionLink.innerHTML = removeParagraphTags(nodeData.group_title.substring(0, 20) + '..');
|
||||
groupQuestionLink.innerHTML = removeParagraphTags(nodeData.group_title);
|
||||
groupQuestionLink.innerHTML = removeParagraphTags(nodeData.serial_Number);
|
||||
|
||||
} else {
|
||||
groupQuestionLink.innerHTML = removeParagraphTags(nodeData.group_title);
|
||||
groupQuestionLink.innerHTML = removeParagraphTags(nodeData.serial_Number);
|
||||
}
|
||||
groupTitleDiv.appendChild(groupQuestionLink);
|
||||
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "nexa-author",
|
||||
"name": "Nexa Author",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "nexa-author",
|
||||
"name": "Nexa Author",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user