diff options
-rw-r--r-- | applications/luci-olsr/luasrc/controller/olsr.lua (renamed from modules/admin-core/luasrc/controller/admin/status_olsr.lua) | 8 | ||||
-rw-r--r-- | applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua (renamed from modules/admin-core/luasrc/model/cbi/admin_services/olsrd.lua) | 0 | ||||
-rw-r--r-- | applications/luci-olsr/luasrc/view/status-olsr/error_olsr.htm (renamed from modules/admin-core/luasrc/view/status-olsr/error_olsr.htm) | 0 | ||||
-rw-r--r-- | applications/luci-olsr/luasrc/view/status-olsr/hna.htm (renamed from modules/admin-core/luasrc/view/status-olsr/hna.htm) | 0 | ||||
-rw-r--r-- | applications/luci-olsr/luasrc/view/status-olsr/index.htm (renamed from modules/admin-core/luasrc/view/status-olsr/index.htm) | 0 | ||||
-rw-r--r-- | applications/luci-olsr/luasrc/view/status-olsr/mid.htm (renamed from modules/admin-core/luasrc/view/status-olsr/mid.htm) | 0 | ||||
-rw-r--r-- | applications/luci-olsr/luasrc/view/status-olsr/routes.htm (renamed from modules/admin-core/luasrc/view/status-olsr/routes.htm) | 0 | ||||
-rw-r--r-- | applications/luci-olsr/luasrc/view/status-olsr/topology.htm (renamed from modules/admin-core/luasrc/view/status-olsr/topology.htm) | 0 | ||||
-rw-r--r-- | contrib/package/luci/Makefile | 21 | ||||
-rw-r--r-- | libs/core/luasrc/util.lua | 2 | ||||
-rw-r--r-- | libs/web/luasrc/dispatcher.lua | 28 | ||||
-rw-r--r-- | modules/admin-core/luasrc/controller/admin/services.lua | 6 | ||||
-rw-r--r-- | modules/freifunk/luasrc/controller/freifunk/freifunk.lua | 8 |
13 files changed, 48 insertions, 25 deletions
diff --git a/modules/admin-core/luasrc/controller/admin/status_olsr.lua b/applications/luci-olsr/luasrc/controller/olsr.lua index cadda546e..0482a8fe7 100644 --- a/modules/admin-core/luasrc/controller/admin/status_olsr.lua +++ b/applications/luci-olsr/luasrc/controller/olsr.lua @@ -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 diff --git a/modules/admin-core/luasrc/model/cbi/admin_services/olsrd.lua b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua index 3e3c68dff..3e3c68dff 100644 --- a/modules/admin-core/luasrc/model/cbi/admin_services/olsrd.lua +++ b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua diff --git a/modules/admin-core/luasrc/view/status-olsr/error_olsr.htm b/applications/luci-olsr/luasrc/view/status-olsr/error_olsr.htm index 25426f50d..25426f50d 100644 --- a/modules/admin-core/luasrc/view/status-olsr/error_olsr.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/error_olsr.htm diff --git a/modules/admin-core/luasrc/view/status-olsr/hna.htm b/applications/luci-olsr/luasrc/view/status-olsr/hna.htm index c13369f42..c13369f42 100644 --- a/modules/admin-core/luasrc/view/status-olsr/hna.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/hna.htm diff --git a/modules/admin-core/luasrc/view/status-olsr/index.htm b/applications/luci-olsr/luasrc/view/status-olsr/index.htm index 0633d1f45..0633d1f45 100644 --- a/modules/admin-core/luasrc/view/status-olsr/index.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/index.htm diff --git a/modules/admin-core/luasrc/view/status-olsr/mid.htm b/applications/luci-olsr/luasrc/view/status-olsr/mid.htm index 6553237ea..6553237ea 100644 --- a/modules/admin-core/luasrc/view/status-olsr/mid.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/mid.htm diff --git a/modules/admin-core/luasrc/view/status-olsr/routes.htm b/applications/luci-olsr/luasrc/view/status-olsr/routes.htm index f3a0fd336..f3a0fd336 100644 --- a/modules/admin-core/luasrc/view/status-olsr/routes.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/routes.htm diff --git a/modules/admin-core/luasrc/view/status-olsr/topology.htm b/applications/luci-olsr/luasrc/view/status-olsr/topology.htm index c622026d4..c622026d4 100644 --- a/modules/admin-core/luasrc/view/status-olsr/topology.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/topology.htm diff --git a/contrib/package/luci/Makefile b/contrib/package/luci/Makefile index 5c6d06a40..d95d91c1d 100644 --- a/contrib/package/luci/Makefile +++ b/contrib/package/luci/Makefile @@ -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)) diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index 074b43519..343c62725 100644 --- a/libs/core/luasrc/util.lua +++ b/libs/core/luasrc/util.lua @@ -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 diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 7ff4031a6..99ba9adca 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -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 diff --git a/modules/admin-core/luasrc/controller/admin/services.lua b/modules/admin-core/luasrc/controller/admin/services.lua index 8a2aa65c4..b0024fb4a 100644 --- a/modules/admin-core/luasrc/controller/admin/services.lua +++ b/modules/admin-core/luasrc/controller/admin/services.lua @@ -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 diff --git a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua index 43d124625..636b9fcd3 100644 --- a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua +++ b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua @@ -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") |