<%# LuCI - Lua Configuration Interface Copyright 2008 Steven Barth Copyright 2008-2010 Jo-Philipp Wich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 $Id$ -%> <% local sys = require "luci.sys" local http = require "luci.http" local disp = require "luci.dispatcher" local fs = require "nixio.fs" local hostname = sys.hostname() local release = fs.readfile("/lib/gluon/release") local load1, load5, load15 = sys.loadavg() local request = disp.context.path local request2 = disp.context.request local category = request[1] local cattree = category and disp.node(category) local leaf = request2[#request2] local tree = disp.node() local node = disp.context.dispatched local categories = disp.node_childs(tree) 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("application/xhtml+xml") local function nodeurl(prefix, name, query) local url = controller .. prefix .. name .. "/" if query then url = url .. http.build_querystring(query) end return pcdata(url) end local function subtree(prefix, node, level) if not level then level = 1 end local childs = disp.node_childs(node) if #childs > 0 then %>
    <% local selected_node local selected_name local i, v for i, v in ipairs(childs) do local nnode = node.nodes[v] if nnode._menu_selected then selected_node = nnode selected_name = v end %>
  • <%=striptags(translate(nnode.title))%>
  • <% end %>

<% if selected_node then subtree(prefix .. selected_name .. "/", selected_node, level + 1) end %>
<% end end -%> <% if node and node.css then %> <% end -%> <% if css then %> <% end -%> <%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI
<% if category then subtree("/" .. category .. "/", cattree) end %>