1 -- Copyright 2017 Dirk Brenken (dev@brenken.org)
2 -- This is free software, licensed under the Apache License, Version 2.0
4 local http = require("luci.http")
5 local cfg = http.formvalue("cfg")
6 local dir = http.formvalue("dir")
7 local uci = require("luci.model.uci").cursor()
8 local trmiface = uci:get("travelmate", "global", "trm_iface") or "trm_wwan"
15 uci:foreach("wireless", "wifi-iface", function(s)
16 local iface = s.network or ""
17 if iface == trmiface then
19 if cfg == section then
22 idx_change = s['.index']
24 if (dir == "up" and idx ~= "" and idx_change ~= "" and idx_change < idx) or
25 (dir == "down" and idx ~= "" and idx_change ~= "" and idx_change > idx) then
26 changed = uci:reorder("wireless", cfg, idx_change)
33 uci:commit("wireless")
36 http.redirect(luci.dispatcher.build_url("admin/services/travelmate/stations"))