From dbbb88812817d58aa7dd53633f9d81a1a1fa6565 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 22 Jan 2014 16:32:46 +0000 Subject: Modify HTML to replace DL,DT,DD with divs. Also cleanup other HTML. --- lib/htmlviewfunctions.lua | 68 +++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 35 deletions(-) (limited to 'lib/htmlviewfunctions.lua') diff --git a/lib/htmlviewfunctions.lua b/lib/htmlviewfunctions.lua index 35d4ca4..5a348bc 100644 --- a/lib/htmlviewfunctions.lua +++ b/lib/htmlviewfunctions.lua @@ -26,13 +26,13 @@ function mymodule.displayitem(myitem, header_level, page_info) if not myitem then return end if myitem.type == "form" then header_level = header_level or 1 - io.write(""..html.html_escape(myitem.label).."") + io.write(""..html.html_escape(myitem.label).."") mymodule.displayform(myitem, nil, nil, page_info, header_level) elseif myitem.type == "group" then header_level = header_level or 1 - io.write(""..html.html_escape(myitem.label).."") - if myitem.descr then io.write('

' .. string.gsub(html.html_escape(myitem.descr), "\n", "
") .. "

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

' .. string.gsub(html.html_escape(myitem.errtxt), "\n", "
") .. "

\n") end + io.write(""..html.html_escape(myitem.label).."") + if myitem.descr then io.write("

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

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

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

") end local seqorder = {} local order = {} for name,item in pairs(myitem.value) do @@ -53,17 +53,17 @@ function mymodule.displayitem(myitem, header_level, page_info) end end elseif myitem.type ~= "hidden" then - io.write("" .. html.html_escape(myitem.label) .. "\n") - io.write("
") - io.write(string.gsub(html.html_escape(tostring(myitem.value)), "\n", "
") .. "\n") - if myitem.descr then io.write("

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

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

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

\n") end - io.write("
\n") + io.write("'>

" .. html.html_escape(myitem.label) .. "

") + io.write("
") + io.write(string.gsub(html.html_escape(tostring(myitem.value)), "\n", "
") .. "\n") + if myitem.descr then io.write("

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

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

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

") end + io.write("
") end end @@ -72,22 +72,22 @@ function mymodule.displayformitem(myitem, name, viewtype, header_level, group) if name then myitem.name = name end if group and group ~= "" then myitem.name = group.."."..myitem.name end if myitem.type ~= "hidden" and myitem.type ~= "group" then - io.write("" .. html.html_escape(myitem.label) .. "\n") - io.write("
\n") + io.write("'>

" .. html.html_escape(myitem.label) .. "

") + io.write("
") end if (viewtype == "viewonly") then myitem.disabled = "true" end if myitem.type == "group" then header_level = header_level or 2 - io.write(""..html.html_escape(myitem.label).."") - if myitem.descr then io.write('

' .. string.gsub(html.html_escape(myitem.descr), "\n", "
") .. "

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

' .. string.gsub(html.html_escape(myitem.errtxt), "\n", "
") .. "

\n") end + io.write(""..html.html_escape(myitem.label).."") + if myitem.descr then io.write("

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

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

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

") end mymodule.displayformcontents(myitem, nil, nil, tonumber(header_level)+1, myitem.name) elseif myitem.type == "multi" then -- FIXME multiple select doesn't work in haserl, so use series of checkboxes @@ -149,10 +149,10 @@ function mymodule.displayformitem(myitem, name, viewtype, header_level, group) io.write((html.form[myitem.type](myitem) or "") .. "\n") end if myitem.type ~= "hidden" and myitem.type ~= "group" then - if myitem.descr then io.write('

' .. string.gsub(html.html_escape(myitem.descr), "\n", "
") .. "

\n") end - if myitem.default then io.write('

Default:' .. string.gsub(html.html_escape(getlabel(myitem, myitem.default)), "\n", "
") .. "

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

' .. string.gsub(html.html_escape(myitem.errtxt), "\n", "
") .. "

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

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

") end + if myitem.default then io.write('

Default:' .. string.gsub(html.html_escape(getlabel(myitem, myitem.default)), "\n", "
") .. "

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

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

") end + io.write("") end end @@ -161,9 +161,8 @@ function mymodule.displayformstart(myform, page_info) if not myform.action and page_info then myform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action end - io.write('
\n') - if myform.descr then io.write('

' .. string.gsub(html.html_escape(myform.descr), "\n", "
") .. "

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

' .. string.gsub(html.html_escape(myform.errtxt), "\n", "
") .. "

\n") end + if myform.descr then io.write('

' .. string.gsub(html.html_escape(myform.descr), "\n", "
") .. "

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

' .. string.gsub(html.html_escape(myform.errtxt), "\n", "
") .. "

\n") end io.write('
') + io.write("

") if type(option) == "table" then for i,v in ipairs(option) do io.write('\n') @@ -234,9 +233,8 @@ function mymodule.displayformend(myform) else io.write('\n') end - io.write('
\n') - io.write('
') - io.write('
\n') + io.write("") + io.write('') end function mymodule.displayform(myform, order, finishingorder, page_info, header_level) @@ -257,13 +255,13 @@ function mymodule.displaycommandresults(commands, session, preserveerrors) end end if #cmdresult > 0 then - io.write("

Command Result

\n
\n") + io.write('

Command Result

') for i,result in ipairs(cmdresult) do - if type(result.value) == "string" and result.value ~= "" then io.write(string.gsub(html.html_escape(result.value), "\n", "
") .. "\n") end - if result.descr then io.write('

' .. string.gsub(html.html_escape(result.descr), "\n", "
") .. "

\n") end - if result.errtxt then io.write('

' .. string.gsub(html.html_escape(result.errtxt), "\n", "
") .. "

\n") end + if type(result.value) == "string" and result.value ~= "" then io.write('

' .. string.gsub(html.html_escape(result.value), "\n", "
") .. "

") end + if result.descr then io.write('

' .. string.gsub(html.html_escape(result.descr), "\n", "
") .. "

") end + if result.errtxt then io.write('

' .. string.gsub(html.html_escape(result.errtxt), "\n", "
") .. "

") end end - io.write("
\n") + io.write('') end end -- cgit v1.2.3