diff --git a/resources/js/ajax.js b/resources/js/ajax.js index 9d024ef..6efc1af 100644 --- a/resources/js/ajax.js +++ b/resources/js/ajax.js @@ -1,23 +1,5 @@ var pathNodes = []; -function getDirSSE() { - var path = ""; - - // Create path from array of items - for (pathNode of pathNodes) { - path += pathNode; - } - - // For some reason, PHPSESSID= gets inserted when in sub dir. - // temp work arround is to trim it. - if (path.includes("PHPSESSID=")) { - path = path.split("; ").pop(); - } - - path = "dirQuery=" + path; - process(path); -} - function getDir(query) { var formULPTH = document.getElementById("DIRPATHUL"); var path = ""; diff --git a/resources/js/fileSystemControls.js b/resources/js/fileSystemControls.js index 0737ad9..0f9553b 100644 --- a/resources/js/fileSystemControls.js +++ b/resources/js/fileSystemControls.js @@ -72,33 +72,30 @@ function renameItem(obj) { xhttp.open("POST", "resources/php/rename.php", false); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send(formData); - - getDirSSE(); } function createDir() { var path = document.getElementById("path").innerHTML; - var newItem = document.getElementById("NewItem").value; - var fullPth = path + newItem; + var newItem = document.getElementById("NewItem"); + var fullPth = path + newItem.value; var xhttp = new XMLHttpRequest(); + newItem.value = ""; xhttp.open("POST", "resources/php/newFileOrDir.php", false); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send("item=" + fullPth + "&isDir=dir"); - getDirSSE(); } function createFile() { var path = document.getElementById("path").innerHTML; - var newItem = document.getElementById("NewItem").value; - var fullPth = path + newItem; - + var newItem = document.getElementById("NewItem"); + var fullPth = path + newItem.value; var xhttp = new XMLHttpRequest(); + newItem.value = ""; xhttp.open("POST", "resources/php/newFileOrDir.php", false); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send("item=" + fullPth + "&isFile=file"); - getDirSSE(); } function startDeleteItem(item) { @@ -122,7 +119,6 @@ function deleteItem(item) { console.log("Deleted: " + fullPth); itemObj = null; - getDirSSE(); } } } diff --git a/resources/js/uiControls.js b/resources/js/uiControls.js index 40e0205..1eb9f4e 100644 --- a/resources/js/uiControls.js +++ b/resources/js/uiControls.js @@ -38,7 +38,7 @@ if(typeof(EventSource) !== "undefined") { var source = new EventSource("resources/php/sse.php"); source.onmessage = function(event) { if (event.data === "updateListing") { - getDirSSE(); + getDir("./"); } }; } else { diff --git a/resources/php/delete.php b/resources/php/delete.php index 207de76..a786f18 100644 --- a/resources/php/delete.php +++ b/resources/php/delete.php @@ -1,7 +1,7 @@ diff --git a/resources/php/rename.php b/resources/php/rename.php index 3873d26..ab3b770 100644 --- a/resources/php/rename.php +++ b/resources/php/rename.php @@ -1,6 +1,9 @@