summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-travelmate/luasrc/model/cbi/travelmate
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2017-07-25 07:24:59 +0200
committerDirk Brenken <dev@brenken.org>2017-07-25 07:24:59 +0200
commit5dd6be451372f44363bd0428c2e44cf912540e50 (patch)
treedda76b3059ed2358ce9eb8b0e6bf29a669eee791 /applications/luci-app-travelmate/luasrc/model/cbi/travelmate
parent31f77a3cfe3ff04d7c20d7ba6d2daacdcc9fbc5d (diff)
luci-app-travelmate: enhancements & fixes
* add re-ordering buttons in Station Overview * fix possible nil error during wifi scan Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-travelmate/luasrc/model/cbi/travelmate')
-rw-r--r--applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_order.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_order.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_order.lua
new file mode 100644
index 0000000000..5734841030
--- /dev/null
+++ b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_order.lua
@@ -0,0 +1,22 @@
+-- Copyright 2017 Dirk Brenken (dev@brenken.org)
+-- This is free software, licensed under the Apache License, Version 2.0
+
+local uci = require("luci.model.uci").cursor()
+local http = require("luci.http")
+local cfg = http.formvalue("cfg")
+local pos = http.formvalue("pos")
+local dir = http.formvalue("dir")
+
+if cfg ~= nil then
+ if dir == "up" then
+ pos = pos - 1
+ uci:reorder("wireless", cfg, pos)
+ elseif dir == "down" then
+ pos = pos + 1
+ uci:reorder("wireless", cfg, pos)
+ end
+ uci:save("wireless")
+ uci:commit("wireless")
+end
+
+http.redirect(luci.dispatcher.build_url("admin/services/travelmate/stations"))