summaryrefslogtreecommitdiffstats
path: root/rrdtool-listrrd-html.lsp
blob: 32813388382ffdc6847f150cb3a8faf66ee5922e (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<% local form, viewlibrary, page_info, session = ... 
require("viewfunctions")
%>
<%
--[[ DEBUG INFORMATION
io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
io.write(html.cfe_unpack(form))
io.write("</span>")
--]]
%>

<% displaycommandresults({"delete", "rrdinfo"}, session) %>

<script type="text/javascript">
function javascript_confirm_demo(formID,filename) {
	var message = "Are you sure you want to remove '" + filename + "'?";
	var return_value = confirm(message);
	if ( return_value === true ) {
		location.href="delete?filename=" + filename;
	}
}
</script>

<h2><%= form.label %></h2>

<form id="confirmDisplay" action="#" onsubmit="return false"></form>

<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 session.permissions[page_info.controller].delete then %>
				<A STYLE="cursor: pointer;" onclick="javascript_confirm_demo('confirmDisplay','<% io.write(file.value.filename.value) %>')">Delete</A>
			<% end %>
			<%
			io.write(html.link{value = "rrdinfo?filename=" .. file.value.filename.value, label="Info " })
--			if session.permissions[page_info.controller].edit then io.write(html.link{value = "edit?filename=" .. file.value.filename.value.."&redir="..page_info.orig_action, label="Edit " }) end
--			if session.permissions[page_info.controller].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(file.value.filename.value) %></TD>
	</TR>
<% end %>

	<% if session.permissions[page_info.controller].createrrd then %>
	<TR>
		<TD style="padding-right:20px;white-space:nowrap;">
			<% io.write(html.link{value = "createrrd", label="Create new DB " }) %>
		</TD>
		<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
	</TR>
	<% end %>

</TABLE>

<% if viewlibrary and viewlibrary.dispatch_component and session.permissions[page_info.controller].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"
	displayform(newfileform)
end %>