diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-04-17 00:40:59 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-04-17 00:40:59 +0000 |
commit | 81adf8a6763769157690b1e82211cbe7b960da8e (patch) | |
tree | c69f20fc220ff096b10f85f26083459e381c1372 | |
parent | 02f08e3420245cb727783f5abe460d336f135459 (diff) | |
download | acf-tcpproxy-81adf8a6763769157690b1e82211cbe7b960da8e.tar.bz2 acf-tcpproxy-81adf8a6763769157690b1e82211cbe7b960da8e.tar.xz |
Changes to use new htmlviewfunctions functions
-rw-r--r-- | tcpproxy-listsmtpentries-html.lsp | 20 | ||||
-rw-r--r-- | tcpproxy-listsmtpfiles-html.lsp | 26 | ||||
-rw-r--r-- | 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) %> -<h1>Interface Entries</h1> +<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> <table id="listentries" class="tablesorter"><thead> <tr> <th>Action</th> @@ -32,15 +32,20 @@ html = require("acf.html") <th>Command Entry</th> </tr> </thead><tbody> +<% local ipaddr = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> <% for i,interface in ipairs(view.value) do %> <tr> <td> - <% 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 + %> </td> <td><%= html.html_escape(interface.interface) %></td> <td><%= html.html_escape(interface.ipaddr) %></td> @@ -48,3 +53,4 @@ html = require("acf.html") </tr> <% end %> </tbody></table> +<% 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) %> -<h1>Files</h1> +<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> <table id="listfiles" class="tablesorter"><thead> <tr> <th>Action</th> <th>File</th> </tr> </thead><tbody> +<% local filename = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> <% for i,file in ipairs(view.value) do %> <tr> <td> - <% 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 + %> </td> <td><%= html.html_escape(file) %></td> </tr> <% end %> </tbody></table> +<% htmlviewfunctions.displaysectionend(header_level) %> <% if viewlibrary and viewlibrary.dispatch_component and viewlibrary.check_permission("createsmtpfile") then - local createform = viewlibrary.dispatch_component("createsmtpfile", nil, true) %> -<h2><%= html.html_escape(createform.label) %></h2> -<% - 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) %> -<h1>SMTP Proxy Status</h1> -<% 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) %> - <div class='item'><p class='left'>Install package</p> - <div class='right'> - <form action="<%= html.html_escape(page_info.script .. "/apk-tools/apk/install") %>" method="post"> - <input type='hidden' name='package' value='<%= html.html_escape(view.value.version.name) %>'> - <input class='submit' type='submit' name='submit' value='Install'></form> - </div></div><!-- end .item --> -<% end %> <% if viewlibrary and viewlibrary.dispatch_component then viewlibrary.dispatch_component("listsmtpentries") |