<%# 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 -%> <% local uci = require("simple-uci").cursor() local disp = require "gluon.web.dispatcher" local fs = require "nixio.fs" local pretty_hostname = require "pretty_hostname" local hostname = pretty_hostname.get(uci) local release = fs.readfile("/lib/gluon/release") local root = node() local rnode = node(unpack(request)) local category = request[1] local cattree = category and node(category) local categories = disp.node_children(root) http:prepare_content("application/xhtml+xml") local function append(xs, x) local r = {unpack(xs)} r[#r+1] = x return r end local function title(node) return i18n(node.pkg).translate(node.title) end local function subtree(prefix, node, name, ...) if not node then return end local children = disp.node_children(node) if #children == 0 then return end %>
    <% for i, v in ipairs(children) do local child = node.nodes[v] local active = (v == name) %>
  • <%|title(child)%>
  • <% end %>

<% subtree(append(prefix, name), node.nodes[name], ...) %>
<% end local function menutree(path, ...) subtree({path}, root.nodes[category], ...) end -%> <%| hostname .. ((rnode and rnode.title) and ' - ' .. title(rnode) or '') %>
<% if not hidenav then menutree(unpack(request)) end %>
<% ok, err = pcall(renderer.render, content, env, pkg) if not ok then renderer.render('error500', {message = err}, 'gluon-web') end %>