From 3d6451d0b5fed1f8fbe5c431d1cfb7f002514373 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 10 Apr 2014 06:02:36 +0000 Subject: Changes to use new htmlviewfunctions functions --- dhcp-home-html.lsp | 13 +++++-------- dhcp-listfiles-html.lsp | 17 +++++++++++------ dhcp-listhosts-html.lsp | 21 +++++++++++---------- dhcp-listsubnets-html.lsp | 23 ++++++++++++----------- dhcp-model.lua | 4 ++-- 5 files changed, 41 insertions(+), 37 deletions(-) diff --git a/dhcp-home-html.lsp b/dhcp-home-html.lsp index 39be215..769c40e 100644 --- a/dhcp-home-html.lsp +++ b/dhcp-home-html.lsp @@ -8,14 +8,11 @@ viewlibrary.dispatch_component("status") end %> -

Global Settings

-

Edit global settings

-
-
" method="post"> - - -
-
+<% +local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Global Settings"}), page_info) +htmlviewfunctions.displayitem(cfe({type="link", value={redir=cfe({ type="hidden", value=page_info.orig_action })}, label="Edit global settings", option="Edit", action="settings"}), page_info, 0) +htmlviewfunctions.displaysectionend(header_level) +%> <% if viewlibrary and viewlibrary.dispatch_component then viewlibrary.dispatch_component("listsubnets") diff --git a/dhcp-listfiles-html.lsp b/dhcp-listfiles-html.lsp index 3e1bb65..f39e60e 100644 --- a/dhcp-listfiles-html.lsp +++ b/dhcp-listfiles-html.lsp @@ -31,7 +31,7 @@ end @@ -41,21 +41,26 @@ end viewlibrary.dispatch_component("status") end %> -

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

+<% local header_level = htmlviewfunctions.displaysectionstart(data, page_info) %> + -<% for i,file in ipairs(data.value) do %> +<% local filename = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> +<% for i,file in ipairs( data.value ) do %> + <% filename.value = file.filename %> - + + <% end %>
Action File Size Last Modified
- <%= html.link{value = "expert?filename=" .. file.filename.."&redir="..page_info.orig_action, label=file.filename} %> - <% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="expert"}), page_info, -1) %><%= html.html_escape(file.filename) %> <%= convertsize(file.filesize) %>b<%= html.html_escape(file.filesize) %> <%= html.html_escape(file.mtime) %>
+<% htmlviewfunctions.displaysectionend(header_level) %> + diff --git a/dhcp-listhosts-html.lsp b/dhcp-listhosts-html.lsp index 871f92e..2959db6 100644 --- a/dhcp-listhosts-html.lsp +++ b/dhcp-listhosts-html.lsp @@ -22,28 +22,29 @@ <% htmlviewfunctions.displaycommandresults({"edithost", "delhost", "createhost"}, session) %> -

Host Declarations

+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> +<% local hst = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> <% for i,host in ipairs(view.value) do %> <% end %>
Action Host
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/edithost?host="..host.."&redir="..page_info.orig_action, label="Edit "} %> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/delhost?submit=true&host="..host, label="Delete "} %> + <% + hst.value = host + htmlviewfunctions.displayitem(cfe({type="link", value={host=hst, redir=redir}, label="", option="Edit", action="edithost"}), page_info, -1) + htmlviewfunctions.displayitem(cfe({type="form", value={host=hst}, label="", option="Delete", action="delhost" }), page_info, -1) + %> <%= html.html_escape(host) %>
-

Add new host

-
-
" method="post"> - - -
-
+<% htmlviewfunctions.displayitem(cfe({type="link", value={redir=redir}, label="Add new host", option="New", action="createhost"}), page_info, 0) %> + +<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/dhcp-listsubnets-html.lsp b/dhcp-listsubnets-html.lsp index 00bd1ef..158ee60 100644 --- a/dhcp-listsubnets-html.lsp +++ b/dhcp-listsubnets-html.lsp @@ -22,28 +22,29 @@ <% htmlviewfunctions.displaycommandresults({"editsubnet", "delsubnet", "createsubnet"}, session) %> -

Subnet Declarations

+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> +<% local subn = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> <% for i,subnet in ipairs(view.value) do %> <% end %>
Action Subnet
- <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editsubnet?subnet="..subnet.."&redir="..page_info.orig_action, label="Edit "} %> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/delsubnet?submit=true&subnet="..subnet, label="Delete "} %> + <% + subn.value = subnet + htmlviewfunctions.displayitem(cfe({type="link", value={subnet=subn, redir=redir}, label="", option="Edit", action="editsubnet"}), page_info, -1) + htmlviewfunctions.displayitem(cfe({type="form", value={subnet=subn}, label="", option="Delete", action="delsubnet" }), page_info, -1) + %> <%= html.html_escape(subnet) %>
- -

Add new subnet

-
-
" method="post"> - - -
-
+ +<% htmlviewfunctions.displayitem(cfe({type="link", value={redir=redir}, label="Add new subnet", option="New", action="createsubnet"}), page_info, 0) %> + +<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/dhcp-model.lua b/dhcp-model.lua index 6c34931..5f84e8e 100644 --- a/dhcp-model.lua +++ b/dhcp-model.lua @@ -521,7 +521,7 @@ mymodule.get_hosts = function () end end - return cfe({ type="list", value=retval, label="Host list" }) + return cfe({ type="list", value=retval, label="Host Declarations" }) end mymodule.create_new_subnet = function() @@ -689,7 +689,7 @@ mymodule.get_subnets = function () end end - return cfe({ type="list", value=retval, label="Subnet list" }) + return cfe({ type="list", value=retval, label="Subnet Declarations" }) end mymodule.read_settings = function() -- cgit v1.2.3