2 LuCI - Lua Configuration Interface
3 Copyright
2008 Steven Barth
<steven@midlink.org
>
4 Copyright
2008-
2011 Jo-Philipp Wich
<xm@subsignal.org
>
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 fs = require
"luci.fs"
15 local sys = require
"luci.sys"
16 local http = require
"luci.http"
17 local disp = require
"luci.dispatcher"
19 local hostname = sys.hostname()
20 local load1, load5, load15 = sys.loadavg()
22 local request = disp.context.path
23 local category = request[
1]
24 local cattree = category and disp.node(category)
26 local tree = disp.node()
27 local node = disp.context.dispatched
29 local categories = disp.node_childs(tree)
34 -- tag all nodes leading to this page
35 for i, r in ipairs(request) do
36 if c.nodes and c.nodes[r] then
38 c._menu_selected = true
42 local uci = require
"luci.model.uci".cursor()
43 local ff = uci:get(
"freifunk",
"community",
"name") or
""
44 local co =
"profile_" .. ff
45 local community = uci:get_first(co,
"community",
"name") or
"Freifunk"
46 local hp = uci:get_first(co,
"community",
"homepage") or
"http://www.freifunk.net"
47 local logo =
"/luci-static/freifunk-generic/logo.jpg"
49 local show_comm = true
51 local lo = fs.glob(
"/www/luci-static/resources/custom_logo.*")
53 logo = string.gsub(lo[
1],
"/www",
"")
56 local lon = fs.glob(
"/www/luci-static/resources/custom_logo_only.*")
58 logo = string.gsub(lon[
1],
"/www",
"")
62 local hea = fs.glob(
"/www/luci-static/resources/custom_header.*")
64 logo = string.gsub(hea[
1],
"/www",
"")
70 <?xml version=
"1.0" encoding=
"utf-8"?>
71 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
72 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"<%=luci.i18n.context.lang%>" lang=
"<%=luci.i18n.context.lang%>">
74 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
75 <meta http-equiv=
"Content-Script-Type" content=
"text/javascript" />
76 <link rel=
"stylesheet" type=
"text/css" media=
"screen" href=
"<%=media%>/cascade.css" />
77 <link rel=
"stylesheet" media=
"only screen and (max-device-width: 854px)" href=
"<%=media%>/mobile.css" type=
"text/css" />
78 <link rel=
"stylesheet" media=
"only screen and (max-width: 854px)" href=
"<%=media%>/smallscreen.css" type=
"text/css" />
79 <link rel=
"stylesheet" media=
"handheld" href=
"<%=media%>/mobile.css" type=
"text/css" />
80 <!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/ie7.css" /><![endif]-->
81 <% if node and node.css then %
><link rel=
"stylesheet" type=
"text/css" media=
"screen" href=
"<%=resource%>/<%=node.css%>" />
83 <% if css then %
><style title=
"text/css">
87 <meta name=
"viewport" content=
"initial-scale=1.0" />
88 <script type=
"text/javascript" src=
"<%=resource%>/xhr.js"></script>
90 <title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(tostring(node.title)) or '')) %
> - LuCI
</title>
93 <body class=
"lang_<%=luci.i18n.context.lang%>">
98 <div class="warning"><div style="background-color: #cccccc;padding: 2px 10px 2px 10px">
99 <%: Your Internet Explorer is too old to display this page correctly. Please upgrade it to at least version 7 or use another browser like Firefox, Opera or Safari.%>
103 <%- if luci.sys.process.info(
"uid") ==
0 and luci.sys.user.getuser(
"root") and not luci.sys.user.getpasswd(
"root") then -%
>
104 <div class=
"warning">
105 <strong><%:No password set!%
></strong><br />
106 <%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%
>
111 <span id=
"skiplink1"><a href=
"#navigation"><%:skiplink1 Skip to navigation%
></a></span>
112 <span id=
"skiplink2"><a href=
"#content"><%:skiplink2 Skip to content%
></a></span>
117 <div class=
"header_banner">
118 <a href=
"<%=hp%>"><img src=
"<%=logo%>" alt=
"Header" /></a>
121 <div class=
"header_left">
122 <a href=
"<%=hp%>"><img src=
"<%=logo%>" id=
"mainlogo" alt=
"Logo" /></a>
123 <%if show_comm then%
>
124 <a href=
"<%=hp%>"><%=community%
></a>
128 <div class=
"header_right">
129 <%=luci.version.distversion%
><br />
130 <%:Load%
>: <%=
"%.2f" % load1%
> <%=
"%.2f" % load5%
> <%=
"%.2f" % load15%
><br />
131 <%:Hostname%
>: <%=hostname%
><br />
132 <span id=
"xhr_poll_status" style=
"display:none" onclick=
"XHR.running() ? XHR.halt() : XHR.run()">
134 <span id=
"xhr_poll_status_on"><%:on%
></span>
135 <span id=
"xhr_poll_status_off" style=
"display:none"><%:off%
></span>
138 <div class=
"clear"></div>
144 local function submenu(prefix, node)
145 local childs = disp.node_childs(node)
148 <ul id=
"submenu_<%=string.gsub(string.gsub(prefix, "/
", "_
"), "^_(.-)_$
", "%
1")%>">
150 for i, r in ipairs(childs) do
151 local nnode = node.nodes[r]
152 local href = controller .. prefix .. r ..
"/" ..
153 (nnode.query and http.build_querystring(nnode.query) or
"")
156 <a<%=ifattr(nnode._menu_selected,
"class",
"active")%
> href=
"<%=luci.util.pcdata(href)%>"><%=translate(nnode.title)%
></a>
157 <%- submenu(prefix .. r ..
"/", nnode) %
>
169 <h2 class=
"navigation"><a id=
"navigation" name=
"navigation"><%:navigation Navigation%
></a></h2>
170 <ul id=
"mainmenu" class=
"dropdowns">
172 local childs = disp.node_childs(cattree)
174 for i, r in ipairs(childs) do
175 local nnode = cattree.nodes[r]
176 local href = controller ..
"/" .. category ..
"/" .. r ..
177 (nnode.query and http.build_querystring(k.query) or
"")
180 <a<%=ifattr(nnode._menu_selected,
"class",
"preactive")%
> href=
"<%=href%>"><%=translate(nnode.title)%
></a>
181 <%- submenu(
"/" .. category ..
"/" .. r ..
"/", nnode) %
>
190 <% if #categories
> 1 then %
>
192 <% for i, r in ipairs(categories) do %
>
193 <li><a<%=ifattr(request[
1] == r,
"class",
"active")%
> href=
"<%=controller%>/<%=r%>/"><%=striptags(translate(tree.nodes[r].title))%
></a></li>
199 if tree.nodes[category] and tree.nodes[category].ucidata then
201 for i, j in pairs(require(
"luci.model.uci").cursor():changes()) do
202 for k, l in pairs(j) do
203 for m, n in pairs(l) do
210 <% if ucic
> 0 then %
>
211 <a class=
"warning" href=
"<%=controller%>/<%=category%>/uci/changes/?redir=<%=http.urlencode(http.formvalue("redir
") or REQUEST_URI)%>"><%:Unsaved Changes%
>: <%=ucic%
></a>
216 <div class=
"clear"></div>
218 <div id=
"maincontent">
219 <% if category ~=
"freifunk" and category ~=
"splash" then %
>
221 <div class=
"errorbox">
222 <strong><%:Java Script required!%
></strong><br />
223 <%:You must enable Java Script in your browser or LuCI will not work properly.%
>