webmcp

view framework/env/ui_deprecated/select.lua @ 23:3a6fe8663b26

Code cleanup and documentation added; Year in copyright notice changed to 2009-2010

Details:
- Changed quoting style in auth.openid.xrds_document{...}
- Fixed documentation for auth.openid.initiate{...}
- Added documentation for mondelefant
- Code-cleanup in mondelefant:
-- removed unneccessary lines "rows = PQntuples(res); cols = PQnfields(res);"
-- avoided extra copy of first argument (self) in mondelefant_conn_query
-- no rawget in meta-method "__index" of database result lists and objects
-- removed unreachable "return 0;" in meta-method "__newindex" of database result lists and objects
- Year in copyright notice changed to 2009-2010
- Version string changed to "1.1.1"
author jbe
date Fri Jun 04 19:00:34 2010 +0200 (2010-06-04)
parents 9fdfb27f8e67
children
line source
1 function ui_deprecated.select(args)
2 local record = assert(slot.get_state_table(), "ui_deprecated.select was not called within a form.").form_record
3 local value = param.get(args.field) or record[args.field]
4 local html_options = args.html_options or {}
5 html_options.name = args.field
7 ui_deprecated.tag("div", { html_options = { class="ui_field ui_select" }, content = function()
8 if args.label then
9 ui_deprecated.tag("div", { html_options = { class="label" }, content = function()
10 ui_deprecated.text(args.label)
11 end })
12 end
13 ui_deprecated.tag("div", { html_options = { class="value" }, content = function()
14 ui_deprecated.tag("select", { html_options = html_options, content = function()
15 if args.include_option then
16 ui_deprecated.tag("option", { html_options = { value = "" }, content = args.include_option })
17 end
18 for i, object in ipairs(args.foreign_records) do
19 local selected = nil
20 if tostring(object[args.foreign_id]) == tostring(value) then
21 selected = "1"
22 end
23 ui_deprecated.tag("option", { html_options = { value = object[args.foreign_id], selected = selected }, content = object[args.foreign_name] })
24 end
25 end }) -- /select
26 end }) -- /div
27 end }) -- /div
28 end

Impressum / About Us