Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 0x4A6F-master
  • 0x4A6F-rpi4
  • autinerd/experimental-openwrt-24.10
  • experimental
  • feature/addMikrotikwAP
  • master
  • nrb/airmax-test
  • nrb/ar9344-reset-sequence
  • nrb/ex400-remove-wps
  • nrb/gluon-master-cpe510
  • nrb/test-radv-filter
  • nrbffs/fastd-remove-delay
  • nrbffs/netgear-ex6120
  • v2018.2.2-ffs
  • v2018.2.3-ffs
  • v2019.1-ffs
  • v2019.1.1-ffs
  • v2019.1.2-ffs
  • v2020.1-ffs
  • v2020.1.1-ffs
  • v2020.1.3-ffs
  • v2020.2-ffs
  • v2020.2.1-ffs
  • v2020.2.2-ffs
  • v2020.2.3-ffs
  • v2021.1-ffs
  • v2021.1.1-ffs
  • v2021.1.2-ffs
  • v2022.1.1-ffs
  • v2022.1.3-ffs
  • v2022.1.4-ffs
  • v2023.1-ffs
  • v2023.2-ffs
  • v2023.2.2-ffs
  • v2023.2.3-ffs
  • v2023.2.4-ffs
  • v2023.2.5-ffs
  • experimental-2022-09-24
  • experimental-2022-09-24-base
  • experimental-2023-03-11
  • experimental-2023-03-11-base
  • experimental-2023-03-12
  • experimental-2023-03-12-base
  • experimental-2023-03-16
  • experimental-2023-03-16-base
  • experimental-2023-03-20
  • experimental-2023-03-20-base
  • experimental-2023-03-23
  • experimental-2023-03-23-base
  • experimental-2023-03-25
  • experimental-2023-03-25-base
  • experimental-2023-03-26
  • experimental-2023-03-26-base
  • experimental-2023-03-30
  • experimental-2023-03-30-base
  • experimental-2023-03-31
  • experimental-2023-03-31-base
  • experimental-2023-04-01
  • experimental-2023-04-01-base
  • experimental-2023-04-08
  • experimental-2023-04-08-base
  • experimental-2023-04-10
  • experimental-2023-04-10-base
  • experimental-2023-04-13
  • experimental-2023-04-13-base
  • experimental-2023-04-15
  • experimental-2023-04-15-base
  • experimental-2023-04-16
  • experimental-2023-04-16-base
  • experimental-2023-04-18
  • experimental-2023-04-18-base
  • experimental-2023-04-20
  • experimental-2023-04-20-base
  • experimental-2023-04-26
  • experimental-2023-04-26-base
  • experimental-2023-04-28
  • experimental-2023-04-28-base
  • experimental-2023-04-30
  • experimental-2023-04-30-base
  • experimental-2023-05-02
  • experimental-2023-05-02-base
  • experimental-2023-05-03
  • experimental-2023-05-03-base
  • experimental-2023-05-12
  • experimental-2023-05-12-base
  • experimental-2023-05-21
  • experimental-2023-05-21-base
  • experimental-2023-05-25
  • experimental-2023-05-25-base
  • experimental-2023-07-02
  • experimental-2023-07-02-base
  • experimental-2023-07-04
  • experimental-2023-07-04-base
  • experimental-2023-07-12
  • experimental-2023-07-12-base
  • experimental-2023-07-16
  • experimental-2023-07-16-base
  • experimental-2023-08-04
  • experimental-2023-08-04-base
  • experimental-2023-08-10
  • experimental-2023-08-10-base
  • experimental-2023-09-08
  • experimental-2023-09-08-base
  • experimental-2023-09-09
  • experimental-2023-09-09-base
  • experimental-2023-09-10
  • experimental-2023-09-10-base
  • experimental-2023-09-11
  • experimental-2023-09-11-base
  • experimental-2023-09-12
  • experimental-2023-09-12-base
  • experimental-2023-09-13
  • experimental-2023-09-13-base
  • experimental-2023-09-15
  • experimental-2023-09-15-base
  • experimental-2023-09-16
  • experimental-2023-09-16-base
  • experimental-2023-09-18
  • experimental-2023-09-18-base
  • experimental-2023-09-20
  • experimental-2023-09-20-base
  • experimental-2023-09-27
  • experimental-2023-09-27-base
  • experimental-2023-09-28
  • experimental-2023-09-28-base
  • experimental-2023-09-29
  • experimental-2023-09-29-base
  • experimental-2023-10-02
  • experimental-2023-10-02-base
  • experimental-2023-10-13
  • experimental-2023-10-13-base
  • experimental-2023-10-14
  • experimental-2023-10-14-base
  • experimental-2023-10-16
  • experimental-2023-10-16-base
  • experimental-2023-10-23
  • experimental-2023-10-23-base
