diff options
Diffstat (limited to 'rc-status-html.lsp')
-rw-r--r-- | rc-status-html.lsp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/rc-status-html.lsp b/rc-status-html.lsp new file mode 100644 index 0000000..1ea448a --- /dev/null +++ b/rc-status-html.lsp @@ -0,0 +1,40 @@ +<% 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(session.editresult.errtxt, "\n", "<BR>") .. "</P>\n") end + if session.editresult.descr then io.write('<P CLASS="descr">' .. string.gsub(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(val.errtxt, "\n", "<BR>") .. "</P>\n") end + end + session.editresult = nil +end %> + +<H1><%= view.label %></H1> +<TABLE> +<TR><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> +<% if session.permissions[page_info.controller].edit then %> +<TD class='header'>Update</TD> +<% end %> +</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="<%= page_info.script .. page_info.prefix .. page_info.controller .. "/edit" %>" method="POST"> + <TD><%= 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> + <TD><input class="submit" type="submit" name="<%= result.option %>" value="<%= result.submit or result.option %>"></TD> + </form></TR> + <% else %> + <TD><%= item.servicename %></TD><TD><%= item.sequence %></TD> + <TD><%= item.kill %></TD><TD><%= item.system %></TD></TR> + <% end %> +<% end %> +</TABLE> |