Software / code / prosody
Comparison
util/dataforms.lua @ 956:4c3f3d60a2f4
util.dataforms: Set form type when generating a form
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 05 Apr 2009 19:41:24 +0100 |
| parent | 955:98ca5a753fee |
| child | 957:34f8cda285c4 |
comparison
equal
deleted
inserted
replaced
| 955:98ca5a753fee | 956:4c3f3d60a2f4 |
|---|---|
| 14 | 14 |
| 15 function new(layout) | 15 function new(layout) |
| 16 return setmetatable(layout, form_mt); | 16 return setmetatable(layout, form_mt); |
| 17 end | 17 end |
| 18 | 18 |
| 19 local form_x_attr = { xmlns = xmlns_forms }; | |
| 20 | |
| 21 function form_t.form(layout, data) | 19 function form_t.form(layout, data) |
| 22 local form = st.stanza("x", form_x_attr); | 20 local form = st.stanza("x", { xmlns = xmlns_forms, type = "form" }); |
| 23 if layout.title then | 21 if layout.title then |
| 24 form:tag("title"):text(layout.title):up(); | 22 form:tag("title"):text(layout.title):up(); |
| 25 end | 23 end |
| 26 if layout.instructions then | 24 if layout.instructions then |
| 27 form:tag("instructions"):text(layout.instructions):up(); | 25 form:tag("instructions"):text(layout.instructions):up(); |