fix user image upload/delete and user page style in modern ui #7488
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Dec 16, 2025 at 12:08 UTC
3ea8d391a69581fe6a1e0e65eef52a964be6d0fd
1 file changed
+10
-8
views/default3.handlebars
+10
-8
@@ -1505,13 +1505,12 @@
1505
</div>
1506
<div class='fs-4 fw-bold'>General - <span id=p30userName></span></div>
1507
</div>
1508
- <div id="p30info" style="overflow-y:auto">
1509
- <div class="row">
1508
+ <div id="p30info" class='pe-2' style="overflow-y:auto">
1509
+ <div class="d-flex">
1510
<div class="col">
1511
<div id="p30html"></div>
1512
</div>
1513
- <div class="col-auto" style="width: 20px;"></div>
1514
- <div class="col-auto" style="width: 200px; position: relative;">
1513
+ <div class="col-auto">
1514
<img id="p30userAuthServiceLogo" style="display:none" class="userAuthStrategyLogo" width="64" height="64">
1515
<picture id="MainUserImage"
1516
style="display:none; border-width:0px; height:200px; width:200px; float:right"
@@ -6548,10 +6547,10 @@
6547
*/
6548
function showModal(modalId, okButtonId, okCallback, b = null, tag = null) {
6549
if (xxModal == null) {
6551
- ['idx_dlgOkButton', 'idx_dlgCancelButton'].forEach(function (id) { // clear existing onclick, enable buttons and show them
6550
+ ['idx_dlgOkButton', 'idx_dlgCancelButton', 'idx_dlgDeleteButton'].forEach(function (id) { // clear existing onclick, enable buttons and show them
6551
Q(id).onclick = null;
6553
- QE(id, true);
6554
- QV(id, true);
6552
+ QE(id, (id != 'idx_dlgDeleteButton' ? true : false));
6553
+ QV(id, (id != 'idx_dlgDeleteButton' ? true : false));
6554
});
6555
xxModal = new bootstrap.Modal(document.getElementById(modalId));
6556
var hiddenModal = function (event) {
@@ -13939,7 +13938,7 @@
13938
var x = '<input id=p2file type=file class="form-control" accept="image/*" onchange=account_manageImageEx()><div style=width:100%><canvas id=p2canvas width=256 height=256 style="width:256px;height:256px;margin-left:60px;margin-top:8px;border-radius:16px;background: var(--sub-menu-bg);border: 1px solid #cfcdcd; cursor: pointer;" onclick=account_canvasClick() /></div>';
13939
13940
setModalContent('xxAddAgent', "Manage Account Image", x);
13942
- showModal('xxAddAgentModal', 'idx_dlgOkButton', account_manageImageEx2);
13941
+ showModal('xxAddAgentModal', 'idx_dlgOkButton', () => account_manageImageEx2(1, user._id));
13942
13943
var ctx = Q('p2canvas').getContext('2d');
13944
if (user.accountImageRnd == null) { user.accountImageRnd = Math.floor(Math.random() * 9999999999); }
@@ -13949,6 +13948,8 @@
13948
myImg.onload = function () { ctx.clearRect(0, 0, 256, 256); ctx.drawImage(myImg, 0, 0); };
13949
myImg.src = ((user.flags != null) && (user.flags & 1)) ? ('userimage.ashx?rnd=' + user.accountImageRnd + arg) : 'images/user-256.png';
13950
QE('idx_dlgDeleteButton', (user.flags != null) && (user.flags & 1));
13951
+ QV('idx_dlgDeleteButton', (user.flags != null) && (user.flags & 1));
13952
+ Q('idx_dlgDeleteButton').onclick = () => account_manageImageEx2(2, user._id);
13953
QE('idx_dlgOkButton', false);
13954
}
13955
@@ -13975,6 +13976,7 @@
13976
function account_manageImageEx2(b, userid) {
13977
// Send updated image, or 0 if we pressed the delete button
13978
meshserver.send({ action: 'updateUserImage', userid: userid, image: (b == 2) ? 0 : Q('p2canvas').toDataURL(Q('p2file').files[0].type) });
13979
+ if (b == 2) { xxModal.hide(); } // Close dialog on delete
13980
//meshserver.send({ action: 'updateUserImage', image: (b == 2)?0:Q('p2canvas').toDataURL('image/png', 0.8) });
13981
}
13982