configure panel for directories
This commit is contained in:
@ -256,6 +256,34 @@ div#itemsTable table tbody td:nth-child(1) {
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
div#dirConfig table * {
|
||||
background: #bcd1e5 !important;
|
||||
}
|
||||
div#dirConfig table {
|
||||
border-collapse: collapse;
|
||||
width: auto;
|
||||
}
|
||||
div#dirConfig table td {
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
div#dirsTable table thead th:nth-child(2) {
|
||||
width: 80px;
|
||||
}
|
||||
div#dirsTable table thead th:nth-child(3) {
|
||||
width: 80px;
|
||||
}
|
||||
div#dirsTable table thead th:nth-child(4) {
|
||||
width: 170px;
|
||||
}
|
||||
div#dirsTable table tbody td:nth-child(1) {
|
||||
text-overflow: ellipsis;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
div#hitsTable table thead th:nth-child(1) {
|
||||
width: 270px;
|
||||
}
|
||||
|
@ -45,6 +45,8 @@ public class Util {
|
||||
_x("Copy To Clipbaord"),
|
||||
_x("Default settings for new feeds"),
|
||||
_x("Details for {0}"),
|
||||
_x("Directory configuration for {0}"),
|
||||
_x("Directory sync frequency (seconds, 0 means never)"),
|
||||
_x("Distrusted"),
|
||||
_x("Distrusted User"),
|
||||
_x("Down"),
|
||||
@ -138,6 +140,7 @@ public class Util {
|
||||
_x("User"),
|
||||
_x("View 1 Certificate"),
|
||||
_x("View {0} Certificates"),
|
||||
_x("Watch directory for changes using operating system"),
|
||||
_x("Your full MuWire id is"),
|
||||
_x("Your short MuWire id is {0}"),
|
||||
_x("Your Trust"),
|
||||
|
@ -1,6 +1,7 @@
|
||||
class Directory {
|
||||
constructor(xmlNode) {
|
||||
this.directory = xmlNode.getElementsByTagName("Directory")[0].childNodes[0].nodeValue
|
||||
this.path = Base64.encode(this.directory)
|
||||
this.autoWatch = xmlNode.getElementsByTagName("AutoWatch")[0].childNodes[0].nodeValue
|
||||
this.syncInterval = xmlNode.getElementsByTagName("SyncInterval")[0].childNodes[0].nodeValue
|
||||
this.lastSync = xmlNode.getElementsByTagName("LastSync")[0].childNodes[0].nodeValue
|
||||
@ -9,7 +10,11 @@ class Directory {
|
||||
getMapping() {
|
||||
var mapping = new Map()
|
||||
|
||||
mapping.set("Directory", this.directory)
|
||||
var configLink = new Link(_t("Configure"), "configure", [this.path])
|
||||
var divRight = "<span class='right'><div class='dropdown'><a class='droplink'>" + _t("Actions") + "</a><div class='dropdown-content'>" +
|
||||
configLink.render() + "</div></div></span>"
|
||||
|
||||
mapping.set("Directory", this.directory + divRight)
|
||||
mapping.set("Auto Watch", this.autoWatch)
|
||||
mapping.set("Last Sync", this.lastSync)
|
||||
mapping.set("Sync Interval", this.syncInterval)
|
||||
@ -42,11 +47,14 @@ function refreshDirs() {
|
||||
var xmlhttp = new XMLHttpRequest()
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
pathToDir.clear()
|
||||
var listOfDirs = []
|
||||
var dirNodes = this.responseXML.getElementsByTagName("WatchedDir")
|
||||
var i
|
||||
for (i = 0; i < dirNodes.length; i ++) {
|
||||
listOfDirs.push(new Directory(dirNodes[i]))
|
||||
var dir = new Directory(dirNodes[i])
|
||||
listOfDirs.push(dir)
|
||||
pathToDir.set(dir.path, dir)
|
||||
}
|
||||
|
||||
var newOrder
|
||||
@ -77,7 +85,47 @@ function sortDirs(key, order) {
|
||||
refreshDirs()
|
||||
}
|
||||
|
||||
function configure(path) {
|
||||
var dir = pathToDir.get(path)
|
||||
|
||||
var html = "<form action='/MuWire/AdvancedShare' method='post'>"
|
||||
html += "<h3>" + _t("Directory configuration for {0}", dir.directory) + "</h3>"
|
||||
|
||||
html += "<table>"
|
||||
|
||||
html += "<tr>"
|
||||
html += "<td>" + _t("Watch directory for changes using operating system") + "</td>"
|
||||
html += "<td><p align='right'><input type='checkbox' name='autoWatch' value='true'"
|
||||
if (dir.autoWatch == "true")
|
||||
html += " checked "
|
||||
html += "></p></td>"
|
||||
html += "</tr>"
|
||||
|
||||
html += "<tr>"
|
||||
html += "<td>" + _t("Directory sync frequency (seconds, 0 means never)") + "</td>"
|
||||
html += "<td><p align='right'><input type='text' size='3' name='syncInterval' value='" + dir.syncInterval + "'></p></td>"
|
||||
html += "</tr>"
|
||||
|
||||
html += "</table>"
|
||||
|
||||
html += "<input type='hidden' name='path' value='" + path + "'>"
|
||||
html += "<input type='hidden' name='action' value='configure'>"
|
||||
|
||||
html += "<input type='submit' value='" + _t("Save") + "'>"
|
||||
html += "<a href='#' onclick='window.cancelConfig();return false;'>" + _t("Cancel") + "</a>"
|
||||
html += "</form>"
|
||||
|
||||
var tableDiv = document.getElementById("dirConfig")
|
||||
tableDiv.innerHTML = html
|
||||
}
|
||||
|
||||
function cancelConfig() {
|
||||
var tableDiv = document.getElementById("dirConfig")
|
||||
tableDiv.innerHTML = ""
|
||||
}
|
||||
|
||||
var revision = -1
|
||||
var pathToDir = new Map()
|
||||
|
||||
var sortKey = "Directory"
|
||||
var sortOrder = "descending"
|
Reference in New Issue
Block a user