* Separated OLSR pages into separate application pack
authorSteven Barth <redacted>
Fri, 6 Jun 2008 15:50:21 +0000 (15:50 +0000)
committerSteven Barth <redacted>
Fri, 6 Jun 2008 15:50:21 +0000 (15:50 +0000)
* Minor bugfixes and enhancements

13 files changed:
applications/luci-olsr/luasrc/controller/olsr.lua [moved from modules/admin-core/luasrc/controller/admin/status_olsr.lua with 95% similarity]
applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua [moved from modules/admin-core/luasrc/model/cbi/admin_services/olsrd.lua with 100% similarity]
applications/luci-olsr/luasrc/view/status-olsr/error_olsr.htm [moved from modules/admin-core/luasrc/view/status-olsr/error_olsr.htm with 100% similarity]
applications/luci-olsr/luasrc/view/status-olsr/hna.htm [moved from modules/admin-core/luasrc/view/status-olsr/hna.htm with 100% similarity]
applications/luci-olsr/luasrc/view/status-olsr/index.htm [moved from modules/admin-core/luasrc/view/status-olsr/index.htm with 100% similarity]
applications/luci-olsr/luasrc/view/status-olsr/mid.htm [moved from modules/admin-core/luasrc/view/status-olsr/mid.htm with 100% similarity]
applications/luci-olsr/luasrc/view/status-olsr/routes.htm [moved from modules/admin-core/luasrc/view/status-olsr/routes.htm with 100% similarity]
applications/luci-olsr/luasrc/view/status-olsr/topology.htm [moved from modules/admin-core/luasrc/view/status-olsr/topology.htm with 100% similarity]
contrib/package/luci/Makefile
libs/core/luasrc/util.lua
libs/web/luasrc/dispatcher.lua
modules/admin-core/luasrc/controller/admin/services.lua
modules/freifunk/luasrc/controller/freifunk/freifunk.lua

similarity index 95%
rename from modules/admin-core/luasrc/controller/admin/status_olsr.lua
rename to applications/luci-olsr/luasrc/controller/olsr.lua
index cadda546ef8017a5362ef4cbc17021736971b943..0482a8fe70fa33875f0f0732bb827f69318d742d 100644 (file)
@@ -1,5 +1,4 @@
-module("luci.controller.admin.status_olsr", package.seeall)
-require("luci.sys")
+module("luci.controller.olsr", package.seeall)
 
 function index()
        local page  = node("admin", "status", "olsr")
@@ -25,6 +24,8 @@ function index()
        page.target = call("action_mid")
        page.title  = "MID"
        page.order  = 50
+
+       entry({"admin", "services", "olsrd"}, cbi("olsr/olsrd.lua"), "OLSRd")
 end
 
 function action_index()
@@ -131,6 +132,7 @@ end
 
 -- Internal
 function fetch_txtinfo(otable)
+       require("luci.sys")
        otable = otable or ""
        local rawdata = luci.sys.httpget("http://127.0.0.1:2006/"..otable)
        
@@ -160,4 +162,4 @@ function fetch_txtinfo(otable)
        end
        
        return data
-end
\ No newline at end of file
+end
index 5c6d06a40f94ad62bc5d7a88a07d58ad6fa5815c..d95d91c1d7efb651a66bf9ffbbc9637422b575d9 100644 (file)
@@ -152,7 +152,7 @@ endef
 define Package/luci-ff-halle
   $(call Package/luci/fftemplate)
   DEPENDS+= \
-   +luci-sgi-haserl +luci-app-splash \
+   +luci-sgi-haserl +luci-app-splash +luci-app-olsr \
    +luci-app-ffwizard-leipzig \
    +luci-theme-fledermaus \
    +luci-i18n-german \
@@ -170,7 +170,7 @@ endef
 define Package/luci-ff-leipzig
   $(call Package/luci/fftemplate)
   DEPENDS+= \
-   +luci-sgi-haserl +luci-app-splash \
+   +luci-sgi-haserl +luci-app-splash +luci-app-olsr \
    +luci-app-ffwizard-leipzig \
    +luci-theme-fledermaus \
    +luci-i18n-german \
@@ -188,7 +188,7 @@ endef
 define Package/luci-ff-hannover
   $(call Package/luci/fftemplate)
   DEPENDS+= \
-   +luci-sgi-haserl +luci-app-splash \
+   +luci-sgi-haserl +luci-app-splash +luci-app-olsr \
    +luci-theme-fledermaus \
    +luci-i18n-german \
    +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice
@@ -261,6 +261,17 @@ define Package/luci-app-firewall/install
 endef
 
 
+define Package/luci-app-olsr
+  $(call Package/luci/webtemplate)
+  DEPENDS+=+luci-mod-admin-core +olsrd-mod-txtinfo
+  TITLE:=OLSR configuration and status module
+endef
+
+define Package/luci-app-olsr/install
+       $(call Package/luci/install/template,$(1),applications/luci-olsr)
+endef
+
+
 define Package/luci-app-splash
   $(call Package/luci/fftemplate)
   DEPENDS+=+luci-sgi-haserl +iptables-mod-nat +iptables-mod-ipopt
@@ -404,6 +415,9 @@ endif
 ifneq ($(CONFIG_PACKAGE_luci-app-firewall),)
        PKG_SELECTED_MODULES+=applications/luci-fw
 endif
