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 ver = require
"luci.version"
23 local sys = require
"luci.sys"
24 local util = require
"luci.util"
25 local http = require
"luci.http"
26 local disp = require
"luci.dispatcher"
28 local boardinfo = util.ubus(
"system",
"board")
30 local request = disp.context.path
31 local request2 = disp.context.request
33 local category = request[
1]
34 local cattree = category and disp.node(category)
36 local leaf = request2[#request2]
38 local tree = disp.node()
39 local node = disp.context.dispatched
41 local categories = disp.node_childs(tree)
46 -- tag all nodes leading to this page
47 for i, r in ipairs(request) do
48 if c.nodes and c.nodes[r] then
50 c._menu_selected = true
55 http.prepare_content(
"text/html")
57 local function nodeurl(prefix, name, query)
58 local url = controller .. prefix .. name ..
"/"
60 url = url .. http.build_querystring(query)
65 local function subtree(prefix, node, level)
70 local childs = disp.node_childs(node)
83 for i, v in ipairs(childs) do
84 local nnode = node.nodes[v]
85 if nnode._menu_selected then
91 <li class=
"tabmenu-item-<%=v%><%- if nnode._menu_selected or (node.leaf and v == leaf) then %> active<% end %>">
92 <a href=
"<%=nodeurl(prefix, v, nnode.query)%>"><%=striptags(translate(nnode.title))%
></a>
102 if selected_node then
103 subtree(prefix .. selected_name ..
"/", selected_node, level +
1)
109 <html lang=
"<%=luci.i18n.context.lang%>">
111 <meta charset=
"utf-8">
112 <title><%=striptags( (boardinfo.hostname or
"?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %
> - LuCI
</title>
113 <meta content=
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name=
"viewport" />
114 <meta name=
"format-detection" content=
"telephone=no, email=no"/>
115 <meta name=
"apple-mobile-web-app-capable" content=
"yes">
116 <meta name=
"mobile-web-app-capable" content=
"yes">
117 <meta name=
"x5-fullscreen" content=
"true">
118 <meta name=
"full-screen" content=
"yes">
119 <meta name=
"x5-page-mode" content=
"app">
120 <meta name=
"browsermode" content=
"application">
121 <meta name=
"theme-color" content=
"#0099CC">
122 <meta name=
"msapplication-tap-highlight" content=
"no">
123 <meta name=
"msapplication-TileColor" content=
"#0099CC">
124 <meta name=
"msapplication-TileImage" content=
"<%=media%>/logo.png"/>
125 <link rel=
"stylesheet" href=
"<%=media%>/css/style.css?<%= ver.luciversion %>">
126 <link rel=
"shortcut icon" href=
"<%=media%>/favicon.ico">
127 <% if node and node.css then %
>
128 <link rel=
"stylesheet" href=
"<%=resource%>/<%=node.css%>">
131 <style title=
"text/css">
135 <script src=
"<%=resource%>/xhr.js"></script>
138 <body class=
"lang_<%=luci.i18n.context.lang%> <%- if node then %><%= striptags( node.title ) %><%- end %>">
141 <div class=
"container">
142 <span class=
"showSide"></span>
143 <a class=
"brand" href=
"#"><%=boardinfo.hostname or
"?"%
></a>
144 <div class=
"pull-right">
146 -- calculate the number of unsaved changes
147 if tree.nodes[category] and tree.nodes[category].ucidata then
149 for i, j in pairs(require(
"luci.model.uci").cursor():changes()) do
150 for k, l in pairs(j) do
151 for m, n in pairs(l) do
152 ucichanges = ucichanges +
1;
157 <% if ucichanges
> 0 then %
>
158 <a class=
"label notice" href=
"<%=controller%>/<%=category%>/uci/changes?redir=<%=http.urlencode(http.formvalue("redir
") or REQUEST_URI)%>"><span class=
"mobile-hide"><%:Unsaved Changes%
>:
</span><%=ucichanges%
></a>
160 <span id=
"xhr_poll_status" style=
"display:none" onclick=
"XHR.running() ? XHR.halt() : XHR.run()">
161 <span class=
"label success" id=
"xhr_poll_status_on"><span class=
"mobile-hide"><%:Auto Refresh%
> </span><%:on%
></span>
162 <span class=
"label" id=
"xhr_poll_status_off" style=
"display:none"><span class=
"mobile-hide"><%:Auto Refresh%
> </span><%:off%
></span>
170 <div style=
"" class=
"loading"><span><div class=
"loading-img"></div>Loading...
</span></div>
171 <div class=
"main-left">
174 local function submenu(prefix, node)
175 local childs = disp.node_childs(node)
178 <ul class=
"slide-menu">
180 for i, r in ipairs(childs) do
181 local nnode = node.nodes[r]
182 local href = controller .. prefix .. r ..
183 (nnode.query and http.build_querystring(nnode.query) or
"")
185 <li><a data-title=
"<%=pcdata(striptags(nnode.title))%>" href=
"<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%
></a></li>
194 childs = disp.node_childs(cattree)
197 for i, r in ipairs(childs) do
198 local nnode = cattree.nodes[r]
199 local href = controller ..
"/" .. category ..
"/" .. r ..
200 (nnode.query and http.build_querystring(k.query) or
"")
201 local grandchildren = disp.node_childs(nnode)
203 if #grandchildren
> 0 then
206 <a class=
"menu" data-title=
"<%=pcdata(striptags(nnode.title))%>" href=
"#"><%=pcdata(striptags(translate(nnode.title)))%
></a>
207 <%- submenu(
"/" .. category ..
"/" .. r ..
"/", nnode) %
>
211 <a data-title=
"<%=pcdata(striptags(nnode.title))%>" href=
"<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%
></a>
220 <div class=
"main-right">
221 <div class=
"darkMask"></div>
222 <div id=
"maincontent">
223 <div class=
"container">
224 <%- if luci.sys.process.info(
"uid") ==
0 and luci.sys.user.getuser(
"root") and not luci.sys.user.getpasswd(
"root") then -%
>
225 <div class=
"alert-message warning">
226 <h4><%:No password set!%
></h4>
227 <%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%
><br>
228 <a href=
"<%=pcdata(luci.dispatcher.build_url("admin/system/admin
"))%>"><%:Go to password configuration...%
></a>
231 <% if category then subtree(
"/" .. category ..
"/", cattree) end %
>