summaryrefslogtreecommitdiffhomepage
path: root/modules/freifunk/src/controller/public
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-05-22 14:04:03 +0000
committerSteven Barth <steven@midlink.org>2008-05-22 14:04:03 +0000
commit6604399aa8f35d33c53a5e5a1fea765f401aef5e (patch)
treeed818d630634a98a8996a1ba6d10e63bbea17c39 /modules/freifunk/src/controller/public
parentf738eb786e3d30028310c7bcc447e7e7b63767e0 (diff)
Merge branch 'menu'
Diffstat (limited to 'modules/freifunk/src/controller/public')
-rw-r--r--modules/freifunk/src/controller/public/index.lua1
-rw-r--r--modules/freifunk/src/controller/public/olsr.lua137
-rw-r--r--modules/freifunk/src/controller/public/status.lua21
3 files changed, 0 insertions, 159 deletions
diff --git a/modules/freifunk/src/controller/public/index.lua b/modules/freifunk/src/controller/public/index.lua
deleted file mode 100644
index f65478c05..000000000
--- 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/olsr.lua b/modules/freifunk/src/controller/public/olsr.lua
deleted file mode 100644
index d41f5ed41..000000000
--- a/modules/freifunk/src/controller/public/olsr.lua
+++ /dev/null
@@ -1,137 +0,0 @@
-module("ffluci.controller.public.olsr", package.seeall)
-require("ffluci.sys")
-
-function action_index()
- local data = fetch_txtinfo("links")
-
- if not data or not data.Links then
- ffluci.template.render("public_olsr/error_olsr")
- return nil
- end
-
- local function compare(a, b)
- if tonumber(a.ETX) == 0 then
- return false
- end
-
- if tonumber(b.ETX) == 0 then
- return true
- end
-
- return tonumber(a.ETX) < tonumber(b.ETX)
- end
-
- table.sort(data.Links, compare)
-
- ffluci.template.render("public_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")
- return nil
- end
-
- local function compare(a, b)
- if tonumber(a.ETX) == 0 then
- return false
- end
-
- if tonumber(b.ETX) == 0 then
- return true
- end
-
- return tonumber(a.ETX) < tonumber(b.ETX)
- end
-
- table.sort(data.Routes, compare)
-
- ffluci.template.render("public_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")
- return nil
- end
-
- local function compare(a, b)
- return a["Destination IP"] < b["Destination IP"]
- end
-
- table.sort(data.Topology, compare)
-
- ffluci.template.render("public_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")
- return nil
- end
-
- local function compare(a, b)
- return a.Network < b.Network
- end
-
- table.sort(data.HNA, compare)
-
- ffluci.template.render("public_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")
- return nil
- end
-
- local function compare(a, b)
- return a.IP < b.IP
- end
-
- table.sort(data.MID, compare)
-
- ffluci.template.render("public_olsr/mid", {mids=data.MID})
-end
-
-
--- Internal
-function fetch_txtinfo(otable)
- otable = otable or ""
- local rawdata = ffluci.sys.httpget("http://127.0.0.1:2006/"..otable)
-
- if #rawdata == 0 then
- return nil
- end
-
- local data = {}
-
- local tables = ffluci.util.split(ffluci.util.trim(rawdata), "\n\n")
-
-
- for i, tbl in ipairs(tables) do
- local lines = ffluci.util.split(tbl, "\n")
- local name = table.remove(lines, 1):sub(8)
- local keys = ffluci.util.split(table.remove(lines, 1), "\t")
-
- data[name] = {}
-
- for j, line in ipairs(lines) do
- local fields = ffluci.util.split(line, "\t")
- data[name][j] = {}
- for k, key in pairs(keys) do
- data[name][j][key] = fields[k]
- end
- end
- end
-
- return data
-end \ 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 8d2f7a303..000000000
--- 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
-
-