mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Started work on account pictures.
This commit is contained in:
parent
302f1b0bba
commit
bfb2472862
4 changed files with 104 additions and 7 deletions
|
@ -12,7 +12,7 @@
|
|||
<link type="text/css" href="styles/ol.css" media="screen" rel="stylesheet" title="CSS" />
|
||||
<link type="text/css" href="styles/ol3-contextmenu.min.css" media="screen" rel="stylesheet" title="CSS" />
|
||||
<link type="text/css" href="styles/xterm.css" media="screen" rel="stylesheet" title="CSS" />
|
||||
<link type="text/css" href="styles/flatpickr.min.css" media="screen" rel="stylesheet" title="CSS" >
|
||||
<link type="text/css" href="styles/flatpickr.min.css" media="screen" rel="stylesheet" title="CSS">
|
||||
<link rel="apple-touch-icon" href="/favicon-303x303.png" />
|
||||
<script type="text/javascript" src="scripts/common-0.0.1{{{min}}}.js"></script>
|
||||
<script type="text/javascript" src="scripts/meshcentral{{{min}}}.js"></script>
|
||||
|
@ -342,7 +342,8 @@
|
|||
<div id=p2 style="display:none">
|
||||
<div id="p2title"><h1>My Account</h1></div>
|
||||
<div id="p2info" style="overflow-y:auto">
|
||||
<img id="p2AccountImage" alt="" loading="lazy" width="128" height="128" src="images/clipboard-128.png" />
|
||||
<!--<img id="p2AccountImage" alt="" loading="lazy" width="128" height="128" onclick="account_manageImage()" src="images/clipboard-128.png" />-->
|
||||
<img id="p2AccountImage" alt="" loading="lazy" width="128" height="128" style="border-radius:8px;cursor:pointer;box-shadow: 0px 0px 7px #000;margin-top:7px" onclick="account_manageImage()" src="userimage.ashx" />
|
||||
<div id="p2AccountSecurity" style="display:none">
|
||||
<p><strong>Account security</strong></p>
|
||||
<div style="margin-left:25px">
|
||||
|
@ -9675,6 +9676,48 @@
|
|||
meshserver.send({ action: 'previousLogins' });
|
||||
}
|
||||
|
||||
function account_manageImage() {
|
||||
if (xxdialogMode) return;
|
||||
var x = '<input id=p2file type=file style=width:100% 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;box-shadow: 0px 0px 15px #000" onclick=account_canvasClick() /></div>';
|
||||
setDialogMode(2, "Manage Account Image", 7, account_manageImageEx2, x);
|
||||
var ctx = Q('p2canvas').getContext("2d");
|
||||
if ((userinfo.flags != null) && (userinfo.flags & 1)) {
|
||||
var myImg = new Image();
|
||||
myImg.onload = function() { ctx.drawImage(myImg, 0, 0); };
|
||||
myImg.src = 'userimage.ashx';
|
||||
} else {
|
||||
ctx.fillStyle = "#CCC";
|
||||
ctx.fillRect(0, 0, 256, 256);
|
||||
}
|
||||
QE('idx_dlgDeleteButton', (userinfo.flags != null) && (userinfo.flags & 1));
|
||||
QE('idx_dlgOkButton', false);
|
||||
}
|
||||
|
||||
function account_canvasClick() { Q('p2file').click(); }
|
||||
|
||||
function account_manageImageEx() {
|
||||
var file = Q('p2file').files[0];
|
||||
var img = new Image;
|
||||
img.onload = function() {
|
||||
var cx = 0, cy = 0, min = Math.min(img.width, img.height);
|
||||
if (img.width > min) { cx = (img.width - min) / 2; }
|
||||
if (img.height > min) { cy = (img.height - min) / 2; }
|
||||
var ctx = Q('p2canvas').getContext("2d");
|
||||
ctx.imageSmoothingEnabled = true;
|
||||
ctx.webkitImageSmoothingEnabled = true;
|
||||
ctx.mozImageSmoothingEnabled = true;
|
||||
ctx.drawImage(img, cx, cy, min, min, 0, 0, 256, 256);
|
||||
QE('idx_dlgOkButton', true);
|
||||
}
|
||||
img.src = URL.createObjectURL(file);
|
||||
}
|
||||
|
||||
function account_manageImageEx2(b, t) {
|
||||
// Send updated image, or 0 if we pressed the delete button
|
||||
meshserver.send({ action: 'updateUserImage', image: (b == 2)?0:Q('p2canvas').toDataURL('image/jpeg', 0.8) });
|
||||
//meshserver.send({ action: 'updateUserImage', image: (b == 2)?0:Q('p2canvas').toDataURL('image/png', 0.8) });
|
||||
}
|
||||
|
||||
function account_managePhone() {
|
||||
if (xxdialogMode || ((features & 0x02000000) == 0)) return;
|
||||
var x;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue