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
25 for i,r in ipairs(request) do
26 if c.nodes and c.nodes[r] then
28 c._menu_selected = true
32 require("luci.i18n").loadc("default")
34 require("luci.http").prepare_content("text/html")
35 %><?xml version="1.0" encoding="utf-8"?>
36 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
37 <html xmlns="http://www.w3.org/1999/xhtml">
39 <link rel="stylesheet" type="text/css" href="<%=media%>/cascade.css" />
40 <% if node and node.css then %><link rel="stylesheet" type="text/css" href="<%=resource%>/<%=node.css%>" /><% end %>
41 <meta http-equiv="content-type" content="text/xhtml+xml; charset=utf-8" />
42 <meta http-equiv="content-script-type" content="text/javascript" />
43 <title>LuCI - Lua Configuration Interface - <%=(node and node.title)%></title>
47 <div class="info whitetext smalltext bold right">
48 <%=luci.config.brand.firmware%><br />
49 <%=luci.config.brand.distro%><br />
50 <%:load%>: <%=load1%> <%=load5%> <%=load15%><br />
51 <%:hostname%>: <%=luci.sys.hostname()%>
54 <span class="headertitle"><%=luci.config.brand.title%></span><br />
55 <span class="whitetext bold"><%=luci.config.brand.subtitle%></span>
59 <div class="pathbar separator black whitetext bold">
62 local url = controller
63 for k,v in pairs(request) do
64 if c.nodes and c.nodes[v] then
67 %><a href="<%=url%>"><%=c.title or v%></a> <% if k ~= #request then %>» <% end
74 <div class="mainmenu">
76 local function submenu(prefix, node)
77 if not node.nodes then
81 for k, n in pairs(node.nodes) do
82 if n.title and n.target then
83 table.insert(index, {name=k, order=n.order or 100})
87 table.sort(index, function(a, b) return a.order < b.order end)
90 <% for j, v in pairs(index) do
91 local nnode = node.nodes[v.name]
92 local href = controller .. prefix .. v.name
93 href = (nnode.query) and href .. luci.http.build_querystring(nnode.query) or href
96 <span<% if nnode._menu_selected then %> class="active"<%end%>><a href="<%=href%>"><%=nnode.title%></a></span>
97 <% submenu(prefix .. v.name .. "/", nnode) %>
104 if cattree and cattree.nodes then
106 for k, node in pairs(cattree.nodes) do
107 table.insert(index, {name=k, order=node.order or 100})
110 table.sort(index, function(a, b) return a.order < b.order end)
112 for i, k in ipairs(index) do
113 node = cattree.nodes[k.name]
114 if node.title and node.target then
115 local href = controller.."/"..category.."/"..k.name
116 href = (k.query) and href .. luci.http.build_querystring(k.query) or href %>
117 <div<% if node._menu_selected then %> class="preactive"<%end%>><a href="<%=href%>"><%=node.title%></a>
118 <%submenu("/" .. category .. "/" .. k.name .. "/", node)%>
125 <div class="modemenu">
127 for k,node in pairs(tree.nodes) do
128 if node.title then %>
129 <li<% if request[1] == k then %> class="active"<%end%>><a href="<%=controller%>/<%=k%>"><%=node.title%></a></li>
135 if "admin" == request[1] then
137 for i, j in pairs(require("luci.model.uci").changes()) do
138 for k, l in pairs(j) do
139 for m, n in pairs(l) do
145 <div class="mainmenu" style="float:right; margin-right:2em">
147 <% if ucic > 0 then %>
148 <a href="<%=controller%>/admin/uci/changes"><%:changes%>: <%=ucic%></a>
150 <li><a href="<%=controller%>/admin/uci/apply"><%:apply%></a></li>
151 <li><a href="<%=controller%>/admin/uci/revert"><%:revert%></a></li>
154 <a href="#"><%:changes%>: 0</a>