Merge pull request #1251 from dibdot/luci-app-travelmate
[project/luci.git] / applications / luci-app-travelmate / luasrc / model / cbi / travelmate / wifi_order.lua
1 -- Copyright 2017 Dirk Brenken (dev@brenken.org)
2 -- This is free software, licensed under the Apache License, Version 2.0
3
4 local uci = require("luci.model.uci").cursor()
5 local http = require("luci.http")
6 local cfg = http.formvalue("cfg")
7 local pos = http.formvalue("pos")
8 local dir = http.formvalue("dir")
9
10 if cfg ~= nil then
11         if dir == "up" then
12                 pos = pos - 1
13                 uci:reorder("wireless", cfg, pos)
14         elseif dir == "down" then
15                 pos = pos + 1
16                 uci:reorder("wireless", cfg, pos)
17         end
18         uci:save("wireless")
19         uci:commit("wireless")
20 end
21
22 http.redirect(luci.dispatcher.build_url("admin/services/travelmate/stations"))