<% require("luci.sys") require("luci.tools.webadmin") local load1, load5, load15 = luci.sys.loadavg() local uptime = luci.sys.uptime() local request = require("luci.dispatcher").context.path local category = request[1] local tree = luci.dispatcher.node() local cattree = category and luci.dispatcher.node(category) local node = luci.dispatcher.context.dispatched local hostname = luci.sys.hostname() local identifier, model, total_mem, cache, buffer, free_mem = luci.sys.sysinfo() local c = tree for i,r in ipairs(request) do if c.nodes and c.nodes[r] then c = c.nodes[r] c._menu_selected = true end end --count changes: function countchanges(tree) local count = 0 if tree.nodes[category] and tree.nodes[category].ucidata then for i, j in pairs(require("luci.model.uci").cursor():changes()) do for k, l in pairs(j) do for m, n in pairs(l) do count = count + 1; end end end end return(count) end local ucic = countchanges(tree) require("luci.i18n").loadc("default") require("luci.http").prepare_content("text/html") local function countsubs(node) local count=0 for k, n in pairs(node.nodes) do if n.title and n.target then count = count + 1 end end return(count) end local function iphone_button(content, class, script) %>
<%=content%>
<% end local function iphone_menu(prefix, node, id) if not node.nodes or node.hidden then return false end local index = {} local count = 0 for k, n in pairs(node.nodes) do if n.title and n.target then table.insert(index, {name=k, order=n.order or 100}) count = count + 1 end end table.sort(index, function(a, b) return a.order < b.order end) if count > 0 then local subs local counter = 0 local next_id local aclass = "" local ahref = "" for j, v in pairs(index) do if not v.hidden and #v.name > 0 then local nnode = node.nodes[v.name] local href = controller .. prefix .. v.name href = (nnode.query) and href .. luci.http.build_querystring(nnode.query) or href subs = countsubs(nnode) counter = counter + 1 next_id = id.."_"..counter ahref=luci.util.pcdata(href) if nnode._menu_selected then aclass = "active" else aclass = "" end %> <% iphone_button('' .. nnode.title .. '', "", "top.location.href='" .. ahref .. "'") %> <% if subs > 0 then iphone_button("⟩", "", "show_menu_items('level"..next_id.."')") end %> <% iphone_menu(prefix .. v.name .. "/", nnode, next_id) %> <%- end end end end -%> <% if node and node.css then %> <% end %> <%=striptags( hostname .. ( (node and node.title) and ' - ' .. node.title or '')) %> - LuCI
<%:Distversion%>: <%=luci.version.distversion%> <%:Hostname%>: <%=hostname%> <%:Load%>: <%="%.2f" % load1%> <%="%.2f" % load5%> <%="%.2f" % load15%> <%:Uptime%>: <%=luci.tools.webadmin.date_format(tonumber(uptime))%> <%:Model%>: <%=model%> <%:Identifier%>: <%=identifier%>