gluon/package/gluon-config-mode-contact-info/files/lib/gluon/config-mode/wizard/0500-contact-info.lua
Nils Schneider 3aecc92073 gluon-config-mode: modularize wizard
This commit splits gluon-config-mode into several, mostly independent
packages.

* gluon-config-mode-core: basic functionality (required)
* gluon-config-mode-hostname: hostname field
* gluon-config-mode-autoupdater: show when autoupdater is enabled
* gluon-config-mode-mesh-vpn: fastd vpn configuration, bw limit
* gluon-config-mode-geo-location: geo coordinates
* gluon-config-mode-contact-info: contact info field

The package gluon-config-mode has been removed. You need to replace
it with these packages (or any subset of them) in site.mk:

* gluon-config-mode-hostname
* gluon-config-mode-autoupdater
* gluon-config-mode-mesh-vpn
* gluon-config-mode-geo-location
* gluon-config-mode-contact-info

Note: It is not possible to deactivate the autoupdater in config mode
anymore (expert mode will still allow it). Instead, a message is shown
in case the autoupdater is enabled.
2014-08-05 14:56:45 +02:00

32 lines
1015 B
Lua

local cbi = require "luci.cbi"
local uci = luci.model.uci.cursor()
local M = {}
function M.section(form)
local s = form:section(cbi.SimpleSection, nil,
[[Hier kannst du einen <em>öffentlichen</em> Hinweis hinterlegen um
anderen Freifunkern zu ermöglichen Kontakt mit dir aufzunehmen. Bitte
beachte, dass dieser Hinweis auch öffentlich im Internet, zusammen mit
den Koordinaten deines Knotens, einsehbar sein wird.]])
local o = s:option(cbi.Value, "_contact", "Kontakt")
o.default = uci:get_first("gluon-node-info", "owner", "contact", "")
o.rmempty = true
o.datatype = "string"
o.description = "z.B. E-Mail oder Telefonnummer"
o.maxlen = 140
end
function M.handle(data)
if data._contact ~= nil then
uci:set("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact", data._contact)
else
uci:delete("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact")
end
uci:save("gluon-node-info")
uci:commit("gluon-node-info")
end
return M