diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-04-10 06:50:28 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-04-10 06:50:28 +0000 |
commit | 10c0b646cc0aa525e5b607f928d7b14f7868bfe6 (patch) | |
tree | 627e076cfa80721e25952b0fd32169c0446dba57 | |
parent | cc4fd41686f103acdc72c72a8e8295c3c169a28f (diff) | |
download | acf-ipsec-tools-10c0b646cc0aa525e5b607f928d7b14f7868bfe6.tar.bz2 acf-ipsec-tools-10c0b646cc0aa525e5b607f928d7b14f7868bfe6.tar.xz |
Changes to use new htmlviewfunctions functions
-rw-r--r-- | ipsectools-details-html.lsp | 17 | ||||
-rw-r--r-- | ipsectools-listcerts-html.lsp | 9 | ||||
-rw-r--r-- | ipsectools-model.lua | 6 | ||||
-rw-r--r-- | ipsectools-uploadcert-html.lsp | 9 | ||||
-rw-r--r-- | ipsectools-viewcert-html.lsp | 9 |
5 files changed, 23 insertions, 27 deletions
diff --git a/ipsectools-details-html.lsp b/ipsectools-details-html.lsp index 1e8bfe6..0c3d2ff 100644 --- a/ipsectools-details-html.lsp +++ b/ipsectools-details-html.lsp @@ -1,24 +1,19 @@ -<% local data, viewlibrary, page_info = ... ---htmlviewfunctions = require("htmlviewfunctions") +<% local data, viewlibrary, page_info, session = ... +htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> <% viewlibrary.dispatch_component("status") %> -<h2><%= html.html_escape(data.label) %></h2> <% +local header_level = htmlviewfunctions.displaysectionstart(data, page_info) +local header_level2 = htmlviewfunctions.incrementheader(header_level) if not data.value.show_isakmp or #data.value.show_isakmp.value == 0 then io.write("<p>No status details available</p>") else for i,entry in pairs(data.value.show_isakmp.value) do if (type(entry) == "table") and (entry.Destination) and (entry.Destination.value) and (#entry.Destination.value > 0) then - io.write("<h3><img src='"..html.html_escape(page_info.wwwprefix..page_info.staticdir).."/tango/16x16/status/network-") - if (tonumber(entry.St.value) < 9) then - io.write("error") - else - io.write("idle") - end - io.write(".png' width='16' height='16'> ".. html.html_escape(entry.Destination.value) .. "</h3>") + htmlviewfunctions.displaysectionstart(cfe({label=entry.Destination.value}), page_info, header_level2) io.write("<table>\n") local tags = {"Created","Source","Destination", "St", "Phase2details"} for j,tag in pairs(tags) do @@ -28,8 +23,10 @@ else io.write("</td></tr>") end io.write("</table>") + htmlviewfunctions.displaysectionend(header_level2) end end end --htmlviewfunctions.displayitem(data.value.ip_xfrm_policy) +htmlviewfunctions.displaysectionend(header_level) %> diff --git a/ipsectools-listcerts-html.lsp b/ipsectools-listcerts-html.lsp index 465d0e7..457dcf1 100644 --- a/ipsectools-listcerts-html.lsp +++ b/ipsectools-listcerts-html.lsp @@ -23,25 +23,28 @@ <% htmlviewfunctions.displaycommandresults({"deletecert"}, session) %> <% htmlviewfunctions.displaycommandresults({"uploadcert"}, session, true) %> -<h1><%= html.html_escape(view.label) %></h1> +<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> <table id="list" class="tablesorter"><thead> <tr> <th>Action</th> <th>Certificate</th> </tr> </thead><tbody> +<% local certcfe = cfe({ type="hidden", value="" }) %> <% for i,cert in ipairs(view.value) do %> <tr> <td> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/deletecert?submit=true&cert="..cert, label="Delete "} %> + <% certcfe.value = cert %> + <% htmlviewfunctions.displayitem(cfe({type="form", value={cert=certcfe}, label="", option="Delete", action="deletecert" }), page_info, -1) %> <% if not string.find(cert, "%-key") then %> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/viewcert?cert="..cert, label="View "} %> + <% htmlviewfunctions.displayitem(cfe({type="link", value={cert=certcfe}, label="", option="View", action="viewcert" }), page_info, -1) %> <% end %> </td> <td><%= html.html_escape(cert) %></td> </tr> <% end %> </tbody></table> +<% htmlviewfunctions.displaysectionend(header_level) %> <% if viewlibrary.dispatch_component and viewlibrary.check_permission("uploadcert") then viewlibrary.dispatch_component("uploadcert") diff --git a/ipsectools-model.lua b/ipsectools-model.lua index 701a504..5af6556 100644 --- a/ipsectools-model.lua +++ b/ipsectools-model.lua @@ -177,9 +177,9 @@ end function mymodule.new_upload_cert() local value = {} - value.cert = cfe({ type="raw", value=0, label="Certificate", descr='File must be a password protected ".pfx" file' }) - value.password = cfe({ label="Certificate Password" }) - value.name = cfe({ label="Certificate Local Name" }) + value.cert = cfe({ type="raw", value=0, label="Certificate", descr='File must be a password protected ".pfx" file', seq=1 }) + value.password = cfe({ type="password", label="Certificate Password", seq=2 }) + value.name = cfe({ label="Certificate Local Name", seq=3 }) return cfe({ type="group", value=value }) end diff --git a/ipsectools-uploadcert-html.lsp b/ipsectools-uploadcert-html.lsp index 41048e4..68dd7a5 100644 --- a/ipsectools-uploadcert-html.lsp +++ b/ipsectools-uploadcert-html.lsp @@ -1,13 +1,8 @@ -<% local form, viewlibrary, page_info = ... %> +<% local form, viewlibrary, page_info, session = ... %> <% htmlviewfunctions = require("htmlviewfunctions") %> -<% html = require("acf.html") %> -<h1><%= html.html_escape(form.label) %></h1> <% - form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action form.enctype = "multipart/form-data" form.value.cert.type="file" - form.value.password.type="password" - local order = {"cert", "password"} - htmlviewfunctions.displayform(form, order) + htmlviewfunctions.displayitem(form, page_info) %> diff --git a/ipsectools-viewcert-html.lsp b/ipsectools-viewcert-html.lsp index fb8b196..9d0139d 100644 --- a/ipsectools-viewcert-html.lsp +++ b/ipsectools-viewcert-html.lsp @@ -3,9 +3,10 @@ <% html = require("acf.html") %> <% if view.value.result then %> -<h1>Certificate Details</h1> -<% htmlviewfunctions.displayitem(view.value.cert, 1, page_info) %> -<pre><%= html.html_escape(view.value.result.value) %></pre> + <% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Certificate Details"}), page_info) %> + <% htmlviewfunctions.displayitem(view.value.cert, page_info, 1) %> + <pre><%= html.html_escape(view.value.result.value) %></pre> + <% htmlviewfunctions.displaysectionend(header_level) %> <% else - htmlviewfunctions.displayitem(view, 1, page_info) + htmlviewfunctions.displayitem(view, page_info, 1) end %> |