diff --git a/package.json b/package.json index 4c0eaa9b..11904732 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.1-j", + "version": "0.4.1-l", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default-min.handlebars b/views/default-min.handlebars index 6bf1c971..54ae316f 100644 --- a/views/default-min.handlebars +++ b/views/default-min.handlebars @@ -1 +1 @@ - {{{title}}}
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file + {{{title}}}
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file diff --git a/views/default.handlebars b/views/default.handlebars index 6aeed319..d4ec4539 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -336,6 +336,7 @@       +       @@ -623,6 +624,7 @@       +         @@ -5908,6 +5910,7 @@ QE('p13NewFolderButton', false); QE('p13UploadButton', false); QE('p13RenameFileButton', false); + QE('p13ViewFileButton', false); QE('p13SelectAllButton', false); Q('p13SelectAllButton').value = 'Select All'; QE('p13RefreshButton', false); @@ -5921,6 +5924,7 @@ QE('p13NewFolderButton', ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13UploadButton', ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13RenameFileButton', (cc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false))); + QE('p13ViewFileButton', (cc == 1) && (sfc == 1) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13SelectAllButton', tc > 0); Q('p13SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All'); QE('p13RefreshButton', true); @@ -5943,6 +5947,17 @@ 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); } + function p13viewfile() { + var checkboxes = document.getElementsByName('fd'); + for (var i = 0; i < checkboxes.length; i++) { + if (checkboxes[i].checked) { + if (p13filetree.dir[checkboxes[i].value].s <= 204800) { + p13downloadfile(encodeURIComponent(p13filetreelocation.join('/') + '/' + p13filetree.dir[checkboxes[i].value].n), encodeURIComponent(p13filetree.dir[checkboxes[i].value].n), p13filetree.dir[checkboxes[i].value].s, 'viewer'); + } else { messagebox('File Viewer', 'Only files less than 200k can be viewed.'); } + break; + } + } + } 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(); } @@ -5991,9 +6006,9 @@ var downloadFile; // Global state for file download // Called by the html page to start a download, arguments are: path, file name and file size. - function p13downloadfile(x, y, z) { + function p13downloadfile(x, y, z, tag) { if (xxdialogMode || downloadFile || !files) return; - downloadFile = { path: decodeURIComponent(x), file: decodeURIComponent(y), size: z, tsize: 0, data: '', state: 0, id: Math.random() } + downloadFile = { path: decodeURIComponent(x), file: decodeURIComponent(y), size: z, tsize: 0, data: '', state: 0, id: Math.random(), tag: tag } //console.log('p13downloadFileCancel', downloadFile); files.sendText({ action: 'download', sub: 'start', id: downloadFile.id, path: downloadFile.path }); setDialogMode(2, "Download File", 10, p13downloadFileCancel, '
' + downloadFile.file + '

'); @@ -6019,7 +6034,12 @@ Q('d2progressBar').value = downloadFile.tsize; // Change the progress bar } if ((ReadInt(data, 0) & 1) != 0) { // Check end flag - saveAs(data2blob(downloadFile.data), downloadFile.file); downloadFile = null; setDialogMode(0); // Save the file + if (downloadFile.tag == 'viewer') { + setDialogMode(2, downloadFile.file, 9, null, '
' + EscapeHtml(downloadFile.data) + '
'); + downloadFile = null; + } else { + saveAs(data2blob(downloadFile.data), downloadFile.file); downloadFile = null; setDialogMode(0); // Save the file + } } else { files.sendText({ action: 'download', sub: 'ack', id: downloadFile.id }); // Send the ACK } @@ -7463,6 +7483,7 @@ QE('p5NewFolderButton', filetreelocation.length > 0); QE('p5UploadButton', filetreelocation.length > 0); QE('p5RenameFileButton', (cc == 1) && (filetreelocation.length > 0)); + //QE('p5ViewFileButton', (cc == 1) && (sfc == 1) && (filetreelocation.length > 0)); QE('p5SelectAllButton', tc > 0); Q('p5SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All'); QE('p5CutButton', (sfc > 0) && (cc == sfc)); @@ -7489,6 +7510,17 @@ function p5uploadFile() { setDialogMode(2, "Upload File", 3, p5uploadFileEx, '
'); updateUploadDialogOk('p5uploadinput'); } function p5uploadFileEx() { Q('p5loginSubmit').click(); } function updateUploadDialogOk(x) { QE('idx_dlgOkButton', Q(x).value != ''); } + /* + function p5viewfile() { + var checkboxes = document.getElementsByName('fc'); + for (var i = 0; i < checkboxes.length; i++) { + if (checkboxes[i].checked) { + console.log(filetreelocation.join('/') + '/' + checkboxes[i].value); // TODO: Download and show this file + break; + } + } + } + */ var p5clipboard = null, p5clipboardFolder = null, p5clipboardCut = 0; function p5copyFile(cut) { var checkboxes = document.getElementsByName('fc'); p5clipboard = []; p5clipboardCut = cut, p5clipboardFolder = Clone(filetreelocation); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && (checkboxes[i].attributes.file.value == "3")) { p5clipboard.push(checkboxes[i].value); } } p5updateClipview(); } diff --git a/views/messenger-min.handlebars b/views/messenger-min.handlebars index 19bdf575..d735c54f 100644 --- a/views/messenger-min.handlebars +++ b/views/messenger-min.handlebars @@ -1 +1 @@ - MeshMessenger
MeshMessenger
\ No newline at end of file + MeshMessenger
MeshMessenger
\ No newline at end of file diff --git a/views/messenger.handlebars b/views/messenger.handlebars index 5ee4aac5..271496fd 100644 --- a/views/messenger.handlebars +++ b/views/messenger.handlebars @@ -12,7 +12,7 @@
-
+