summaryrefslogtreecommitdiffhomepage
path: root/html/webbox.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/webbox.js')
-rw-r--r--html/webbox.js32
1 files changed, 26 insertions, 6 deletions
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