From 81adf8a6763769157690b1e82211cbe7b960da8e Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 17 Apr 2014 00:40:59 +0000 Subject: Changes to use new htmlviewfunctions functions --- tcpproxy-listsmtpentries-html.lsp | 20 +++++++++++++------- tcpproxy-listsmtpfiles-html.lsp | 26 ++++++++++++++------------ tcpproxy-smtpstatus-html.lsp | 17 ++++++++--------- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/tcpproxy-listsmtpentries-html.lsp b/tcpproxy-listsmtpentries-html.lsp index 228aa76..372dc0b 100644 --- a/tcpproxy-listsmtpentries-html.lsp +++ b/tcpproxy-listsmtpentries-html.lsp @@ -23,7 +23,7 @@ html = require("acf.html") <% htmlviewfunctions.displaycommandresults({"editsmtpentry", "delsmtpentry"}, session) %> -

Interface Entries

+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> @@ -32,15 +32,20 @@ html = require("acf.html") +<% local ipaddr = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> <% for i,interface in ipairs(view.value) do %> @@ -48,3 +53,4 @@ html = require("acf.html") <% end %>
ActionCommand Entry
- <% if viewlibrary.check_permission("editsmtpentry") then %> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editsmtpentry?ipaddr="..(interface.ipaddr or interface.interface).."&redir="..page_info.orig_action, label="Edit "} %> - <% end %> - <% if viewlibrary.check_permission("delsmtpentry") then %> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/delsmtpentry?submit=true&ipaddr="..(interface.ipaddr or interface.interface), label="Delete "} %> - <% end %> + <% + ipaddr.value = interface.ipaddr or interface.interface + if viewlibrary.check_permission("editsmtpentry") then + htmlviewfunctions.displayitem(cfe({type="link", value={ipaddr=ipaddr, redir=redir}, label="", option="Edit", action="editsmtpentry"}), page_info, -1) + end + if viewlibrary.check_permission("delsmtpentry") then + htmlviewfunctions.displayitem(cfe({type="form", value={ipaddr=ipaddr}, label="", option="Delete", action="delsmtpentry"}), page_info, -1) + end + %> <%= html.html_escape(interface.interface) %> <%= html.html_escape(interface.ipaddr) %>
+<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/tcpproxy-listsmtpfiles-html.lsp b/tcpproxy-listsmtpfiles-html.lsp index b5e479a..a303f47 100644 --- a/tcpproxy-listsmtpfiles-html.lsp +++ b/tcpproxy-listsmtpfiles-html.lsp @@ -24,32 +24,34 @@ html = require("acf.html") <% htmlviewfunctions.displaycommandresults({"editsmtpfile", "delsmtpfile"}, session) %> <% htmlviewfunctions.displaycommandresults({"createsmtpfile"}, session, true) %> -

Files

+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> +<% local filename = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> <% for i,file in ipairs(view.value) do %> <% end %>
Action File
- <% if viewlibrary.check_permission("editsmtpfile") then %> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editsmtpfile?filename="..file.."&redir="..page_info.orig_action, label="Edit "} %> - <% end %> - <% if viewlibrary.check_permission("delsmtpfile") then %> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/delsmtpfile?submit=true&filename="..file, label="Delete "} %> - <% end %> + <% + filename.value = file + if viewlibrary.check_permission("editsmtpfile") then + htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="editsmtpfile"}), page_info, -1) + end + if viewlibrary.check_permission("delsmtpfile") then + htmlviewfunctions.displayitem(cfe({type="form", value={filename=filename}, label="", option="Delete", action="delsmtpfile"}), page_info, -1) + end + %> <%= html.html_escape(file) %>
+<% htmlviewfunctions.displaysectionend(header_level) %> <% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createsmtpfile") then - local createform = viewlibrary.dispatch_component("createsmtpfile", nil, true) %> -

<%= html.html_escape(createform.label) %>

-<% - createform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/createsmtpfile" - htmlviewfunctions.displayform(createform) + viewlibrary.dispatch_component("createsmtpfile") end %> diff --git a/tcpproxy-smtpstatus-html.lsp b/tcpproxy-smtpstatus-html.lsp index 7edf5e0..e50a954 100644 --- a/tcpproxy-smtpstatus-html.lsp +++ b/tcpproxy-smtpstatus-html.lsp @@ -6,17 +6,16 @@ html = require("acf.html") <% htmlviewfunctions.displaycommandresults({"editsmtpentry", "delsmtpentry", "editsmtpfile", "delsmtpfile"}, session) %> <% htmlviewfunctions.displaycommandresults({"createsmtpfile"}, session, true) %> -

SMTP Proxy Status

-<% htmlviewfunctions.displayitem(view.value.version) +<% +local header_level = htmlviewfunctions.displaysectionstart(view, page_info) +htmlviewfunctions.displayitem(view.value.version) if view.value.version and view.value.version.errtxt and viewlibrary.check_permission("apk-tools/apk/install") then + local install = cfe({ type="form", value={}, label="Install package", option="Install", action=page_info.script.."/apk-tools/apk/install" }) + install.value.package = cfe({ type="hidden", value=view.value.version.name }) + htmlviewfunctions.displayitem(install, page_info, 0) -- header_level 0 means display inline without header +end +htmlviewfunctions.displaysectionend(header_level) %> -

Install package

-
-
" method="post"> - -
-
-<% end %> <% if viewlibrary and viewlibrary.dispatch_component then viewlibrary.dispatch_component("listsmtpentries") -- cgit v1.2.3