Skip to content
Snippets Groups Projects
Commit d03c88af authored by Ruben Barkow's avatar Ruben Barkow Committed by Matthias Schiffer
Browse files

gluon-config-mode-contact-info: define an "obligatory" option in site.conf (#843)

parent d2fb547a
No related branches found
No related tags found
No related merge requests found
gluon-config-mode-contact-info
==============================
This package allows the user to provide contact information within config mode to be
distributed in the mesh. You can define whether the owner contact field is
obligatory or not in your site.conf.
site.conf
---------
config_mode.owner.obligatory : this whole section is optional
- ``true`` field is obligatory: gluon-node-info.@owner[0].contact may not be empty
- ``false`` field is optional: gluon-node-info.@owner[0].contact may be empty
- defaults to ``false``
# example:
config_mode = {
geo_location = {
show_altitude = true,
},
owner = {
obligatory = true
},
},
\ No newline at end of file
...@@ -192,10 +192,15 @@ ...@@ -192,10 +192,15 @@
-- skip = true, -- skip = true,
-- }, -- },
-- Show/hide the altitude field
-- config_mode = { -- config_mode = {
-- geo_location = { -- Show/hide the altitude field
-- show_altitude = false, -- geo_location = {
-- }, -- show_altitude = false,
-- },
-- define if the contact field is obligatory (optional)
-- owner = {
-- obligatory = true
-- },
-- }, -- },
} }
...@@ -13,10 +13,15 @@ PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) ...@@ -13,10 +13,15 @@ PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/gluon-config-mode-contact-info define Package/gluon-config-mode-contact-info
SECTION:=gluon SECTION:=gluon
CATEGORY:=Gluon CATEGORY:=Gluon
TITLE:=Set a custom string that will be distributed in the mesh. TITLE:=Allows the user to provide contact information to be distributed in the mesh
DEPENDS:=gluon-config-mode-core-virtual +gluon-node-info DEPENDS:=gluon-config-mode-core-virtual +gluon-node-info
endef endef
define Package/gluon-config-mode-contact-info/description
Allows the user to provide contact information to be distributed in the mesh.
Can be made obligatory in site.conf
endef
define Build/Prepare define Build/Prepare
mkdir -p $(PKG_BUILD_DIR) mkdir -p $(PKG_BUILD_DIR)
endef endef
...@@ -34,4 +39,9 @@ define Package/gluon-config-mode-contact-info/install ...@@ -34,4 +39,9 @@ define Package/gluon-config-mode-contact-info/install
$(call GluonInstallI18N,gluon-config-mode-contact-info,$(1)) $(call GluonInstallI18N,gluon-config-mode-contact-info,$(1))
endef endef
define Package/gluon-config-mode-contact-info/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-config-mode-contact-info)) $(eval $(call BuildPackage,gluon-config-mode-contact-info))
if need_table('config_mode', nil, false) and need_table('config_mode.owner', nil, false) then
need_boolean('config_mode.owner.obligatory', false)
end
...@@ -14,13 +14,13 @@ msgid "Contact info" ...@@ -14,13 +14,13 @@ msgid "Contact info"
msgstr "Kontakt" msgstr "Kontakt"
msgid "" msgid ""
"You can provide your contact information here to allow others to contact " "Please provide your contact information here to allow others to contact "
"you. Please note that this information will be visible <em>publicly</em> on " "you. Note that this information will be visible <em>publicly</em> on "
"the internet together with your node's coordinates." "the internet together with your node's coordinates."
msgstr "" msgstr ""
"Hier kannst du einen <em>öffentlichen</em> Hinweis hinterlegen, um anderen " "Bitte hinterlege hier einen Hinweis, um anderen zu ermöglichen, "
"zu ermöglichen, Kontakt mit dir aufzunehmen. Bitte beachte, dass " "Kontakt mit dir aufzunehmen. Beachte, dass dieser Hinweis auch "
"dieser Hinweis auch öffentlich im Internet, zusammen mit den Koordinaten " "<em>öffentlich</em> im Internet, zusammen mit den Koordinaten "
"deines Knotens, einsehbar sein wird." "deines Knotens, einsehbar sein wird."
msgid "e.g. E-mail or phone number" msgid "e.g. E-mail or phone number"
......
...@@ -14,11 +14,12 @@ msgid "Contact info" ...@@ -14,11 +14,12 @@ msgid "Contact info"
msgstr "Informations de Contact" msgstr "Informations de Contact"
msgid "" msgid ""
"You can provide your contact information here to allow others to contact " "Please provide your contact information here to allow others to contact "
"you. Please note that this information will be visible <em>publicly</em> on " "you. Note that this information will be visible <em>publicly</em> on "
"the internet together with your node's coordinates." "the internet together with your node's coordinates."
msgstr "" msgstr ""
"Ici vous pouvez donner des informations <em>publiques</em> pour permettre aux autres de vous contacter. " "S'il vous plaît entrez ici des informations <em>publiques</em> pour "
"permettre aux autres de vous contacter. "
"Ces informations seront affichées en ligne, avec les coordonnées du nœud." "Ces informations seront affichées en ligne, avec les coordonnées du nœud."
msgid "e.g. E-mail or phone number" msgid "e.g. E-mail or phone number"
......
...@@ -5,8 +5,8 @@ msgid "Contact info" ...@@ -5,8 +5,8 @@ msgid "Contact info"
msgstr "" msgstr ""
msgid "" msgid ""
"You can provide your contact information here to allow others to contact " "Please provide your contact information here to allow others to contact "
"you. Please note that this information will be visible <em>publicly</em> on " "you. Note that this information will be visible <em>publicly</em> on "
"the internet together with your node's coordinates." "the internet together with your node's coordinates."
msgstr "" msgstr ""
......
local cbi = require "luci.cbi" local cbi = require "luci.cbi"
local i18n = require "luci.i18n" local i18n = require "luci.i18n"
local uci = luci.model.uci.cursor() local uci = luci.model.uci.cursor()
local site = require 'gluon.site_config'
local M = {} local M = {}
function M.section(form) function M.section(form)
local s = form:section(cbi.SimpleSection, nil, i18n.translate( local s = form:section(cbi.SimpleSection, nil, i18n.translate(
'You can provide your contact information here to ' 'Please provide your contact information here to '
.. 'allow others to contact you. Please note that ' .. 'allow others to contact you. Note that '
.. 'this information will be visible <em>publicly</em> ' .. 'this information will be visible <em>publicly</em> '
.. 'on the internet together with your node\'s coordinates.' .. 'on the internet together with your node\'s coordinates.'
) )
...@@ -15,7 +16,7 @@ function M.section(form) ...@@ -15,7 +16,7 @@ function M.section(form)
local o = s:option(cbi.Value, "_contact", i18n.translate("Contact info")) local o = s:option(cbi.Value, "_contact", i18n.translate("Contact info"))
o.default = uci:get_first("gluon-node-info", "owner", "contact", "") o.default = uci:get_first("gluon-node-info", "owner", "contact", "")
o.rmempty = true o.rmempty = not ((site.config_mode or {}).owner or {}).obligatory
o.datatype = "string" o.datatype = "string"
o.description = i18n.translate("e.g. E-mail or phone number") o.description = i18n.translate("e.g. E-mail or phone number")
o.maxlen = 140 o.maxlen = 140
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment