summaryrefslogtreecommitdiffhomepage
path: root/html
diff options
context:
space:
mode:
authorRoland Stigge <stigge@antcom.de>2018-01-10 22:42:44 +0100
committerRoland Stigge <stigge@antcom.de>2018-01-10 22:42:44 +0100
commitfa910b8e62f27e54312dff6d4445baabd34d805d (patch)
tree34e6c98d231fb75d88d9f0a6fd64af4ce87ef7d2 /html
parent42573fe80d35d4cb411944ae80bea6e582f5b249 (diff)
Add read only mode
Diffstat (limited to 'html')
-rw-r--r--html/index.html8
-rw-r--r--html/webbox.js32
2 files changed, 30 insertions, 10 deletions
diff --git a/html/index.html b/html/index.html
index 43ef009..580e415 100644
--- a/html/index.html
+++ b/html/index.html
@@ -39,11 +39,11 @@
<div class="menuwindow" id="menuwindow" hidden>
<div class="menudiv">
<table class="menudialog">
- <tr><td class="entry" onclick="hideMenu(); createDir();">New Folder</td></tr>
+ <tr class="writecommand"><td class="entry" onclick="hideMenu(); createDir();">New Folder</td></tr>
<tr><td class="entry" onclick="hideMenu(); download();">Download</td></tr>
- <tr><td class="entry" onclick="hideMenu(); upload();">Upload</td></tr>
- <tr><td class="entry" onclick="hideMenu(); deleteItems();">Delete</td></tr>
- <tr><td class="entry" onclick="hideMenu(); move();">Move</td></tr>
+ <tr class="writecommand"><td class="entry" onclick="hideMenu(); upload();">Upload</td></tr>
+ <tr class="writecommand"><td class="entry" onclick="hideMenu(); deleteItems();">Delete</td></tr>
+ <tr class="writecommand"><td class="entry" onclick="hideMenu(); move();">Move</td></tr>
<tr><td class="entry" onclick="hideMenu(); info();">Info</td></tr>
<tr><td class="entry" onclick="hideMenu(); selectAll();">Select/Unselect All</td></tr>
<tr><td class="entry" onclick="hideMenu();">Close Menu</td></tr>
diff --git a/html/webbox.js b/html/webbox.js
index 296429b..40a7a1a 100644
--- a/html/webbox.js
+++ b/html/webbox.js
@@ -31,9 +31,9 @@ function loadContents(dir) {
}
result += "<tr " +
- "onmousedown=\"entryMouseDown('" + listElements[i].childNodes[0].nodeValue + "')\" " +
- "onmouseup=\"entryMouseUp('" + listElements[i].childNodes[0].nodeValue + "')\"" +
- "><td class=\"type\">" + type + "</td><td class=\"name\">" + listElements[i].childNodes[0].nodeValue + "</td></tr>";
+ "onmousedown=\"entryMouseDown('" + listElements[i].textContent + "')\" " +
+ "onmouseup=\"entryMouseUp('" + listElements[i].textContent + "')\"" +
+ "><td class=\"type\">" + type + "</td><td class=\"name\">" + listElements[i].textContent + "</td></tr>";
}
}
@@ -224,6 +224,16 @@ function hideMenu() {
document.getElementById("menuwindow").style.display = 'none';
}
+// if readOnly = "1", disable respective controls since this setting is global and constant
+function prepareReadOnly(readOnly) {
+ if (readOnly == "1") {
+ var writecommands = document.getElementsByClassName("writecommand");
+ for (var i = 0; i < writecommands.length; i++) {
+ writecommands[i].style.display = "none";
+ }
+ }
+}
+
function initMainpage() {
setCurrentDir("/");
@@ -248,13 +258,23 @@ function initMainpage() {
var xhrTitle = new XMLHttpRequest();
xhrTitle.onreadystatechange = function() {
- if (this.readyState != 4 || this.status != 200) {
+ if (this.readyState != 4) {
return;
}
- document.getElementsByClassName("title")[0].innerHTML = xhrTitle.responseText;
+ if (this.status != 200) {
+ document.getElementsByClassName("title")[0].innerHTML = "HTTP error";
+ return;
+ }
+
+ var serverInfo = xhrTitle.responseXML;
+ var title = serverInfo.getElementsByTagName("title")[0].textContent;
+ document.getElementsByClassName("title")[0].innerHTML = title;
+
+ var readOnly = serverInfo.getElementsByTagName("readonly")[0].textContent;
+ prepareReadOnly(readOnly);
}
- xhrTitle.open("GET", "/bin/query?command=title", true);
+ xhrTitle.open("GET", "/bin/query?command=server-info", true);
xhrTitle.send();
// load footer