diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-10-22 18:50:22 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-10-22 18:50:22 +0000 |
commit | 4260dd6353273dab0d0bb444915320f161851e50 (patch) | |
tree | 1d62b42879c6713790a151feacfe5685fe20155b | |
parent | 53106120b719ff1980eec8c92fdd6c65ea406094 (diff) | |
download | acf-dhcp-4260dd6353273dab0d0bb444915320f161851e50.tar.bz2 acf-dhcp-4260dd6353273dab0d0bb444915320f161851e50.tar.xz |
Modified viewfunctions to split displayform, creating displayformstart and displayformend, to provide flexibility while still using the library. Also added support for hidden fields - including a common redir field. Removed redirectOnSuccess from controllerfunctions handle_form, and replaced it with the redir field. Removed redirectOnSuccess from controllers that used it and added handlecommandresults and redir entries to links and forms throughout many views. This will cause a redirect to the originating view when a form is successfully completed. acf_www-controller now includes orig_action in page_info to report the original action launched by the user.
git-svn-id: svn://svn.alpinelinux.org/acf/dhcp/trunk@1560 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | dhcp-home-html.lsp | 3 | ||||
-rw-r--r-- | dhcp-listhosts-html.lsp | 5 | ||||
-rw-r--r-- | dhcp-listsubnets-html.lsp | 7 | ||||
-rw-r--r-- | dhcp-model.lua | 2 | ||||
-rw-r--r-- | dhcp-settings-html.lsp | 3 |
5 files changed, 16 insertions, 4 deletions
diff --git a/dhcp-home-html.lsp b/dhcp-home-html.lsp index 4962d4f..ab7ff26 100644 --- a/dhcp-home-html.lsp +++ b/dhcp-home-html.lsp @@ -1,6 +1,8 @@ <% local view, viewlibrary, page_info, session = ... %> <% require("viewfunctions") %> +<% displaycommandresults({"settings", "edithost", "delhost", "createhost", "editsubnet", "delsubnet", "createsubnet"}, session) %> + <% if viewlibrary and viewlibrary.dispatch_component then viewlibrary.dispatch_component("status") end %> @@ -10,6 +12,7 @@ end %> <DL> <dt>Edit global settings</dt> <dd><form action="<%= page_info.script .. page_info.prefix .. page_info.controller .. "/settings" %>" method="POST"> +<input class="hidden" type="hidden" name="redir" value="<%= page_info.orig_action %>" > <input type=submit value="Edit" class="submit"> </form></dd> </DL> diff --git a/dhcp-listhosts-html.lsp b/dhcp-listhosts-html.lsp index 2ef1646..6b92ecb 100644 --- a/dhcp-listhosts-html.lsp +++ b/dhcp-listhosts-html.lsp @@ -1,6 +1,8 @@ <% local view, viewlibrary, page_info, session = ... %> <% require("viewfunctions") %> +<% displaycommandresults({"edithost", "delhost", "createhost"}, session) %> + <H1>Host Declarations</H1> <DL> @@ -12,7 +14,7 @@ <% for i,host in ipairs(view.value) do %> <TR> <TD style="padding-right:20px;white-space:nowrap;"> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/edithost?host="..host, label="Edit "} %> + <%= 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?host="..host, label="Delete "} %> </TD> <TD style="white-space:nowrap;"><%= host %></TD> @@ -22,6 +24,7 @@ <dt>Add new host</dt> <dd><form action="<%= page_info.script .. page_info.prefix .. page_info.controller .. "/createhost" %>" method="POST"> +<input class="hidden" type="hidden" name="redir" value="<%= page_info.orig_action %>" > <input type=submit value="New" class="submit"> </form></dd> </DL> diff --git a/dhcp-listsubnets-html.lsp b/dhcp-listsubnets-html.lsp index 4eb4285..242afe1 100644 --- a/dhcp-listsubnets-html.lsp +++ b/dhcp-listsubnets-html.lsp @@ -1,6 +1,8 @@ <% local view, viewlibrary, page_info, session = ... %> <% require("viewfunctions") %> +<% displaycommandresults({"editsubnet", "delsubnet", "createsubnet"}, session) %> + <H1>Subnet Declarations</H1> <DL> @@ -12,8 +14,8 @@ <% for i,subnet in ipairs(view.value) do %> <TR> <TD style="padding-right:20px;white-space:nowrap;"> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/editsubnet?subnet="..subnet, label="Edit "} %> - <%= html.link{value=page_info.script..page_info.prefix..page_info.controller.."/delsubnet?subnet="..subnet, label="Delete "} %> + <%= 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?subnet="..subnet.."&redir="..page_info.orig_action, label="Delete "} %> </TD> <TD style="white-space:nowrap;"><%= subnet %></TD> </TR> @@ -22,6 +24,7 @@ <dt>Add new subnet</dt> <dd><form action="<%= page_info.script .. page_info.prefix .. page_info.controller .. "/createsubnet" %>" method="POST"> +<input class="hidden" type="hidden" name="redir" value="<%= page_info.orig_action %>" > <input type=submit value="New" class="submit"> </form></dd> </DL> diff --git a/dhcp-model.lua b/dhcp-model.lua index 4d3ff5e..f542554 100644 --- a/dhcp-model.lua +++ b/dhcp-model.lua @@ -492,6 +492,7 @@ host_delete = function(name) file = string.sub(file, 1, start-1) .. string.sub(file, endd+1, -1) fs.write_file(configfile, string.gsub(file, "\n*$", "")) config = nil + cmdresult.value = "Host Deleted" end end @@ -650,6 +651,7 @@ subnet_delete = function(name) file = string.sub(file, 1, start-1) .. string.sub(file, endd+1, -1) fs.write_file(configfile, string.gsub(file, "\n*$", "")) config = nil + cmdresult.value = "Subnet Deleted" end end diff --git a/dhcp-settings-html.lsp b/dhcp-settings-html.lsp index 796f565..098bb78 100644 --- a/dhcp-settings-html.lsp +++ b/dhcp-settings-html.lsp @@ -1,8 +1,9 @@ -<% local form = ... %> +<% local form, viewlibrary, page_info = ... %> <% require("viewfunctions") %> <h1><%= form.label %></h1> <% + form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action local order = {"domainname", "domainnameservers", "defleasetime", "maxleasetime"} displayform(form, order) %> |