Software / code / prosody
Comparison
util/dataforms.lua @ 2488:08bfd7c96531
util.dataforms: Add optional type parameters (defaults to 'form')
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 22 Jan 2010 14:58:31 +0000 |
| parent | 2219:9e1c6b6a2ee4 |
| child | 2923:b7049746bd29 |
comparison
equal
deleted
inserted
replaced
| 2487:d9db41109ba0 | 2488:08bfd7c96531 |
|---|---|
| 21 | 21 |
| 22 function new(layout) | 22 function new(layout) |
| 23 return setmetatable(layout, form_mt); | 23 return setmetatable(layout, form_mt); |
| 24 end | 24 end |
| 25 | 25 |
| 26 function form_t.form(layout, data) | 26 function form_t.form(layout, data, formtype) |
| 27 local form = st.stanza("x", { xmlns = xmlns_forms, type = "form" }); | 27 local form = st.stanza("x", { xmlns = xmlns_forms, type = formtype or "form" }); |
| 28 if layout.title then | 28 if layout.title then |
| 29 form:tag("title"):text(layout.title):up(); | 29 form:tag("title"):text(layout.title):up(); |
| 30 end | 30 end |
| 31 if layout.instructions then | 31 if layout.instructions then |
| 32 form:tag("instructions"):text(layout.instructions):up(); | 32 form:tag("instructions"):text(layout.instructions):up(); |