fix some functions not being called in sitestyle=3 #6733
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Jan 26, 2025 at 10:59 UTC
ea80f8595e7de756d0f13e1292d1064827116ff2
1 file changed
+19
-12
views/default3.handlebars
+19
-12
@@ -6273,7 +6273,11 @@
6273
*/
6274
function showModal(modalId, okButtonId, okCallback, b = null, tag = null) {
6275
if (xxModal == null) {
6276
- QE(okButtonId, true);
6276
+ ['idx_dlgOkButton', 'idx_dlgCancelButton'].forEach(function (id) { // clear existing onclick, enable buttons and show them
6277
+ Q(id).onclick = null;
6278
+ QE(id, true);
6279
+ QV(id, true);
6280
+ });
6281
xxModal = new bootstrap.Modal(document.getElementById(modalId));
6282
var hiddenModal = function (event) {
6283
if (xxModal) { xxModal.dispose(); xxModal = null; }
@@ -12284,11 +12288,11 @@
12288
function p13fileNameCheck(e) { var x = isFilenameValid(Q('p13renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e != null) && (e.keyCode == 13)) { dialogclose(1); } }
12289
function p13uploadFile() {
12290
setModalContent('xxAddAgent', "Upload File", '<input type=file name=files id=p13uploadinput class="form-control" multiple=multiple onchange="updateUploadDialogOk(\'p13uploadinput\')" />');
12287
- showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p13uploadFileEx);
12291
+ showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p13uploadFileEx());
12292
updateUploadDialogOk('p13uploadinput');
12293
}
12294
function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q('p13uploadinput').files.length > 0); }
12291
- function p13uploadFileEx() { p13doUploadFiles(Q('p13uploadinput').files); }
12295
+ function p13uploadFileEx() { p13doUploadFiles(Q('p13uploadinput').files); return false; }
12296
function p13viewfile() {
12297
var checkboxes = document.getElementsByName('fd');
12298
for (var i = 0; i < checkboxes.length; i++) {
@@ -12347,7 +12351,7 @@
12351
}
12352
}
12353
setModalContent('xxAddAgent', "Paste", x);
12350
- showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p13pasteFileEx);
12354
+ showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p13pasteFileEx());
12355
}
12356
function p13pasteFileEx() { files.sendText({ action: (p13clipboardCut == 0 ? 'copy' : 'move'), reqid: 1, scpath: p13clipboardFolder, dspath: p13targetpath, names: p13clipboard }); p13folderup(999); if (p13clipboardCut == 1) { p13clipboard = null, p13clipboardFolder = null, p13clipboardCut = 0; p13updateClipview(); } }
12357
function p13updateClipview() {
@@ -12418,7 +12422,7 @@
12422
//console.log('p13downloadFileCancel', gdownloadFile);
12423
files.sendText({ action: 'download', sub: 'start', id: gdownloadFile.id, path: gdownloadFile.path });
12424
setModalContent('xxAddAgent', "Download File", '<div>' + gdownloadFile.file + '</div><br /><progress id=d2progressBar style=width:100% value=0 max=' + z + ' />');
12421
- showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p13downloadFileCancel);
12425
+ showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p13downloadFileCancel());
12426
}
12427
12428
// Called by the html page to cancel the download
@@ -12559,7 +12563,7 @@
12563
p13uploadFileContinue(1, files);
12564
} else {
12565
// Otherwise, prompt for confirmation
12562
- setModalContent('xxAddAgent', "Upload File", p13uploadFileContinue, format((overWriteCount == 1) ? "Upload will overwrite 1 file. Continue?" : "Upload will overwrite {0} files. Continue?", overWriteCount));
12566
+ setModalContent('xxAddAgent', "Upload File", format((overWriteCount == 1) ? "Upload will overwrite 1 file. Continue?" : "Upload will overwrite {0} files. Continue?", overWriteCount));
12567
showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p13uploadFileContinue(3, files));
12568
}
12569
}
@@ -12570,8 +12574,10 @@
12574
uploadFile.xfiles = files;
12575
uploadFile.xfilePtr = -1;
12576
setModalContent('xxAddAgent', "Upload File", '<div id=p13dfileName>' + "Connecting..." + '</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />');
12573
- showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p13uploadFileCancel(10));
12577
+ showModal('xxAddAgentModal', 'idx_dlgCancelButton', () => p13uploadFileCancel(10));
12578
+ document.getElementById('idx_dlgOkButton').style.display = 'none'; // hide OK button
12579
p13uploadNextFile();
12580
+ if (b == 3) return false; // if overwritten, dont close the dialog
12581
}
12582
12583
// Perform SHA-384 hashing
@@ -13557,7 +13563,7 @@
13563
Q('d3filter').value = '.js';
13564
Q('d3attrib').value = currentNode._id;
13565
setModalContent('xxAddAgent', "Upload Mesh Agent Core", '');
13560
- showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p15uploadCoreEx2);
13566
+ showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p15uploadCoreEx2());
13567
d3init();
13568
}
13569
@@ -13638,7 +13644,7 @@
13644
x += '<td style=text-align:center><div style=padding:6px>' + "Verified phone number" + '</div><div style=font-size:20px>' + EscapeHtml(userinfo.phone) + '</div>';
13645
x += '<div style=margin:10px><label><input id=d2delPhone type=checkbox class="form-check-input me-2" onclick=account_managePhoneRemoveValidate() />' + "Remove phone number" + '</label></div>';
13646
setModalContent('xxAddAgent', "Phone Notifications", x);
13641
- showModal('xxAddAgentModal', 'idx_dlgOkButton', () => account_managePhoneRemove);
13647
+ showModal('xxAddAgentModal', 'idx_dlgOkButton', () => account_managePhoneRemove());
13648
account_managePhoneRemoveValidate();
13649
} else {
13650
x = '<table style=width:100%><tr><td style=width:56px><img src="images/phone80.png" style=padding:8px>';
@@ -13646,7 +13652,7 @@
13652
x += '<br /><br /><div style=width:100%;text-align:center>' + "Phone number:" + ' <input type=tel pattern="[0-9]" autocomplete="tel" inputmode="tel" maxlength=18 id=d2phoneinput onKeyUp=account_managePhoneValidate() onkeypress="if (event.key==\'Enter\') account_managePhoneValidate(1)"></div></table>';
13653
xxdialogTag = 'verifyPhone';
13654
setModalContent('xxAddAgent', "Phone Notifications", x);
13649
- showModal('xxAddAgentModal', 'idx_dlgOkButton', () => account_managePhoneAdd);
13655
+ showModal('xxAddAgentModal', 'idx_dlgOkButton', () => account_managePhoneAdd());
13656
Q('d2phoneinput').focus();
13657
account_managePhoneValidate();
13658
}
@@ -13668,7 +13674,7 @@
13674
x += '<td style=text-align:center><div style=padding:6px>' + "Verified handle" + '</div><div style=font-weight:bold>' + EscapeHtml(userinfo.msghandle) + '</div>';
13675
x += '<div style=margin:10px><label><input id=d2delPhone type=checkbox class="form-check-input me-2" onclick=account_managePhoneRemoveValidate() />' + "Remove messaging" + '</label></div>';
13676
setModalContent('xxAddAgent', "Messaging Notifications", x);
13671
- showModal('xxAddAgentModal', 'idx_dlgOkButton', () => account_manageMessagingRemove);
13677
+ showModal('xxAddAgentModal', 'idx_dlgOkButton', () => account_manageMessagingRemove());
13678
account_managePhoneRemoveValidate();
13679
} else {
13680
x = '<table style=width:100%><tr><td style=width:56px;vertical-align:top><img src="images/messaging40.png" style=padding:8px>';
@@ -13966,7 +13972,7 @@
13972
if (xxdialogMode || (userinfo.emailVerified == true) || (serverinfo.emailcheck != true)) return false;
13973
var x = "Click ok to send a verification mail to:" + '<br /><div style=padding:8px><b>' + EscapeHtml(userinfo.email) + '</b></div>' + "Please wait a few minute to receive the verification.";
13974
setModalContent('xxAddAgent', "Email Verification", x);
13969
- showModal('xxAddAgentModal', 'idx_dlgOkButton', () => account_showVerifyEmailEx);
13975
+ showModal('xxAddAgentModal', 'idx_dlgOkButton', () => account_showVerifyEmailEx());
13976
return false;
13977
}
13978
@@ -19843,6 +19849,7 @@
19849
for (var i = 1; i < 24; i++) { QV('dialog' + i, i == x); } // Edit this line when more dialogs are added
19850
QV('dialog', x);
19851
if (c) { if (x == 2) { QH('id_dialogOptions', c); } else { QH('id_dialogMessage', c); } }
19852
+ if (x == 0) { if (xxModal) xxModal.hide(); }
19853
MoreToggle(false);
19854
}
19855