* Separated OLSR pages into separate application pack
* Minor bugfixes and enhancements
This commit is contained in:
parent
dd9606825d
commit
9322801072
13 changed files with 48 additions and 25 deletions
|
@ -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
|
||||
end
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue