aboutsummaryrefslogtreecommitdiff
path: root/backends/networking/wwwroot/.filesAJAX.html
diff options
context:
space:
mode:
Diffstat (limited to 'backends/networking/wwwroot/.filesAJAX.html')
-rw-r--r--backends/networking/wwwroot/.filesAJAX.html34
1 files changed, 30 insertions, 4 deletions
diff --git a/backends/networking/wwwroot/.filesAJAX.html b/backends/networking/wwwroot/.filesAJAX.html
index d648466d2c..f736b74b7e 100644
--- a/backends/networking/wwwroot/.filesAJAX.html
+++ b/backends/networking/wwwroot/.filesAJAX.html
@@ -17,7 +17,7 @@
</tr></table>
<div id="create_directory" class="modal">
<p>{create_directory_desc}</p>
- <form action="create" id="create_directory_form">
+ <form action="create" id="create_directory_form" onsubmit="return createDirectory();">
<input type="hidden" name="path" value="{path}"/>
<input type="hidden" name="ajax" value="true"/>
<input type="text" name="directory_name" value=""/>
@@ -71,6 +71,32 @@
function getCallback(path) {
return function (jsonResponse) {
+ if (jsonResponse.type == "error") {
+ showError();
+ return;
+ }
+
+ openDirectory(path, jsonResponse.items);
+ hideLoading();
+ };
+ }
+
+ function createDirectory() {
+ if (isLoading) return;
+ showLoading();
+
+ var data = {"answer_json": "true"};
+ var elements = document.getElementById("create_directory_form").elements;
+ for (var el in elements)
+ data[elements[el].name] = elements[el].value;
+
+ ajax.getAndParseJson("./create", data, getCreateDirectoryCallback(data["path"]));
+ show("create_directory");
+ return false; // invalidate form, so it won't submit
+ }
+
+ function getCreateDirectoryCallback(path) {
+ return function (jsonResponse) {
console.log(jsonResponse);
if (jsonResponse.type == "error") {
@@ -78,8 +104,8 @@
return;
}
- openDirectory(path, jsonResponse.items);
hideLoading();
+ showDirectory(path);
};
}
@@ -122,7 +148,7 @@
function makeBreadcrumb(name, path) {
var a = createElementWithContents("a", name);
a.onclick = function () { showDirectory(path); };
- a.href = "javascript:onclick();";
+ a.href = "javascript:void(0);";
return a;
}
@@ -194,7 +220,7 @@
var a = createElementWithContents("a", item.name);
if (item.isDirectory) {
a.onclick = function () { showDirectory(item.path); };
- a.href = "javascript:onclick();";
+ a.href = "javascript:void(0);";
} else
a.href = "./download?path=" + encodeURIComponent(item.path);
td.appendChild(a);