diff options
author | Steven Barth <steven@midlink.org> | 2008-08-26 23:00:44 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-08-26 23:00:44 +0000 |
commit | 91ba7c42f5b45614c9f4c803d09399f08a8e27b1 (patch) | |
tree | 21d1e1d67b3bee82eb123c0c5dbb274f2fcb6b59 /modules/freifunk/luasrc | |
parent | 43b3217e5595acc91ff6d7614a5c21c88696fbcc (diff) |
UCI API changes
Diffstat (limited to 'modules/freifunk/luasrc')
-rw-r--r-- | modules/freifunk/luasrc/controller/freifunk/luciinfo.lua | 57 | ||||
-rw-r--r-- | modules/freifunk/luasrc/view/freifunk/contact.htm | 2 | ||||
-rw-r--r-- | modules/freifunk/luasrc/view/freifunk/index.htm | 2 |
3 files changed, 2 insertions, 59 deletions
diff --git a/modules/freifunk/luasrc/controller/freifunk/luciinfo.lua b/modules/freifunk/luasrc/controller/freifunk/luciinfo.lua deleted file mode 100644 index 5ddb791fe..000000000 --- a/modules/freifunk/luasrc/controller/freifunk/luciinfo.lua +++ /dev/null @@ -1,57 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> - -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 - -$Id$ -]]-- -module("luci.controller.freifunk.luciinfo", package.seeall) - -function index() - node("freifunk", "luciinfo").target = call("action_index") -end - -function action_index() - local uci = luci.model.uci - luci.http.prepare_content("text/plain") - - -- General - luci.http.write("luciinfo.api=1\n") - luci.http.write("luciinfo.version=" .. tostring(require("luci").__version__) .. "\n") - - -- Sysinfo - local s, m, r = luci.sys.sysinfo() - local dr = luci.sys.net.defaultroute() - dr = dr and luci.ip.Hex(dr.Gateway, 32, luci.ip.FAMILY_INET4):string() - local l1, l5, l15 = luci.sys.loadavg() - - luci.http.write("sysinfo.system=" .. sanitize(s) .. "\n") - luci.http.write("sysinfo.cpu=" .. sanitize(m) .. "\n") - luci.http.write("sysinfo.ram=" .. sanitize(r) .. "\n") - luci.http.write("sysinfo.hostname=" .. sanitize(luci.sys.hostname()) .. "\n") - luci.http.write("sysinfo.load1=" .. tostring(l1) .. "\n") - luci.http.write("sysinfo.load5=" .. tostring(l5) .. "\n") - luci.http.write("sysinfo.load15=" .. tostring(l15) .. "\n") - luci.http.write("sysinfo.defaultgw=" .. dr or "" .. "\n") - - - -- Freifunk - local ff = uci.get_all("freifunk") or {} - for k, v in pairs(ff) do - for i, j in pairs(v) do - if i:sub(1, 1) ~= "." then - luci.http.write("freifunk." .. k .. "." .. i .. "=" .. j .. "\n") - end - end - end -end - -function sanitize(val) - return val:gsub("\n", "\t") -end
\ No newline at end of file diff --git a/modules/freifunk/luasrc/view/freifunk/contact.htm b/modules/freifunk/luasrc/view/freifunk/contact.htm index 8de7b8d1c..12b072c02 100644 --- a/modules/freifunk/luasrc/view/freifunk/contact.htm +++ b/modules/freifunk/luasrc/view/freifunk/contact.htm @@ -13,7 +13,7 @@ $Id$ -%> <%+header%> -<% local contact = luci.model.uci.get_all("freifunk", "contact") %> +<% local contact = luci.model.uci.cursor():get_all("freifunk", "contact") %> <h1><%:contact%></h1> <table cellspacing="0" cellpadding="6"> <tr><th><%:nickname%>:</th><td><%=contact.nickname%></td></tr> diff --git a/modules/freifunk/luasrc/view/freifunk/index.htm b/modules/freifunk/luasrc/view/freifunk/index.htm index 2d9b5a63e..d9cc6a30d 100644 --- a/modules/freifunk/luasrc/view/freifunk/index.htm +++ b/modules/freifunk/luasrc/view/freifunk/index.htm @@ -13,7 +13,7 @@ $Id$ -%> <%+header%> -<% local ff = luci.model.uci.get_all("freifunk") %> +<% local ff = luci.model.uci.cursor():get_all("freifunk") %> <h1><%:hellonet%> <%=ff.community.name%>!</h1> <p><%:public1%><br /> <%:public2%><%=luci.sys.hostname()%>. <%:public3%> |