diff --git a/agents/meshcore.js b/agents/meshcore.js
index 9eae6e2a..668bf1d3 100644
--- a/agents/meshcore.js
+++ b/agents/meshcore.js
@@ -700,6 +700,22 @@ function createMeshCore(agent) {
if (this.httprequest.uploadFile) { this.write(new Buffer(JSON.stringify({ action: 'uploadstart', reqid: this.httprequest.uploadFileid }))); }
break;
}
+ case 'copy': {
+ // Copy a bunch of files from scpath to dspath
+ for (var i in cmd.names) {
+ var sc = obj.path.join(cmd.scpath, cmd.names[i]), ds = obj.path.join(cmd.dspath, cmd.names[i]);
+ if (sc != ds) { try { fs.copyFileSync(sc, ds); } catch (e) { } }
+ }
+ break;
+ }
+ case 'move': {
+ // Move a bunch of files from scpath to dspath
+ for (var i in cmd.names) {
+ var sc = obj.path.join(cmd.scpath, cmd.names[i]), ds = obj.path.join(cmd.dspath, cmd.names[i]);
+ if (sc != ds) { try { fs.copyFileSync(sc, ds); fs.unlinkSync(sc); } catch (e) { } }
+ }
+ break;
+ }
}
}
//sendConsoleText("Got tunnel #" + this.httprequest.index + " data: " + data, this.httprequest.sessionid);
diff --git a/package.json b/package.json
index b83619e9..1ff473d3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "meshcentral",
- "version": "0.1.5-s",
+ "version": "0.1.5-t",
"keywords": [
"Remote Management",
"Intel AMT",
diff --git a/views/default.handlebars b/views/default.handlebars
index 481d00bd..6ab88ef2 100644
--- a/views/default.handlebars
+++ b/views/default.handlebars
@@ -288,7 +288,7 @@
@@ -1996,11 +1999,7 @@
if (action == 3) gotoDevice(nodeid, 11); // Terminal
if (action == 4) gotoDevice(nodeid, 13); // Files
if (action == 5) gotoDevice(nodeid, 15); // Console
- //if (action == 6) {
- //var nodes = "";
- //$(":checkbox").each(function () { if ($(this).is(':checked')) { nodes += ($(this).val() + ";"); } });
- //window.location = "multidesktop.aspx?node=" + nodes + "&auto=1";
- //}
+ if (action == 6) { Q('viewselect').value = 3; Q('viewselect').onchange(); Q('autoConnectDesktopCheckbox').checked = true; Q('autoConnectDesktopCheckbox').onclick(); } // Multi-Desktop
}
function cmmeshaction(action) {
@@ -3570,6 +3569,10 @@
delete files;
files = null;
}
+ p13clipboard = p13clipboardFolder = null;
+ p13clipboardCut = 0;
+ p13updateClipview();
+ p13oldlinkpath = null;
}
var p13filetree = null;
@@ -3609,15 +3612,11 @@
return checkedNames;
}
+ //var p13oldlinkpath = null;
function p13updateFiles(checkedNames) {
var html1 = '', html2 = '', displayPath = '
Root', fullPath = 'Root';
- // Save all existing checked boxes
- var checkedBoxes = [], checkboxes = document.getElementsByName('fd');
- for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { checkedBoxes.push(checkboxes[i].value) }; } // Save all existing checked boxes
-
// Work on parsing the file path
- var oldlinkpath = p13filetreelocation.join('/');
var x = p13filetree.path.split('\\');
p13filetreelocation = [];
for (var i in x) { if (x[i] != '') { p13filetreelocation.push(x[i]); } } // Remove empty spaces
@@ -3646,11 +3645,11 @@
var h = '';
if (f.t < 3) {
var right = '', title = '';
- h = "
";
+ h = "
";
} else {
var link = shortname;
if (f.s > 0) { link = "
" + shortname + ""; }
- h = "
";
+ h = "
";
}
if (f.t < 3) { html1 += h; } else { html2 += h; }
@@ -3662,17 +3661,7 @@
QE('p13FolderUp', p13filetreelocation.length != 0);
// Re-check all boxes if needed using names
- if (checkedNames != null) {
- checkedBoxes = [];
- checkboxes = document.getElementsByName('fd');
- for (var i in filetreexx) { if (checkedNames.indexOf(filetreexx[i].n) >= 0) { checkedBoxes.push(filetreexx[i].nx); } }
- }
-
- // Re-check all boxes if needed using ID's
- if (oldlinkpath == newlinkpath) {
- checkboxes = document.getElementsByName('fd');
- for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = (checkedBoxes.indexOf(checkboxes[i].value) >= 0); }
- }
+ if (checkedNames != null) { var checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkedNames.indexOf(p13filetree.dir[checkboxes[i].value].n) >= 0) { checkboxes[i].checked = true; } } }
// Update the actions buttons
p13setActions();
@@ -3714,8 +3703,11 @@
QE('p13SelectAllButton', false);
Q('p13SelectAllButton').value = 'Select All';
QE('p13RefreshButton', false);
+ QE('p13CutButton', false);
+ QE('p13CopyButton', false);
+ QE('p13PasteButton', false);
} else {
- var cc = p13getFileSelCount(), tc = p13getFileCount();
+ var cc = p13getFileSelCount(), tc = p13getFileCount(), sfc = p13getFileSelCount(false); // In order: number of entires selected, number of total entries, number of selected entires that are files (not folders)
var winAgent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5));
QE('p13DeleteFileButton', (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13NewFolderButton', ((p13filetreelocation.length > 0) || (winAgent == false)));
@@ -3724,10 +3716,13 @@
QE('p13SelectAllButton', tc > 0);
Q('p13SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All');
QE('p13RefreshButton', true);
+ QE('p13CutButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
+ QE('p13CopyButton', (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false)));
+ QE('p13PasteButton', ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0)));
}
}
- function p13getFileSelCount() { var cc = 0; var checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) cc++; } return cc; }
+ function p13getFileSelCount(includeDirs) { var cc = 0; var checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == "3"))) cc++; } return cc; }
function p13getFileCount() { var cc = 0; var checkboxes = document.getElementsByName('fd'); return checkboxes.length; }
function p13selectallfile() { var nv = (p13getFileSelCount() == 0), checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { checkboxes[i].checked = nv; } p13setActions(); }
function p13createfolder() { setDialogMode(2, "New Folder", 3, p13createfolderEx, '
'); focusTextBox('p13renameinput'); p13fileNameCheck(); }
@@ -3736,10 +3731,17 @@
function p13deletefileEx() { var delfiles = [], checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { delfiles.push(p13filetree.dir[checkboxes[i].value].n); } } files.send(JSON.stringify({ action: 'rm', reqid: 1, path: p13filetreelocation.join('/'), delfiles: delfiles })); p13folderup(999); }
function p13renamefile() { var renamefile, checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i].checked) { renamefile = p13filetree.dir[checkboxes[i].value].n; } } setDialogMode(2, "Rename", 3, p13renamefileEx, '
', { action: 'rename', path: p13filetreelocation.join('/'), oldname: renamefile}); focusTextBox('p13renameinput'); p13fileNameCheck(); }
function p13renamefileEx(b, t) { t.newname = Q('p13renameinput').value; files.send(JSON.stringify(t)); p13folderup(999); }
- function p13fileNameCheck(e) { var x = isFilenameValid(Q('p13renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e.keyCode == 13)) { dialogclose(1); } }
+ function p13fileNameCheck(e) { var x = isFilenameValid(Q('p13renameinput').value); QE('idx_dlgOkButton', x); if ((x == true) && (e != null) && (e.keyCode == 13)) { dialogclose(1); } }
function p13uploadFile() { setDialogMode(2, "Upload File", 3, p13uploadFileEx, '
'); updateUploadDialogOk('p13uploadinput'); }
function p13uploadFileEx() { p13doUploadFiles(Q('p13uploadinput').files); }
+ var p13clipboard = null, p13clipboardFolder = null, p13clipboardCut = 0;
+ function p13copyFile(cut) { var checkboxes = document.getElementsByName('fd'); p13clipboard = []; p13clipboardCut = cut, p13clipboardFolder = p13targetpath; for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == "3")) { p13clipboard.push(p13filetree.dir[checkboxes[i].value].n); } } p13updateClipview(); }
+ function p13pasteFile() { var x = ''; if ((p13clipboard != null) && (p13clipboard.length > 0)) { x = 'Confim ' + (p13clipboardCut == 0?'copy':'move') + ' of ' + p13clipboard.length + ' entrie' + ((p13clipboard.length > 1)?'s':'') + ' to this location?' } setDialogMode(2, "Paste", 3, p13pasteFileEx, x); }
+ function p13pasteFileEx() { files.send(JSON.stringify({ 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(); } }
+ function p13updateClipview() { var x = ''; if ((p13clipboard != null) && (p13clipboard.length > 0)) { x = 'Holding ' + p13clipboard.length + ' entrie' + ((p13clipboard.length > 1)?'s':'') + ' for ' + (p13clipboardCut == 0?'copy':'move') + ',
Clear.' } QH('p13bottomstatus', x); p13setActions(); }
+ function p13clearClip() { p13clipboard = null; p13clipboardFolder = null; p13clipboardCut = 0; p13updateClipview(); }
+
function p13fileDragDrop(e) {
haltEvent(e);
QV('p13bigfail', false);