Compare commits
10 Commits
85526f8bbd
...
ef7d32bdea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef7d32bdea | ||
|
|
86427dbb3f | ||
|
|
6cdf19d212 | ||
|
|
87e10fe685 | ||
|
|
254a0a1ae0 | ||
|
|
92aa201002 | ||
|
|
84e5110f78 | ||
|
|
ace083b56c | ||
|
|
3a5087d1a2 | ||
|
|
f8bf6bf965 |
@ -615,6 +615,7 @@ function loadXML(xmlFileName) {
|
||||
if(filelist !== false)
|
||||
{
|
||||
//JSON File Read Function
|
||||
console.log(encodedJsonFilePath);
|
||||
fs.readFile(encodedJsonFilePath, 'utf8', (error, data) => {
|
||||
if (error) {
|
||||
console.error('Error reading file:', error);
|
||||
|
||||
797
addform.html
797
addform.html
File diff suppressed because it is too large
Load Diff
1
assets/appSetting/AppSetting.json
Normal file
1
assets/appSetting/AppSetting.json
Normal file
@ -0,0 +1 @@
|
||||
{"AppSetting":["WorkArea,MathCheckbox,TextQuestionButton,MCQQuestionButton"]}
|
||||
1
assets/appSetting/AppSettingUnchecked.json
Normal file
1
assets/appSetting/AppSettingUnchecked.json
Normal file
@ -0,0 +1 @@
|
||||
{"AppSetting":["SubTitle"]}
|
||||
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 |
@ -195,6 +195,7 @@ var draggedItem = null;
|
||||
//THis function is Replicate the Nav Pane Change
|
||||
function insertElement(dragStartElement, dragDropElement, position){
|
||||
|
||||
|
||||
var mainpaneSection = document.getElementById('addNewSection')
|
||||
var matches = dragDropElement.id.match(/([a-zA-Z_]+)([0-9]+)/);
|
||||
|
||||
@ -311,5 +312,17 @@ var draggedItem = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const strippedId = dragStartElement.id.replace('nav_', '');
|
||||
console.log(strippedId);
|
||||
|
||||
const element = document.getElementById(`${strippedId}`);
|
||||
console.log(element);
|
||||
if (element) {
|
||||
|
||||
element.focus();
|
||||
element.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
476
dashboard.html
476
dashboard.html
@ -44,12 +44,99 @@
|
||||
<!-- <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: 20px !important;
|
||||
/* 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(93% - 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 +319,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 +696,186 @@ if (fileList !== false) {
|
||||
|
||||
|
||||
|
||||
function duplicateFile(oldfilename) {
|
||||
|
||||
var filename ='';
|
||||
|
||||
Swal.fire({
|
||||
title: 'Enter Filename',
|
||||
input: 'text',
|
||||
inputValue: '',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Submit',
|
||||
cancelButtonText: 'Cancel',
|
||||
inputValidator: (value) => {
|
||||
// console.log(value);
|
||||
|
||||
|
||||
function removeXmlExtension(value) {
|
||||
if (value.endsWith('.xml')) {
|
||||
return value.slice(0, -4);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
const entervalue = removeXmlExtension(value);
|
||||
|
||||
if (value == '') {
|
||||
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;
|
||||
// const newXmlBaseName = newXmlFileNameParts[0];
|
||||
const newJsonFileName = `${newXmlFileNameParts}_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 content = fs.readFileSync(`${xmlFilePath}${oldfilename}`, 'utf-8');
|
||||
const content =decode(`${xmlFilePath}${oldfilename}`);
|
||||
const encrypt = encode(content);
|
||||
try {
|
||||
fs.writeFileSync(`${xmlFilePath}${entervalue}.xml`, encrypt, '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"
|
||||
});
|
||||
}
|
||||
|
||||
if (fileList !== false)
|
||||
{
|
||||
try {
|
||||
const content =decode(jsonFilePath);
|
||||
const encrypt = encode(content);
|
||||
// console.log('json', content);
|
||||
fs.writeFileSync(`${jsonFilePathToSave}${newJsonFileName}`, encrypt, '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"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
try {
|
||||
const content = fs.readFileSync(`${xmlFilePath}${oldfilename}`, 'utf-8');
|
||||
fs.writeFileSync(`${xmlFilePath}${entervalue}.xml`, 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 +934,209 @@ function copyFile(sourceFilePath, destinationFilePath) {
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
const settingBtn = document.getElementById('settingButton');
|
||||
const overlay = document.getElementById('overlay');
|
||||
|
||||
settingBtn.onclick = function() {
|
||||
openPopup();
|
||||
};
|
||||
|
||||
function openPopup() {
|
||||
var headermenu = document.querySelector('.heder-menu')
|
||||
|
||||
headermenu.style.display= 'none';
|
||||
|
||||
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'},
|
||||
{value: 'MCQQuestionButton', label: 'MCQ Question '}
|
||||
];
|
||||
|
||||
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);
|
||||
|
||||
const label2 = document.createElement('label');
|
||||
label2.textContent = option.label;
|
||||
popupContent.appendChild(label2);
|
||||
|
||||
|
||||
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() {
|
||||
var headermenu = document.querySelector('.heder-menu')
|
||||
|
||||
headermenu.style.display= 'block';
|
||||
|
||||
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() {
|
||||
var headermenu = document.querySelector('.heder-menu')
|
||||
|
||||
headermenu.style.display= 'block';
|
||||
|
||||
// const selectedValues = Array.from(document.querySelectorAll('input[class=option]:checked')).map(input => input.value);
|
||||
|
||||
const allOptions = Array.from(document.querySelectorAll('input[class=option]'));
|
||||
|
||||
const uncheckedValues = allOptions.filter(input => !input.checked).map(input => input.value);
|
||||
|
||||
const checkedValues = allOptions.filter(input => input.checked).map(input => input.value);
|
||||
|
||||
|
||||
|
||||
const array = checkedValues;
|
||||
const string = array.join(',');
|
||||
const jsonString = JSON.stringify(string);
|
||||
const wrappedJsonString = `{"AppSetting":[${jsonString}]}`;
|
||||
|
||||
|
||||
//ForUnchecked
|
||||
const string2 = uncheckedValues.join(',')
|
||||
const jsonString2 = JSON.stringify(string2);
|
||||
const wrappedJsonString2 = `{"AppSetting":[${jsonString2}]}`;
|
||||
|
||||
|
||||
const newPath = xmlPath.replace(/\\xml\\/i, '\\');
|
||||
|
||||
const savexmlpath = path.join(__dirname, `./assets/appSetting/AppSetting.json`);
|
||||
const savexmlpath2 = path.join(__dirname, `./assets/appSetting/AppSettingUnchecked.json`);
|
||||
|
||||
|
||||
fs.writeFileSync(savexmlpath, wrappedJsonString, 'utf-8');
|
||||
fs.writeFileSync(savexmlpath2, wrappedJsonString2, 'utf-8');
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
function popupCheck() {
|
||||
const filePath = path.join(__dirname, `./assets/appSetting/AppSetting.json`);
|
||||
fs.readFile(filePath, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
console.error('Error reading file:', err);
|
||||
return;
|
||||
}
|
||||
const jsonObject = JSON.parse(data);
|
||||
|
||||
var aa= jsonObject.AppSetting;
|
||||
const inputString = aa[0];
|
||||
|
||||
const valuesArray = inputString.split(',');
|
||||
valuesArray.forEach(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);
|
||||
}
|
||||
|
||||
32
nav_pane.js
32
nav_pane.js
@ -226,8 +226,8 @@ function navpane() {
|
||||
sectionDiv.style.backgroundColor ='#fcdddd';
|
||||
// sectionDiv.style.border = '5px solid #fcdddd';
|
||||
sectionDiv.style.color ='black';
|
||||
sectionDiv.style.marginLeft ='-67px';
|
||||
sectionDiv.style.paddingLeft='67px';
|
||||
// sectionDiv.style.marginLeft ='-67px';
|
||||
// sectionDiv.style.paddingLeft='67px';
|
||||
sectionDiv.style.marginRight= '-75px'
|
||||
currentlyHighlightedElement = sectionLink;
|
||||
|
||||
@ -265,8 +265,8 @@ function navpane() {
|
||||
// sectionDiv.style.border = '5px solid #fcdddd';
|
||||
sectionDiv.style.borderRadius = '5px';
|
||||
sectionDiv.style.color ='black';
|
||||
sectionDiv.style.marginLeft ='-67px';
|
||||
sectionDiv.style.paddingLeft='67px';
|
||||
// sectionDiv.style.marginLeft ='-67px';
|
||||
// sectionDiv.style.paddingLeft='67px';
|
||||
sectionDiv.style.marginRight= '-75px'
|
||||
sectionLink.style.fontWeight = '100';
|
||||
|
||||
@ -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);
|
||||
@ -434,8 +436,8 @@ function navpane() {
|
||||
// nodeDiv.style.border = '5px solid #fcdddd';
|
||||
nodeDiv.style.borderRadius = '5px';
|
||||
nodeDiv.style.color ='black';
|
||||
nodeDiv.style.marginLeft ='-67px';
|
||||
nodeDiv.style.paddingLeft='67px';
|
||||
// nodeDiv.style.marginLeft ='-67px';
|
||||
// nodeDiv.style.paddingLeft='67px';
|
||||
// nodeDiv.style.marginRight= '-75px';
|
||||
// nodeDiv.style.justifyContent= 'space-between';
|
||||
QuestionID.style.fontWeight = '100';
|
||||
@ -504,8 +506,8 @@ function navpane() {
|
||||
nodeDiv.style.borderRadius = '5px';
|
||||
// nodeDiv.style.color = ' rgb(255 255 255)';
|
||||
nodeDiv.style.color ='black';
|
||||
nodeDiv.style.marginLeft ='-67px';
|
||||
nodeDiv.style.paddingLeft='67px';
|
||||
// nodeDiv.style.marginLeft ='-67px';
|
||||
// nodeDiv.style.paddingLeft='67px';
|
||||
// nodeDiv.style.marginRight= '-75px';
|
||||
nodeDiv.style.borderLeftWidth= '-75px';
|
||||
// nodeDiv.style.justifyContent= 'space-between';
|
||||
@ -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 = ''
|
||||
@ -716,8 +718,8 @@ function navpane() {
|
||||
// groupTitleDiv.style.border = '5px solid #fcdddd';
|
||||
groupTitleDiv.style.borderRadius = '5px';
|
||||
groupTitleDiv.style.backgroundColor = '#fcdddd';
|
||||
groupTitleDiv.style.marginLeft ='-67px';
|
||||
groupTitleDiv.style.paddingLeft='67px';
|
||||
// groupTitleDiv.style.marginLeft ='-67px';
|
||||
// groupTitleDiv.style.paddingLeft='67px';
|
||||
groupTitleDiv.style.marginRight= '-75px';
|
||||
groupTitleDiv.style.borderLeftWidth= '-75px';
|
||||
|
||||
@ -819,8 +821,8 @@ function navpane() {
|
||||
groupTitleDiv.style.borderRadius = '5px';
|
||||
groupTitleDiv.style.backgroundColor = '#fcdddd';
|
||||
groupQuestionLink.style.color= 'black';
|
||||
groupTitleDiv.style.marginLeft ='-67px';
|
||||
groupTitleDiv.style.paddingLeft='67px';
|
||||
// groupTitleDiv.style.marginLeft ='-67px';
|
||||
// groupTitleDiv.style.paddingLeft='67px';
|
||||
groupTitleDiv.style.marginRight= '-75px';
|
||||
groupTitleDiv.style.borderLeftWidth= '-75px';
|
||||
GroupBoxID.style.fontWeight = 'normal';
|
||||
@ -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": {
|
||||
|
||||
10
package.json
10
package.json
@ -6,7 +6,7 @@
|
||||
"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 . NexaAuthor --platform=win32 --arch=x64",
|
||||
"convertEnvBase64": "node envConvertBasetoString.js"
|
||||
},
|
||||
"author": "VenbaInfoTech",
|
||||
@ -44,14 +44,6 @@
|
||||
"mathjax-node": "^2.1.1",
|
||||
"mathlive": "^0.95.5",
|
||||
"os": "^0.1.2",
|
||||
"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",
|
||||
"sweetalert": "^2.1.2",
|
||||
"sweetalert2": "^11.6.13",
|
||||
"tippy.js": "^6.3.7",
|
||||
|
||||
@ -3331,8 +3331,8 @@ a.main_sticky {
|
||||
position: fixed;
|
||||
top: 70px;
|
||||
left: 0;
|
||||
|
||||
max-height: 532px;
|
||||
max-height: 750px;
|
||||
/* max-height: 532px; */
|
||||
padding: 0 10px 20px;
|
||||
width: 235px;
|
||||
height: -webkit-fill-available;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -120,6 +120,7 @@ function getQuestionGroupNodes(questionGroup)
|
||||
|
||||
|
||||
//busi logic start
|
||||
console.log(xmlData);
|
||||
var xmlString = xmlData;
|
||||
const parser = new DOMParser();
|
||||
|
||||
@ -133,6 +134,7 @@ jsonObj['attributes'] = getAttributesOfXMLNode(xmlDoc.documentElement);
|
||||
jsonObj['sections'] = [];
|
||||
|
||||
|
||||
|
||||
sectionsList = xmlDoc.getElementsByTagName("Items")[0].childNodes;
|
||||
// console.log(sectionsList);
|
||||
// console.log('no of sections:'+sectionsList.length);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user