2 Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI
5 Copyright 2015 Lutty Yang
8 Have a bug? Please create an issue here on GitHub!
9 https://github.com/LuttyYang/luci-theme-material/issues
12 Copyright 2008 Steven Barth
14 Copyright 2008 Jo-Philipp Wich
16 Copyright 2012 David Menting
20 https://github.com/muicss/mui
22 Licensed to the public under the Apache License 2.0
26 local ver = require "luci.version"
27 local sys = require "luci.sys"
28 local util = require "luci.util"
29 local http = require "luci.http"
30 local disp = require "luci.dispatcher"
32 local boardinfo = util.ubus("system", "board")
34 local request = disp.context.path
35 local request2 = disp.context.request
37 local category = request[1]
38 local cattree = category and disp.node(category)
40 local leaf = request2[#request2]
42 local tree = disp.node()
43 local node = disp.context.dispatched
45 local categories = disp.node_childs(tree)
50 -- tag all nodes leading to this page
51 for i, r in ipairs(request) do
52 if c.nodes and c.nodes[r] then
54 c._menu_selected = true
59 http.prepare_content("text/html")
61 local function nodeurl(prefix, name, query)
62 local url = controller .. prefix .. name .. "/"
64 url = url .. http.build_querystring(query)
69 local function subtree(prefix, node, level)
74 local childs = disp.node_childs(node)
87 for i, v in ipairs(childs) do
88 local nnode = node.nodes[v]
89 if nnode._menu_selected then
95 <li class="tabmenu-item-<%=v%><%- if nnode._menu_selected or (node.leaf and v == leaf) then %> active<% end %>">
96 <a href="<%=nodeurl(prefix, v, nnode.query)%>"><%=striptags(translate(nnode.title))%></a>
106 if selected_node then
107 subtree(prefix .. selected_name .. "/", selected_node, level + 1)
113 <html lang="<%=luci.i18n.context.lang%>">
115 <meta charset="utf-8">
116 <title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(node.title) or
117 '')) %> - LuCI</title>
118 <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
119 <meta name="format-detection" content="telephone=no, email=no"/>
120 <meta name="apple-mobile-web-app-capable" content="yes">
121 <meta name="mobile-web-app-capable" content="yes">
122 <meta name="x5-fullscreen" content="true">
123 <meta name="full-screen" content="yes">
124 <meta name="x5-page-mode" content="app">
125 <meta name="browsermode" content="application">
126 <meta name="theme-color" content="#0099CC">
127 <meta name="msapplication-tap-highlight" content="no">
128 <meta name="msapplication-TileColor" content="#0099CC">
130 <meta name="application-name" content="<%=striptags( (boardinfo.hostname or "?") ) %> - LuCI">
131 <meta name="apple-mobile-web-app-title" content="<%=striptags( (boardinfo.hostname or "?") ) %> - LuCI">
132 <meta name="msapplication-TileImage" content="<%=media%>/logo.png"/>
133 <link rel="icon" href="<%=media%>/logo.png" sizes="144x144">
134 <link rel="apple-touch-icon-precomposed" href="<%=media%>/logo.png" sizes="144x144">
136 <link rel="stylesheet" href="<%=media%>/css/style.css">
137 <link rel="shortcut icon" href="<%=media%>/favicon.ico">
138 <% if node and node.css then %>
139 <link rel="stylesheet" href="<%=resource%>/<%=node.css%>">
142 <style title="text/css">
153 <script src="<%=resource%>/xhr.js"></script>
156 <body class="lang_<%=luci.i18n.context.lang%> <%- if node then %><%= striptags( node.title ) %><%- end %> <% if luci.dispatcher.context.authsession then %>logged-in<% end %>">
159 <div class="container">
160 <span class="showSide"></span>
161 <a class="brand" href="#"><%=boardinfo.hostname or "?"%></a>
162 <div class="pull-right">
164 -- calculate the number of unsaved changes
165 if tree.nodes[category] and tree.nodes[category].ucidata then
167 for i, j in pairs(require("luci.model.uci").cursor():changes()) do
168 for k, l in pairs(j) do
169 for m, n in pairs(l) do
170 ucichanges = ucichanges + 1;
175 <% if ucichanges > 0 then %>
176 <a class="label notice"
177 href="<%=controller%>/<%=category%>/uci/changes?redir=<%=http.urlencode(http.formvalue(" redir") or
178 REQUEST_URI)%>"><span class="mobile-hide"><%:Unsaved Changes%>: </span><%=ucichanges%></a>
180 <span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()">
181 <span class="label success" id="xhr_poll_status_on"><span class="mobile-hide"><%:Auto Refresh%> </span><%:on%></span>
182 <span class="label" id="xhr_poll_status_off" style="display:none"><span class="mobile-hide"><%:Auto Refresh%> </span><%:off%></span>
190 <div style="" class="loading"><span><div class="loading-img"></div>Loading...</span></div>
191 <div class="main-left">
194 local function submenu(prefix, node)
195 local childs = disp.node_childs(node)
198 <ul class="slide-menu">
200 for i, r in ipairs(childs) do
201 local nnode = node.nodes[r]
202 local href = controller .. prefix .. r ..
203 (nnode.query and http.build_querystring(nnode.query) or "")
205 <li><a data-title="<%=pcdata(striptags(nnode.title))%>" href="<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%></a>
215 childs = disp.node_childs(cattree)
218 for i, r in ipairs(childs) do
219 local nnode = cattree.nodes[r]
220 local href = controller .. "/" .. category .. "/" .. r ..
221 (nnode.query and http.build_querystring(k.query) or "")
222 local grandchildren = disp.node_childs(nnode)
224 if #grandchildren > 0 then
227 <a class="menu" data-title="<%=pcdata(striptags(nnode.title))%>" href="#"><%=pcdata(striptags(translate(nnode.title)))%></a>
228 <%- submenu("/" .. category .. "/" .. r .. "/", nnode) %>
232 <a data-title="<%=pcdata(striptags(nnode.title))%>" href="<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%></a>
241 <div class="main-right">
242 <div class="darkMask"></div>
243 <div id="maincontent">
244 <div class="container">
245 <%- if luci.sys.process.info("uid") == 0 and luci.sys.user.getuser("root") and not
246 luci.sys.user.getpasswd("root") then -%>
247 <div class="alert-message warning">
248 <h4><%:No password set!%></h4>
249 <%:There is no password set on this router. Please configure a root password to protect the web
250 interface and enable SSH.%><br>
251 <a href="<%=pcdata(luci.dispatcher.build_url(" admin/system/admin"))%>"><%:Go to password
252 configuration...%></a>
255 <% if category then subtree("/" .. category .. "/", cattree) end %>