From 66f4891f63f0bbd58bf6da82e409512788a02983 Mon Sep 17 00:00:00 2001 From: Alex Vitkov Date: Mon, 15 Feb 2021 11:50:31 +0200 Subject: Respecting write permissions --- loggedin.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'loggedin.js') diff --git a/loggedin.js b/loggedin.js index 03a1011..8c923b4 100644 --- a/loggedin.js +++ b/loggedin.js @@ -5,9 +5,9 @@ var FORM_ASYNC = true; // A FileView is an entry inside the explorer window class FileView { - constructor(filename, visuals, mimetype, is_directory, write_permissions) { + constructor(filename, mimetype, is_directory, write_permissions) { this.filename = filename; - this.visuals = visuals; // The DOM object with the icon and the filenam text + this.visuals = null; // The DOM object with the icon and the filenam text this.mimetype = mimetype; this.is_directory = is_directory; this.write_permissions = write_permissions; @@ -397,12 +397,16 @@ function opendir() { files = []; var json = JSON.parse(xhr.responseText); + console.log(json); if (!json) return; // Create the FileViews from the json response for (const f of json) { - var view = new FileView(f.name, null, f.mimetype, f.is_directory && f.is_directory != "0", true); + var view = new FileView(f.name, + f.mimetype, + f.is_directory && f.is_directory != "0", + f.can_edit && f.can_edit != "0"); files.push(view); } -- cgit v1.2.3 From b2c74f742213acb57b6d17f0a3a64c53a44f3f55 Mon Sep 17 00:00:00 2001 From: Alex Vitkov Date: Mon, 15 Feb 2021 12:00:14 +0200 Subject: asdf --- loggedin.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'loggedin.js') diff --git a/loggedin.js b/loggedin.js index 8c923b4..bc18ef4 100644 --- a/loggedin.js +++ b/loggedin.js @@ -22,6 +22,7 @@ class Window { this.pwd = pwd; // pwd = [ "Folder1", "Folder2" ] means the current directory of that window is /Folder1/Folder2 this.visuals = null; // The DOM object this.h2 = null; // The titlebar of the window + this.fileview = null; } } @@ -343,11 +344,11 @@ function openfile_nondir() { focus.filecontents.classList.remove('imgview'); focus.filecontents.style.backgroundImage = "unset"; - var pre = mk(focus.filecontents, 'pre'); + wnd.pre = mk(focus.filecontents, 'pre'); xhr.onload = function () { - pre.innerText = xhr.responseText; - pre.contentEditable = "true"; + wnd.pre.innerText = xhr.responseText; + wnd.pre.contentEditable = "true"; }; } @@ -860,7 +861,7 @@ function make_window(pwd) { mk(h3, 'div', 'separator'); let replace_btn = mk(h3, 'button'); - replace_btn.innerText = "Save"; + replace_btn.innerText = "Save Changes"; replace_btn.onclick = () => { alert("No implemento"); } mk(h3, 'div', 'separator'); -- cgit v1.2.3 From 7d2589a55bad9880057b4321e044db539c9d132f Mon Sep 17 00:00:00 2001 From: Alex Vitkov Date: Mon, 15 Feb 2021 12:00:50 +0200 Subject: asdf --- loggedin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'loggedin.js') diff --git a/loggedin.js b/loggedin.js index bc18ef4..2b1f2c0 100644 --- a/loggedin.js +++ b/loggedin.js @@ -344,11 +344,11 @@ function openfile_nondir() { focus.filecontents.classList.remove('imgview'); focus.filecontents.style.backgroundImage = "unset"; - wnd.pre = mk(focus.filecontents, 'pre'); + var pre = mk(focus.filecontents, 'pre'); xhr.onload = function () { - wnd.pre.innerText = xhr.responseText; - wnd.pre.contentEditable = "true"; + pre.innerText = xhr.responseText; + pre.contentEditable = "true"; }; } -- cgit v1.2.3