diff options
-rw-r--r-- | opennhrp-editinterface-html.lsp | 21 | ||||
-rw-r--r-- | opennhrp-listinterfaces-html.lsp | 8 | ||||
-rw-r--r-- | opennhrp-model.lua | 8 | ||||
-rw-r--r-- | 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") <script type="text/javascript"> function enabledisable(){ - if ($("[name='type']").val() == "NHRP Enabled") { - $("[name='map']").show(); - $("[name='dynamic-map']").show(); + if ($("#type").val() == "NHRP Enabled") { + $("#map").parents(".item").show(); + $("#dynamic-map").parents(".item").show(); } else { - $("[name='map']").hide(); - $("[name='dynamic-map']").hide(); + $("#map").parents(".item").hide(); + $("#dynamic-map").parents(".item").hide(); } } $(function(){ - $("[name='type']").change(enabledisable); + $("#type").change(enabledisable); enabledisable(); }); </script> -<h1><%= html.html_escape(form.label) %></h1> -<% - 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) %> -<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> @@ -32,10 +32,13 @@ html = require("acf.html") <th>Comment</th> </tr> </thead><tbody> +<% local interface = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> <% for i,intf in ipairs(view.value) do %> <tr> <td> - <% 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) %> </td> <td><%= html.html_escape(intf.interface) %></td> <td><%= html.html_escape(intf.type) %></td> @@ -43,3 +46,4 @@ html = require("acf.html") </tr> <% end %> </tbody></table> +<% 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 %> -<h2><%= html.html_escape(data.label) %></h2> -<% -htmlviewfunctions.displayitem(data.value.status) -%> -<div class='item'><p class='left'><%= html.html_escape(data.value.peers_list.label) %></p> -<div class='right'> +<% 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 %> -</div></div><!-- end .item --> +<% htmlviewfunctions.displayitemend() %> +<% htmlviewfunctions.displaysectionend(header_level) %> |