summaryrefslogtreecommitdiffstats
path: root/rc-status-html.lsp
blob: a23479838a879cb964f125121220f02d0bb9daff (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
<% local view, viewlibrary, page_info, session = ... %>
<% require("viewfunctions") %>

<% if session.editresult then %>
	<H1>Command Result</H1>
	<% if session.editresult.errtxt then io.write('<P CLASS="error">' .. string.gsub(html.html_escape(session.editresult.errtxt), "\n", "<BR>") .. "</P>\n") end
	if session.editresult.descr then io.write('<P CLASS="descr">' .. string.gsub(html.html_escape(session.editresult.descr), "\n", "<BR>") .. "</P>\n") end
	for name,val in pairs(session.editresult.value) do
		if val.errtxt then io.write('<P CLASS="error">' .. string.gsub(html.html_escape(val.errtxt), "\n", "<BR>") .. "</P>\n") end
	end
	session.editresult = nil
end %>

<H1><%= html.html_escape(view.label) %></H1>
<TABLE>
<TR>
<% if session.permissions.rc.edit then %>
<TD class='header'>Update</TD>
<% end %>
<TD class='header'>Service Name</TD><TD class='header'>Sequence</TD>
<TD class='header'>Kill on shutdown</TD><TD class='header'>System init service</TD>
</TR>
<%
for i,item in ipairs(view.value) do %>
	<TR>
	<% if session.permissions[page_info.controller].edit then
		local result = viewlibrary.dispatch_component(page_info.controller.."/edit", {servicename=item.servicename}, true)
		for name,val in pairs(result.value) do val.name=name end
		if result.value.kill.value then result.value.kill.checked = "" end
		if result.value.system.value then result.value.system.checked = "" end %>
		<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/edit") %>" method="POST">
		<TD><input class="submit" type="submit" name="<%= html.html_escape(result.option) %>" value="<%= html.html_escape(result.submit or result.option) %>"></TD>
		<TD><%= html.html_escape(item.servicename) %><%= html.form.hidden(result.value.servicename) %></TD><TD><%= html.form.text(result.value.sequence) %></TD>
		<TD><%= html.form.checkbox(result.value.kill) %></TD><TD><%= html.form.checkbox(result.value.system) %></TD>
		</form></TR>
	<% else %>
	<TD><%= html.html_escape(item.servicename) %></TD><TD><%= html.html_escape(item.sequence) %></TD>
	<TD><%= html.html_escape(item.kill) %></TD><TD><%= html.html_escape(item.system) %></TD></TR>
	<% end %>
<% end %>
</TABLE>