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(
"text/html")
38 <?xml version=
"1.0" encoding=
"utf-8"?>
39 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
40 <html xmlns=
"http://www.w3.org/1999/xhtml">
42 <link rel=
"stylesheet" type=
"text/css" href=
"<%=media%>/cascade.css" />
43 <% if node and node.css then %
><link rel=
"stylesheet" type=
"text/css" href=
"<%=resource%>/<%=node.css%>" /><% end %
>
44 <meta http-equiv=
"content-type" content=
"application/xhtml+xml; charset=utf-8" />
45 <meta http-equiv=
"content-script-type" content=
"text/javascript" />
46 <title><%= hostname .. ( (node and node.title) and ' - ' .. node.title or '') %
> - LuCI
</title>
49 <script type="text/javascript">
50 function setup_hover() {
51 function ie_hover(e) {
52 e.onmouseover = function() { this.className = "hover" }
53 e.onmouseout = function() { this.className = null }
56 var lis = document.getElementById("mainmenu").getElementsByTagName("LI");
57 var divs = document.getElementById("mainmenu").getElementsByTagName("DIV");
59 for( var i = 0; i < lis.length; i++ ) ie_hover( lis[i] );
60 for( var i = 0; i < divs.length; i++ ) ie_hover( divs[i] );
65 <body onload=
"window.setup_hover && setup_hover()">
67 <div class=
"info whitetext smalltext bold right">
68 <%=luci.config.brand.firmware%
> (<%=luci.config.brand.distro%
>) |
69 <%:load%
>: <%=load1%
> <%=load5%
> <%=load15%
> |
70 <%:hostname%
>: <%=hostname%
>
73 <span class=
"headertitle"><%=luci.config.brand.title%
></span><br />
74 <span class=
"whitetext bold"><%=luci.config.brand.subtitle%
></span>
78 <div class=
"pathbar separator black whitetext bold">
81 local url = controller
82 for k,v in pairs(request) do
83 if c.nodes and c.nodes[v] then
86 %
><a href=
"<%=url%>"><%=c.title or v%
></a> <% if k ~= #request then %
>» <% end
93 <div id=
"mainmenu" class=
"mainmenu">
95 local function submenu(prefix, node)
96 if node.hidden or not node.nodes then
101 for k, n in pairs(node.nodes) do
102 if n.title and n.target then
103 table.insert(index, {name=k, order=n.order or
100})
108 table.sort(index, function(a, b) return a.order < b.order end)
113 <%- for j, v in pairs(index) do
114 if not v.hidden and #v.name
> 0 then
115 local nnode = node.nodes[v.name]
116 local href = controller .. prefix .. v.name
117 href = (nnode.query) and href .. luci.http.build_querystring(nnode.query) or href
120 <span<% if nnode._menu_selected then %
> class=
"active"<%end%
>><a href=
"<%=href%>"><%=nnode.title%
></a></span>
121 <%- submenu(prefix .. v.name ..
"/", nnode) %
>
130 if cattree and cattree.nodes then
132 for k, node in pairs(cattree.nodes) do
133 table.insert(index, {name=k, order=node.order or
100})
136 table.sort(index, function(a, b) return a.order < b.order end)
138 for i, k in ipairs(index) do
139 node = cattree.nodes[k.name]
140 if not node.hidden and node.title and node.target then
141 local href = controller..
"/"..category..
"/"..k.name
142 href = (k.query) and href .. luci.http.build_querystring(k.query) or href %
>
143 <div<% if node._menu_selected then %
> class=
"preactive"<%end%
>><a href=
"<%=href%>"><%=node.title%
></a>
144 <%submenu(
"/" .. category ..
"/" .. k.name ..
"/", node)%
>
151 <div class=
"modemenu">
153 for k,node in pairs(tree.nodes) do
154 if node.title and not node.hidden then %
>
155 <li<% if request[
1] == k then %
> class=
"active"<%end%
>><a href=
"<%=controller%>/<%=k%>"><%=node.title%
></a></li>
162 if tree.nodes[category] and tree.nodes[category].ucidata then
164 for i, j in pairs(require(
"luci.model.uci").changes()) do
165 for k, l in pairs(j) do
166 for m, n in pairs(l) do
172 <div class=
"mainmenu" style=
"float:right; margin-right:2em">
174 <% if ucic
> 0 then %
>
175 <a class=
"warning" href=
"<%=controller%>/<%=category%>/uci/changes"><%:unsavedchanges%
>: <%=ucic%
></a>
176 <% submenu(
"/" .. category ..
"/uci/", tree.nodes[category].nodes[
"uci"]) -%
>
178 <a href=
"#"><%:changes%
>:
0</a>