<%# LuCI - Lua Configuration Interface Copyright 2008 Steven Barth Copyright 2008 Jo-Philipp Wich Copyright 2012 David Menting Copyright 2013 Griffin Boyce Copyright 2013 Seamus Tuohy Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -%> <% local crypto = require "luci.commotion.crypto" local http = require "luci.http" local sys = require "luci.sys" local disp = require "luci.dispatcher" local cdisp = require "luci.commotion.dispatch" -- ensure that client is running https crypto.check_https("/admin/", luci.http.getenv()) -- send as HTML5 http.prepare_content("text/html") hostname = sys.hostname() --The request path (eg. http://ipaddress/cgi-bin/luci/;id-string/THIS/THIS/THIS/) request = disp.context.path local request2 = disp.context.request --ROOT NODE OF PATH (eg. admin on admin pages) category = request[1] section = request[2] --SAME AGAIN cattree = category and disp.node(category) --leaf is length of request2 local leaf = request2[#request2] --Create a node of the local thread (the current context) tree = disp.node() --Show the local node (current menu) on the tree node = disp.context.dispatched --An Ordered table of node names of this tree's child nodes local categories = disp.node_childs(tree) local c = tree local i, r -- tag all nodes leading to this page 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 --nodeurl was here --subtree was here -%> <%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI <% if node and node.css then %> <% end -%>
Commotion - toggle header <%uci = require "luci.model.uci".cursor() ubus = require "ubus" conn = ubus.connect() if not conn then error("Failed to connect to ubusd") end mesh_ip = "None" uci:foreach("wireless", "wifi-iface", function(s) if s and s.mode and s.mode == "adhoc" and s.network then local iface = conn:call("network.interface."..s.network, "status", {}) if iface and iface["ipv4-address"] then if iface ~= nil and iface["ipv4-address"][1].address then mesh_ip = iface["ipv4-address"][1].address else mesh_ip = "Unknown" end elseif mesh_ip == "None" then mesh_ip = "Unknown" end end end ) conn:close() -%>
Node name:<%=hostname%> Mesh IP-Address:<%=mesh_ip%>
<%include("themes/commotion/unsaved_changes", {tree=tree, controller=controller, category=category})%>
<%if request[2] == "commotion" then%> <%# TODO Clean and combine these two menu templates after R1 push %> <%include("themes/commotion/basic_menu", {controller=controller, cattree=cattree, category=category, node=node, section=section})%>
<%elseif request[1] ~= "commotion" then%> <%include("themes/commotion/adv_menu", {controller=controller, cattree=cattree, category=category, node=node, section=section})%> <%include("themes/commotion/subtree", {controller=controller, category=category, cattree=cattree})%> <%end%>