+ifneq ($(CONFIG_PACKAGE_luci-app-olsr),)
+       PKG_SELECTED_MODULES+=applications/luci-olsr
+endif
 ifneq ($(CONFIG_PACKAGE_luci-app-splash),)
        PKG_SELECTED_MODULES+=applications/luci-splash
 endif
@@ -451,6 +465,7 @@ $(eval $(call BuildPackage,luci-mod-freifunk))
 
 $(eval $(call BuildPackage,luci-app-ffwizard-leipzig))
 $(eval $(call BuildPackage,luci-app-firewall))
+$(eval $(call BuildPackage,luci-app-olsr))
 $(eval $(call BuildPackage,luci-app-splash))
 $(eval $(call BuildPackage,luci-app-statistics))
 
index 074b43519a88d0f88d76adc5a16d9c8f1619609b..343c62725999a1827f3d6d9ae84f04294794bd56 100644 (file)
@@ -107,7 +107,7 @@ end
 function dumptable(t, i)
        i = i or 0
        for k,v in pairs(t) do
-               print(string.rep("\t", i) .. k, v)
+               print(string.rep("\t", i) .. tostring(k), tostring(v))
                if type(v) == "table" then
                        dumptable(v, i+1)
                end
index 7ff4031a62d44fe71a3ff41bb772b422324c5675..99ba9adca3a425024b929f4ebed4b52f895f8349 100644 (file)
@@ -99,10 +99,9 @@ end
 -- Creates a request object for dispatching
 function httpdispatch()
        local pathinfo = luci.http.env.PATH_INFO or ""
-       local c = tree
 
-       for s in pathinfo:gmatch("([%w-]+)") do
-               table.insert(request, s)
+       for node in pathinfo:gmatch("[^/]+") do
+               table.insert(request, node)
        end
 
        dispatch()
@@ -163,7 +162,7 @@ function dispatch()
        tpl.viewns.media       = luci.config.main.mediaurlbase
        tpl.viewns.resource    = luci.config.main.resourcebase
        tpl.viewns.uci         = require("luci.model.uci").config
-       tpl.viewns.REQUEST_URI = luci.http.env.SCRIPT_NAME .. luci.http.env.PATH_INFO
+       tpl.viewns.REQUEST_URI = luci.http.env.SCRIPT_NAME .. (luci.http.env.PATH_INFO or "")
        
 
        if c and type(c.target) == "function" then
@@ -304,7 +303,16 @@ function assign(path, clone, title, order)
        obj.title = title
        obj.order = order
        
-       setmetatable(obj, {__index = clone})
+       local c = tree
+       for k, v in ipairs(clone) do
+               if not c.nodes[v] then
+                       c.nodes[v] = {nodes={}}
+               end
+
+               c = c.nodes[v]
+       end
+       
+       setmetatable(obj, {__index = c})
        
        return obj
 end
@@ -325,18 +333,22 @@ end
 function node(...)
        local c = tree
 
-       if arg[1] and type(arg[1]) == "table" then
-               arg = arg[1]
+       arg.n = nil
+       if arg[1] then
+               if type(arg[1]) == "table" then
+                       arg = arg[1]
+               end
        end
 
        for k,v in ipairs(arg) do
                if not c.nodes[v] then
-                       c.nodes[v] = {nodes={}, module=getfenv(2)._NAME}
+                       c.nodes[v] = {nodes={}}
                end
 
                c = c.nodes[v]
        end
 
+       c.module = getfenv(2)._NAME
        c.path = arg
 
        return c
index 8a2aa65c47b938d04edd2d37136b04619e73f0e6..b0024fb4ad862ef32912777706ff4bebf8e6b340 100644 (file)
@@ -23,10 +23,4 @@ function index()
        page.target = cbi("admin_services/dnsmasq")
        page.title  = "Dnsmasq"
        page.order  = 30
-       
-       if luci.fs.isfile("/etc/config/olsr") then
-               local page  = node("admin", "services", "olsr")
-               page.target = cbi("admin_services/olsrd")
-               page.title  = "OLSR"
-       end
 end
\ No newline at end of file
index 43d124625f194bec869fc26596b1f1fea5c66cdc..636b9fcd376867a1dc0461074619a9bf48005a92 100644 (file)
@@ -30,13 +30,13 @@ function index()
        page.setuser  = false
        page.setgroup = false
        
-       assign({"freifunk", "status", "routes"}, node("admin", "status", "routes"), "Routingtabelle", 10)
-       assign({"freifunk", "status", "iwscan"}, node("admin", "status", "iwscan"), "WLAN-Scan", 20)
+       assign({"freifunk", "status", "routes"}, {"admin", "status", "routes"}, "Routingtabelle", 10)
+       assign({"freifunk", "status", "iwscan"}, {"admin", "status", "iwscan"}, "WLAN-Scan", 20)
        
-       assign({"freifunk", "olsr"}, node("admin", "status", "olsr"), "OLSR", 30)
+       assign({"freifunk", "olsr"}, {"admin", "status", "olsr"}, "OLSR", 30)
        
        if luci.fs.isfile("/etc/config/luci_statistics") then
-               assign({"freifunk", "statistics"}, node("admin", "statistics", "graph"), i18n("stat_statistics", "Statistiken"), 40)
+               assign({"freifunk", "statistics"}, {"admin", "statistics", "graph"}, i18n("stat_statistics", "Statistiken"), 40)
        end
        
        local page  = node("admin", "index", "freifunk")
git clone https://git.99rst.org/PROJECT