2 Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI
5 Copyright
2015 Lutty Yang
<lutty@wcan.in
>
7 Have a bug? Please create an issue here on GitHub!
8 https://github.com/LuttyYang/luci-theme-material/issues
11 Copyright
2008 Steven Barth
<steven@midlink.org
>
12 Copyright
2008 Jo-Philipp Wich
<jow@openwrt.org
>
13 Copyright
2012 David Menting
<david@nut-bolt.nl
>
16 https://github.com/muicss/mui
18 Licensed to the public under the Apache License
2.0
22 local sys = require
"luci.sys"
23 local util = require
"luci.util"
24 local http = require
"luci.http"
25 local disp = require
"luci.dispatcher"
27 local boardinfo = util.ubus(
"system",
"board")
29 local request = disp.context.path
30 local request2 = disp.context.request
32 local category = request[
1]
33 local cattree = category and disp.node(category)
35 local leaf = request2[#request2]
37 local tree = disp.node()
38 local node = disp.context.dispatched
40 local categories = disp.node_childs(tree)
45 -- tag all nodes leading to this page
46 for i, r in ipairs(request) do
47 if c.nodes and c.nodes[r] then
49 c._menu_selected = true
54 http.prepare_content(
"text/html")
56 local function nodeurl(prefix, name, query)
57 local url = controller .. prefix .. name ..
"/"
59 url = url .. http.build_querystring(query)
64 local function subtree(prefix, node, level)
69 local childs = disp.node_childs(node)
82 for i, v in ipairs(childs) do
83 local nnode = node.nodes[v]
84 if nnode._menu_selected then
90 <li class=
"tabmenu-item-<%=v%><%- if nnode._menu_selected or (node.leaf and v == leaf) then %> active<% end %>">
91 <a href=
"<%=nodeurl(prefix, v, nnode.query)%>"><%=striptags(translate(nnode.title))%
></a>
101 if selected_node then
102 subtree(prefix .. selected_name ..
"/", selected_node, level +
1)
108 <html lang=
"<%=luci.i18n.context.lang%>">
110 <meta charset=
"utf-8">
111 <title><%=striptags( (boardinfo.hostname or
"?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %
> - LuCI
</title>
112 <meta content=
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name=
"viewport" />
113 <meta name=
"format-detection" content=
"telephone=no, email=no"/>
114 <meta name=
"apple-mobile-web-app-capable" content=
"yes">
115 <meta name=
"mobile-web-app-capable" content=
"yes">
116 <meta name=
"x5-fullscreen" content=
"true">
117 <meta name=
"full-screen" content=
"yes">
118 <meta name=
"x5-page-mode" content=
"app">
119 <meta name=
"browsermode" content=
"application">
120 <meta name=
"theme-color" content=
"#0099CC">
121 <meta name=
"msapplication-tap-highlight" content=
"no">
122 <meta name=
"msapplication-TileColor" content=
"#0099CC">
123 <meta name=
"msapplication-TileImage" content=
"<%=media%>/logo.png"/>
124 <link rel=
"stylesheet" href=
"<%=media%>/css/style.css">
125 <link rel=
"shortcut icon" href=
"<%=media%>/favicon.ico">
126 <% if node and node.css then %
>
127 <link rel=
"stylesheet" href=
"<%=resource%>/<%=node.css%>">
130 <style title=
"text/css">
134 <script src=
"<%=resource%>/xhr.js"></script>
137 <body class=
"lang_<%=luci.i18n.context.lang%> <%- if node then %><%= striptags( node.title ) %><%- end %>">
140 <div class=
"container">
141 <span class=
"showSide"></span>
142 <a class=
"brand" href=
"#"><%=boardinfo.hostname or
"?"%
></a>
143 <div class=
"pull-right">
145 -- calculate the number of unsaved changes
146 if tree.nodes[category] and tree.nodes[category].ucidata then
148 for i, j in pairs(require(
"luci.model.uci").cursor():changes()) do
149 for k, l in pairs(j) do
150 for m, n in pairs(l) do
151 ucichanges = ucichanges +
1;
156 <% if ucichanges
> 0 then %
>
157 <a class=
"label notice" href=
"<%=controller%>/<%=category%>/uci/changes"><%:Unsaved Changes%
>: <%=ucichanges%
></a>
159 <span id=
"xhr_poll_status" style=
"display:none" onclick=
"XHR.running() ? XHR.halt() : XHR.run()">
160 <span class=
"label success" id=
"xhr_poll_status_on"><%:Auto Refresh%
> <%:on%
></span>
161 <span class=
"label" id=
"xhr_poll_status_off" style=
"display:none"><%:Auto Refresh%
> <%:off%
></span>
169 <div class=
"main-left">
172 local function submenu(prefix, node)
173 local childs = disp.node_childs(node)
176 <ul class=
"slide-menu">
178 for i, r in ipairs(childs) do
179 local nnode = node.nodes[r]
180 local href = controller .. prefix .. r ..
181 (nnode.query and http.build_querystring(nnode.query) or
"")
183 <li><a data-title=
"<%=pcdata(striptags(nnode.title))%>" href=
"<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%
></a></li>
192 childs = disp.node_childs(cattree)
195 for i, r in ipairs(childs) do
196 local nnode = cattree.nodes[r]
197 local href = controller ..
"/" .. category ..
"/" .. r ..
198 (nnode.query and http.build_querystring(k.query) or
"")
199 local grandchildren = disp.node_childs(nnode)
201 if #grandchildren
> 0 then
204 <a class=
"menu" data-title=
"<%=pcdata(striptags(nnode.title))%>" href=
"#"><%=pcdata(striptags(translate(nnode.title)))%
></a>
205 <%- submenu(
"/" .. category ..
"/" .. r ..
"/", nnode) %
>
209 <a data-title=
"<%=pcdata(striptags(nnode.title))%>" href=
"<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%
></a>
218 <div class=
"main-right">
219 <div class=
"darkMask"></div>
220 <div id=
"maincontent">
221 <div class=
"container">
222 <%- if luci.sys.process.info(
"uid") ==
0 and luci.sys.user.getuser(
"root") and not luci.sys.user.getpasswd(
"root") then -%
>
223 <div class=
"alert-message warning">
224 <h4><%:No password set!%
></h4>
225 <%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%
><br>
226 <a href=
"<%=pcdata(luci.dispatcher.build_url("admin/system/admin
"))%>"><%:Go to password configuration...%
></a>
229 <% if category then subtree(
"/" .. category ..
"/", cattree) end %
>