summaryrefslogtreecommitdiffstats
path: root/lib/viewfunctions.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-07-10 20:29:29 +0000
committerTed Trask <ttrask01@yahoo.com>2008-07-10 20:29:29 +0000
commit43a9488d38abb2ea6001afd8c6c36433bf44bc71 (patch)
tree7481edf0b7e037ecdb3bb096d5111e3605dc719b /lib/viewfunctions.lua
parent0c011f565a24bffe9065f67fabf5db57b2be80d9 (diff)
downloadacf-core-43a9488d38abb2ea6001afd8c6c36433bf44bc71.tar.bz2
acf-core-43a9488d38abb2ea6001afd8c6c36433bf44bc71.tar.xz
Added finishingorder to displayform in viewfunctions to specify fields that go at the end. Fixed bug in getopts that ignored the last line if no trailing carriage return.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1294 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/viewfunctions.lua')
-rw-r--r--lib/viewfunctions.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/viewfunctions.lua b/lib/viewfunctions.lua
index dd2fcda..62a87c6 100644
--- a/lib/viewfunctions.lua
+++ b/lib/viewfunctions.lua
@@ -145,7 +145,7 @@ function displayformitem(myitem, name, viewtype)
io.write("</DD>\n")
end
-function displayform(myform, order)
+function displayform(myform, order, finishingorder)
if not myform then return end
if myform.descr then io.write('<P CLASS="descr">' .. string.gsub(myform.descr, "\n", "<BR>") .. "</P>\n") end
if myform.errtxt then io.write('<P CLASS="error">' .. string.gsub(myform.errtxt, "\n", "<BR>") .. "</P>\n") end
@@ -161,12 +161,26 @@ function displayform(myform, order)
end
end
end
+ local reversefinishingorder = {}
+ if finishingorder then
+ for x,name in ipairs(finishingorder) do
+ reversefinishingorder[name] = x
+ end
+ end
for name,item in pairs(myform.value) do
- if nil == reverseorder[name] then
+ if nil == reverseorder[name] and nil == reversefinishingorder[name] then
item.name = name
displayformitem(item)
end
end
+ if finishingorder then
+ for x,name in ipairs(finishingorder) do
+ if myform.value[name] then
+ myform.value[name].name = name
+ displayformitem(myform.value[name])
+ end
+ end
+ end
io.write('<DT></DT><DD><input class="submit" type="submit" name="' .. myform.option .. '" value="' .. (myform.submit or myform.option) .. '"></DD>\n')
io.write('</DL>\n')
io.write('</FORM>')