diff options
author | Steven Barth <steven@midlink.org> | 2008-06-02 20:16:05 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-06-02 20:16:05 +0000 |
commit | 561b0cfaa3fb8163d9ec74a3f96fd5b22ad54f33 (patch) | |
tree | 8b4b1765c70bae824bbad3006021cf7a4a775a34 | |
parent | 953510ccac9b9c6b3c1d8634897c0dddc92913e4 (diff) |
* Moved Freifunk status pages to admin-core and linked them in Freifunk
* luci/web: Added assign() to dispatcher to reference foreign nodes in the dispatching tree
-rw-r--r-- | libs/web/luasrc/dispatcher.lua | 23 | ||||
-rw-r--r-- | modules/admin-core/luasrc/controller/admin/status.lua | 2 | ||||
-rw-r--r-- | modules/admin-core/luasrc/controller/admin/status_olsr.lua (renamed from modules/freifunk/luasrc/controller/freifunk/olsr.lua) | 33 | ||||
-rw-r--r-- | modules/admin-core/luasrc/view/admin_status/iwscan.htm (renamed from modules/freifunk/luasrc/view/public_status/iwscan.htm) | 0 | ||||
-rw-r--r-- | modules/admin-core/luasrc/view/admin_status/routes.htm (renamed from modules/freifunk/luasrc/view/public_status/routes.htm) | 0 | ||||
-rw-r--r-- | modules/admin-core/luasrc/view/status-olsr/error_olsr.htm (renamed from modules/freifunk/luasrc/view/freifunk-olsr/error_olsr.htm) | 0 | ||||
-rw-r--r-- | modules/admin-core/luasrc/view/status-olsr/hna.htm (renamed from modules/freifunk/luasrc/view/freifunk-olsr/hna.htm) | 0 | ||||
-rw-r--r-- | modules/admin-core/luasrc/view/status-olsr/index.htm (renamed from modules/freifunk/luasrc/view/freifunk-olsr/index.htm) | 0 | ||||
-rw-r--r-- | modules/admin-core/luasrc/view/status-olsr/mid.htm (renamed from modules/freifunk/luasrc/view/freifunk-olsr/mid.htm) | 0 | ||||
-rw-r--r-- | modules/admin-core/luasrc/view/status-olsr/routes.htm (renamed from modules/freifunk/luasrc/view/freifunk-olsr/routes.htm) | 0 | ||||
-rw-r--r-- | modules/admin-core/luasrc/view/status-olsr/topology.htm (renamed from modules/freifunk/luasrc/view/freifunk-olsr/topology.htm) | 0 | ||||
-rw-r--r-- | modules/freifunk/luasrc/controller/freifunk/freifunk.lua | 13 |
12 files changed, 38 insertions, 33 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index cd481622b..e3d8ac0d4 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -293,20 +293,29 @@ function createtree() built_tree = true end --- Shortcut for creating a dispatching node -function entry(path, target, title, order, add) - add = add or {} +-- Reassigns a node to another position +function assign(path, clone, title, order) + local obj = node(path) + obj.nodes = nil + obj.module = nil + + obj.title = title + obj.order = order + + setmetatable(obj, {__index = clone}) + + return obj +end +-- Shortcut for creating a dispatching node +function entry(path, target, title, order) local c = node(path) + c.target = target c.title = title c.order = order c.module = getfenv(2)._NAME - for k,v in pairs(add) do - c[k] = v - end - return c end diff --git a/modules/admin-core/luasrc/controller/admin/status.lua b/modules/admin-core/luasrc/controller/admin/status.lua index 223f54b29..afd6804f7 100644 --- a/modules/admin-core/luasrc/controller/admin/status.lua +++ b/modules/admin-core/luasrc/controller/admin/status.lua @@ -6,6 +6,8 @@ function index() entry({"admin", "status"}, template("admin_status/index"), i18n("status", "Status"), 20) entry({"admin", "status", "syslog"}, call("action_syslog"), i18n("syslog", "Systemprotokoll")) + entry({"admin", "status", "routes"}, template("admin_status/routes"), "Routingtabelle", 10) + entry({"admin", "status", "iwscan"}, template("admin_status/iwscan"), "WLAN-Scan", 20) end function action_syslog() diff --git a/modules/freifunk/luasrc/controller/freifunk/olsr.lua b/modules/admin-core/luasrc/controller/admin/status_olsr.lua index ac143277d..cadda546e 100644 --- a/modules/freifunk/luasrc/controller/freifunk/olsr.lua +++ b/modules/admin-core/luasrc/controller/admin/status_olsr.lua @@ -1,28 +1,27 @@ -module("luci.controller.freifunk.olsr", package.seeall) +module("luci.controller.admin.status_olsr", package.seeall) require("luci.sys") function index() - local page = node("freifunk", "olsr") + local page = node("admin", "status", "olsr") page.target = call("action_index") page.title = "OLSR" - page.order = 30 - local page = node("freifunk", "olsr", "routes") + local page = node("admin", "status", "olsr", "routes") page.target = call("action_routes") page.title = "Routen" page.order = 10 - local page = node("freifunk", "olsr", "topology") + local page = node("admin", "status", "olsr", "topology") page.target = call("action_topology") page.title = "Topologie" page.order = 20 - local page = node("freifunk", "olsr", "hna") + local page = node("admin", "status", "olsr", "hna") page.target = call("action_hna") page.title = "HNA" page.order = 30 - local page = node("freifunk", "olsr", "mid") + local page = node("admin", "status", "olsr", "mid") page.target = call("action_mid") page.title = "MID" page.order = 50 @@ -32,7 +31,7 @@ function action_index() local data = fetch_txtinfo("links") if not data or not data.Links then - luci.template.render("freifunk-olsr/error_olsr") + luci.template.render("status-olsr/error_olsr") return nil end @@ -50,14 +49,14 @@ function action_index() table.sort(data.Links, compare) - luci.template.render("freifunk-olsr/index", {links=data.Links}) + luci.template.render("status-olsr/index", {links=data.Links}) end function action_routes() local data = fetch_txtinfo("routes") if not data or not data.Routes then - luci.template.render("freifunk-olsr/error_olsr") + luci.template.render("status-olsr/error_olsr") return nil end @@ -75,14 +74,14 @@ function action_routes() table.sort(data.Routes, compare) - luci.template.render("freifunk-olsr/routes", {routes=data.Routes}) + luci.template.render("status-olsr/routes", {routes=data.Routes}) end function action_topology() local data = fetch_txtinfo("topology") if not data or not data.Topology then - luci.template.render("freifunk-olsr/error_olsr") + luci.template.render("status-olsr/error_olsr") return nil end @@ -92,14 +91,14 @@ function action_topology() table.sort(data.Topology, compare) - luci.template.render("freifunk-olsr/topology", {routes=data.Topology}) + luci.template.render("status-olsr/topology", {routes=data.Topology}) end function action_hna() local data = fetch_txtinfo("hna") if not data or not data.HNA then - luci.template.render("freifunk-olsr/error_olsr") + luci.template.render("status-olsr/error_olsr") return nil end @@ -109,14 +108,14 @@ function action_hna() table.sort(data.HNA, compare) - luci.template.render("freifunk-olsr/hna", {routes=data.HNA}) + luci.template.render("status-olsr/hna", {routes=data.HNA}) end function action_mid() local data = fetch_txtinfo("mid") if not data or not data.MID then - luci.template.render("freifunk-olsr/error_olsr") + luci.template.render("status-olsr/error_olsr") return nil end @@ -126,7 +125,7 @@ function action_mid() table.sort(data.MID, compare) - luci.template.render("freifunk-olsr/mid", {mids=data.MID}) + luci.template.render("status-olsr/mid", {mids=data.MID}) end diff --git a/modules/freifunk/luasrc/view/public_status/iwscan.htm b/modules/admin-core/luasrc/view/admin_status/iwscan.htm index adba2d23e..adba2d23e 100644 --- a/modules/freifunk/luasrc/view/public_status/iwscan.htm +++ b/modules/admin-core/luasrc/view/admin_status/iwscan.htm diff --git a/modules/freifunk/luasrc/view/public_status/routes.htm b/modules/admin-core/luasrc/view/admin_status/routes.htm index 382b8290f..382b8290f 100644 --- a/modules/freifunk/luasrc/view/public_status/routes.htm +++ b/modules/admin-core/luasrc/view/admin_status/routes.htm diff --git a/modules/freifunk/luasrc/view/freifunk-olsr/error_olsr.htm b/modules/admin-core/luasrc/view/status-olsr/error_olsr.htm index 25426f50d..25426f50d 100644 --- a/modules/freifunk/luasrc/view/freifunk-olsr/error_olsr.htm +++ b/modules/admin-core/luasrc/view/status-olsr/error_olsr.htm diff --git a/modules/freifunk/luasrc/view/freifunk-olsr/hna.htm b/modules/admin-core/luasrc/view/status-olsr/hna.htm index c13369f42..c13369f42 100644 --- a/modules/freifunk/luasrc/view/freifunk-olsr/hna.htm +++ b/modules/admin-core/luasrc/view/status-olsr/hna.htm diff --git a/modules/freifunk/luasrc/view/freifunk-olsr/index.htm b/modules/admin-core/luasrc/view/status-olsr/index.htm index 0633d1f45..0633d1f45 100644 --- a/modules/freifunk/luasrc/view/freifunk-olsr/index.htm +++ b/modules/admin-core/luasrc/view/status-olsr/index.htm diff --git a/modules/freifunk/luasrc/view/freifunk-olsr/mid.htm b/modules/admin-core/luasrc/view/status-olsr/mid.htm index 6553237ea..6553237ea 100644 --- a/modules/freifunk/luasrc/view/freifunk-olsr/mid.htm +++ b/modules/admin-core/luasrc/view/status-olsr/mid.htm diff --git a/modules/freifunk/luasrc/view/freifunk-olsr/routes.htm b/modules/admin-core/luasrc/view/status-olsr/routes.htm index f3a0fd336..f3a0fd336 100644 --- a/modules/freifunk/luasrc/view/freifunk-olsr/routes.htm +++ b/modules/admin-core/luasrc/view/status-olsr/routes.htm diff --git a/modules/freifunk/luasrc/view/freifunk-olsr/topology.htm b/modules/admin-core/luasrc/view/status-olsr/topology.htm index c622026d4..c622026d4 100644 --- a/modules/freifunk/luasrc/view/freifunk-olsr/topology.htm +++ b/modules/admin-core/luasrc/view/status-olsr/topology.htm diff --git a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua index 89813b3d8..39ae5fe9a 100644 --- a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua +++ b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua @@ -27,16 +27,11 @@ function index() 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 + assign({"freifunk", "status", "routes"}, node("admin", "status", "routes"), "Routingtabelle", 10) + assign({"freifunk", "status", "iwscan"}, node("admin", "status", "iwscan"), "WLAN-Scan", 20) + + assign({"freifunk", "olsr"}, node("admin", "status", "olsr"), "OLSR", 30) local page = node("admin", "index", "freifunk") page.target = cbi("freifunk/freifunk") |