2 luci-theme-material is based on MUI and luci-theme-bootstrap.
5 Copyright
2008 Steven Barth
<steven@midlink.org
>
6 Copyright
2008 Jo-Philipp Wich
<jow@openwrt.org
>
7 Copyright
2012 David Menting
<david@nut-bolt.nl
>
10 https://github.com/muicss/mui
13 Copyright
2015 Lutty Yang
<lutty@wcan.in
>
15 Licensed to the public under the Apache License
2.0
19 local sys = require
"luci.sys"
20 local util = require
"luci.util"
21 local http = require
"luci.http"
22 local disp = require
"luci.dispatcher"
24 local boardinfo = util.ubus(
"system",
"board")
26 local request = disp.context.path
27 local request2 = disp.context.request
29 local category = request[
1]
30 local cattree = category and disp.node(category)
32 local leaf = request2[#request2]
34 local tree = disp.node()
35 local node = disp.context.dispatched
37 local categories = disp.node_childs(tree)
42 -- tag all nodes leading to this page
43 for i, r in ipairs(request) do
44 if c.nodes and c.nodes[r] then
46 c._menu_selected = true
51 http.prepare_content(
"text/html")
53 local function nodeurl(prefix, name, query)
54 local url = controller .. prefix .. name ..
"/"
56 url = url .. http.build_querystring(query)
61 local function subtree(prefix, node, level)
66 local childs = disp.node_childs(node)
79 for i, v in ipairs(childs) do
80 local nnode = node.nodes[v]
81 if nnode._menu_selected then
87 <li class=
"tabmenu-item-<%=v%><%- if nnode._menu_selected or (node.leaf and v == leaf) then %> active<% end %>">
88 <a href=
"<%=nodeurl(prefix, v, nnode.query)%>"><%=striptags(translate(nnode.title))%
></a>
99 subtree(prefix .. selected_name ..
"/", selected_node, level +
1)
105 <html lang=
"<%=luci.i18n.context.lang%>">
107 <meta charset=
"utf-8">
108 <title><%=striptags( (boardinfo.hostname or
"?") .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %
> - LuCI
</title>
109 <meta content=
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name=
"viewport" />
110 <meta name=
"format-detection" content=
"telephone=no, email=no"/>
111 <meta name=
"apple-mobile-web-app-capable" content=
"yes">
112 <meta name=
"mobile-web-app-capable" content=
"yes">
113 <meta name=
"x5-fullscreen" content=
"true">
114 <meta name=
"full-screen" content=
"yes">
115 <meta name=
"x5-page-mode" content=
"app">
116 <meta name=
"browsermode" content=
"application">
117 <meta name=
"theme-color" content=
"#0099CC">
118 <meta name=
"msapplication-tap-highlight" content=
"no">
119 <meta name=
"msapplication-TileColor" content=
"#0099CC">
120 <meta name=
"msapplication-TileImage" content=
"<%=media%>/logo.png"/>
121 <link rel=
"stylesheet" href=
"<%=media%>/css/style.css">
122 <link rel=
"shortcut icon" href=
"<%=media%>/favicon.ico">
123 <% if node and node.css then %
>
124 <link rel=
"stylesheet" href=
"<%=resource%>/<%=node.css%>">
127 <style title=
"text/css">
131 <script src=
"<%=resource%>/xhr.js"></script>
134 <body class=
"lang_<%=luci.i18n.context.lang%> <%- if node then %><%= striptags( node.title ) %><%- end %>">
137 <div class=
"container">
138 <span class=
"showSide"></span>
139 <a class=
"brand" href=
"#"><%=boardinfo.hostname or
"?"%
></a>
140 <div class=
"pull-right">
142 -- calculate the number of unsaved changes
143 if tree.nodes[category] and tree.nodes[category].ucidata then
145 for i, j in pairs(require(
"luci.model.uci").cursor():changes()) do
146 for k, l in pairs(j) do
147 for m, n in pairs(l) do
148 ucichanges = ucichanges +
1;
153 <% if ucichanges
> 0 then %
>
154 <a class=
"label notice" href=
"<%=controller%>/<%=category%>/uci/changes"><%:Unsaved Changes%
>: <%=ucichanges%
></a>
156 <span id=
"xhr_poll_status" style=
"display:none" onclick=
"XHR.running() ? XHR.halt() : XHR.run()">
157 <span class=
"label success" id=
"xhr_poll_status_on"><%:Auto Refresh%
> <%:on%
></span>
158 <span class=
"label" id=
"xhr_poll_status_off" style=
"display:none"><%:Auto Refresh%
> <%:off%
></span>
166 <div class=
"main-left">
169 local function submenu(prefix, node)
170 local childs = disp.node_childs(node)
173 <ul class=
"slide-menu">
175 for i, r in ipairs(childs) do
176 local nnode = node.nodes[r]
177 local href = controller .. prefix .. r ..
178 (nnode.query and http.build_querystring(nnode.query) or
"")
180 <li><a data-title=
"<%=pcdata(striptags(nnode.title))%>" href=
"<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%
></a></li>
189 childs = disp.node_childs(cattree)
192 for i, r in ipairs(childs) do
193 local nnode = cattree.nodes[r]
194 local href = controller ..
"/" .. category ..
"/" .. r ..
195 (nnode.query and http.build_querystring(k.query) or
"")
196 local grandchildren = disp.node_childs(nnode)
198 if #grandchildren
> 0 then
201 <a class=
"menu" data-title=
"<%=pcdata(striptags(nnode.title))%>" href=
"#"><%=pcdata(striptags(translate(nnode.title)))%
></a>
202 <%- submenu(
"/" .. category ..
"/" .. r ..
"/", nnode) %
>
206 <a data-title=
"<%=pcdata(striptags(nnode.title))%>" href=
"<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%
></a>
215 <div class=
"main-right">
216 <div class=
"darkMask"></div>
217 <div id=
"maincontent">
218 <div class=
"container">
219 <%- if luci.sys.process.info(
"uid") ==
0 and luci.sys.user.getuser(
"root") and not luci.sys.user.getpasswd(
"root") then -%
>
220 <div class=
"alert-message warning">
221 <h4><%:No password set!%
></h4>
222 <%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%
><br>
223 <a href=
"<%=pcdata(luci.dispatcher.build_url("admin/system/admin
"))%>"><%:Go to password configuration...%
></a>
226 <% if category then subtree(
"/" .. category ..
"/", cattree) end %
>