summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fetchcrl-model.lua43
-rw-r--r--fetchcrl-startstop-html.lsp19
2 files changed, 28 insertions, 34 deletions
diff --git a/fetchcrl-model.lua b/fetchcrl-model.lua
index 5cd3d62..7b68fd2 100644
--- a/fetchcrl-model.lua
+++ b/fetchcrl-model.lua
@@ -33,30 +33,29 @@ get_status = function()
return cfe({ type="group", value=status, label="Fetch-CRL Status" })
end
-function startstop_service(action)
- local result = {}
- result.actions = cfe({ type="list", value={"Download", "Delete"}, label="Start/Stop actions" })
- if action then
- result.result = cfe({ label="Start/Stop result" })
-
- if (string.lower(action) == "download") then
- local file = io.popen(path .. "fetch-crl 2>&1")
- if file ~= nil then
- result.result.value = file:read( "*a" )
- file:close()
- end
- elseif (string.lower(action) == "delete") then
- local config = format.parse_ini_file(fs.read_file(configfile) or "", "")
- local dir = config.CRLDIR or outputdirectory
- for file in fs.find(".*\.r0", dir) do
- os.remove(file)
- end
- result.result.value = "Deleted CRL Files"
- else
- result.result.errtxt = "Unknown command!"
+function get_startstop(clientdata)
+ local actions = {"Download", "Delete"}
+ return cfe({ type="group", label="Management", value={}, option=actions })
+end
+
+function startstop_service(startstop, action)
+ if (string.lower(action) == "download") then
+ local file = io.popen(path .. "fetch-crl 2>&1")
+ if file ~= nil then
+ startstop.descr = file:read( "*a" )
+ file:close()
+ end
+ elseif (string.lower(action) == "delete") then
+ local config = format.parse_ini_file(fs.read_file(configfile) or "", "")
+ local dir = config.CRLDIR or outputdirectory
+ for file in fs.find(".*\.r0", dir) do
+ os.remove(file)
end
+ startstop.descr = "Deleted CRL Files"
+ else
+ startstop.errtxt = "Unknown command!"
end
- return cfe({ type="group", value=result, label="Start/Stop result" })
+ return startstop
end
get_configfile = function()
diff --git a/fetchcrl-startstop-html.lsp b/fetchcrl-startstop-html.lsp
index 3a5f6f7..438b129 100644
--- a/fetchcrl-startstop-html.lsp
+++ b/fetchcrl-startstop-html.lsp
@@ -1,20 +1,15 @@
-<% local data, viewlibrary, page_info = ... %>
+<% local form, viewlibrary, page_info = ... %>
<H1>Management</H1>
-
-<% if data.value.result then %>
-<H2>Previous action result</H2>
-<% if data.value.result.value ~= "" then %>
-<P CLASS='descr'><%= string.gsub(html.html_escape(data.value.result.value), "\n", "<BR>") %></P>
-<% end if data.value.result.errtxt then %>
-<P CLASS='error'><%= string.gsub(html.html_escape(data.value.result.errtxt), "\n", "<BR>") %></P>
-<% end end %>
-
<DL>
+<%
+if form.descr then io.write('<P CLASS="descr">' .. string.gsub(html.html_escape(myform.descr), "\n", "<BR>") .. "</P>\n") end
+if form.errtxt then io.write('<P CLASS="error">' .. string.gsub(html.html_escape(myform.errtxt), "\n", "<BR>") .. "</P>\n") end
+%>
<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action) %>" method="POST">
<DT>Download CRL</DT>
-<DD><input class="submit" type="submit" name="action" value="Download"></DD>
+<DD><input class="submit" type="submit" name="submit" value="Download"></DD>
<DT>Delete Local CRLs</DT>
-<DD><input class="submit" type="submit" name="action" value="Delete"></DD>
+<DD><input class="submit" type="submit" name="submit" value="Delete"></DD>
</form>
</DL>