2017-02-08 21:19:24 +00:00
|
|
|
return function(form, uci)
|
2018-02-23 05:26:10 +00:00
|
|
|
local pkg_i18n = i18n 'gluon-config-mode-contact-info'
|
2018-05-31 07:21:09 +00:00
|
|
|
local site_i18n = i18n 'gluon-site'
|
2018-02-23 05:26:10 +00:00
|
|
|
|
2017-08-08 11:50:41 +00:00
|
|
|
local site = require 'gluon.site'
|
2014-07-27 17:31:45 +00:00
|
|
|
|
2017-02-08 21:19:24 +00:00
|
|
|
local owner = uci:get_first("gluon-node-info", "owner")
|
2014-07-27 17:31:45 +00:00
|
|
|
|
2018-05-31 07:21:09 +00:00
|
|
|
local help = site_i18n._translate("gluon-config-mode:contact-help") or pkg_i18n.translate(
|
2018-05-19 17:26:33 +00:00
|
|
|
'Please provide your contact information here to allow others to contact '
|
|
|
|
.. 'you. Note that this information will be visible <em>publicly</em> on '
|
|
|
|
.. 'the internet together with your node\'s coordinates. This means it can '
|
|
|
|
.. 'be downloaded and processed by anyone. This information is '
|
|
|
|
.. 'not required to operate a node. If you chose to enter data, it will be '
|
|
|
|
.. 'stored on this node and can be deleted by yourself at any time.'
|
2018-05-31 07:21:09 +00:00
|
|
|
)
|
|
|
|
local s = form:section(Section, nil, help)
|
2014-07-27 17:31:45 +00:00
|
|
|
|
2018-05-31 07:21:09 +00:00
|
|
|
local o = s:option(Value, "contact", pkg_i18n.translate("Contact info"),
|
|
|
|
site_i18n._translate("gluon-config-mode:contact-note") or pkg_i18n.translate("e.g. E-mail or phone number"))
|
2017-02-08 21:19:24 +00:00
|
|
|
o.default = uci:get("gluon-node-info", owner, "contact")
|
2018-06-04 21:37:32 +00:00
|
|
|
o.datatype = 'minlength(1)'
|
2018-05-19 17:26:33 +00:00
|
|
|
o.optional = true
|
2017-02-08 21:19:24 +00:00
|
|
|
function o:write(data)
|
2017-08-08 02:11:54 +00:00
|
|
|
uci:set("gluon-node-info", owner, "contact", data)
|
2017-02-08 21:19:24 +00:00
|
|
|
end
|
2014-07-27 17:31:45 +00:00
|
|
|
|
2017-02-08 21:19:24 +00:00
|
|
|
return {'gluon-node-info'}
|
2014-07-27 17:31:45 +00:00
|
|
|
end
|