From 736d860f1c9171512132de7f5ff67c1ed2cf008d Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 22 Oct 2008 18:50:22 +0000 Subject: 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/alpine-baselayout/trunk@1560 ab2d0c66-481e-0410-8bed-d214d4d58bed --- health-system-html.lsp | 3 +-- interfaces-controller.lua | 4 ++-- interfaces-read-html.lsp | 4 ++-- logfiles-view-html.lsp | 10 ++++++---- syslog-config-html.lsp | 10 ++++------ 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/health-system-html.lsp b/health-system-html.lsp index 69f3dad..8ee3572 100644 --- a/health-system-html.lsp +++ b/health-system-html.lsp @@ -7,8 +7,7 @@
<%= view.value.uname.value %>

Uptime

-
<%= view.value
-.uptime.value %>
+
<%= view.value.uptime.value %>

Time/TimeZone

<%= view.value.date.value %>
diff --git a/interfaces-controller.lua b/interfaces-controller.lua index 03c072f..02b2a3c 100644 --- a/interfaces-controller.lua +++ b/interfaces-controller.lua @@ -14,7 +14,7 @@ read = function (self) end update = function(self) - return controllerfunctions.handle_form(self, function() return self.model.get_iface_by_name(self.clientdata.name or "") end, self.model.update_iface, self.clientdata, "Save", "Update Interface", "Interface updated", "read") + return controllerfunctions.handle_form(self, function() return self.model.get_iface_by_name(self.clientdata.name or "") end, self.model.update_iface, self.clientdata, "Save", "Update Interface", "Interface updated") end delete = function(self) @@ -30,7 +30,7 @@ ifdown = function(self) end create = function(self) - return controllerfunctions.handle_form(self, function() return self.model.get_iface(self.clientdata.family, self.clientdata.method) end, self.model.create_iface, self.clientdata, "Create", "Create Interface", "Interface created", "read") + return controllerfunctions.handle_form(self, function() return self.model.get_iface(self.clientdata.family, self.clientdata.method) end, self.model.create_iface, self.clientdata, "Create", "Create Interface", "Interface created") end editintfile = function(self) diff --git a/interfaces-read-html.lsp b/interfaces-read-html.lsp index f3279a2..4558809 100644 --- a/interfaces-read-html.lsp +++ b/interfaces-read-html.lsp @@ -19,7 +19,7 @@ io.write("") <% end %> <% end %> -<% displaycommandresults({"delete", "ifup", "ifdown", "restart"}, session) %> +<% displaycommandresults({"update", "delete", "ifup", "ifdown", "restart"}, session) %> <% if viewlibrary and viewlibrary.dispatch_component then viewlibrary.dispatch_component("status") @@ -42,7 +42,7 @@ end %> end %> <% if session.permissions.interfaces.update then %> - Edit + Edit <% end if session.permissions.interfaces.delete then %> Delete diff --git a/logfiles-view-html.lsp b/logfiles-view-html.lsp index a83153c..338a384 100644 --- a/logfiles-view-html.lsp +++ b/logfiles-view-html.lsp @@ -20,17 +20,19 @@ end

File Content

-<% if form.descr then %>

<%= string.gsub(form.descr, "\n", "
") %>

<% end %> -<% if form.errtxt then %>

<%= string.gsub(form.errtxt, "\n", "
") %>

<% end %> -
" method="POST"> +<% if form.type == "form" then %> +<% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %> +<% displayformstart(form) %> +<% end %> <% if form.value.filecontent.errtxt then %>

<%= string.gsub(form.value.filecontent.errtxt, "\n", "
") %>

<% end %> +<% if form.value.filecontent.descr then %>

<%= string.gsub(form.value.filecontent.descr, "\n", "
") %>

<% end %> <% if form.type == "form" then %>

Save

-
Submit and save above changes
+<% displayformend(form) %> <% end %>
diff --git a/syslog-config-html.lsp b/syslog-config-html.lsp index e6001b3..efc989f 100644 --- a/syslog-config-html.lsp +++ b/syslog-config-html.lsp @@ -1,4 +1,4 @@ -<% local form, viewlibrary = ... %> +<% local form, viewlibrary, page_info = ... %> <% require("viewfunctions") %> <% --[[ DEBUG INFORMATION @@ -13,9 +13,8 @@ io.write("") end %>

Configuration

-<% if form.descr then %>

<%= string.gsub(form.descr, "\n", "
") %>

<% end %> -<% if form.errtxt then %>

<%= string.gsub(form.errtxt, "\n", "
") %>

<% end %> -
+<% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %> +<% displayformstart(form) %>

Advanced Configuration

General

@@ -40,8 +39,7 @@ end %> %>

Save and Apply Above Settings

-
Save/Apply above settings
-
+<% displayformend(form) %> <% if viewlibrary and viewlibrary.dispatch_component then viewlibrary.dispatch_component("startstop") -- cgit v1.2.3