From 7918c835865b80c6009bbe498db3f53d3d30cf3a Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 26 Oct 2011 02:51:34 +0000 Subject: [PATCH] themes/freifunk: port to updated dispatcher api --- .../luasrc/view/themes/freifunk/header.htm | 172 +++++++++--------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/themes/freifunk/luasrc/view/themes/freifunk/header.htm b/themes/freifunk/luasrc/view/themes/freifunk/header.htm index 023e86a1ed..0580a1866a 100644 --- a/themes/freifunk/luasrc/view/themes/freifunk/header.htm +++ b/themes/freifunk/luasrc/view/themes/freifunk/header.htm @@ -11,26 +11,34 @@ You may obtain a copy of the License at -%> <% -require("luci.sys") -local load1, load5, load15 = luci.sys.loadavg() -local request = require("luci.dispatcher").context.path -local category = request[1] -local tree = luci.dispatcher.node() -local cattree = category and luci.dispatcher.node(category) -local node = luci.dispatcher.context.dispatched -local hostname = luci.sys.hostname() - -local c = tree -for i,r in ipairs(request) do - if c.nodes and c.nodes[r] then - c = c.nodes[r] - c._menu_selected = true - end -end + local sys = require "luci.sys" + local http = require "luci.http" + local disp = require "luci.dispatcher" + + local hostname = sys.hostname() + local load1, load5, load15 = sys.loadavg() + + local request = disp.context.path + local category = request[1] + local cattree = category and disp.node(category) + + local tree = disp.node() + local node = disp.context.dispatched + + local categories = disp.node_childs(tree) -require("luci.i18n").loadc("base") -require("luci.http").prepare_content("text/html") + local c = tree + local i, r + -- tag all nodes leading to this page + for i, r in ipairs(request) do + if c.nodes and c.nodes[r] then + c = c.nodes[r] + c._menu_selected = true + end + end + + http.prepare_content("text/html") -%> @@ -62,7 +70,7 @@ require("luci.http").prepare_content("text/html") - +
@@ -90,87 +98,79 @@ require("luci.http").prepare_content("text/html")
-<%:Path%>: <% -local c = tree -local url = controller -for k,v in pairs(request) do - if c.nodes and c.nodes[v] then - c = c.nodes[v] - url = url .. "/" .. v - %><%=pcdata(striptags(translate(c.title) or v))%> <% if k ~= #request then %>» <% end +<%:Path%>: +<% + local c = tree + local url = controller + for i, r in ipairs(request) do + if c.nodes and c.nodes[r] then + c = c.nodes[r] + url = url .. "/" .. r +%> + <%=pcdata(striptags(translate(c.title) or v))%> + <% if k ~= #request then %> » <% end %> +<% + end end -end %>
+ <% + end + end + %> + + <% if #categories > 1 then %>
-
+ <% end %> <% if tree.nodes[category] and tree.nodes[category].ucidata then -- 2.30.2