diff options
author | Roland Stigge <stigge@antcom.de> | 2018-01-08 16:57:47 +0100 |
---|---|---|
committer | Roland Stigge <stigge@antcom.de> | 2018-01-08 16:57:47 +0100 |
commit | d8eae5827b2599bb1fb125aed47d73bf82d1ff10 (patch) | |
tree | 97c835f8580e4eb102185b2a7cbbe9c2e559db5f /html | |
parent | 34f772d353839b5febcc0cad2a54e29716dcb6c8 (diff) |
Debian package, fix list xml
Diffstat (limited to 'html')
-rw-r--r-- | html/webbox.js | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/html/webbox.js b/html/webbox.js index 071137c..dd57966 100644 --- a/html/webbox.js +++ b/html/webbox.js @@ -189,6 +189,7 @@ function entryMouseUp(filename) { } else if (type == "dir") { if (filename == "..") { if (!currentDir.includes("/")) { + // error: this shouldn't happen alert("Bad path " + currentDir + " for " + filename); return; } @@ -215,6 +216,7 @@ function entryMouseUp(filename) { function showDialog() { document.getElementById("greyout").style.display = 'block'; document.getElementById("dialogwindow").style.display = 'block'; + document.getElementById("okbutton").focus(); } function hideDialog() { @@ -238,7 +240,7 @@ function initMainpage() { // default action for "Cancel" button: hide dialog window document.getElementById("cancelbutton").onclick = hideDialog; - // on Escape, hide dialog window + // on Escape, globally hide dialog and menu window document.onkeydown = function(evt) { if (evt.key == "Escape") { hideDialog(); @@ -352,6 +354,7 @@ function createDir() { document.getElementById("dialog").innerHTML = xhr.responseText; document.getElementById("okbutton").onclick = hideDialog; + document.getElementById("okbutton").focus(); loadContents(currentDir); // load new file list with new dir } @@ -368,7 +371,7 @@ function createDir() { document.getElementById("dialog").innerHTML = document.getElementById("create-dir-dialog").innerHTML; document.getElementById("newdir").focus(); - + document.getElementById("newdir").onkeydown = function(evt) { if (evt.key == "Enter") { document.getElementById("okbutton").click(); @@ -382,6 +385,7 @@ function upload() { uploadfile.click(); } +// Callback on selected and uploaded file function onUploadFile() { var xhr = new XMLHttpRequest(); @@ -390,12 +394,23 @@ function onUploadFile() { return; } + showDialog(); + var message = ""; + if (xhr.responseText == "OK") { - alert("Upload successful."); + message = "Upload successful."; loadContents(currentDir); // load new file list with uploaded file } else { - alert("Error: " + xhr.responseText); + message = "Error: " + xhr.responseText; + } + + document.getElementById("dialog").innerHTML = message; + document.getElementById("cancelbutton").style.display = "none"; + document.getElementById("okbutton").onclick = function() { + hideDialog(); + document.getElementById("cancelbutton").style.display = "block"; } + document.getElementById("okbutton").focus(); } var uploadfile = document.getElementById("uploadfile"); @@ -490,6 +505,7 @@ function move() { document.getElementById("dialog").innerHTML = xhr.responseText; document.getElementById("okbutton").onclick = hideDialog; + document.getElementById("okbutton").focus(); loadContents(currentDir); // load new file list with deleted items } |