137 results

Target

Select target project
  • firmware/gluon
  • 0x4A6F/gluon
  • patrick/gluon
3 results
Select Git revision
  • 0x4A6F-master
  • 0x4A6F-rpi4
  • 2014.3.x
  • 2014.4.x
  • babel
  • hoodselector
  • master
  • radv-filterd
  • v2015.1.x
  • v2016.1.x
  • v2016.2.4-batmanbug
  • v2016.2.x
  • v2018.2.2-ffs
  • v2018.2.x
  • v2014.1
  • v2014.2
  • v2014.3
  • v2014.3.1
  • v2014.4
  • v2015.1
  • v2015.1.1
  • v2015.1.2
  • v2016.1
  • v2016.1.1
  • v2016.1.2
  • v2016.1.3
  • v2016.1.4
  • v2016.1.5
  • v2016.1.6
  • v2016.2
  • v2016.2.1
  • v2016.2.2
  • v2016.2.3
  • v2016.2.4
  • v2016.2.5
  • v2016.2.6
  • v2016.2.7
  • v2017.1
  • v2017.1.1
  • v2017.1.2
  • v2017.1.3
  • v2017.1.4
  • v2017.1.5
  • v2017.1.6
  • v2017.1.7
  • v2017.1.8
  • v2018.1
  • v2018.1.1
  • v2018.1.2
  • v2018.1.3
  • v2018.1.4
  • v2018.2
  • v2018.2-ffs0.1
  • v2018.2.1
  • v2018.2.1-ffs0.1
  • v2018.2.2-ffs0.1
