summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fetchcrl-model.lua36
-rw-r--r--fetchcrl-startstop-html.lsp19
2 files changed, 29 insertions, 26 deletions
diff --git a/fetchcrl-model.lua b/fetchcrl-model.lua
index 29617e4..a47543c 100644
--- a/fetchcrl-model.lua
+++ b/fetchcrl-model.lua
@@ -34,25 +34,29 @@ get_status = function()
end
function startstop_service(action)
- local cmdresult = cfe({ label="Start/Stop result" })
+ 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
- cmdresult.value = file:read( "*a" )
- file:close()
+ 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!"
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
- cmdresult.value = "Deleted CRL Files"
- else
- cmdresult.errtxt = "Unknown command!"
end
- return cmdresult
+ return cfe({ type="group", value=result, label="Start/Stop result" })
end
get_configfile = function()
diff --git a/fetchcrl-startstop-html.lsp b/fetchcrl-startstop-html.lsp
index b28dc97..3a5f6f7 100644
--- a/fetchcrl-startstop-html.lsp
+++ b/fetchcrl-startstop-html.lsp
@@ -1,21 +1,20 @@
<% local data, viewlibrary, page_info = ... %>
<H1>Management</H1>
-<DL>
-<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>
-<DT>Delete Local CRLs</DT>
-<DD><input class="submit" type="submit" name="action" value="Delete"></DD>
-</form>
<% if data.value.result then %>
-<DT>Previous action result</DT>
-<DD>
+<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 %>
-</DD>
+
+<DL>
+<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>
+<DT>Delete Local CRLs</DT>
+<DD><input class="submit" type="submit" name="action" value="Delete"></DD>
+</form>
</DL>