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

21 files changed:
applications/luci-olsr/luasrc/controller/olsr.lua [new file with mode: 0644]
applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua [new file with mode: 0644]
applications/luci-olsr/luasrc/view/status-olsr/error_olsr.htm [new file with mode: 0644]
applications/luci-olsr/luasrc/view/status-olsr/hna.htm [new file with mode: 0644]
applications/luci-olsr/luasrc/view/status-olsr/index.htm [new file with mode: 0644]
applications/luci-olsr/luasrc/view/status-olsr/mid.htm [new file with mode: 0644]
applications/luci-olsr/luasrc/view/status-olsr/routes.htm [new file with mode: 0644]
applications/luci-olsr/luasrc/view/status-olsr/topology.htm [new file with mode: 0644]
contrib/package/luci/Makefile
libs/core/luasrc/util.lua
libs/web/luasrc/dispatcher.lua
modules/admin-core/luasrc/controller/admin/services.lua
modules/admin-core/luasrc/controller/admin/status_olsr.lua [deleted file]
modules/admin-core/luasrc/model/cbi/admin_services/olsrd.lua [deleted file]
modules/admin-core/luasrc/view/status-olsr/error_olsr.htm [deleted file]
modules/admin-core/luasrc/view/status-olsr/hna.htm [deleted file]
modules/admin-core/luasrc/view/status-olsr/index.htm [deleted file]
modules/admin-core/luasrc/view/status-olsr/mid.htm [deleted file]
modules/admin-core/luasrc/view/status-olsr/routes.htm [deleted file]
modules/admin-core/luasrc/view/status-olsr/topology.htm [deleted file]
modules/freifunk/luasrc/controller/freifunk/freifunk.lua

