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

Target

Select target project
  • firmware/gluon
  • 0x4A6F/gluon
  • patrick/gluon
3 results
Select Git revision
Show changes
Showing
with 174 additions and 89 deletions
......@@ -2,8 +2,6 @@ return function(form, uci)
local pkg_i18n = i18n 'gluon-config-mode-contact-info'
local site_i18n = i18n 'gluon-site'
local site = require 'gluon.site'
local owner = uci:get_first("gluon-node-info", "owner")
local help = site_i18n._translate("gluon-config-mode:contact-help") or pkg_i18n.translate(
......@@ -23,7 +21,6 @@ return function(form, uci)
o.optional = true
function o:write(data)
uci:set("gluon-node-info", owner, "contact", data)
uci:save("gluon-node-info")
end
return {'gluon-node-info'}
end
......@@ -4,7 +4,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-core
PKG_VERSION:=2
include ../gluon.mk
......
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html lang="">
<head>
<meta http-equiv="refresh" content="0; URL=/cgi-bin/config" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta http-equiv="refresh" content="0; URL=/cgi-bin/config">
</head>
<body>
</body>
......
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"
......
local util = require "gluon.util"
local uci = require("simple-uci").cursor()
local wizard = {}
for _, entry in ipairs(util.glob('/lib/gluon/config-mode/wizard/*')) do
local f = assert(loadfile(entry))
setfenv(f, getfenv())
local w = f()
table.insert(wizard, w)
end
local f = Form(translate("Welcome!"))
f.submit = translate('Save & restart')
f.reset = false
......@@ -18,21 +9,10 @@ local s = f:section(Section)
s.template = "wizard/welcome"
s.package = "gluon-config-mode-core"
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
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()
......@@ -40,13 +20,9 @@ function f:write()
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")
for _, c in ipairs(commit) do
uci:commit(c)
end
for _, r in ipairs(run) do
r()
end
os.execute('exec gluon-reconfigure >/dev/null')
f.template = "wizard/reboot"
f.package = "gluon-config-mode-core"
......
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-domain-select
PKG_VERSION:=1
include ../gluon.mk
......
......@@ -7,7 +7,8 @@ return function(form, uci)
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
......@@ -48,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
include ../gluon.mk
......
......@@ -10,15 +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"
......@@ -26,15 +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."
"Die Höhenangabe ist optional und sollte nur gesetzt werden, wenn ein exakter "
"Wert bekannt ist."
msgid "e.g. %s"
msgstr "z.B. %s"
......@@ -10,15 +10,16 @@ msgstr ""
"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"
......@@ -26,8 +27,8 @@ 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 "
......
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"
......@@ -15,7 +18,7 @@ msgstr ""
msgid "Longitude"
msgstr ""
msgid "Show node on the map"
msgid "Set node position"
msgstr ""
msgid ""
......
......@@ -4,6 +4,9 @@ return function(form, uci)
local site = require 'gluon.site'
local osm
pcall(function() osm = require 'gluon.config-mode.geo-location-osm' end)
local location = uci:get_first("gluon-node-info", "location")
local show_altitude = site.config_mode.geo_location.show_altitude(false)
......@@ -12,8 +15,11 @@ return function(form, uci)
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 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 ' ..
......@@ -26,32 +32,59 @@ return function(form, uci)
local o
local share_location = s:option(Flag, "location", pkg_i18n.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)
-- The config mode does not have a nicer place to put this at the moment...
if not show_altitude then
uci:delete("gluon-node-info", location, "altitude")
end
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 = uci:get("gluon-node-info", location, "latitude")
o:depends(share_location, true)
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", pkg_i18n.translate("Longitude"), pkg_i18n.translatef("e.g. %s", "10.689901"))
o.default = uci:get("gluon-node-info", location, "longitude")
o:depends(share_location, true)
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",
......@@ -59,7 +92,7 @@ return function(form, uci)
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)
......@@ -67,5 +100,7 @@ return function(form, uci)
end
end
return {'gluon-node-info'}
function s:write()
uci:save("gluon-node-info")
end
end
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-hostname
PKG_VERSION:=1
include ../gluon.mk
......
need_boolean(in_site({'config_mode', 'hostname', 'optional'}), false)
need_boolean(in_site({'config_mode', 'hostname', 'prefill'}), false)
......@@ -14,7 +14,8 @@ return function(form, uci)
local current_hostname = pretty_hostname.get(uci)
local default_hostname = util.default_hostname()
local configured = uci:get_first('gluon-setup-mode', 'setup_mode', 'configured', false) or (current_hostname ~= default_hostname)
local configured = uci:get_first('gluon-setup-mode', 'setup_mode', 'configured', false) or
(current_hostname ~= default_hostname)
local s = form:section(Section)
local o = s:option(Value, "hostname", pkg_i18n.translate("Node name"))
......@@ -23,13 +24,12 @@ return function(form, uci)
o.optional = true
o.placeholder = default_hostname
end
if configured then
if configured or site.config_mode.hostname.prefill(true) then
o.default = current_hostname
end
function o:write(data)
pretty_hostname.set(uci, data or default_hostname)
uci:save('system')
end
return {'system'}
end