summaryrefslogtreecommitdiffhomepage
path: root/modules/freifunk/src/controller
diff options
context:
space:
mode:
Diffstat (limited to 'modules/freifunk/src/controller')
-rw-r--r--modules/freifunk/src/controller/freifunk/freifunk.lua (renamed from modules/freifunk/src/controller/admin/index/wizard.lua)79
-rw-r--r--modules/freifunk/src/controller/freifunk/luciinfo.lua (renamed from modules/freifunk/src/controller/rpc/luciinfo.lua)14
-rw-r--r--modules/freifunk/src/controller/freifunk/olsr.lua (renamed from modules/freifunk/src/controller/public/olsr.lua)49
-rw-r--r--modules/freifunk/src/controller/public/index.lua1
-rw-r--r--modules/freifunk/src/controller/public/status.lua21
-rw-r--r--modules/freifunk/src/controller/sudo/status.lua1
6 files changed, 123 insertions, 42 deletions
diff --git a/modules/freifunk/src/controller/admin/index/wizard.lua b/modules/freifunk/src/controller/freifunk/freifunk.lua
index efca38d21b..e73ec263cb 100644
--- a/modules/freifunk/src/controller/admin/index/wizard.lua
+++ b/modules/freifunk/src/controller/freifunk/freifunk.lua
@@ -1,6 +1,79 @@
-module("ffluci.controller.admin.index.wizard", package.seeall)
+module("ffluci.controller.freifunk.freifunk", package.seeall)
-function action()
+function index()
+ local page = node()
+ page.target = alias("freifunk")
+
+ local page = node("freifunk")
+ page.title = "Freifunk"
+ page.target = alias("freifunk", "index")
+ page.order = 5
+ page.setuser = "nobody"
+ page.setgroup = "nogroup"
+
+ local page = node("freifunk", "index")
+ page.target = template("freifunk/index")
+ page.title = "Übersicht"
+ page.order = 10
+
+ local page = node("freifunk", "index", "contact")
+ page.target = template("freifunk/contact")
+ page.title = "Kontakt"
+
+
+ local page = node("freifunk", "status")
+ page.target = action_status
+ page.title = "Status"
+ page.order = 20
+ page.setuser = false
+ page.setgroup = false
+
+ local page = node("freifunk", "status", "routes")
+ page.target = template("public_status/routes")
+ page.title = "Routingtabelle"
+ page.order = 10
+
+ local page = node("freifunk", "status", "iwscan")
+ page.target = template("public_status/iwscan")
+ page.title = "WLAN-Scan"
+ page.order = 20
+
+
+ local page = node("admin", "index", "wizard")
+ page.target = action_wizard
+ page.title = "Freifunkassistent"
+ page.order = 20
+
+ local page = node("admin", "index", "freifunk")
+ page.target = cbi("freifunk/freifunk")
+ page.title = "Freifunk"
+ page.order = 30
+
+ local page = node("admin", "index", "contact")
+ page.target = cbi("freifunk/contact")
+ page.title = "Kontakt"
+ page.order = 40
+end
+
+function action_status()
+ local data = {}
+
+ data.s, data.m, data.r = ffluci.sys.sysinfo()
+
+ data.wifi = ffluci.sys.wifi.getiwconfig()
+
+ data.routes = {}
+ for i, r in pairs(ffluci.sys.net.routes()) do
+ if r.Destination == "00000000" then
+ table.insert(data.routes, r)
+ end
+ end
+
+
+ ffluci.template.render("public_status/index", data)
+end
+
+function action_wizard()
if ffluci.http.formvalue("ip") then
return configure_freifunk()
end
@@ -16,7 +89,7 @@ function action()
end
end
- ffluci.template.render("admin_index/wizard", {ifaces=ifaces})
+ ffluci.template.render("freifunk/wizard", {ifaces=ifaces})
end
function configure_freifunk()
diff --git a/modules/freifunk/src/controller/rpc/luciinfo.lua b/modules/freifunk/src/controller/freifunk/luciinfo.lua
index 611423fbb0..bc45898d9c 100644
--- a/modules/freifunk/src/controller/rpc/luciinfo.lua
+++ b/modules/freifunk/src/controller/freifunk/luciinfo.lua
@@ -1,4 +1,8 @@
-module("ffluci.controller.rpc.luciinfo", package.seeall)
+module("ffluci.controller.freifunk.luciinfo", package.seeall)
+
+function index()
+ node("freifunk", "luciinfo").target = action_index
+end
function action_index()
local uci = ffluci.model.uci.StateSession()
@@ -7,7 +11,7 @@ function action_index()
-- General
print("luciinfo.api=1")
- print("luciinfo.version=" .. tostring(ffluci.__version__))
+ print("luciinfo.version=" .. tostring(require("ffluci").__version__))
-- Sysinfo
local s, m, r = ffluci.sys.sysinfo()
@@ -28,11 +32,11 @@ function action_index()
-- Freifunk
local ff = uci:sections("freifunk") or {}
for k, v in pairs(ff) do
- if k:sub(1, 1) ~= "." then
for i, j in pairs(v) do
- print("freifunk." .. k .. "." .. i .. "=" .. j)
+ if i:sub(1, 1) ~= "." then
+ print("freifunk." .. k .. "." .. i .. "=" .. j)
+ end
end
- end
end
end
diff --git a/modules/freifunk/src/controller/public/olsr.lua b/modules/freifunk/src/controller/freifunk/olsr.lua
index d41f5ed41d..6031cd4317 100644
--- a/modules/freifunk/src/controller/public/olsr.lua
+++ b/modules/freifunk/src/controller/freifunk/olsr.lua
@@ -1,11 +1,38 @@
-module("ffluci.controller.public.olsr", package.seeall)
+module("ffluci.controller.freifunk.olsr", package.seeall)
require("ffluci.sys")
+function index()
+ local page = node("freifunk", "olsr")
+ page.target = action_index
+ page.title = "OLSR"
+ page.order = 30
+
+ local page = node("freifunk", "olsr", "routes")
+ page.target = action_routes
+ page.title = "Routen"
+ page.order = 10
+
+ local page = node("freifunk", "olsr", "topology")
+ page.target = action_topology
+ page.title = "Topologie"
+ page.order = 20
+
+ local page = node("freifunk", "olsr", "hna")
+ page.target = action_hna
+ page.title = "HNA"
+ page.order = 30
+
+ local page = node("freifunk", "olsr", "mid")
+ page.target = action_mid
+ page.title = "MID"
+ page.order = 50
+end
+
function action_index()
local data = fetch_txtinfo("links")
if not data or not data.Links then
- ffluci.template.render("public_olsr/error_olsr")
+ ffluci.template.render("freifunk-olsr/error_olsr")
return nil
end
@@ -23,14 +50,14 @@ function action_index()
table.sort(data.Links, compare)
- ffluci.template.render("public_olsr/index", {links=data.Links})
+ ffluci.template.render("freifunk-olsr/index", {links=data.Links})
end
function action_routes()
local data = fetch_txtinfo("routes")
if not data or not data.Routes then
- ffluci.template.render("public_olsr/error_olsr")
+ ffluci.template.render("freifunk-olsr/error_olsr")
return nil
end
@@ -48,14 +75,14 @@ function action_routes()
table.sort(data.Routes, compare)
- ffluci.template.render("public_olsr/routes", {routes=data.Routes})
+ ffluci.template.render("freifunk-olsr/routes", {routes=data.Routes})
end
function action_topology()
local data = fetch_txtinfo("topology")
if not data or not data.Topology then
- ffluci.template.render("public_olsr/error_olsr")
+ ffluci.template.render("freifunk-olsr/error_olsr")
return nil
end
@@ -65,14 +92,14 @@ function action_topology()
table.sort(data.Topology, compare)
- ffluci.template.render("public_olsr/topology", {routes=data.Topology})
+ ffluci.template.render("freifunk-olsr/topology", {routes=data.Topology})
end
function action_hna()
local data = fetch_txtinfo("hna")
if not data or not data.HNA then
- ffluci.template.render("public_olsr/error_olsr")
+ ffluci.template.render("freifunk-olsr/error_olsr")
return nil
end
@@ -82,14 +109,14 @@ function action_hna()
table.sort(data.HNA, compare)
- ffluci.template.render("public_olsr/hna", {routes=data.HNA})
+ ffluci.template.render("freifunk-olsr/hna", {routes=data.HNA})
end
function action_mid()
local data = fetch_txtinfo("mid")
if not data or not data.MID then
- ffluci.template.render("public_olsr/error_olsr")
+ ffluci.template.render("freifunk-olsr/error_olsr")
return nil
end
@@ -99,7 +126,7 @@ function action_mid()
table.sort(data.MID, compare)
- ffluci.template.render("public_olsr/mid", {mids=data.MID})
+ ffluci.template.render("freifunk-olsr/mid", {mids=data.MID})
end
diff --git a/modules/freifunk/src/controller/public/index.lua b/modules/freifunk/src/controller/public/index.lua
deleted file mode 100644
index f65478c05f..0000000000
--- a/modules/freifunk/src/controller/public/index.lua
+++ /dev/null
@@ -1 +0,0 @@
-module("ffluci.controller.public.index", package.seeall) \ No newline at end of file
diff --git a/modules/freifunk/src/controller/public/status.lua b/modules/freifunk/src/controller/public/status.lua
deleted file mode 100644
index 8d2f7a303f..0000000000
--- a/modules/freifunk/src/controller/public/status.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-module("ffluci.controller.public.status", package.seeall)
-
-function action_index()
- local data = {}
-
- data.s, data.m, data.r = ffluci.sys.sysinfo()
-
- data.wifi = ffluci.sys.wifi.getiwconfig()
-
- data.routes = {}
- for i, r in pairs(ffluci.sys.net.routes()) do
- if r.Destination == "00000000" then
- table.insert(data.routes, r)
- end
- end
-
-
- ffluci.template.render("public_status/index", data)
-end
-
-
diff --git a/modules/freifunk/src/controller/sudo/status.lua b/modules/freifunk/src/controller/sudo/status.lua
deleted file mode 100644
index fd5127d2cf..0000000000
--- a/modules/freifunk/src/controller/sudo/status.lua
+++ /dev/null
@@ -1 +0,0 @@
-module("ffluci.controller.sudo.status", package.seeall) \ No newline at end of file