diff --git a/applications/luci-olsr/luasrc/controller/olsr.lua b/applications/luci-olsr/luasrc/controller/olsr.lua
new file mode 100644 (file)
index 0000000..0482a8f
--- /dev/null
@@ -0,0 +1,165 @@
+module("luci.controller.olsr", package.seeall)
+
+function index()
+       local page  = node("admin", "status", "olsr")
+       page.target = call("action_index")
+       page.title  = "OLSR"
+       
+       local page  = node("admin", "status", "olsr", "routes")
+       page.target = call("action_routes")
+       page.title  = "Routen"
+       page.order  = 10
+       
+       local page  = node("admin", "status", "olsr", "topology")
+       page.target = call("action_topology")
+       page.title  = "Topologie"
+       page.order  = 20
+       
+       local page  = node("admin", "status", "olsr", "hna")
+       page.target = call("action_hna")
+       page.title  = "HNA"
+       page.order  = 30
+       
+       local page  = node("admin", "status", "olsr", "mid")
+       page.target = call("action_mid")
+       page.title  = "MID"
+       page.order  = 50
+
+       entry({"admin", "services", "olsrd"}, cbi("olsr/olsrd.lua"), "OLSRd")
+end
+
+function action_index()
+       local data = fetch_txtinfo("links")
+       
+       if not data or not data.Links then
+               luci.template.render("status-olsr/error_olsr")
+               return nil
+       end
+       
+       local function compare(a, b)
+               if tonumber(a.ETX) == 0 then
+                       return false
+               end
+               
+               if tonumber(b.ETX) == 0 then
+                       return true
+               end
+               
+               return tonumber(a.ETX) < tonumber(b.ETX)
+       end
+       
+       table.sort(data.Links, compare)
+       
+       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("status-olsr/error_olsr")
+               return nil
+       end
+       
+       local function compare(a, b)
+               if tonumber(a.ETX) == 0 then
+                       return false
+               end
+               
+               if tonumber(b.ETX) == 0 then
+                       return true
+               end
+               
+               return tonumber(a.ETX) < tonumber(b.ETX)
+       end
+       
+       table.sort(data.Routes, compare)
+       
+       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("status-olsr/error_olsr")
+               return nil
+       end
+       
+       local function compare(a, b)
+               return a["Destination IP"] < b["Destination IP"]
+       end
+       
+       table.sort(data.Topology, compare)
+       
+       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("status-olsr/error_olsr")
+               return nil
+       end
+       
+       local function compare(a, b)
+               return a.Network < b.Network
+       end
+       
+       table.sort(data.HNA, compare)
+       
+       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("status-olsr/error_olsr")
+               return nil
+       end
+       
+       local function compare(a, b)
+               return a.IP < b.IP
+       end
+       
+       table.sort(data.MID, compare)
+       
+       luci.template.render("status-olsr/mid", {mids=data.MID})
+end
+
+
+-- Internal
+function fetch_txtinfo(otable)
+       require("luci.sys")
+       otable = otable or ""
+       local rawdata = luci.sys.httpget("http://127.0.0.1:2006/"..otable)
+       
+       if #rawdata == 0 then
+               return nil
+       end
+       
+       local data = {}
+       
+       local tables = luci.util.split(luci.util.trim(rawdata), "\n\n")
+       
+
+       for i, tbl in ipairs(tables) do
+               local lines = luci.util.split(tbl, "\n")
+               local name  = table.remove(lines, 1):sub(8)
+               local keys  = luci.util.split(table.remove(lines, 1), "\t")
+               
+               data[name] = {}
+               
+               for j, line in ipairs(lines) do
+                       local fields = luci.util.split(line, "\t")
+                       data[name][j] = {}
+                       for k, key in pairs(keys) do
+                               data[name][j][key] = fields[k] 
+                       end
+               end
+       end
+       
+       return data
+end
diff --git a/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua
new file mode 100644 (file)
index 0000000..3e3c68d
--- /dev/null
@@ -0,0 +1,90 @@
+-- ToDo: Autodetect things, Translate, Add descriptions
+require("luci.fs")
+
+m = Map("olsr", "OLSR", [[OLSR ist ein flexibles Routingprotokoll, 
+dass den Aufbau von mobilen Ad-Hoc Netzen unterstützt.]])
+
+s = m:section(NamedSection, "general", "olsr", "Allgemeine Einstellungen")
+
+debug = s:option(ListValue, "DebugLevel", "Debugmodus")
+for i=0, 9 do
+       debug:value(i)
+end
+
+ipv = s:option(ListValue, "IpVersion", "Internet Protokoll")
+ipv:value("4", "IPv4")
+ipv:value("6", "IPv6")
+
+noint = s:option(Flag, "AllowNoInt", "Start ohne Netzwerk")
+noint.enabled = "yes"
+noint.disabled = "no"
+
+s:option(Value, "Pollrate", "Abfragerate (Pollrate)", "s")
+
+tcr = s:option(ListValue, "TcRedundancy", "TC-Redundanz")
+tcr:value("0", "MPR-Selektoren")
+tcr:value("1", "MPR-Selektoren und MPR")
+tcr:value("2", "Alle Nachbarn")
+
+s:option(Value, "MprCoverage", "MPR-Erfassung")
+
+lql = s:option(ListValue, "LinkQualityLevel", "VQ-Level")
+lql:value("0", "deaktiviert")
+lql:value("1", "MPR-Auswahl")
+lql:value("2", "MPR-Auswahl und Routing")
+
+lqfish = s:option(Flag, "LinkQualityFishEye", "VQ-Fisheye")
+
+s:option(Value, "LinkQualityWinSize", "VQ-Fenstergröße")
+
+s:option(Value, "LinkQualityDijkstraLimit", "VQ-Dijkstralimit")
+
+hyst = s:option(Flag, "UseHysteresis", "Hysterese aktivieren")
+hyst.enabled = "yes"
+hyst.disabled = "no"
+
+
+i = m:section(TypedSection, "Interface", "Schnittstellen")
+i.anonymous = true
+i.addremove = true
+i.dynamic = true
+
+network = i:option(ListValue, "Interface", "Netzwerkschnittstellen")
+network:value("")
+luci.model.uci.foreach("network", "interface",
+       function (section)
+               if section[".name"] ~= "loopback" then
+                       network:value(section[".name"])
+               end
+       end)
+
+i:option(Value, "HelloInterval", "Hello-Intervall")
+
+i:option(Value, "HelloValidityTime", "Hello-Gültigkeit")
+
+i:option(Value, "TcInterval", "TC-Intervall")
+
+i:option(Value, "TcValidityTime", "TC-Gültigkeit")
+
+i:option(Value, "MidInterval", "MID-Intervall")
+
+i:option(Value, "MidValidityTime", "MID-Gültigkeit")
+
+i:option(Value, "HnaInterval", "HNA-Intervall")
+
+i:option(Value, "HnaValidityTime", "HNA-Gültigkeit")
+
+
+p = m:section(TypedSection, "LoadPlugin", "Plugins")
+p.addremove = true
+p.dynamic = true
+
+lib = p:option(ListValue, "Library", "Bibliothek")
+lib:value("")
+for k, v in pairs(luci.fs.dir("/usr/lib")) do
+       if v:sub(1, 6) == "olsrd_" then
+               lib:value(v)
+       end
+end
+
+return m
\ No newline at end of file
diff --git a/applications/luci-olsr/luasrc/view/status-olsr/error_olsr.htm b/applications/luci-olsr/luasrc/view/status-olsr/error_olsr.htm
new file mode 100644 (file)
index 0000000..25426f5
--- /dev/null
@@ -0,0 +1,6 @@
+<%+header%>
+<h1><%:olsr OLSR%></h1>
+<p class="error"><%:olsrerror1 Es konnte keine Verbindung zum OLSR-Daemon hergestellt werden!%></p>
+<p><%:olsrerror2 Um die Statusinformationen abfragen zu können muss der OLSR-Daemon gestartet
+und das Plugin "txtinfo" geladen sein.%></p>
+<%+footer%>
\ No newline at end of file
diff --git a/applications/luci-olsr/luasrc/view/status-olsr/hna.htm b/applications/luci-olsr/luasrc/view/status-olsr/hna.htm
new file mode 100644 (file)
index 0000000..c13369f
--- /dev/null
@@ -0,0 +1,17 @@
+<%+header%>
+<h1><%:olsrhna OLSR-HNA%></h1>
+<br />
+<table cellspacing="0" cellpadding="6">
+<tr>
+<th><%:destination Ziel%></th>
+<th><%:gateway Gateway%></th>
+</tr>
+<% for k, route in ipairs(routes) do %>
+<tr>
+<td><%=route.Network%>/<%=route.Netmask%></td>
+<td><a href="http://<%=route.Gateway%>"><%=route.Gateway%></a></td>
+</tr>
+<% end %>
+</table>
+<br />
+<%+footer%>
\ No newline at end of file
diff --git a/applications/luci-olsr/luasrc/view/status-olsr/index.htm b/applications/luci-olsr/luasrc/view/status-olsr/index.htm
new file mode 100644 (file)
index 0000000..0633d1f
--- /dev/null
@@ -0,0 +1,43 @@
+<%+header%>
+<h1><%:olsrlinks OLSR-Verbindungen%></h1>
+<p><%:olsrlinks1 Übersicht über aktuell bestehende OLSR-Verbindungen%></p>
+<br />
+<table cellspacing="0" cellpadding="6">
+<tr>
+<th><%:destination Ziel%></th>
+<th><%:local Lokal%></th>
+<th>LQ</th>
+<th>NLQ</th>
+<th>ETX</th>
+</tr>
+<% for k, link in ipairs(links) do 
+       local color = "#bb3333"
+       
+       link.ETX = tonumber(link.ETX)
+       if link.ETX == 0 then
+               color = "#bb3333"
+       elseif link.ETX < 4 then
+               color = "#00cc00"
+       elseif link.ETX < 10 then
+               color = "#ffcb05"
+       elseif link.ETX < 100 then
+               color = "#ff6600"
+       end
+%>
+<tr>
+<td><a href="http://<%=link["remote IP"]%>"><%=link["remote IP"]%></a></td>
+<td><%=link["Local IP"]%></td>
+<td><%=link.LinkQuality%></td>
+<td><%=link.NLQ%></td>
+<td style="background-color:<%=color%>"><%=link.ETX%></td>
+</tr>
+<% end %>
+</table>
+<br />
+<h3><%:legend Legende%>:</h3>
+<ul>
+<li><strong>LQ: </strong><%:lq1 Erfolgsquote gesendeter Pakete%></li>
+<li><strong>NLQ: </strong><%:nlq1 Erfolgsquote empfangener Pakete%></li>
+<li><strong>ETX: </strong><%:etx1 Zu erwartende Sendeversuche pro Paket%></li>
+</ul>
+<%+footer%>
\ No newline at end of file
diff --git a/applications/luci-olsr/luasrc/view/status-olsr/mid.htm b/applications/luci-olsr/luasrc/view/status-olsr/mid.htm
new file mode 100644 (file)
index 0000000..6553237
--- /dev/null
@@ -0,0 +1,17 @@
+<%+header%>
+<h1><%:olsrmid OLSR-MID%></h1>
+<br />
+<table cellspacing="0" cellpadding="6">
+<tr>
+<th><%:node Knoten%></th>
+<th><%:aliases Aliasse%></th>
+</tr>
+<% for k, mid in ipairs(mids) do %>
+<tr>
+<td><a href="http://<%=mid.IP%>"><%=mid.IP%></a></td>
+<td><%=mid.Aliases%></td>
+</tr>
+<% end %>
+</table>
+<br />
+<%+footer%>
\ No newline at end of file
diff --git a/applications/luci-olsr/luasrc/view/status-olsr/routes.htm b/applications/luci-olsr/luasrc/view/status-olsr/routes.htm
new file mode 100644 (file)
index 0000000..f3a0fd3
--- /dev/null
@@ -0,0 +1,36 @@
+<%+header%>
+<h1><%:olsrlinks OLSR-Routen%></h1>
+<br />
+<table cellspacing="0" cellpadding="6">
+<tr>
+<th><%:destination Ziel%></th>
+<th><%:gateway Gateway%></th>
+<th><%:interface Schnittstelle%></th>
+<th><%:metric Metrik%></th>
+<th>ETX</th>
+</tr>
+<% for k, route in ipairs(routes) do 
+       local color = "#bb3333"
+       
+       route.ETX = tonumber(route.ETX)
+       if route.ETX == 0 then
+               color = "#bb3333"
+       elseif route.ETX < 4 then
+               color = "#00cc00"
+       elseif route.ETX < 10 then
+               color = "#ffcb05"
+       elseif route.ETX < 100 then
+               color = "#ff6600"
+       end
+%>
+<tr>
+<td><%=route.Destination%></td>
+<td><%=route.Gateway%></td>
+<td><%=route.Interface%></td>
+<td><%=route.Metric%></td>
+<td style="background-color:<%=color%>"><%=route.ETX%></td>
+</tr>
+<% end %>
+</table>
+<br />
+<%+footer%>
\ No newline at end of file
diff --git a/applications/luci-olsr/luasrc/view/status-olsr/topology.htm b/applications/luci-olsr/luasrc/view/status-olsr/topology.htm
new file mode 100644 (file)
index 0000000..c622026
--- /dev/null
@@ -0,0 +1,23 @@
+<%+header%>
+<h1><%:olsrtopo OLSR-Topologie%></h1>
+<br />
+<table cellspacing="0" cellpadding="6">
+<tr>
+<th><%:destination Ziel%></th>
+<th><%:lasthop Letzter Router%></th>
+<th>LQ</th>
+<th>ILQ</th>
+<th>ETX</th>
+</tr>
+<% for k, route in ipairs(routes) do %>
+<tr>
+<td><a href="http://<%=route["Destination IP"]%>"><%=route["Destination IP"]%></a></td>
+<td><a href="http://<%=route["Last hop IP"]%>"><%=route["Last hop IP"]%></a></td>
+<td><%=route.LQ%></td>
+<td><%=route.ILQ%></td>
+<td><%=route.ETX%></td>
+</tr>
+<% end %>
+</table>
+<br />
+<%+footer%>
\ No newline at end of file
index 5c6d06a..d95d91c 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 074b435..343c627 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 7ff4031..99ba9ad 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 8a2aa65..b0024fb 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
diff --git a/modules/admin-core/luasrc/controller/admin/status_olsr.lua b/modules/admin-core/luasrc/controller/admin/status_olsr.lua
deleted file mode 100644 (file)
index cadda54..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-module("luci.controller.admin.status_olsr", package.seeall)
-require("luci.sys")
-
-function index()
-       local page  = node("admin", "status", "olsr")
-       page.target = call("action_index")
-       page.title  = "OLSR"
-       
-       local page  = node("admin", "status", "olsr", "routes")
-       page.target = call("action_routes")
-       page.title  = "Routen"
-       page.order  = 10
-       
-       local page  = node("admin", "status", "olsr", "topology")
-       page.target = call("action_topology")
-       page.title  = "Topologie"
-       page.order  = 20
-       
-       local page  = node("admin", "status", "olsr", "hna")
-       page.target = call("action_hna")
-       page.title  = "HNA"
-       page.order  = 30
-       
-       local page  = node("admin", "status", "olsr", "mid")
-       page.target = call("action_mid")
-       page.title  = "MID"
-       page.order  = 50
-end
-
-function action_index()
-       local data = fetch_txtinfo("links")
-       
-       if not data or not data.Links then
-               luci.template.render("status-olsr/error_olsr")
-               return nil
-       end
-       
-       local function compare(a, b)
-               if tonumber(a.ETX) == 0 then
-                       return false
-               end
-               
-               if tonumber(b.ETX) == 0 then
-                       return true
-               end
-               
-               return tonumber(a.ETX) < tonumber(b.ETX)
-       end
-       
-       table.sort(data.Links, compare)
-       
-       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("status-olsr/error_olsr")
-               return nil
-       end
-       
-       local function compare(a, b)
-               if tonumber(a.ETX) == 0 then
-                       return false
-               end
-               
-               if tonumber(b.ETX) == 0 then
-                       return true
-               end
-               
-               return tonumber(a.ETX) < tonumber(b.ETX)
-       end
-       
-       table.sort(data.Routes, compare)
-       
-       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("status-olsr/error_olsr")
-               return nil
-       end
-       
-       local function compare(a, b)
-               return a["Destination IP"] < b["Destination IP"]
-       end
-       
-       table.sort(data.Topology, compare)
-       
-       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("status-olsr/error_olsr")
-               return nil
-       end
-       
-       local function compare(a, b)
-               return a.Network < b.Network
-       end
-       
-       table.sort(data.HNA, compare)
-       
-       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("status-olsr/error_olsr")
-               return nil
-       end
-       
-       local function compare(a, b)
-               return a.IP < b.IP
-       end
-       
-       table.sort(data.MID, compare)
-       
-       luci.template.render("status-olsr/mid", {mids=data.MID})
-end
-
-
--- Internal
-function fetch_txtinfo(otable)
-       otable = otable or ""
-       local rawdata = luci.sys.httpget("http://127.0.0.1:2006/"..otable)
-       
-       if #rawdata == 0 then
-               return nil
-       end
-       
-       local data = {}
-       
-       local tables = luci.util.split(luci.util.trim(rawdata), "\n\n")
-       
-
-       for i, tbl in ipairs(tables) do
-               local lines = luci.util.split(tbl, "\n")
-               local name  = table.remove(lines, 1):sub(8)
-               local keys  = luci.util.split(table.remove(lines, 1), "\t")
-               
-               data[name] = {}
-               
-               for j, line in ipairs(lines) do
-                       local fields = luci.util.split(line, "\t")
-                       data[name][j] = {}
-                       for k, key in pairs(keys) do
-                               data[name][j][key] = fields[k] 
-                       end
-               end
-       end
-       
-       return data
-end
\ No newline at end of file
diff --git a/modules/admin-core/luasrc/model/cbi/admin_services/olsrd.lua b/modules/admin-core/luasrc/model/cbi/admin_services/olsrd.lua
deleted file mode 100644 (file)
index 3e3c68d..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
--- ToDo: Autodetect things, Translate, Add descriptions
-require("luci.fs")
-
-m = Map("olsr", "OLSR", [[OLSR ist ein flexibles Routingprotokoll, 
-dass den Aufbau von mobilen Ad-Hoc Netzen unterstützt.]])
-
-s = m:section(NamedSection, "general", "olsr", "Allgemeine Einstellungen")
-
-debug = s:option(ListValue, "DebugLevel", "Debugmodus")
-for i=0, 9 do
-       debug:value(i)
-end
-
-ipv = s:option(ListValue, "IpVersion", "Internet Protokoll")
-ipv:value("4", "IPv4")
-ipv:value("6", "IPv6")
-
-noint = s:option(Flag, "AllowNoInt", "Start ohne Netzwerk")
-noint.enabled = "yes"
-noint.disabled = "no"
-
-s:option(Value, "Pollrate", "Abfragerate (Pollrate)", "s")
-
-tcr = s:option(ListValue, "TcRedundancy", "TC-Redundanz")
-tcr:value("0", "MPR-Selektoren")
-tcr:value("1", "MPR-Selektoren und MPR")
-tcr:value("2", "Alle Nachbarn")
-
-s:option(Value, "MprCoverage", "MPR-Erfassung")
-
-lql = s:option(ListValue, "LinkQualityLevel", "VQ-Level")
-lql:value("0", "deaktiviert")
-lql:value("1", "MPR-Auswahl")
-lql:value("2", "MPR-Auswahl und Routing")
-
-lqfish = s:option(Flag, "LinkQualityFishEye", "VQ-Fisheye")
-
-s:option(Value, "LinkQualityWinSize", "VQ-Fenstergröße")
-
-s:option(Value, "LinkQualityDijkstraLimit", "VQ-Dijkstralimit")
-
-hyst = s:option(Flag, "UseHysteresis", "Hysterese aktivieren")
-hyst.enabled = "yes"
-hyst.disabled = "no"
-
-
-i = m:section(TypedSection, "Interface", "Schnittstellen")
-i.anonymous = true
-i.addremove = true
-i.dynamic = true
-
-network = i:option(ListValue, "Interface", "Netzwerkschnittstellen")
-network:value("")
-luci.model.uci.foreach("network", "interface",
-       function (section)
-               if section[".name"] ~= "loopback" then
-                       network:value(section[".name"])
-               end
-       end)
-
-i:option(Value, "HelloInterval", "Hello-Intervall")
-
-i:option(Value, "HelloValidityTime", "Hello-Gültigkeit")
-
-i:option(Value, "TcInterval", "TC-Intervall")
-
-i:option(Value, "TcValidityTime", "TC-Gültigkeit")
-
-i:option(Value, "MidInterval", "MID-Intervall")
-
-i:option(Value, "MidValidityTime", "MID-Gültigkeit")
-
-i:option(Value, "HnaInterval", "HNA-Intervall")
-
-i:option(Value, "HnaValidityTime", "HNA-Gültigkeit")
-
-
-p = m:section(TypedSection, "LoadPlugin", "Plugins")
-p.addremove = true
-p.dynamic = true
-
-lib = p:option(ListValue, "Library", "Bibliothek")
-lib:value("")
-for k, v in pairs(luci.fs.dir("/usr/lib")) do
-       if v:sub(1, 6) == "olsrd_" then
-               lib:value(v)
-       end
-end
-
-return m
\ No newline at end of file
diff --git a/modules/admin-core/luasrc/view/status-olsr/error_olsr.htm b/modules/admin-core/luasrc/view/status-olsr/error_olsr.htm
deleted file mode 100644 (file)
index 25426f5..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<%+header%>
-<h1><%:olsr OLSR%></h1>
-<p class="error"><%:olsrerror1 Es konnte keine Verbindung zum OLSR-Daemon hergestellt werden!%></p>
-<p><%:olsrerror2 Um die Statusinformationen abfragen zu können muss der OLSR-Daemon gestartet
-und das Plugin "txtinfo" geladen sein.%></p>
-<%+footer%>
\ No newline at end of file
diff --git a/modules/admin-core/luasrc/view/status-olsr/hna.htm b/modules/admin-core/luasrc/view/status-olsr/hna.htm
deleted file mode 100644 (file)
index c13369f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<%+header%>
-<h1><%:olsrhna OLSR-HNA%></h1>
-<br />
-<table cellspacing="0" cellpadding="6">
-<tr>
-<th><%:destination Ziel%></th>
-<th><%:gateway Gateway%></th>
-</tr>
-<% for k, route in ipairs(routes) do %>
-<tr>
-<td><%=route.Network%>/<%=route.Netmask%></td>
-<td><a href="http://<%=route.Gateway%>"><%=route.Gateway%></a></td>
-</tr>
-<% end %>
-</table>
-<br />
-<%+footer%>
\ No newline at end of file
diff --git a/modules/admin-core/luasrc/view/status-olsr/index.htm b/modules/admin-core/luasrc/view/status-olsr/index.htm
deleted file mode 100644 (file)
index 0633d1f..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<%+header%>
-<h1><%:olsrlinks OLSR-Verbindungen%></h1>
-<p><%:olsrlinks1 Übersicht über aktuell bestehende OLSR-Verbindungen%></p>
-<br />
-<table cellspacing="0" cellpadding="6">
-<tr>
-<th><%:destination Ziel%></th>
-<th><%:local Lokal%></th>
-<th>LQ</th>
-<th>NLQ</th>
-<th>ETX</th>
-</tr>
-<% for k, link in ipairs(links) do 
-       local color = "#bb3333"
-       
-       link.ETX = tonumber(link.ETX)
-       if link.ETX == 0 then
-               color = "#bb3333"
-       elseif link.ETX < 4 then
-               color = "#00cc00"
-       elseif link.ETX < 10 then
-               color = "#ffcb05"
-       elseif link.ETX < 100 then
-               color = "#ff6600"
-       end
-%>
-<tr>
-<td><a href="http://<%=link["remote IP"]%>"><%=link["remote IP"]%></a></td>
-<td><%=link["Local IP"]%></td>
-<td><%=link.LinkQuality%></td>
-<td><%=link.NLQ%></td>
-<td style="background-color:<%=color%>"><%=link.ETX%></td>
-</tr>
-<% end %>
-</table>
-<br />
-<h3><%:legend Legende%>:</h3>
-<ul>
-<li><strong>LQ: </strong><%:lq1 Erfolgsquote gesendeter Pakete%></li>
-<li><strong>NLQ: </strong><%:nlq1 Erfolgsquote empfangener Pakete%></li>
-<li><strong>ETX: </strong><%:etx1 Zu erwartende Sendeversuche pro Paket%></li>
-</ul>
-<%+footer%>
\ No newline at end of file
diff --git a/modules/admin-core/luasrc/view/status-olsr/mid.htm b/modules/admin-core/luasrc/view/status-olsr/mid.htm
deleted file mode 100644 (file)
index 6553237..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<%+header%>
-<h1><%:olsrmid OLSR-MID%></h1>
-<br />
-<table cellspacing="0" cellpadding="6">
-<tr>
-<th><%:node Knoten%></th>
-<th><%:aliases Aliasse%></th>
-</tr>
-<% for k, mid in ipairs(mids) do %>
-<tr>
-<td><a href="http://<%=mid.IP%>"><%=mid.IP%></a></td>
-<td><%=mid.Aliases%></td>
-</tr>
-<% end %>
-</table>
-<br />
-<%+footer%>
\ No newline at end of file
diff --git a/modules/admin-core/luasrc/view/status-olsr/routes.htm b/modules/admin-core/luasrc/view/status-olsr/routes.htm
deleted file mode 100644 (file)
index f3a0fd3..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<%+header%>
-<h1><%:olsrlinks OLSR-Routen%></h1>
-<br />
-<table cellspacing="0" cellpadding="6">
-<tr>
-<th><%:destination Ziel%></th>
-<th><%:gateway Gateway%></th>
-<th><%:interface Schnittstelle%></th>
-<th><%:metric Metrik%></th>
-<th>ETX</th>
-</tr>
-<% for k, route in ipairs(routes) do 
-       local color = "#bb3333"
-       
-       route.ETX = tonumber(route.ETX)
-       if route.ETX == 0 then
-               color = "#bb3333"
-       elseif route.ETX < 4 then
-               color = "#00cc00"
-       elseif route.ETX < 10 then
-               color = "#ffcb05"
-       elseif route.ETX < 100 then
-               color = "#ff6600"
-       end
-%>
-<tr>
-<td><%=route.Destination%></td>
-<td><%=route.Gateway%></td>
-<td><%=route.Interface%></td>
-<td><%=route.Metric%></td>
-<td style="background-color:<%=color%>"><%=route.ETX%></td>
-</tr>
-<% end %>
-</table>
-<br />
-<%+footer%>
\ No newline at end of file
diff --git a/modules/admin-core/luasrc/view/status-olsr/topology.htm b/modules/admin-core/luasrc/view/status-olsr/topology.htm
deleted file mode 100644 (file)
index c622026..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<%+header%>
-<h1><%:olsrtopo OLSR-Topologie%></h1>
-<br />
-<table cellspacing="0" cellpadding="6">
-<tr>
-<th><%:destination Ziel%></th>
-<th><%:lasthop Letzter Router%></th>
-<th>LQ</th>
-<th>ILQ</th>
-<th>ETX</th>
-</tr>
-<% for k, route in ipairs(routes) do %>
-<tr>
-<td><a href="http://<%=route["Destination IP"]%>"><%=route["Destination IP"]%></a></td>
-<td><a href="http://<%=route["Last hop IP"]%>"><%=route["Last hop IP"]%></a></td>
-<td><%=route.LQ%></td>
-<td><%=route.ILQ%></td>
-<td><%=route.ETX%></td>
-</tr>
-<% end %>
-</table>
-<br />
-<%+footer%>
\ No newline at end of file
index 43d1246..636b9fc 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")