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"
16 uci:foreach("wireless", "wifi-iface", function(s)
18 if iface == trmiface then
20 if cfg == section then
23 idx_change = s['.index']
25 if idx ~= "" and idx_change ~= "" and idx_change < idx then
26 uci:reorder("wireless", cfg, idx_change)
31 elseif dir == "down" then
32 uci:foreach("wireless", "wifi-iface", function(s)
34 if iface == trmiface then
36 if cfg == section then
39 idx_change = s['.index']
41 if idx ~= "" and idx_change ~= "" and idx_change > idx then
42 uci:reorder("wireless", cfg, idx_change)
49 uci:commit("wireless")
51 http.redirect(luci.dispatcher.build_url("admin/services/travelmate/stations"))