gluon-config-mode: allow contact field to be empty

This commit is contained in:
Nils Schneider 2014-03-02 19:28:40 +01:00
parent db11e29df1
commit 59a28c6721

View File

@ -78,7 +78,7 @@ einsehbar sein wird.]])
o = s:option(Value, "_contact", "Kontakt")
o.default = uci:get_first("gluon-node-info", "owner", "contact", "")
o.rmempty = false
o.rmempty = true
o.datatype = "string"
o.description = "z.B. E-Mail oder Telefonnummer"
o.maxlen = 140
@ -122,7 +122,11 @@ function f.handle(self, state, data)
uci:set("gluon-node-info", sname, "latitude", data._latitude)
uci:set("gluon-node-info", sname, "longitude", data._longitude)
end
uci:set("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact", data._contact)
if data._contact ~= nil then
uci:set("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact", data._contact)
else
uci:set("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact")
end
uci:save("gluon-node-info")
uci:commit("gluon-node-info")