Commit 52ad6edf authored by Ted Trask's avatar Ted Trask

Modified viewfunctions to split displayform, creating displayformstart and...

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/dansguardian/trunk@1560 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent 9624824d
<%
require("viewfunctions")
local form, viewlibrary = ...
local form, viewlibrary, page_info = ...
%>
<%
......@@ -15,11 +15,10 @@ io.write("</span>")
viewlibrary.dispatch_component("status")
end %>
<form action="" method="POST">
<h1>Configuration</h1>
<%
if form.descr then io.write('<P CLASS="descr">' .. string.gsub(form.descr, "\n", "<BR>") .. "</P>\n") end
if form.errtxt then io.write('<P CLASS="error">' .. string.gsub(form.errtxt, "\n", "<BR>") .. "</P>\n") end
form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action
displayformstart(form)
for field,val in pairs(form.value) do
val.name = field
end
......@@ -63,11 +62,7 @@ The author recommends 50 for "young children", 100 for "older children" and 160
</dl>
<h2>Save Changes</h2>
<dl>
<DT></DT><DD><input class="submit" type="submit" name="<%= form.option %>" value="<%= (form.submit or form.option) %>"></DD>
</dl>
</form>
<% displayformend(form) %>
<% if viewlibrary and viewlibrary.dispatch_component then
viewlibrary.dispatch_component("startstop")
......
<% local view, viewlibrary, page_info = ...
<% local view, viewlibrary, page_info, session = ...
require("viewfunctions")
%>
......@@ -10,6 +10,8 @@ io.write("</span>")
--]]
%>
<% displaycommandresults({"edit"}, session) %>
<% if viewlibrary and viewlibrary.dispatch_component then
viewlibrary.dispatch_component("status")
end %>
......@@ -24,7 +26,7 @@ end %>
<%
for k,v in ipairs( view.value ) do
io.write( "<tr><td><a href=\"" .. page_info.script .. page_info.prefix .. page_info.controller .. "/edit?filename=" .. v.filename .. "\">" .. v.filename .. "</a></td><td>" .. v.size .."</td><td>" .. v.mtime .."</td></tr>\n" )
io.write( "<tr><td><a href=\"" .. page_info.script .. page_info.prefix .. page_info.controller .. "/edit?filename=" .. v.filename .. "&redir=" .. page_info.orig_action .. "\">" .. v.filename .. "</a></td><td>" .. v.size .."</td><td>" .. v.mtime .."</td></tr>\n" )
end
%>
</TABLE>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment