summaryrefslogtreecommitdiffstats
path: root/tinydns-listfiles-html.lsp
blob: 470693f36a71b51232c2d00a559326b75484bf8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<% local form, viewlibrary, page_info, session = ... 
htmlviewfunctions = require("htmlviewfunctions")
html = require("acf.html")
%>

<% htmlviewfunctions.displaycommandresults({"delete", "edit", "editfile"}, session) %>
<% htmlviewfunctions.displaycommandresults({"newfile", "startstop"}, session, true) %>

<h1>Configuration</h1>
<h2>Edit/View existing Domains</h2>
<DL><TABLE>
	<TR style="background:#eee;font-weight:bold;">
		<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Action</TD>
		<TD style="padding-right:20px;white-space:nowrap;text-align:right;" class="header">Size</TD>
		<TD style="padding-right:20px;white-space:nowrap;text-align:left;" class="header">Last Modified</TD>
		<TD style="white-space:nowrap;text-align:left;" class="header">File</TD>
	</TR>		
<% for i,file in ipairs(form.value) do %>
	<TR>
		<TD style="padding-right:20px;white-space:nowrap;">
			<%
			if viewlibrary.check_permission("delete") then io.write(html.link{value = "delete?submit=true&filename=" .. file.value.filename.value, label="Delete " }) end
			io.write(html.link{value = "view?filename=" .. file.value.filename.value, label="View " })
			if viewlibrary.check_permission("edit") then io.write(html.link{value = "edit?filename=" .. file.value.filename.value.."&redir="..page_info.orig_action, label="Edit " }) end
			if viewlibrary.check_permission("editfile") then io.write(html.link{value = "editfile?filename=" .. file.value.filename.value.."&redir="..page_info.orig_action, label="Expert " }) end
			%>
		</TD>
		<TD style="padding-right:20px;white-space:nowrap;text-align:right;"><%= html.html_escape(file.value.filesize.value) %></TD>
		<TD style="padding-right:20px;white-space:nowrap;"><%= html.html_escape(file.value.mtime.value) %></TD>
		<TD style="white-space:nowrap;" width="90%"><%= html.html_escape(string.gsub(file.value.filename.value, "^.*/", "")) %></TD>
	</TR>
<% end %>
</TABLE>
<% if #form.value == 0 then %>
	No domains defined
<% end %>
</DL>

<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("newfile") then
	local newfileform = viewlibrary.dispatch_component("newfile", nil, true) %>
<h2>Create new Domain</h2>
<%
	newfileform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/newfile"
	htmlviewfunctions.displayform(newfileform)
end %>

<% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("startstop") then
	viewlibrary.dispatch_component("startstop")
end %>