2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
17 local load1, load5, load15 = luci.sys.loadavg()
18 local request = require("luci.dispatcher").context.path
19 local category = request[1]
20 local tree = luci.dispatcher.node()
21 local cattree = category and luci.dispatcher.node(category)
22 local node = luci.dispatcher.context.dispatched
23 local hostname = luci.sys.hostname()
26 for i,r in ipairs(request) do
27 if c.nodes and c.nodes[r] then
29 c._menu_selected = true
33 require("luci.i18n").loadc("default")
34 require("luci.http").prepare_content("application/xhtml+xml")
38 <?xml version="1.0" encoding="utf-8"?>
39 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
40 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%=luci.i18n.context.lang%>" lang="<%=luci.i18n.context.lang%>">
42 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
43 <meta http-equiv="Content-Script-Type" content="text/javascript" />
44 <link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" />
45 <% if node and node.css then %><link rel="stylesheet" type="text/css" media="screen" href="<%=resource%>/<%=node.css%>" />
47 <script type="text/javascript" src="<%=media%>/VarType.js"></script>
48 <script type="text/javascript" src="<%=media%>/XHTML1.js"></script>
49 <script type="text/javascript" src="<%=media%>/Dropdowns.js"></script>
50 <title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. node.title or '')) %> - LuCI</title>
52 <body class="lang_<%=luci.i18n.context.lang%>">
55 <span id="skiplink1"><a href="#navigation"><%:skiplink1 Skip to navigation%></a></span>
56 <span id="skiplink2"><a href="#content"><%:skiplink2 Skip to content%></a></span>
60 <h1><%=luci.config.brand.firmware%></h1>
62 <%=luci.config.brand.distro%><br />
63 <%:load%>: <%=load1%> <%=load5%> <%=load15%><br />
64 <%:hostname%>: <%=hostname%>
69 <h2 class="navigation"><a id="navigation" name="navigation"><%:navigation Navigation%></a></h2>
70 <ul id="mainmenu" class="dropdowns">
72 local function submenu(prefix, node)
73 if not node.nodes or node.hidden then
78 for k, n in pairs(node.nodes) do
79 if n.title and n.target then
80 table.insert(index, {name=k, order=n.order or 100})
85 table.sort(index, function(a, b) return a.order < b.order end)
89 <ul id="submenu_<%=string.gsub(string.gsub(prefix, "/", "_"), "^_(.-)_$", "%1")%>">
91 for j, v in pairs(index) do
93 local nnode = node.nodes[v.name]
94 local href = controller .. prefix .. v.name .. "/"
95 href = (nnode.query) and href .. luci.http.build_querystring(nnode.query) or href
97 <li><a<% if nnode._menu_selected then %> class="active"<%end%> href="<%=luci.util.pcdata(href)%>"><%=nnode.title%></a><%-
98 submenu(prefix .. v.name .. "/", nnode)
109 if cattree and cattree.nodes then
111 for k, node in pairs(cattree.nodes) do
112 table.insert(index, {name=k, order=node.order or 100})
115 table.sort(index, function(a, b) return a.order < b.order end)
117 for i, k in ipairs(index) do
118 node = cattree.nodes[k.name]
119 if node.title and node.target and not node.hidden then
120 local href = controller.."/"..category.."/"..k.name.."/"
121 href = (k.query) and href .. luci.http.build_querystring(k.query) or href
123 <li><a<% if node._menu_selected then %> class="preactive"<%end%> href="<%=href%>"><%=node.title%></a><%
124 submenu("/" .. category .. "/" .. k.name .. "/", node)
132 for k,node in pairs(tree.nodes) do
133 if node.title and not node.hidden then %>
134 <li><a<% if request[1] == k then %> class="active"<%end%> href="<%=controller%>/<%=k%>/"><%=node.title%></a></li><%
141 if tree.nodes[category] and tree.nodes[category].ucidata then
143 for i, j in pairs(require("luci.model.uci").cursor():changes()) do
144 for k, l in pairs(j) do
145 for m, n in pairs(l) do
151 <ul id="savemenu" class="dropdowns">
152 <li><% if ucic > 0 then %><a class="warning" href="<%=controller%>/<%=category%>/uci/changes/"><%:unsavedchanges%>: <%=ucic%></a><%
153 submenu("/" .. category .. "/uci/", tree.nodes[category].nodes["uci"])
155 <a href="#"><%:changes%>: 0</a><% end -%>
159 <div class="clear"></div>
161 <div id="maincontent">