From 7c43e1e53cb1f9bd0d47be6095ab34d462a27cbb Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 11 Apr 2014 02:17:19 +0000 Subject: Changes to use new htmlviewfunctions functions --- opennhrp-editinterface-html.lsp | 21 ++++++++------------- opennhrp-listinterfaces-html.lsp | 8 ++++++-- opennhrp-model.lua | 8 ++++---- opennhrp-show-html.lsp | 14 +++++++------- 4 files changed, 25 insertions(+), 26 deletions(-) diff --git a/opennhrp-editinterface-html.lsp b/opennhrp-editinterface-html.lsp index ef5ebe6..0872e4a 100644 --- a/opennhrp-editinterface-html.lsp +++ b/opennhrp-editinterface-html.lsp @@ -1,4 +1,4 @@ -<% local form, viewlibrary, page_info = ... +<% local form, viewlibrary, page_info, session = ... htmlviewfunctions = require("htmlviewfunctions") html = require("acf.html") %> @@ -11,23 +11,18 @@ html = require("acf.html") -

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

-<% - form.value.interface.readonly = true - local option = {"interface", "type", "map"} - htmlviewfunctions.displayform(form, option, nil, page_info) -%> +<% htmlviewfunctions.displayitem(form, page_info) %> diff --git a/opennhrp-listinterfaces-html.lsp b/opennhrp-listinterfaces-html.lsp index a684c2d..68ad0c6 100644 --- a/opennhrp-listinterfaces-html.lsp +++ b/opennhrp-listinterfaces-html.lsp @@ -23,7 +23,7 @@ html = require("acf.html") <% htmlviewfunctions.displaycommandresults({"editinterface"}, session) %> -

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

+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> @@ -32,10 +32,13 @@ html = require("acf.html") +<% local interface = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> <% for i,intf in ipairs(view.value) do %> @@ -43,3 +46,4 @@ html = require("acf.html") <% end %>
ActionComment
- <% io.write(html.link{value = "editinterface?interface="..intf.interface.."&redir="..page_info.orig_action, label="Edit " }) %> + <% interface.value = intf.interface %> + <% htmlviewfunctions.displayitem(cfe({type="link", value={interface=interface, redir=redir}, label="", option="Edit", action="editinterface"}), page_info, -1) %> <%= html.html_escape(intf.interface) %> <%= html.html_escape(intf.type) %>
+<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/opennhrp-model.lua b/opennhrp-model.lua index c9a8e4c..1fa81bd 100644 --- a/opennhrp-model.lua +++ b/opennhrp-model.lua @@ -220,10 +220,10 @@ end function mymodule.getinterfacedetails(interface) local details = {} - details.interface = cfe({ value=interface, label="Interface" }) - details.type = cfe({ type="select", value="Unused", label="Interface type", option={"Unused", "NHRP Enabled", "Shortcut Destination"} }) - details.map = cfe({ type="list", value={}, label="Static Peers", descr="List of static peer mappings of protocol-address to nbma-address. Optional 'register' parameter specifies Registration Request sent to this peer on startup. If the statically mapped peer is running Cisco IOS, specify the cisco keyword. (protocol-address[/prefix] nbma-address [register] [cisco])" }) - details["dynamic-map"] = cfe({ type="list", value={}, label="Dynamic Peers", descr="List of dynamic peer mappings of protocol-address to nbma-domain-name. For each A record in the domain nbma-domain-name, opennhrp creates a dynamic NHS entry. (protocol-address/prefix nbma-domain-name)" }) + details.interface = cfe({ readonly=true, value=interface, label="Interface", seq=1 }) + details.type = cfe({ type="select", value="Unused", label="Interface type", option={"Unused", "NHRP Enabled", "Shortcut Destination"}, seq=2 }) + details.map = cfe({ type="list", value={}, label="Static Peers", descr="List of static peer mappings of protocol-address to nbma-address. Optional 'register' parameter specifies Registration Request sent to this peer on startup. If the statically mapped peer is running Cisco IOS, specify the cisco keyword. (protocol-address[/prefix] nbma-address [register] [cisco])", seq=3 }) + details["dynamic-map"] = cfe({ type="list", value={}, label="Dynamic Peers", descr="List of dynamic peer mappings of protocol-address to nbma-domain-name. For each A record in the domain nbma-domain-name, opennhrp creates a dynamic NHS entry. (protocol-address/prefix nbma-domain-name)", seq=4 }) configfilecontent = configfilecontent or fs.read_file(configfile) or "" config = config or parseconfigfile(configfilecontent) diff --git a/opennhrp-show-html.lsp b/opennhrp-show-html.lsp index 0ea960a..96b4ef2 100644 --- a/opennhrp-show-html.lsp +++ b/opennhrp-show-html.lsp @@ -7,12 +7,11 @@ html = require("acf.html") viewlibrary.dispatch_component("status") end %> -

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

-<% -htmlviewfunctions.displayitem(data.value.status) -%> -

<%= html.html_escape(data.value.peers_list.label) %>

-
+<% local header_level = htmlviewfunctions.displaysectionstart(data, page_info) %> +<% htmlviewfunctions.displayitem(data.value.status) %> +<% htmlviewfunctions.displayitemstart() %> +<%= html.html_escape(data.value.peers_list.label) %> +<% htmlviewfunctions.displayitemmiddle() %> <% local found for intf,addresses in pairs(data.value.peers_list.value) do @@ -48,4 +47,5 @@ htmlviewfunctions.displayitem(data.value.status) end if not found then io.write("No peers found\n") end %> -
+<% htmlviewfunctions.displayitemend() %> +<% htmlviewfunctions.displaysectionend(header_level) %> -- cgit v1.2.3