luci-app-travelmate: small bugfixes & optimizations
* various small bugfixes and optimizations Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
parent
3909cf79dc
commit
b110746b98
5 changed files with 27 additions and 43 deletions
|
|
@ -10,5 +10,4 @@ if cfg ~= nil then
|
||||||
uci:save("wireless")
|
uci:save("wireless")
|
||||||
uci:commit("wireless")
|
uci:commit("wireless")
|
||||||
end
|
end
|
||||||
|
|
||||||
http.redirect(luci.dispatcher.build_url("admin/services/travelmate/stations"))
|
http.redirect(luci.dispatcher.build_url("admin/services/travelmate/stations"))
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ local s = uci:get_all("wireless", m.hidden.cfg)
|
||||||
if s ~= nil then
|
if s ~= nil then
|
||||||
wssid = m:field(Value, "ssid", translate("SSID"))
|
wssid = m:field(Value, "ssid", translate("SSID"))
|
||||||
wssid.default = s.ssid
|
wssid.default = s.ssid
|
||||||
|
|
||||||
if s.encryption and s.key then
|
if s.encryption and s.key then
|
||||||
wkey = m:field(Value, "key", translatef("Passphrase (%s)", s.encryption))
|
wkey = m:field(Value, "key", translatef("Passphrase (%s)", s.encryption))
|
||||||
wkey.password = true
|
wkey.password = true
|
||||||
|
|
@ -33,7 +32,7 @@ if s ~= nil then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
http.redirect(luci.dispatcher.build_url("admin/services/travelmate/stations"))
|
m.on_cancel()
|
||||||
end
|
end
|
||||||
|
|
||||||
function wssid.write(self, section, value)
|
function wssid.write(self, section, value)
|
||||||
|
|
@ -43,7 +42,7 @@ function wssid.write(self, section, value)
|
||||||
end
|
end
|
||||||
uci:save("wireless")
|
uci:save("wireless")
|
||||||
uci:commit("wireless")
|
uci:commit("wireless")
|
||||||
http.redirect(luci.dispatcher.build_url("admin/services/travelmate/stations"))
|
m.on_cancel()
|
||||||
end
|
end
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ if cfg ~= nil then
|
||||||
local section = ""
|
local section = ""
|
||||||
local idx = ""
|
local idx = ""
|
||||||
local idx_change = ""
|
local idx_change = ""
|
||||||
if dir == "up" then
|
local changed = ""
|
||||||
uci:foreach("wireless", "wifi-iface", function(s)
|
uci:foreach("wireless", "wifi-iface", function(s)
|
||||||
iface = s.network
|
iface = s.network
|
||||||
if iface == trmiface then
|
if iface == trmiface then
|
||||||
|
|
@ -22,30 +22,16 @@ if cfg ~= nil then
|
||||||
else
|
else
|
||||||
idx_change = s['.index']
|
idx_change = s['.index']
|
||||||
end
|
end
|
||||||
if idx ~= "" and idx_change ~= "" and idx_change < idx then
|
if (dir == "up" and idx ~= "" and idx_change ~= "" and idx_change < idx) or
|
||||||
uci:reorder("wireless", cfg, idx_change)
|
(dir == "down" and idx ~= "" and idx_change ~= "" and idx_change > idx) then
|
||||||
|
changed = uci:reorder("wireless", cfg, idx_change)
|
||||||
idx = ""
|
idx = ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
elseif dir == "down" then
|
if changed ~= "" then
|
||||||
uci:foreach("wireless", "wifi-iface", function(s)
|
|
||||||
iface = s.network
|
|
||||||
if iface == trmiface then
|
|
||||||
section = s['.name']
|
|
||||||
if cfg == section then
|
|
||||||
idx = s['.index']
|
|
||||||
else
|
|
||||||
idx_change = s['.index']
|
|
||||||
end
|
|
||||||
if idx ~= "" and idx_change ~= "" and idx_change > idx then
|
|
||||||
uci:reorder("wireless", cfg, idx_change)
|
|
||||||
idx = ""
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
uci:save("wireless")
|
uci:save("wireless")
|
||||||
uci:commit("wireless")
|
uci:commit("wireless")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
http.redirect(luci.dispatcher.build_url("admin/services/travelmate/stations"))
|
http.redirect(luci.dispatcher.build_url("admin/services/travelmate/stations"))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue