aadhavan code merge : RV

This commit is contained in:
venkateswaran ubuntu 2023-11-30 15:24:55 +05:30
commit 432adb7709
20 changed files with 1043 additions and 239 deletions

View File

@ -152,6 +152,7 @@ function QuestionPaperPreview(jsonData){
let cleanedText=cleanedTex.replace('<p>','').replace('</p>','')
var question_id_length =cleanedText.length;
if (question_id_length == 1) {
GroupQuestionTilteAlign =15
} else if (question_id_length == 3) {
GroupQuestionTilteAlign =33
@ -170,7 +171,7 @@ function QuestionPaperPreview(jsonData){
// const questionId =`<p class="GroupQuestionId">${cleanedText})</p>`
const questionId =cleanedText
console.log(questionId);
// console.log(questionId);
const questionGroupSetP = `${question.group_title}`;
const questionGroupmodify =questionGroupSetP.replaceAll('<p>', `<p id="question-Group-Id" style="padding-left:${GroupQuestionTilteAlign}px">`)
@ -206,16 +207,16 @@ function QuestionPaperPreview(jsonData){
questionPaper += `<div class="group-descrip" style="margin-left:${description_align}px">${questionGroupDescription}</div>`;
depth2++
} else if (question.question) {
console.log(question);
let cleanedTex = question.questionId.replace(/\s+/g, ' ').trim();
let cleanedText=cleanedTex.replace('<p>','').replace('</p>','')
var question_id_length =cleanedText.length;
console.log(question_id_length);
if (question_id_length == 1) {
GroupQuestionTilteAlign =14
} else if (question_id_length == 3) {
GroupQuestionTilteAlign =26
}else if(question_id_length == 5){
GroupQuestionTilteAlign =41
}else if(question_id_length == 7) {
GroupQuestionTilteAlign =54
@ -230,7 +231,6 @@ function QuestionPaperPreview(jsonData){
// const questionId =`<p class="questionId">${cleanedText})</p>`;
const questionI =cleanedText;
var questionId = questionI.replace('<p>', '<p class="questionId">');
console.log(questionId);
const questionTex = question.question;
const questionText = questionTex.replaceAll('<p>', `<p class="question_Text" style="margin-left:${GroupQuestionTilteAlign}px">`);

View File

@ -49,6 +49,29 @@
<style>
table {
border-collapse: collapse; /* Set to 'collapse' for adjacent cell borders to collapse into one */
text-indent: 0; /* Reset text indentation */
border-spacing: 0; /* Set to '0' to eliminate any spacing between cells */
}
table td{
border: 1px solid black !important;
}
.table-border{
/* border: 1px solid black; */
margin-left:10px;
margin-right: 10px !important;
width: 80px;
inline-size: 80px;
text-wrap: wrap;
}
tr{
display: flex !important;
/* border: 1px solid black; */
}
.question-Group-Description{
margin-top: -14px;
}
@ -136,7 +159,8 @@
/* Questions Mark */
.question_Text{
display: inline-flex;
display: inline-table;
/* display: inline-flex; */
margin-right: 10px;
}
#question-mark{
@ -183,7 +207,9 @@
margin-top: 20px;
}
.text-qus-align :not(p:first-child){
display:flex;
/* display:flex; */
/* display: contents; */
/* display: flow; */
/* margin-left: 54px; */
}
/* .text-qus-align p:first-child{
@ -411,17 +437,23 @@ color: #1d3557 !important;
<script src="xml2json_for_Questionpaper_preview.js"></script>
<script src="QuestionPaperPreview.js"></script>
<script src="decode.js"></script>
<script>
$("#overlay").show();
const fs = require('fs');
const path =require('path');
require('dotenv').config();
// require('dotenv').config();
//get value from .env
const isEncrypted = process.env.ENCRYPTED;
// const convertBaseToString =require('./envConvertBasetoString');
var configObject = convertBaseToString();
const isEncrypted = configObject.ENCRYPTED.trim();
// 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
@ -435,7 +467,9 @@ color: #1d3557 !important;
function loadXML(xmlFileName) {
//XmlPath get from .env
const xmlPathenv=process.env.XML_FILE_PATH;
const xmlPathenv=configObject.XML_FILE_PATH.trim();
// const xmlPathenv=process.env.XML_FILE_PATH;
const xmlPath =path.join(__dirname,xmlPathenv);
// console.log(xmlFileName)
return new Promise((resolve, reject) => {
@ -482,6 +516,54 @@ setTimeout(() => {
</script>
<script>
function thisclassnameWhenPaste() {
var elements = document.querySelectorAll('.ql-align-justify');
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>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -314,14 +314,15 @@ margin-left: -16px;
<script src="encode.js"></script>
<script src="decode.js"></script>
<script src="envConvertBasetoString.js"></script>
<!-- jquery js -->
<script>
var configObject = convertBaseToString();
console.log(configObject);
const Swal = require('sweetalert2');
function uploadFile() {
@ -336,10 +337,15 @@ function uploadFile() {
var msgDiv = document.getElementById('Message');
var modal = document.getElementById('myModal');
var fileInput = document.getElementById('fileInput');
require('dotenv').config();
// require('dotenv').config();
//XmlPath get from .env
const xmlPathenv=process.env.XML_FILE_PATH;
const xmlPath = path.join(__dirname,xmlPathenv);
// const xmlPathenv=process.env.XML_FILE_PATH;
// const xmlPath = path.join(__dirname,xmlPathenv);
const xmlPathenv=configObject.XML_FILE_PATH.trim();
const xmlPath = path.join(__dirname,xmlPathenv);
function fileupload(filePaths) {
@ -454,6 +460,7 @@ function validateFile(input) {
function downloadFile(filename) {
console.log(xmlPath);
const xmlFilePath = `${xmlPath}${filename}`;
console.log(xmlFilePath)
@ -467,9 +474,15 @@ console.log(jsonFilePath);
var fileList = findFile(jsonFilePath);
console.log(fileList)
const downloadsPath = process.env.DOWNLOAD_XML_FILE_PATH;
// const downloadsPath = process.env.DOWNLOAD_XML_FILE_PATH;
// const downloadsPath = '/varr/www/html';
const isEncrypted = process.env.ENCRYPTED;
// const isEncrypted = process.env.ENCRYPTED;
const downloadsPath = configObject.DOWNLOAD_XML_FILE_PATH.trim();
console.log(downloadsPath,'downloadpath');
const isEncrypted = configObject.ENCRYPTED.trim();
const filePathToSave = path.join(downloadsPath, filename);
const jsonFilePathToSave = path.join(downloadsPath, jsonFileName);
console.log(filePathToSave);
@ -499,6 +512,15 @@ if(fileList !== false)
console.log('isEncrypted NOT');
// //Download XML FIle
// console.log(xmlFilePath);
// fs.writeFile(filePathToSave, xmlFilePath, 'utf-8', (err) => {
// var errorMessage = "";
// if (err) {
// // console.log(err.code);
// if(err.code == 'EACCES'){
// Download XML File
try {

View File

@ -1,8 +1,17 @@
const crypto = require('crypto');
const convertBaseToString =require('./envConvertBasetoString');
function decode(encryptedDataFilePath) {
var configObject = convertBaseToString();
// console.log('encryptedDataFilePath :', encryptedDataFilePath);
const privateKeyPath = process.env.PRIVATE_KEY_PATH;
// const privateKeyPath = process.env.PRIVATE_KEY_PATH;
const privateKeyPath = configObject.PRIVATE_KEY_PATH;
const encryptedFileContent = fs.readFileSync(encryptedDataFilePath);
// Extract the encrypted AES key, IV, and ciphertext

View File

@ -1,18 +1,26 @@
const fs = require('fs');
const crypto = require('crypto');
const convertBaseToString =require('./envConvertBasetoString');
function encode(inputString, downloadFilePath = false) {
var configObject = convertBaseToString();
console.log('encod downloadFilePath : ', downloadFilePath)
var certificatePath = '';
if(downloadFilePath !== false)
{
certificatePath = process.env.DOWNLOAD_PUBLIC_KEY_PATH;
// certificatePath = process.env.DOWNLOAD_PUBLIC_KEY_PATH;
certificatePath = configObject.DOWNLOAD_PUBLIC_KEY_PATH;
}
else{
certificatePath = process.env.PUBLIC_KEY_PATH;
// certificatePath = process.env.PUBLIC_KEY_PATH;
certificatePath = configObject.PUBLIC_KEY_PATH;
}
try {

66
envConvertBasetoString.js Normal file
View File

@ -0,0 +1,66 @@
const path = require('path');
const fs = require('fs');
require('dotenv').config({ path: path.join(__dirname, '.env') });
//this runs on main app
function convertBaseToString() {
var base64 = process.env.MY_CONFIG;
const decodedContents = Buffer.from(base64, 'base64').toString('utf-8');
const configArray = decodedContents.split('\n');
const configObject = {};
configArray.forEach(pair => {
if (pair.trim() !== '') {
const [rawKey, value] = pair.split('=');
const key = rawKey.trim().replace(/^'|'$/g, '');
configObject[key] = value.trim();
}
});
return configObject;
}
//command line utility encode , decode and check add with npm run convertEnvBase64
function envConverter(value) {
var base64 = process.env.MY_CONFIG;
if (value == 'encode') {
const envContents = fs.readFileSync('.env', 'utf-8');
const base64String = Buffer.from(envContents, 'utf-8').toString('base64');
const newEnvContents = `MY_CONFIG = ${base64String}`;
fs.writeFileSync('.env', newEnvContents, 'utf-8');
console.log("Convert String into Base64 is success");
}else if (value == 'decode') {
const envContents = fs.readFileSync('.env', 'utf-8');
const base64String = envContents.split('=')[1].trim();
const originalContents = Buffer.from(base64String, 'base64').toString('utf-8');
fs.writeFileSync('.env', originalContents, 'utf-8');
console.log("Convert Base64 into String is success");
}else if(value == 'check'){
if (base64) {
const decodedContents = Buffer.from(base64, 'base64').toString('utf-8');
const configArray = decodedContents.split('\n');
const configObject = {};
configArray.forEach(pair => {
if (pair.trim() !== '') {
const [rawKey, value] = pair.split('=');
const key = rawKey.trim().replace(/^'|'$/g, '');
configObject[key] = value.trim();
}
});
console.log(configObject);
}else{
console.log("Already Decoded String");
}
}
}
const args = process.argv.slice(2);
envConverter(args[0]);
module.exports = convertBaseToString;

View File

@ -45,7 +45,6 @@ function html2json() {
var questionSubTitle = "";
// var choiceQuestiondiv = document.getElementById('removeAndCloneQroupQuestion_' + element_id)
var choiceQuestioncheckInput = document.getElementById('ChoiceCorrectAnswer_' + element_id)
if(isMathEnabled == true)
@ -88,6 +87,12 @@ function html2json() {
])
}
// if (multipleAnswerorNot.checked) {
// multipleAnswerorNots.push([
// multipleAnswerorNot.value
// ])
// }
// console.log('before group');
//get dynamically added choice detailscolor: #999;
const alphabets = ['b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
@ -128,10 +133,8 @@ function html2json() {
])
}
});
return {
"questionChoiceId" : questionChoiceId,
"question": questionTitle,
@ -143,7 +146,7 @@ function html2json() {
"marks":marks,
"choice_question_uuid":questionUUID,
"answers": answers,
"correct_answer": correct_answers
"correct_answer": correct_answers,
}
}

1
imageresize.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,13 @@
}
require('dotenv').config();
//XmlPath get from .env
const xmlPath=process.env.XML_FILE_PATH;
const convertBaseToString =require('./envConvertBasetoString');
var configObject = convertBaseToString();
console.log("index");
const xmlPath=configObject.XML_FILE_PATH.trim();
// const xmlPath=process.env.XML_FILE_PATH;
const folderName = `/${xmlPath}`;
const filePaths = [];

View File

@ -1,3 +1,5 @@
const { loadImage } = require("jodit/types/core/helpers");
function jsonToHtml(jsonData) {
// console.log(jsonData);
@ -5,7 +7,6 @@ function jsonToHtml(jsonData) {
localStorage.setItem('scroll', 1)
localStorage.setItem('EditNavExpend', 1)
const count = jsonData.sections.length;
// console.log(`Count of sections: ${count}`);
@ -87,14 +88,13 @@ function jsonToHtml(jsonData) {
})
localStorage.removeItem('scroll');
localStorage.removeItem('EditNavExpend');
localStorage.removeItem('json_Decode_Data_For_Mcq_Crt_Ans');
$("#overlay").hide();
}
function QuestionsForEach(Question, questionAreaId, questionRandomNo,index){
function QuestionsForEach(Question, questionAreaId, questionRandomNo){
// console.log(Question);
var questionTypeFormets = "";
if(Question.question_type)
{
@ -132,6 +132,7 @@ function QuestionsForEach(Question, questionAreaId, questionRandomNo){
'questionUUID' :Question.attributes.Id,
'questionDisplayMarks' :Question.display_marks,
'Choice' :Question.answers,
'CorrectAnswer' :Question.correct_answer
}
@ -142,17 +143,13 @@ function QuestionsForEach(Question, questionAreaId, questionRandomNo){
}
else if (questionType == 'group')
{
groupQuestion(false, false, false, questionTitle, questionDescription, questionType, questionSubType, mathEnabled, Choice, questionAreaId, questionRandomNo, questionMarks, questionUUID, questionDisplayMarks,questionId, CorrectAnswer);
// groupQuestion(QuestionObj);
groupQuestion(false, false, false, questionTitle, questionDescription, questionType, questionSubType, mathEnabled, Choice, questionAreaId, questionRandomNo, questionMarks, questionUUID, questionDisplayMarks,questionId,CorrectAnswer[0]);
Choice = Choice.slice(1);
Choice.forEach(function(choicenames, index) {
Choice.forEach(function(choicenames, indexs) {
var choiceName = choicenames.choice_name;
var choiceID = choicenames.id;
var choice_mathEnabled = choicenames.is_math_enabled;
addNewChoice(false , false, choiceName, questionRandomNo, choiceID, choice_mathEnabled);
addNewChoice(false , false, choiceName, questionRandomNo, choiceID, choice_mathEnabled,CorrectAnswer);
});
}
else if (questionType == 'question_group')
@ -177,7 +174,7 @@ function generateGroupQuestion(Question, questionAreaId, questionRandomNo)
const QuestionGroupRandomNo = Date.now();
var questionGroupAreaId = 'group_question_area_'+questionRandomNo;
QuestionsForEach(GroupQuestions, questionGroupAreaId, QuestionGroupRandomNo);
QuestionsForEach(GroupQuestions, questionGroupAreaId, QuestionGroupRandomNo , index);
});
}

View File

@ -1,6 +1,7 @@
function json2xml() {
// console.clear();
var obj = localStorage.getItem("json");
// console.log(obj);
// console.log('***********************************************************');
@ -239,7 +240,7 @@ function json2xml() {
// Serialize the XML to a string
var xmlString = new XMLSerializer().serializeToString(xmlDoc);
// console.log(xmlString);
console.log(xmlString);
localStorage.setItem("xml", xmlString);
}
@ -261,7 +262,7 @@ outputJson.questions.push({
// Convert the output object to JSON string
const outputJsonString = JSON.stringify(outputJson, null, 2);
localStorage.setItem("Correct_Answer_Json", outputJsonString);
console.log('outputJsonString : ', outputJsonString);
// console.log('outputJsonString : ', outputJsonString);
}

30
main.js
View File

@ -6,14 +6,28 @@ const path = require('path');
const jquery = require('jquery');
let onlineStatus = true;
const { dialog } = require('electron');
const saveFile = require('./savexml')
require('dotenv').config({ path: path.join(__dirname, '.env') });
const saveFile = require('./savexml');
const { log } = require('console');
// require('dotenv').config({ path: path.join(__dirname, '.env') });
// const Quill = require('quill');
let mainWindow;
const convertBaseToString =require('./envConvertBasetoString');
var configObject = convertBaseToString();
// console.log(configObject);
// const auto_close= process.env.DISABLE_AUTO_CLOSE;
const auto_close= configObject.DISABLE_AUTO_CLOSE.trim();
// const auto_close_time = parseInt(process.env.AUTO_CLOSE_TIME) * 1000;
const auto_close_time = parseInt(configObject.AUTO_CLOSE_TIME.trim()) * 1000;
const auto_close= process.env.DISABLE_AUTO_CLOSE;
const auto_close_time = parseInt(process.env.AUTO_CLOSE_TIME) * 1000;
// console.assert(condition, message);
@ -39,9 +53,10 @@ async function createWindow() {
// mainWindow.removeMenu()
mainWindow.loadFile('dashboard.html'); // Create an HTML file for your interface
if(process.env.ENABLE_DEV_TOOLS === 'TRUE')
// if(process.env.ENABLE_DEV_TOOLS === 'TRUE')
if(configObject.ENABLE_DEV_TOOLS === 'TRUE')
{
if (mainWindow) {
mainWindow.webContents.toggleDevTools();
@ -229,3 +244,6 @@ app.on('activate', function () {
createWindow();
}
});

View File

@ -19,7 +19,14 @@ function navpane() {
function removeParagraphTags(html) {
return html.replace(/<p>/g, '').replace(/<\/p>/g, '').replace(/<img.*?>/g, '');
// return html.replace(/<p>/g, '').replace(/<\/p>/g, '');
var html = html.replace(/<[^>]*>/g, '');
// if (html.length >= 30) {
// html=html.slice(0, 25) + '...';
// }
return html
}
//function for remove <img> tag
@ -61,7 +68,8 @@ function navpane() {
const treeTitle = removeParagraphTags(data.question_paper_title);
const heading = document.createElement('a');
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;
heading.innerHTML = truncatedTitle;
container.appendChild(heading);
createTree(data, container);
@ -161,7 +169,6 @@ function navpane() {
// color: inherit;
// cursor: auto;
// }
var sectionLink = document.createElement('a');
sectionLink.href = '#' + section.section_id;
sectionLink.style.textOverflow ='ellipsis';
@ -248,6 +255,8 @@ function navpane() {
sectionLink.style.fontWeight = '100';
currentlyHighlightedElement = sectionLink;
// sectionDiv.scrollIntoView({ behavior: 'smooth', block: 'start' });
});
SectionBoxID.addEventListener('mouseout', function() {
@ -256,7 +265,9 @@ function navpane() {
}
sectionDiv.style.backgroundColor='white'
sectionDiv.style.border='white'
sectionLink.style.fontWeight = '100';
sectionLink.style.fontWeight = '100';
// sectionDiv.scrollIntoView({ behavior: 'smooth', block: 'start' });
});
@ -278,7 +289,6 @@ function navpane() {
function createTreeNode(nodeData, parentNode) {
const nodeDiv = document.createElement('div');
nodeDiv.className = "navContain";
// nodeDiv.id = nodeData.textQuestion_Id || nodeData.choice_question_id;
const nodeDataId = nodeData.question_Id
const nodeDataType = nodeData.question_type
@ -338,6 +348,12 @@ function navpane() {
});
questionLink.style.color = '#000000';
questionLink.style.fontSize = '13px';
questionLink.style.textOverflow ='ellipsis';
questionLink.style.whiteSpace= 'nowrap';
questionLink.style.overflow ='hidden';
questionLink.style.display ='-webkit-inline-box';
questionLink.style.maxWidth = '190px';
questionLink.style.fontWeight = '100';
if(nodeDataType == 'text')
{
@ -365,6 +381,7 @@ function navpane() {
// });
QuestionID.addEventListener('mouseover', function () {
// console.log(QuestionID);
if (currentlyHighlightedElement !== null && currentlyHighlightedElement !== questionLink) {
currentlyHighlightedElement.style.fontWeight = '100';
}
@ -379,6 +396,11 @@ function navpane() {
nodeDiv.style.marginRight= '-75px'
QuestionID.style.fontWeight = '100';
currentlyHighlightedElement = nodeDiv;
// nodeDiv.scrollIntoView({ behavior: 'smooth', block: 'start' });
var a=nodeDiv.querySelector('a').href
var aa=a.split('#')[1];
// scrollToElement(aa)
});
QuestionID.addEventListener('mouseout', function () {
@ -400,8 +422,13 @@ function navpane() {
nodeDiv.style.marginLeft ='0px';
nodeDiv.style.paddingLeft='0px';
currentlyHighlightedElement =null
});
// nodeDiv.scrollIntoView({ behavior: 'smooth', block: 'start' });
var a=nodeDiv.querySelector('a').href
var aa=a.split('#')[1];
// scrollToElement(aa)
});
// questionLink.addEventListener('click', function () {
// if (currentlyHighlightedElement !== null && currentlyHighlightedElement !== questionLink) {
@ -454,11 +481,23 @@ function navpane() {
nodeDiv.style.paddingLeft='0px';
currentlyHighlightedElement =null
});
// if (nodeData.question.length > 20) {
// // questionLink.innerHTML = removeParagraphTags(nodeData.question.substring(0, 20) + '...');
// questionLink.innerHTML = removeParagraphTags(nodeData.question);
// } else {
// questionLink.innerHTML = removeParagraphTags(nodeData.question);
// }
questionLink.innerHTML = removeTagsAndTruncate(nodeData.question, 20);
// console.log('questionLink : ', questionLink)
nodeDiv.appendChild(questionLink);
} else if (nodeData.group_title) {
@ -612,7 +651,7 @@ function navpane() {
groupTitleDiv.style.borderLeftWidth= '-75px';
currentlyHighlightedElement = groupQuestionLink;
});
groupQuestionLink.addEventListener('mouseout', () => {
@ -638,7 +677,6 @@ function navpane() {
groupTitleDiv.style.marginLeft ='0px';
groupTitleDiv.style.paddingLeft='0px';
currentlyHighlightedElement = null;
});
// GroupBoxID.addEventListener('click', function () {
@ -691,7 +729,8 @@ function navpane() {
groupTitleDiv.style.marginLeft ='0px';
groupTitleDiv.style.paddingLeft='0px';
currentlyHighlightedElement = null;
// groupTitleDiv.scrollIntoView({ behavior: 'smooth', block: 'start' });
});
GroupBoxID.addEventListener('mouseover', function () {
@ -715,12 +754,15 @@ function navpane() {
groupTitleDiv.style.borderLeftWidth= '-75px';
GroupBoxID.style.fontWeight = 'normal';
currentlyHighlightedElement = groupQuestionLink;
// groupTitleDiv.scrollIntoView({ behavior: 'smooth', block: 'start' });
});
if (nodeData.group_title.length > 20) {
groupQuestionLink.innerHTML = removeParagraphTags(nodeData.group_title.substring(0, 20) + '..');
// groupQuestionLink.innerHTML = removeParagraphTags(nodeData.group_title.substring(0, 20) + '..');
groupQuestionLink.innerHTML = removeParagraphTags(nodeData.group_title);
} else {
groupQuestionLink.innerHTML = removeParagraphTags(nodeData.group_title);
}

124
package-lock.json generated
View File

@ -17,6 +17,7 @@
"electron-context-menu": "^3.6.1",
"electron-dl": "^3.5.1",
"electron-download-manager": "^2.1.2",
"electron-prompt": "^1.7.0",
"ev-emitter": "^2.1.2",
"fizzy-ui-utils": "^3.0.0",
"formidable": "^3.5.1",
@ -24,6 +25,7 @@
"http": "^0.0.1-security",
"imagesloaded": "^5.0.0",
"is-online": "^10.0.0",
"jodit": "^4.0.0-beta.61",
"jquery": "^3.7.1",
"jquery-ui": "^1.13.2",
"jsdom": "^22.1.0",
@ -31,10 +33,17 @@
"mathjax-node": "^2.1.1",
"mathlive": "^0.95.5",
"quill": "^1.3.7",
"quill-better-table": "^1.1.0",
"quill-better-table-picker": "^1.0.2",
"quill-image-resize": "^3.0.9",
"quill-image-resize-module": "^3.0.0",
"quill-resize-module": "^1.2.4",
"quill-table": "^1.0.0",
"quill1-table": "^1.7.2",
"sweetalert2": "^11.6.13",
"tippy.js": "^6.3.7",
"uuid": "^9.0.1"
"uuid": "^9.0.1",
"xml2js": "^0.6.2"
},
"devDependencies": {
"electron": "^26.1.0",
@ -563,6 +572,15 @@
"node": ">=0.8"
}
},
"node_modules/autobind-decorator": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/autobind-decorator/-/autobind-decorator-2.4.0.tgz",
"integrity": "sha512-OGYhWUO72V6DafbF8PM8rm3EPbfuyMZcJhtm5/n26IDwO18pohE4eNazLoCGhPiXOCD0gEGmrbU3849QvM8bbw==",
"engines": {
"node": ">=8.10",
"npm": ">=6.4.1"
}
},
"node_modules/aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
@ -576,6 +594,20 @@
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz",
"integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg=="
},
"node_modules/babel-plugin-add-module-exports": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-0.2.1.tgz",
"integrity": "sha512-3AN/9V/rKuv90NG65m4tTHsI04XrCKsWbztIcW7a8H5iIN7WlvWucRtVV0V/rT4QvtA11n5Vmp20fLwfMWqp6g=="
},
"node_modules/babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==",
"dependencies": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@ -883,6 +915,13 @@
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true
},
"node_modules/core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz",
"integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==",
"deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.",
"hasInstallScript": true
},
"node_modules/core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
@ -1394,6 +1433,11 @@
"node": ">= 10.0.0"
}
},
"node_modules/electron-prompt": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/electron-prompt/-/electron-prompt-1.7.0.tgz",
"integrity": "sha512-IfqJYEgcRO6NuyPROo8AtdkAiZ6N9I1lQEf4dJAkPuhV5YgOHdmLqZJf6OXumZJfzrjpzCM5jHeYOrhGdgbnEA=="
},
"node_modules/electron-wix-msi": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/electron-wix-msi/-/electron-wix-msi-5.0.0.tgz",
@ -2645,6 +2689,14 @@
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g=="
},
"node_modules/jodit": {
"version": "4.0.0-beta.61",
"resolved": "https://registry.npmjs.org/jodit/-/jodit-4.0.0-beta.61.tgz",
"integrity": "sha512-FEck/EVy3lYCxE+mZqeReMf9hIaQvwfiwSIacS53N6cBhSu0QguJtMNya9EWkz9zLzCjEyxex2xTreTF9BP21w==",
"dependencies": {
"autobind-decorator": "^2.4.0"
}
},
"node_modules/jquery": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz",
@ -3717,6 +3769,16 @@
"quill-delta": "^3.6.2"
}
},
"node_modules/quill-better-table": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/quill-better-table/-/quill-better-table-1.1.0.tgz",
"integrity": "sha512-B0ZZGsPzWpLEOlZ7oPeBflSxmTd4dCBY2TvyCaIqVsAGOHRyRk2hkwLJX52itBNFqJ6+2XH70ev/mTEU0zkZDA=="
},
"node_modules/quill-better-table-picker": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/quill-better-table-picker/-/quill-better-table-picker-1.0.2.tgz",
"integrity": "sha512-A8NYCMYQajoxl4lduvwu3bBmrVuHRjx8GHzG7xOv7wOOtm+UplYJU6FZk/OX/3PtrdiSZHY9QtKJCu8v0qtCSA=="
},
"node_modules/quill-delta": {
"version": "3.6.3",
"resolved": "https://registry.npmjs.org/quill-delta/-/quill-delta-3.6.3.tgz",
@ -3740,6 +3802,41 @@
"raw-loader": "^0.5.1"
}
},
"node_modules/quill-image-resize-module": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/quill-image-resize-module/-/quill-image-resize-module-3.0.0.tgz",
"integrity": "sha512-1TZBnUxU/WIx5dPyVjQ9yN7C6mLZSp04HyWBEMqT320DIq4MW4JgzlOPDZX5ZpBM3bU6sacU4kTLUc8VgYQZYw==",
"dependencies": {
"lodash": "^4.17.4",
"quill": "^1.2.2",
"raw-loader": "^0.5.1"
}
},
"node_modules/quill-resize-module": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/quill-resize-module/-/quill-resize-module-1.2.4.tgz",
"integrity": "sha512-toBGslzfzxXlokN7d7naL6iq2Da5mDS4zzvyES2YpqwBqO/yrxHR1rylz0D1zLHAZcF+aeDWBNwktrYQMN5vGw==",
"dependencies": {
"extend": "^3.0.2"
}
},
"node_modules/quill-table": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/quill-table/-/quill-table-1.0.0.tgz",
"integrity": "sha512-ZE3+p+leMg8o7Whmku/bcDAS30WLd9ISQR9rV7aN+kIwoJ8e+VkPx7FcqmmHwbjpKfymJnpScyu/Sb+SRqgChw==",
"dependencies": {
"babel-plugin-add-module-exports": "^0.2.1",
"babel-runtime": "^6.26.0"
}
},
"node_modules/quill1-table": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/quill1-table/-/quill1-table-1.7.2.tgz",
"integrity": "sha512-Cg4wUr5Tnba6KIqT8OytHNdqqEKcDIwkFGgmcfbx9nJFIgV39nQkFoHjDh1fRb5p4si9Se2lU09fdnFu1PELvw==",
"peerDependencies": {
"quill": "^1.3.7"
}
},
"node_modules/raw-loader": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-0.5.1.tgz",
@ -3790,6 +3887,11 @@
"node": ">=4"
}
},
"node_modules/regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
},
"node_modules/regexp.prototype.flags": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz",
@ -4623,6 +4725,26 @@
"node": ">=12"
}
},
"node_modules/xml2js": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz",
"integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==",
"dependencies": {
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
},
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/xml2js/node_modules/xmlbuilder": {
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==",
"engines": {
"node": ">=4.0"
}
},
"node_modules/xmlbuilder": {
"version": "15.1.1",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz",

View File

@ -6,7 +6,8 @@
"scripts": {
"test": "start",
"start": "electron .",
"build": "cross-env NODE_ENV=production electron-packager . ProjectB --platform=win32 --arch=x64"
"build": "cross-env NODE_ENV=production electron-packager . ProjectB --platform=win32 --arch=x64",
"convertEnvBase64": "node envConvertBasetoString.js"
},
"author": "venkatesh",
"license": "MIT",
@ -24,6 +25,7 @@
"electron-context-menu": "^3.6.1",
"electron-dl": "^3.5.1",
"electron-download-manager": "^2.1.2",
"electron-prompt": "^1.7.0",
"ev-emitter": "^2.1.2",
"fizzy-ui-utils": "^3.0.0",
"formidable": "^3.5.1",
@ -31,6 +33,7 @@
"http": "^0.0.1-security",
"imagesloaded": "^5.0.0",
"is-online": "^10.0.0",
"jodit": "^4.0.0-beta.61",
"jquery": "^3.7.1",
"jquery-ui": "^1.13.2",
"jsdom": "^22.1.0",
@ -38,9 +41,16 @@
"mathjax-node": "^2.1.1",
"mathlive": "^0.95.5",
"quill": "^1.3.7",
"quill-better-table": "^1.1.0",
"quill-better-table-picker": "^1.0.2",
"quill-image-resize": "^3.0.9",
"quill-image-resize-module": "^3.0.0",
"quill-resize-module": "^1.2.4",
"quill-table": "^1.0.0",
"quill1-table": "^1.7.2",
"sweetalert2": "^11.6.13",
"tippy.js": "^6.3.7",
"uuid": "^9.0.1"
"uuid": "^9.0.1",
"xml2js": "^0.6.2"
}
}

View File

@ -6,8 +6,14 @@ const path = require('path')
require('dotenv').config();
const convertBaseToString =require('./envConvertBasetoString');
var configObject = convertBaseToString();
//Get the value from .env
const isEncrypted = process.env.ENCRYPTED;
// const isEncrypted = process.env.ENCRYPTED;
// console.log(configObject);
const isEncrypted = configObject.ENCRYPTED.trim();
// start the Autosave filename take the names in xml folder
////////
@ -23,7 +29,9 @@ function getFilesInFolder(folderName) {
}
}
//XmlPath get from .env
const xmlPath_ = process.env.XML_FILE_PATH;
// const xmlPath_ = process.env.XML_FILE_PATH;
const xmlPath_ = configObject.XML_FILE_PATH.trim();
const folderName = `/${xmlPath_}`;
const filePaths = [];
const files = getFilesInFolder(folderName);
@ -119,7 +127,9 @@ function savexml(UserFilename,reorder=false) {
console.log('save xml : ', enc);
//XmlPath get from .env
const xmlPathenv=process.env.XML_FILE_PATH;
// const xmlPathenv=process.env.XML_FILE_PATH;
const xmlPathenv=configObject.XML_FILE_PATH.trim();
const xmlPath = path.join(__dirname, xmlPathenv)
// Get the json string from localStorage for set fileName
var jsonData = localStorage.getItem("json");

View File

@ -3604,6 +3604,7 @@ font-size: 14px;
.navContain{
display: flex;
/* display: contents; */
align-items: center;
}
@ -3780,6 +3781,7 @@ font-size: 14px;
}
#overlay{
position: fixed;
top: 0;
@ -3810,4 +3812,4 @@ font-size: 14px;
}
.is-hide{
display:none;
}
}

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,6 @@ function getAttributesOfXMLNode(node)
function getQuestionsNodes(questionNode,type)
{
// console.log(questionNode);
var questionObj = {};
if(type == 1)
{
@ -45,10 +44,10 @@ function getQuestionsNodes(questionNode,type)
questionObj['question_description'] = (questionNode.childNodes[2].firstChild !== null? questionNode.childNodes[2].firstChild.nodeValue : "");
questionObj['question_type'] = 'group';
questionObj['attributes'] = getAttributesOfXMLNode(questionNode);
questionObj['question_sub_type'] = questionNode.childNodes[5].firstChild.nodeValue;
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;
questionObj['is_math_enabled'] = questionNode.childNodes[6].firstChild.nodeValue;
questionObj['is_math_enabled'] = questionNode.childNodes[5].firstChild.nodeValue;
questionObj['answers'] = [];
questionObj['correct_answer'] = [];
@ -59,7 +58,7 @@ function getQuestionsNodes(questionNode,type)
for (let k = 0; k < choiceList.length ;k++)
{
var tempChoiceobj = {};
console.log(choiceList)
// console.log(choiceList)
tempChoiceobj['id'] = choiceList[k].childNodes[0].firstChild.nodeValue;
tempChoiceobj['no'] = (choiceList[k].childNodes[1].firstChild !== null ? choiceList[k].childNodes[1].firstChild.nodeValue : "");
tempChoiceobj['choice_name'] = (choiceList[k].childNodes[2].firstChild !== null ? choiceList[k].childNodes[2].firstChild.nodeValue : "");
@ -72,7 +71,7 @@ console.log(choiceList)
{
var jsonParsedData = JSON.parse(jsonDecodeData);
// console.log('jsonParsedData : ', jsonParsedData)
console.log('jsonParsedData : ', jsonParsedData)
// Iterate over each question
for (const question of jsonParsedData.questions) {
@ -80,7 +79,7 @@ console.log(choiceList)
const questionId = question.questionId;
const answers = question.answers;
console.log(typeof answers)
// console.log(typeof answers)
// console.log(`Question ID: ${questionId}`);
@ -143,6 +142,7 @@ function getQuestionGroupNodes(questionGroup)
//busi logic start
var xmlString = xmlData;
console.log(xmlString);
const parser = new DOMParser();
// Parse the XML string into an XML document
@ -202,11 +202,11 @@ jsonObj['sections'] = [];
var jsonData = JSON.stringify(jsonObj);
// console.log('Xml to Json Conversion ');
console.log('jsonData : ', jsonData);
// console.log('jsonData : ', jsonData);
// console.log(jsonObj);
jsonToHtml(jsonObj);
// console.log(jsonToHtml(jsonObj))
localStorage.removeItem('json_Decode_Data_For_Mcq_Crt_Ans');
// localStorage.removeItem('json_Decode_Data_For_Mcq_Crt_Ans');
}