Software /
code /
prosody
Comparison
util/dataforms.lua @ 9087:9e45e7adcebf
util.dataforms: Set default value for form type argument
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 03 Aug 2018 20:59:15 +0200 |
parent | 9084:572b6858db03 |
child | 9088:aa1b02411846 |
comparison
equal
deleted
inserted
replaced
9086:74b4be5afb74 | 9087:9e45e7adcebf |
---|---|
24 local function new(layout) | 24 local function new(layout) |
25 return setmetatable(layout, form_mt); | 25 return setmetatable(layout, form_mt); |
26 end | 26 end |
27 | 27 |
28 function form_t.form(layout, data, formtype) | 28 function form_t.form(layout, data, formtype) |
29 local form = st.stanza("x", { xmlns = xmlns_forms, type = formtype or "form" }); | 29 if not formtype then formtype = "form" end |
30 local form = st.stanza("x", { xmlns = xmlns_forms, type = formtype }); | |
30 if layout.title then | 31 if layout.title then |
31 form:tag("title"):text(layout.title):up(); | 32 form:tag("title"):text(layout.title):up(); |
32 end | 33 end |
33 if layout.instructions then | 34 if layout.instructions then |
34 form:tag("instructions"):text(layout.instructions):up(); | 35 form:tag("instructions"):text(layout.instructions):up(); |