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
14 local sys = require
"luci.sys"
15 local http = require
"luci.http"
16 local disp = require
"luci.dispatcher"
18 local hostname = sys.hostname()
19 local load1, load5, load15 = sys.loadavg()
21 local request = disp.context.path
22 local category = request[
1]
23 local cattree = category and disp.node(category)
25 local tree = disp.node()
26 local node = disp.context.dispatched
28 local categories = disp.node_childs(tree)
33 -- tag all nodes leading to this page
34 for i, r in ipairs(request) do
35 if c.nodes and c.nodes[r] then
37 c._menu_selected = true
41 http.prepare_content(
"text/html")
44 <?xml version=
"1.0" encoding=
"utf-8"?>
45 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
46 <html xmlns=
"http://www.w3.org/1999/xhtml">
48 <link rel=
"stylesheet" type=
"text/css" href=
"<%=media%>/cascade.css" />
49 <% if node and node.css then %
><link rel=
"stylesheet" type=
"text/css" href=
"<%=resource%>/<%=node.css%>" /><% end %
>
50 <link rel=
"shortcut icon" href=
"<%=media%>/images/favicon.ico" />
51 <meta http-equiv=
"content-type" content=
"application/xhtml+xml; charset=utf-8" />
52 <meta http-equiv=
"content-script-type" content=
"text/javascript" />
53 <script type=
"text/javascript" src=
"<%=resource%>/xhr.js"></script>
54 <title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %
> - LuCI
</title>
57 <script type="text/javascript">
58 function setup_hover() {
59 function ie_hover(e) {
60 e.onmouseover = function() { this.className = "hover" }
61 e.onmouseout = function() { this.className = null }
64 var lis = document.getElementById("mainmenu").getElementsByTagName("LI");
65 var divs = document.getElementById("mainmenu").getElementsByTagName("DIV");
67 for( var i = 0; i < lis.length; i++ ) ie_hover( lis[i] );
68 for( var i = 0; i < divs.length; i++ ) ie_hover( divs[i] );
73 <body onload=
"if (window.setup_hover) setup_hover()">
78 <%- if luci.sys.user.getuser(
"root") and not luci.sys.user.getpasswd(
"root") then -%
>
80 <strong><%:No password set!%
></strong><br />
81 <%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%
>
89 <div id=
"headerright">
91 <div id=
"schriftzug"><img src=
"<%=media%>/images/schriftzug.png" alt=
"Freifunk ueberschrift" name=
"Freifunk_nordost_ueberschrift" border=
"0"> </div>
92 <div id=
"logo"><img src=
"<%=media%>/images/logo.png" alt=
"Freifunk logo" name=
"Freifunk_nordost" border=
"0"></a></div>
93 <div class=
"clear"></div>
100 <div class=
"pathbar separator black whitetext bold">
104 local url = controller
105 for i, r in ipairs(request) do
106 if c.nodes and c.nodes[r] then
108 url = url ..
"/" .. r
110 <a href=
"<%=url%>"><%=pcdata(striptags(translate(c.title) or v))%
></a>
111 <% if k ~= #request then %
> » <% end %
>
118 <div class=
"menubar">
119 <div id=
"mainmenu" class=
"mainmenu">
121 local function submenu(prefix, node)
122 local childs = disp.node_childs(node)
127 for i, r in ipairs(childs) do
128 local nnode = node.nodes[r]
129 local href = controller .. prefix .. r ..
130 (nnode.query and http.build_querystring(nnode.query) or
"")
133 <span<%=ifattr(nnode._menu_selected,
"class",
"active")%
>>
134 <a href=
"<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%
></a>
136 <%- submenu(prefix .. r ..
"/", nnode) %
>
147 childs = disp.node_childs(cattree)
150 for i, r in ipairs(childs) do
151 local nnode = cattree.nodes[r]
152 local href = controller ..
"/" .. category ..
"/" .. r ..
153 (nnode.query and http.build_querystring(k.query) or
"")
155 <div<%=ifattr(nnode._menu_selected,
"class",
"preactive")%
>>
156 <a href=
"<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%
></a>
157 <%- submenu(
"/" .. category ..
"/" .. r ..
"/", nnode) %
>
165 <% if #categories
> 1 then %
>
166 <div class=
"modemenu">
168 <% for i, r in ipairs(categories) do %
>
169 <li><a<%=ifattr(request[
1] == r,
"class",
"active")%
> href=
"<%=controller%>/<%=r%>/"><%=striptags(translate(tree.nodes[r].title))%
></a></li>
176 if tree.nodes[category] and tree.nodes[category].ucidata then
179 for i, j in pairs(require(
"luci.model.uci").cursor():changes()) do
180 for k, l in pairs(j) do
181 for m, n in pairs(l) do
187 <div class=
"mainmenu" style=
"float:right; margin-right:2em">
189 <% if ucic
> 0 then %
>
190 <a class=
"warning" href=
"<%=controller%>/<%=category%>/uci/changes"><%:Unsaved Changes%
>: <%=ucic%
></a>
191 <% submenu(
"/" .. category ..
"/uci/", tree.nodes[category].nodes[
"uci"]) -%
>
193 <a href=
"#"><%:Changes%
>:
0</a>
201 <div id=
"maincontent">
202 <% if category ~=
"freifunk" and category ~=
"splash" then %
>
204 <div class=
"warning">
205 <strong><%:Java Script required!%
></strong><br />
206 <%:You must enable Java Script in your browser or LuCI will not work properly.%
>