From 9ae856d2dc847fbaa89ebb822b8c9c0abed88c17 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 13 May 2008 20:02:56 +0000 Subject: Rewrote syslog to use components and remove view-specific code from controller. Also made sure not to write to conf file unless all variables pass validation. git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1116 ab2d0c66-481e-0410-8bed-d214d4d58bed --- lib/viewfunctions.lua | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'lib/viewfunctions.lua') diff --git a/lib/viewfunctions.lua b/lib/viewfunctions.lua index 5080a34..bb6e6ec 100644 --- a/lib/viewfunctions.lua +++ b/lib/viewfunctions.lua @@ -75,7 +75,24 @@ function displaymanagement (myform,tags) end end -function displayitem(myitem, viewtype) +function displayitem(myitem) + if not myitem then return end + io.write("" .. myitem.label .. "\n") + io.write("
") + io.write(myitem.value .. "\n") + if myitem.descr then io.write("

" .. string.gsub(myitem.descr, "\n", "
") .. "

\n") end + if myitem.errtxt then io.write("

" .. string.gsub(myitem.errtxt, "\n", "
") .. "

\n") end + io.write("
\n") +end + +function displayformitem(myitem, name, viewtype) + if not myitem then return end + if name then myitem.name = name end io.write("" .. string.gsub(myitem.descr, "\n", "
") .. "

\n") end if myitem.errtxt then io.write("

" .. string.gsub(myitem.errtxt, "\n", "
") .. "

\n") end @@ -113,6 +134,7 @@ function displayitem(myitem, viewtype) end function displayform(myform, order) + if not myform then return end if myform.descr then io.write("

" .. string.gsub(myform.descr, "\n", "
") .. "

\n") end if myform.errtxt then io.write("

" .. string.gsub(myform.errtxt, "\n", "
") .. "

\n") end io.write('
\n') @@ -123,17 +145,17 @@ function displayform(myform, order) reverseorder[name] = x if myform.value[name] then myform.value[name].name = name - displayitem(myform.value[name]) + displayformitem(myform.value[name]) end end end for name,item in pairs(myform.value) do if nil == reverseorder[name] then item.name = name - displayitem(item) + displayformitem(item) end end - io.write('
\n') + io.write('
\n') io.write('\n') io.write('
') end -- cgit v1.2.3