Commit 10c0b646 authored by Ted Trask's avatar Ted Trask

Changes to use new htmlviewfunctions functions

parent cc4fd416
<% 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)
%>
......@@ -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")
......
......@@ -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
......
<% 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)
%>
......@@ -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 %>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment