-- ********************************************************************** -- * Html table renderer -- * -- * version 0.1 -- * -- * (c) 2005 Hi-Project Ltd. -- ********************************************************************** -- sampletable = { -- {caption="Name", width="200", align="left", data="username", attrstart="", attrend="" }, -- {caption="Date", width="100", align="center", data="paymentdate", format=todatefunc }, -- {caption="Amount", width="100", align="right", data="amount", format=tocurrfuc, add=" {$curr$}"} }, -- {caption="Ready", width="30", align="center", data="flag", format=toyesnostr}, -- {caption="Selected", width="30", align="center", data=nil, add=[[]]} -- } require "common.languages" require "webserver.htmlparser" module "htable" local TABLE_ROW_DEFAULT = [[
]]..
[[ ]]..TRANSLANG(tt.caption)..[[ | ]].."\n"
end)
return tbl_hdr
end
function rendertablerow(tbl_desc, row_data, tbl_tr)
-- making table row
--
local tbl_row = [[|
]]..attrstart..addthis..attrend.." | " else local data = tt.data data = row_data[tt.data] or "" if tt.format then data = tt.format(data) end if tt.add then addthis = htemplate.parsebuffer(addthis,row_data) end tbl_row = tbl_row..[[]]..attrstart..data..attrend..addthis.." | " end end) tbl_row = tbl_row.."