56 results
Show changes
Showing
with 291 additions and 221 deletions
<h2><%:Your node's setup is now complete.%></h2>
<%
local fs = require "nixio.fs"
local util = require "nixio.util"
local parts_dir = "/lib/gluon/config-mode/reboot/"
local files = util.consume(fs.dir(parts_dir) or function() end)
table.sort(files)
local parts = {}
for _, entry in ipairs(files) do
if entry:sub(1, 1) ~= '.' then
local p = assert(loadfile(parts_dir .. entry))
setfenv(p, getfenv())
table.insert(parts, p)
end
end
for _, p in ipairs(parts) do
p()
end
%>
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-08-12 23:30+0100\n"
"Last-Translator:Tobias Bernot <tqbs@airmail.cc>\n"
"Language-Team: French\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
......
package 'gluon-config-mode-core'
entry({}, alias("wizard"))
entry({"wizard"}, model("gluon-config-mode/wizard"), _("Wizard"), 5)
local util = require "gluon.util"
local uci = require("simple-uci").cursor()
local f = Form(translate("Welcome!"))
f.submit = translate('Save & restart')
f.reset = false
local s = f:section(Section)
s.template = "wizard/welcome"
s.package = "gluon-config-mode-core"
for _, entry in ipairs(util.glob('/lib/gluon/config-mode/wizard/*')) do
local section = assert(loadfile(entry))
setfenv(section, getfenv())
section()(f, uci)
end
function f:write()
local fcntl = require 'posix.fcntl'
local unistd = require 'posix.unistd'
uci:set("gluon-setup-mode", uci:get_first("gluon-setup-mode", "setup_mode"), "configured", true)
uci:save("gluon-setup-mode")
os.execute('exec gluon-reconfigure >/dev/null')
f.template = "wizard/reboot"
f.package = "gluon-config-mode-core"
f.hidenav = true
if unistd.fork() == 0 then
-- Replace stdout with /dev/null
local null = fcntl.open('/dev/null', fcntl.O_WRONLY)
unistd.dup2(null, unistd.STDOUT_FILENO)
-- Sleep a little so the browser can fetch everything required to
-- display the reboot page, then reboot the device.
unistd.sleep(1)
unistd.execp('reboot', {[0] = 'reboot'})
end
end
return f
local site_i18n = i18n 'gluon-site'
local site = require 'gluon.site'
local sysconfig = require 'gluon.sysconfig'
local pretty_hostname = require 'pretty_hostname'
......@@ -7,7 +9,7 @@ local uci = require("simple-uci").cursor()
local hostname = pretty_hostname.get(uci)
local contact = uci:get_first('gluon-node-info', 'owner', 'contact')
local msg = _translate('gluon-config-mode:reboot')
local msg = site_i18n._translate('gluon-config-mode:reboot')
if not msg then return end
renderer.render_string(msg, {
......
#!/usr/bin/lua
require 'gluon.web.cgi' {
base_path = '/lib/gluon/config-mode',
layout_package = 'gluon-config-mode-theme',
layout_template = 'theme/layout',
}
local disp = require 'gluon.web.dispatcher'
local fs = require "nixio.fs"
local util = require "gluon.web.util"
local nixio_util = require "nixio.util"
local uci = require("simple-uci").cursor()
local wizard_dir = "/lib/gluon/config-mode/wizard/"
local files = nixio_util.consume(fs.dir(wizard_dir) or function() end)
table.sort(files)
local wizard = {}
for _, entry in ipairs(files) do
if entry:sub(1, 1) ~= '.' then
local f = assert(loadfile(wizard_dir .. entry))
setfenv(f, getfenv())
local w = f()
table.insert(wizard, w)
end
end
local f = Form(translate("Welcome!"))
f.submit = translate('Save & restart')
f.reset = false
local s = f:section(Section)
s.template = "gluon/config-mode/welcome"
local commit = {'gluon-setup-mode'}
local run = {}
for _, w in ipairs(wizard) do
for _, c in ipairs(w(f, uci) or {}) do
if type(c) == 'string' then
if not util.contains(commit, c) then
table.insert(commit, c)
end
elseif type(c) == 'function' then
table.insert(run, c)
else
error('invalid wizard module return')
end
end
end
function f:write()
local nixio = require "nixio"
uci:set("gluon-setup-mode", uci:get_first("gluon-setup-mode", "setup_mode"), "configured", true)
for _, c in ipairs(commit) do
uci:commit(c)
end
for _, r in ipairs(run) do
r()
end
f.template = "gluon/config-mode/reboot"
f.hidenav = true
if nixio.fork() == 0 then
-- Replace stdout with /dev/null
nixio.dup(nixio.open('/dev/null', 'w'), nixio.stdout)
-- Sleep a little so the browser can fetch everything required to
-- display the reboot page, then reboot the device.
nixio.nanosleep(1)
nixio.execp("reboot")
end
end
return f
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-domain-select
PKG_VERSION:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include ../gluon.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/gluon-config-mode-domain-select
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=UI for changing the node-config
DEPENDS:=+gluon-config-mode-core @GLUON_MULTIDOMAIN
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,gluon-config-mode-domain-select,i18n)
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef
define Package/gluon-config-mode-domain-select/install
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
$(call GluonInstallI18N,gluon-config-mode-domain-select,$(1))
endef
define Package/gluon-config-domain-select/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-config-mode-domain-select))
$(eval $(call BuildPackageGluon,gluon-config-mode-domain-select))
local valid_domain_codes = table_keys(need_table(in_domain({'domain_names'})))
alternatives(function()
need_boolean(in_domain({'hide_domain'}), false)
end, function()
need_array_of(in_domain({'hide_domain'}), valid_domain_codes, false)
end)
return function(form, uci)
local fs = require 'nixio.fs'
local site_i18n = i18n 'gluon-site'
local json = require 'jsonc'
local site = require 'gluon.site'
local util = require 'gluon.util'
local selected_domain = uci:get('gluon', 'core', 'domain')
local configured = uci:get_first('gluon-setup-mode','setup_mode', 'configured') == '1' or (selected_domain ~= site.default_domain())
local configured = uci:get_first('gluon-setup-mode','setup_mode', 'configured') == '1' or
(selected_domain ~= site.default_domain())
local function hide_domain_code(domain, code)
if configured and code == selected_domain then
return false
elseif type(domain.hide_domain) == 'table' then
return util.contains(domain.hide_domain, code)
else
return domain.hide_domain
end
end
local function get_domain_list()
local list = {}
for domain_path in fs.glob('/lib/gluon/domains/*.json') do
for _, domain_path in ipairs(util.glob('/lib/gluon/domains/*.json')) do
local domain_code = domain_path:match('([^/]+)%.json$')
local domain = assert(json.load(domain_path))
if not domain.hide_domain or (configured and domain.domain_code == selected_domain) then
if not hide_domain_code(domain, domain_code) then
table.insert(list, {
domain_code = domain_code,
domain_name = domain.domain_names[domain_code],
......@@ -24,8 +38,8 @@ return function(form, uci)
return list
end
local s = form:section(Section, nil, translate('gluon-config-mode:domain-select'))
local o = s:option(ListValue, 'domain', translate('gluon-config-mode:domain'))
local s = form:section(Section, nil, site_i18n.translate('gluon-config-mode:domain-select'))
local o = s:option(ListValue, 'domain', site_i18n.translate('gluon-config-mode:domain'))
if configured then
o.default = selected_domain
......@@ -35,20 +49,8 @@ return function(form, uci)
o:value(domain.domain_code, domain.domain_name)
end
local domain_changed = false
function o:write(data)
if data ~= selected_domain then
domain_changed = true
uci:set('gluon', 'core', 'domain', data)
uci:save('gluon')
end
end
local function reconfigure()
if domain_changed then
os.execute('gluon-reconfigure')
end
end
return {'gluon', reconfigure}
end
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-geo-location-osm
include ../gluon.mk
define Package/gluon-config-mode-geo-location-osm
TITLE:=Set geographic location of a node (map support)
DEPENDS:=+gluon-config-mode-geo-location +gluon-web-osm
endef
define Package/gluon-config-mode-geo-location-osm/install
$(Gluon/Build/Install)
$(INSTALL_DIR) $(1)/lib/gluon/config-mode/www/static/
$(LN) /lib/gluon/web/www/static/gluon-web-osm.js $(1)/lib/gluon/config-mode/www/static/
endef
$(eval $(call BuildPackageGluon,gluon-config-mode-geo-location-osm))
need_number(in_site({'config_mode', 'geo_location', 'osm', 'center', 'lon'}))
need_number(in_site({'config_mode', 'geo_location', 'osm', 'center', 'lat'}))
need_number(in_site({'config_mode', 'geo_location', 'osm', 'zoom'}), false)
need_string(in_site({'config_mode', 'geo_location', 'osm', 'openlayers_url'}), false)
if need_table(in_site({'config_mode', 'geo_location', 'osm', 'tile_layer'}), nil, false) then
need_one_of(in_site({'config_mode', 'geo_location', 'osm', 'tile_layer', 'type'}), {'XYZ'})
need_string(in_site({'config_mode', 'geo_location', 'osm', 'tile_layer', 'url'}))
need_string(in_site({'config_mode', 'geo_location', 'osm', 'tile_layer', 'attributions'}))
end
msgid ""
msgstr ""
"Project-Id-Version: gluon-config-mode-geo-location\n"
"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid ""
"You may also select the position on the map displayed below if your computer "
"is connected to the internet at the moment."
msgstr ""
"Wenn dein Computer aktuell mit dem Internet verbunden ist, kann die Position "
"auch auf der hier angezeigten Karte ausgewählt werden."
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid ""
"You may also select the position on the map displayed below if your computer "
"is connected to the internet at the moment."
msgstr ""
local osm = require 'gluon.web.model.osm'
local site = require 'gluon.site'
local M = {}
M.MapValue = osm.MapValue
function M.help(i18n)
local pkg_i18n = i18n 'gluon-config-mode-geo-location-osm'
return pkg_i18n.translate(
'You may also select the position on the map displayed below '
.. 'if your computer is connected to the internet at the moment.'
)
end
function M.options()
local config = site.config_mode.geo_location.osm
return {
openlayers_url = config.openlayers_url(),
tile_layer = config.tile_layer(),
zoom = config.zoom(12),
pos = config.center(),
}
end
return M
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-geo-location
PKG_VERSION:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include ../gluon.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/gluon-config-mode-geo-location
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Set geographic location of a node
DEPENDS:=+gluon-config-mode-core +gluon-node-info
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,gluon-config-mode-geo-location,i18n)
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef
define Package/gluon-config-mode-geo-location/install
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
$(call GluonInstallI18N,gluon-config-mode-geo-location,$(1))
endef
define Package/gluon-config-mode-geo-location/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-config-mode-geo-location))
$(eval $(call BuildPackageGluon,gluon-config-mode-geo-location))
......@@ -10,12 +10,18 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Advertise node position"
msgstr "Knotenposition veröffentlichen"
msgid "Altitude"
msgstr "Höhe"
msgid ""
"If you want the location of your node to be displayed on the map, you can "
"enter its coordinates here."
"If you want the location of your node to be displayed on public maps, you "
"can enter its coordinates here."
msgstr ""
"Um deinen Knoten auf der Karte anzeigen zu können, benötigen wir seine "
"Koordinaten. Hier hast du die Möglichkeit, diese zu hinterlegen."
"Um deinen Knoten auf öffentlichen Karten anzeigen zu können, benötigen wir "
"seine Koordinaten. Hier hast du die Möglichkeit, diese zu hinterlegen."
msgid "Latitude"
msgstr "Breitengrad"
......@@ -23,8 +29,15 @@ msgstr "Breitengrad"
msgid "Longitude"
msgstr "Längengrad"
msgid "Show node on the map"
msgstr "Knoten auf der Karte anzeigen"
msgid "Set node position"
msgstr "Knotenposition setzen"
msgid ""
"Specifying the altitude is optional; it should only be filled in if an "
"accurate value is known."
msgstr ""
"Die Höhenangabe ist optional und sollte nur gesetzt werden, wenn ein exakter "
"Wert bekannt ist."
msgid "e.g. %s"
msgstr "z.B. %s"
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-08-12 23:30+0100\n"
"Last-Translator:Tobias Bernot <tqbs@airmail.cc>\n"
"Language-Team: French\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Advertise node position"
msgstr ""
msgid "Altitude"
msgstr "Hauteur"
msgid ""
"If you want the location of your node to be displayed on the map, you can "
"enter its coordinates here."
"If you want the location of your node to be displayed on public maps, you "
"can enter its coordinates here."
msgstr ""
"Pour Afficher votre nœud sur la Carte nous avons besoin de ses coordonnées. "
"Ici vous pouvez entrer sa position."
msgid "Latitude"
msgstr "Latitude"
......@@ -23,8 +27,15 @@ msgstr "Latitude"
msgid "Longitude"
msgstr "Longitude"
msgid "Show node on the map"
msgstr "Afficher le nœud sur la carte"
msgid "Set node position"
msgstr ""
msgid ""
"Specifying the altitude is optional; it should only be filled in if an "
"accurate value is known."
msgstr ""
"La altitude est optionelle et ne devrait que être ajoutée si la valeur "
"exacte est connue."
msgid "e.g. %s"
msgstr "Ex: %s"
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Advertise node position"
msgstr ""
msgid "Altitude"
msgstr ""
msgid ""
"If you want the location of your node to be displayed on the map, you can "
"enter its coordinates here."
"If you want the location of your node to be displayed on public maps, you "
"can enter its coordinates here."
msgstr ""
msgid "Latitude"
......@@ -12,7 +18,12 @@ msgstr ""
msgid "Longitude"
msgstr ""
msgid "Show node on the map"
msgid "Set node position"
msgstr ""
msgid ""
"Specifying the altitude is optional; it should only be filled in if an "
"accurate value is known."
msgstr ""
msgid "e.g. %s"
......
return function(form, uci)
local pkg_i18n = i18n 'gluon-config-mode-geo-location'
local site_i18n = i18n 'gluon-site'
local site = require 'gluon.site'
local location = uci:get_first("gluon-node-info", "location")
local osm
pcall(function() osm = require 'gluon.config-mode.geo-location-osm' end)
local function show_altitude()
if site.config_mode.geo_location.show_altitude(true) then
return true
end
local location = uci:get_first("gluon-node-info", "location")
return uci:get_bool("gluon-node-info", location, "altitude")
end
local show_altitude = site.config_mode.geo_location.show_altitude(false)
local text = translate(
local text = site_i18n._translate("gluon-config-mode:geo-location-help")
if not text then
text = pkg_i18n.translate(
'If you want the location of your node to ' ..
'be displayed on the map, you can enter its coordinates here.'
'be displayed on public maps, you can enter its coordinates here.'
)
if show_altitude() then
text = text .. ' ' .. translate("gluon-config-mode:altitude-help")
if osm then
text = text .. ' ' .. osm.help(i18n)
end
if show_altitude then
text = text .. ' ' .. pkg_i18n.translate(
'Specifying the altitude is optional; it should only be filled in if an accurate ' ..
'value is known.'
)
end
end
local s = form:section(Section, nil, text)
local o
local share_location = s:option(Flag, "location", translate("Show node on the map"))
local own_latitude = uci:get("gluon-node-info", location, "latitude")
local own_longitude = uci:get("gluon-node-info", location, "longitude")
local set_location = s:option(Flag, "location", pkg_i18n.translate("Set node position"))
set_location.default = own_latitude or own_longitude
-- Delete already saved coordinates
function set_location:write(data)
if not data then
uci:delete("gluon-node-info", location, "latitude")
uci:delete("gluon-node-info", location, "longitude")
uci:set("gluon-node-info", location, "share_location", false)
end
if not show_altitude or not data then
uci:delete("gluon-node-info", location, "altitude")
end
end
local share_location = s:option(Flag, "share_location", pkg_i18n.translate("Advertise node position"))
share_location.default = uci:get_bool("gluon-node-info", location, "share_location")
share_location:depends(set_location, true)
function share_location:write(data)
uci:set("gluon-node-info", location, "share_location", data)
end
o = s:option(Value, "latitude", translate("Latitude"), translatef("e.g. %s", "53.873621"))
o.default = uci:get("gluon-node-info", location, "latitude")
o:depends(share_location, true)
local map
if osm then
map = s:option(osm.MapValue, "map", osm.options())
map:depends(set_location, true)
end
o = s:option(Value, "latitude", pkg_i18n.translate("Latitude"), pkg_i18n.translatef("e.g. %s", "53.873621"))
o.default = own_latitude
o:depends(set_location, true)
o.datatype = "float"
function o:write(data)
uci:set("gluon-node-info", location, "latitude", data)
end
if osm then
map.lat = o
end
o = s:option(Value, "longitude", translate("Longitude"), translatef("e.g. %s", "10.689901"))
o.default = uci:get("gluon-node-info", location, "longitude")
o:depends(share_location, true)
o = s:option(Value, "longitude", pkg_i18n.translate("Longitude"), pkg_i18n.translatef("e.g. %s", "10.689901"))
o.default = own_longitude
o:depends(set_location, true)
o.datatype = "float"
function o:write(data)
uci:set("gluon-node-info", location, "longitude", data)
end
if osm then
map.lon = o
end
if show_altitude() then
o = s:option(Value, "altitude", translate("gluon-config-mode:altitude-label"), translatef("e.g. %s", "11.51"))
if show_altitude then
o = s:option(Value, "altitude",
site_i18n._translate("gluon-config-mode:altitude-label") or pkg_i18n.translate("Altitude"),
pkg_i18n.translatef("e.g. %s", "11.51")
)
o.default = uci:get("gluon-node-info", location, "altitude")
o:depends(share_location, true)
o:depends(set_location, true)
o.datatype = "float"
o.optional = true
function o:write(data)
......@@ -56,5 +100,7 @@ return function(form, uci)
end
end
return {'gluon-node-info'}
function s:write()
uci:save("gluon-node-info")
end
end