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 | 736d860f1c9171512132de7f5ff67c1ed2cf008d (patch) | |
tree | d5e25cb790c938fbec97aa2151106283d130f13d | |
parent | 41665704f43110b5126b96a9e11be2ab6f86c60f (diff) | |
download | acf-alpine-baselayout-736d860f1c9171512132de7f5ff67c1ed2cf008d.tar.bz2 acf-alpine-baselayout-736d860f1c9171512132de7f5ff67c1ed2cf008d.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/alpine-baselayout/trunk@1560 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | health-system-html.lsp | 3 | ||||
-rw-r--r-- | interfaces-controller.lua | 4 | ||||
-rw-r--r-- | interfaces-read-html.lsp | 4 | ||||
-rw-r--r-- | logfiles-view-html.lsp | 10 | ||||
-rw-r--r-- | 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 @@ <pre><%= view.value.uname.value %></pre> <h2>Uptime</h2> -<pre><%= view.value -.uptime.value %></pre> +<pre><%= view.value.uptime.value %></pre> <h2>Time/TimeZone</h2> <pre><%= view.value.date.value %></pre> 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("</span>") <% 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 %> <TR> <% if session.permissions.interfaces.update then %> - <A HREF='update?name=<%= interface.name.value %>'>Edit </A> + <A HREF='update?name=<%= interface.name.value %>&redir=read'>Edit </A> <% end if session.permissions.interfaces.delete then %> <A HREF='delete?name=<%= interface.name.value %>'>Delete </A> 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 </DL> <H3>File Content</H3> -<% if form.descr then %><P CLASS='descr'><%= string.gsub(form.descr, "\n", "<BR>") %></P><% end %> -<% if form.errtxt then %><P CLASS='error'><%= string.gsub(form.errtxt, "\n", "<BR>") %></P><% end %> -<form action="<%= page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %>" method="POST"> +<% if form.type == "form" then %> +<% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %> +<% displayformstart(form) %> <input type="hidden" name="filename" value="<%= form.value.filename.value %>"> +<% end %> <textarea name="filecontent"> <%= html.html_escape(form.value.filecontent.value) %> </textarea> <% if form.value.filecontent.errtxt then %><P CLASS='error'><%= string.gsub(form.value.filecontent.errtxt, "\n", "<BR>") %></P><% end %> +<% if form.value.filecontent.descr then %><P CLASS='descr'><%= string.gsub(form.value.filecontent.descr, "\n", "<BR>") %></P><% end %> <% if form.type == "form" then %> <H3>Save</H3> -<DL><DT>Submit and save above changes</DT><DD><input class="submit" type="submit" name="<%= form.option %>" value="<%= form.option %>"></DD></DL> +<% displayformend(form) %> <% end %> </form> 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("</span>") end %> <H1>Configuration</H1> -<% if form.descr then %><P CLASS='descr'><%= string.gsub(form.descr, "\n", "<BR>") %></P><% end %> -<% if form.errtxt then %><P CLASS='error'><%= string.gsub(form.errtxt, "\n", "<BR>") %></P><% end %> -<form action="" method="POST"> +<% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %> +<% displayformstart(form) %> <H2>Advanced Configuration</H2> <H3>General</H3> <DL> @@ -40,8 +39,7 @@ end %> %> </DL> <H2>Save and Apply Above Settings</H2> -<DL><DT>Save/Apply above settings</DT><DD><input class="submit" type="submit" name="<%= form.option %>" value="Save"></DD></DL> -</form> +<% displayformend(form) %> <% if viewlibrary and viewlibrary.dispatch_component then viewlibrary.dispatch_component("startstop") |