* Moved Freifunk status pages to admin-core and linked them in Freifunk
authorSteven Barth <redacted>
Mon, 2 Jun 2008 20:16:05 +0000 (20:16 +0000)
committerSteven Barth <redacted>
Mon, 2 Jun 2008 20:16:05 +0000 (20:16 +0000)
* luci/web: Added assign() to dispatcher to reference foreign nodes in the dispatching tree

12 files changed:
libs/web/luasrc/dispatcher.lua
modules/admin-core/luasrc/controller/admin/status.lua
modules/admin-core/luasrc/controller/admin/status_olsr.lua [moved from modules/freifunk/luasrc/controller/freifunk/olsr.lua with 73% similarity]
modules/admin-core/luasrc/view/admin_status/iwscan.htm [moved from modules/freifunk/luasrc/view/public_status/iwscan.htm with 100% similarity]
modules/admin-core/luasrc/view/admin_status/routes.htm [moved from modules/freifunk/luasrc/view/public_status/routes.htm with 100% similarity]
modules/admin-core/luasrc/view/status-olsr/error_olsr.htm [moved from modules/freifunk/luasrc/view/freifunk-olsr/error_olsr.htm with 100% similarity]
modules/admin-core/luasrc/view/status-olsr/hna.htm [moved from modules/freifunk/luasrc/view/freifunk-olsr/hna.htm with 100% similarity]
modules/admin-core/luasrc/view/status-olsr/index.htm [moved from modules/freifunk/luasrc/view/freifunk-olsr/index.htm with 100% similarity]
modules/admin-core/luasrc/view/status-olsr/mid.htm [moved from modules/freifunk/luasrc/view/freifunk-olsr/mid.htm with 100% similarity]
modules/admin-core/luasrc/view/status-olsr/routes.htm [moved from modules/freifunk/luasrc/view/freifunk-olsr/routes.htm with 100% similarity]
modules/admin-core/luasrc/view/status-olsr/topology.htm [moved from modules/freifunk/luasrc/view/freifunk-olsr/topology.htm with 100% similarity]
modules/freifunk/luasrc/controller/freifunk/freifunk.lua

index cd481622b8f4e0bb06450ee72a5889f344978e5c..e3d8ac0d483e490791b21cda527b679e8cf3014f 100644 (file)
@@ -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
 
index 223f54b2953c7d5019e995e997176baaec30cccc..afd6804f79a25e7e7431af5df017c339e664f32b 100644 (file)
@@ -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()
similarity index 73%
rename from modules/freifunk/luasrc/controller/freifunk/olsr.lua
rename to modules/admin-core/luasrc/controller/admin/status_olsr.lua
index ac143277dbbab896f31bd13d2071e36ba891e9bd..cadda546ef8017a5362ef4cbc17021736971b943 100644 (file)
@@ -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
 
 
index 89813b3d8ddfe03913c433c2efa3c4db9b5d3e47..39ae5fe9add4186640a1e5ab815a65f8323dea91 100644 (file)
@@ -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")
git clone https://git.99rst.org/PROJECT