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
16 local hostname = require(
"luci.sys").hostname()
17 local crequest = luci.dispatcher.context.request
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")
33 require(
"luci.http").prepare_content(
"application/xhtml+xml")
37 <?xml version=
"1.0" encoding=
"utf-8"?>
38 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
39 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"<%=luci.i18n.context.lang%>" lang=
"<%=luci.i18n.context.lang%>">
41 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
42 <meta http-equiv=
"Content-Script-Type" content=
"text/javascript" />
43 <link rel=
"stylesheet" type=
"text/css" media=
"screen" href=
"<%=media%>/cascade.css" />
44 <link rel=
"stylesheet" type=
"text/css" media=
"screen" href=
"<%=media%>/dashboard.css" />
45 <% if node and node.css then %
><link rel=
"stylesheet" type=
"text/css" media=
"screen" href=
"<%=resource%>/<%=node.css%>" />
47 <title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. node.title or '')) %
> - LuCI
</title>
49 <body class=
"lang_<%=luci.i18n.context.lang%>">
53 <span id=
"skiplink1"><a href=
"#navigation"><%:skiplink1 Skip to navigation%
></a></span>
54 <span id=
"skiplink2"><a href=
"#content"><%:skiplink2 Skip to content%
></a></span>
58 local function ucimenu(prefix, node)
59 if not node.nodes or node.hidden then
64 for k, n in pairs(node.nodes) do
65 if n.title and n.target then
66 table.insert(index, {name=k, order=n.order or
100})
71 table.sort(index, function(a, b) return a.order < b.order end)
74 for j, v in pairs(index) do
76 local nnode = node.nodes[v.name]
77 local href = controller .. prefix .. v.name ..
"/"
78 href = (nnode.query) and href .. luci.http.build_querystring(nnode.query) or href
80 <span><a class=
"menulink<% if nnode._menu_selected then %> active<%end%>" href=
"<%=luci.util.pcdata(href)%>"> > <%=nnode.title%
></a></span>
91 <div id=
"header"></div>
94 if tree.nodes[category] and tree.nodes[category].ucidata then
96 for i, j in pairs(require(
"luci.model.uci").cursor():changes()) do
97 for k, l in pairs(j) do
98 for m, n in pairs(l) do
104 <% if ucic
> 0 then %
><div class=
"menubar"><div><a class=
"warning" href=
"<%=controller%>/<%=category%>/uci/changes/"><%:Unsaved Changes%
>: <%=ucic%
></a><%
105 ucimenu(
"/" .. category ..
"/uci/", tree.nodes[category].nodes[
"uci"],
"changes")-%
>
106 <div class=
"clear"></div>
111 <div class=
"menubar">
112 <h2 class=
"navigation"><a id=
"navigation" name=
"navigation"><%:Navigation%
></a></h2>
113 <strong><%:Path%
>:
</strong>
114 <a href=
"<%=controller%>"><%= luci.__appname__ %
></a>
118 for k, v in ipairs(crequest) do
119 if pointer.nodes and pointer.nodes[v] then
120 pointer = pointer.nodes[v]
122 » <a href=
"<%=luci.dispatcher.build_url(unpack(crequest, 1, k))%>"><%=pointer.title or v%
></a>
129 <div id=
"maincontent">
130 <% if node.subindex then %
><%+themes/oxygen/dashboard%
><% end %
>