summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2009-03-17 20:39:56 +0000
committerTed Trask <ttrask01@yahoo.com>2009-03-17 20:39:56 +0000
commit74632a4008ec27db2244f3ddeadabba58cc25f4c (patch)
tree222b96ca71b89574357405fbf2b59baf262e688e
parent7c83dbe3df24b03a7e66640de2e9fc6ab0c762fd (diff)
downloadacf-fetch-crl-74632a4008ec27db2244f3ddeadabba58cc25f4c.tar.bz2
acf-fetch-crl-74632a4008ec27db2244f3ddeadabba58cc25f4c.tar.xz
Changed the way startstop works in core to add a list of allowed actions. Modified all ACFs that don't use the standard functions to work with new library method.
git-svn-id: svn://svn.alpinelinux.org/acf/fetch-crl/trunk@1730 ab2d0c66-481e-0410-8bed-d214d4d58bed
-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>