val tree = fileTree(path)!!
return adminPage("VFS - /$path") {
- h1 { +"/$path" }
-
- when (tree) {
- is TreeNode.FileNode -> table {
- tr {
- th {
- colSpan = "2"
- +"/$path"
+ main {
+ h1 { +"/$path" }
+
+ when (tree) {
+ is TreeNode.FileNode -> table {
+ tr {
+ th {
+ colSpan = "2"
+ +"/$path"
+ }
}
- }
- tr {
- td {
- colSpan = "2"
- iframe {
- src = href(Root.Admin.Vfs.Inline(path.elements))
+ tr {
+ td {
+ colSpan = "2"
+ iframe {
+ src = href(Root.Admin.Vfs.Inline(path.elements))
+ }
}
}
- }
- tr {
- th { +"Last updated" }
- td { dateTime(tree.stats.updated) }
- }
- tr {
- th { +"Size (bytes)" }
- td { +"${tree.stats.size}" }
- }
- tr {
- th { +"Actions" }
- td {
- ul {
- li {
- a(href = href(Root.Admin.Vfs.Download(path.elements))) {
- +"Download"
+ tr {
+ th { +"Last updated" }
+ td { dateTime(tree.stats.updated) }
+ }
+ tr {
+ th { +"Size (bytes)" }
+ td { +"${tree.stats.size}" }
+ }
+ tr {
+ th { +"Actions" }
+ td {
+ ul {
+ li {
+ a(href = href(Root.Admin.Vfs.Download(path.elements))) {
+ +"Download"
+ }
}
- }
- li {
- form(action = href(Root.Admin.Vfs.Overwrite(path.elements)), method = FormMethod.post, encType = FormEncType.multipartFormData) {
- installCsrfToken()
- label {
- fileInput(name = "uploaded")
- +"Upload New Version"
+ li {
+ form(action = href(Root.Admin.Vfs.Overwrite(path.elements)), method = FormMethod.post, encType = FormEncType.multipartFormData) {
+ installCsrfToken()
+ label {
+ fileInput(name = "uploaded")
+ +"Upload New Version"
+ }
+ submitInput()
}
- submitInput()
}
- }
- li {
- a(href = href(Root.Admin.Vfs.DeleteConfirmPage(path.elements))) {
- +"Delete"
+ li {
+ a(href = href(Root.Admin.Vfs.DeleteConfirmPage(path.elements))) {
+ +"Delete"
+ }
}
}
}
}
- }
- tr {
- th { +"Navigate" }
- td {
- ul {
- path.elements.indices.forEach { index ->
- val parent = path.elements.take(index)
- li {
- a(href = href(Root.Admin.Vfs.View(parent))) {
- +"/${StoragePath(parent)}"
+ tr {
+ th { +"Navigate" }
+ td {
+ ul {
+ path.elements.indices.forEach { index ->
+ val parent = path.elements.take(index)
+ li {
+ a(href = href(Root.Admin.Vfs.View(parent))) {
+ +"/${StoragePath(parent)}"
+ }
}
}
}
}
}
}
- }
-
- is TreeNode.DirNode -> ul {
- if (!path.isRoot)
- li {
- a(href = href(Root.Admin.Vfs.View(path.elements.dropLast(1)))) {
- +".."
- }
- }
- render(path, tree.children)
+ is TreeNode.DirNode -> ul {
+ if (!path.isRoot)
+ li {
+ a(href = href(Root.Admin.Vfs.View(path.elements.dropLast(1)))) {
+ +".."
+ }
+ }
+
+ render(path, tree.children)
+ }
}
}
}
respond(HttpStatusCode.Conflict)
else
respondHtml(block = adminPage("Confirm Deletion of /$path") {
- p {
- +"Are you sure you want to delete the file at /$path? "
- strong { +"It will be gone forever!" }
- }
- table {
- tr {
- th { +"Last Updated" }
- td { dateTime(stats.updated) }
+ main {
+ p {
+ +"Are you sure you want to delete the file at /$path? "
+ strong { +"It will be gone forever!" }
}
- tr {
- th { +"Size (bytes)" }
- td { +"${stats.size}" }
+ table {
+ tr {
+ th { +"Last Updated" }
+ td { dateTime(stats.updated) }
+ }
+ tr {
+ th { +"Size (bytes)" }
+ td { +"${stats.size}" }
+ }
+ }
+
+ form(method = FormMethod.get, action = href(Root.Admin.Vfs.View(path.elements))) {
+ submitInput { value = "No, take me back" }
+ }
+ +Entities.nbsp
+ form(method = FormMethod.post, action = href(Root.Admin.Vfs.DeleteConfirmPost(path.elements))) {
+ installCsrfToken()
+ submitInput(classes = "evil") { value = "Yes, delete it" }
}
- }
-
- form(method = FormMethod.get, action = href(Root.Admin.Vfs.View(path.elements))) {
- submitInput { value = "No, take me back" }
- }
- +Entities.nbsp
- form(method = FormMethod.post, action = href(Root.Admin.Vfs.DeleteConfirmPost(path.elements))) {
- installCsrfToken()
- submitInput(classes = "evil") { value = "Yes, delete it" }
}
})
}
respond(HttpStatusCode.Conflict)
else
respondHtml(block = adminPage("Confirm Deletion of /$path") {
- p {
- +"Are you sure you want to delete the directory at /$path? "
- strong { +"It, and all of its contents, will be gone forever!" }
- }
- ul {
- for (entry in entries)
- li {
- +entry.name
- if (entry.type == StoredFileType.DIRECTORY)
- +"/"
- }
- }
-
- form(method = FormMethod.get, action = href(Root.Admin.Vfs.View(path.elements))) {
- submitInput { value = "No, take me back" }
- }
- +Entities.nbsp
- form(method = FormMethod.post, action = href(Root.Admin.Vfs.RmDirConfirmPost(path.elements))) {
- installCsrfToken()
- submitInput(classes = "evil") { value = "Yes, delete it" }
+ main {
+ p {
+ +"Are you sure you want to delete the directory at /$path? "
+ strong { +"It, and all of its contents, will be gone forever!" }
+ }
+ ul {
+ for (entry in entries)
+ li {
+ +entry.name
+ if (entry.type == StoredFileType.DIRECTORY)
+ +"/"
+ }
+ }
+
+ form(method = FormMethod.get, action = href(Root.Admin.Vfs.View(path.elements))) {
+ submitInput { value = "No, take me back" }
+ }
+ +Entities.nbsp
+ form(method = FormMethod.post, action = href(Root.Admin.Vfs.RmDirConfirmPost(path.elements))) {
+ installCsrfToken()
+ submitInput(classes = "evil") { value = "Yes, delete it" }
+ }
}
})
}