diff options
author | Steven Barth <steven@midlink.org> | 2008-05-22 14:04:03 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-05-22 14:04:03 +0000 |
commit | 6604399aa8f35d33c53a5e5a1fea765f401aef5e (patch) | |
tree | ed818d630634a98a8996a1ba6d10e63bbea17c39 /modules/freifunk | |
parent | f738eb786e3d30028310c7bcc447e7e7b63767e0 (diff) |
Merge branch 'menu'
Diffstat (limited to 'modules/freifunk')
-rw-r--r-- | modules/freifunk/src/controller/freifunk/freifunk.lua (renamed from modules/freifunk/src/controller/admin/index/wizard.lua) | 79 | ||||
-rw-r--r-- | modules/freifunk/src/controller/freifunk/luciinfo.lua (renamed from modules/freifunk/src/controller/rpc/luciinfo.lua) | 14 | ||||
-rw-r--r-- | modules/freifunk/src/controller/freifunk/olsr.lua (renamed from modules/freifunk/src/controller/public/olsr.lua) | 49 | ||||
-rw-r--r-- | modules/freifunk/src/controller/public/index.lua | 1 | ||||
-rw-r--r-- | modules/freifunk/src/controller/public/status.lua | 21 | ||||
-rw-r--r-- | modules/freifunk/src/controller/sudo/status.lua | 1 | ||||
-rw-r--r-- | modules/freifunk/src/model/cbi/freifunk/contact.lua (renamed from modules/freifunk/src/model/cbi/admin_index/contact.lua) | 0 | ||||
-rw-r--r-- | modules/freifunk/src/model/cbi/freifunk/freifunk.lua (renamed from modules/freifunk/src/model/cbi/admin_index/freifunk.lua) | 0 | ||||
-rw-r--r-- | modules/freifunk/src/model/menu/10freifunk.lua | 18 | ||||
-rw-r--r-- | modules/freifunk/src/view/freifunk-olsr/error_olsr.htm (renamed from modules/freifunk/src/view/public_olsr/error_olsr.htm) | 0 | ||||
-rw-r--r-- | modules/freifunk/src/view/freifunk-olsr/hna.htm (renamed from modules/freifunk/src/view/public_olsr/hna.htm) | 0 | ||||
-rw-r--r-- | modules/freifunk/src/view/freifunk-olsr/index.htm (renamed from modules/freifunk/src/view/public_olsr/index.htm) | 0 | ||||
-rw-r--r-- | modules/freifunk/src/view/freifunk-olsr/mid.htm (renamed from modules/freifunk/src/view/public_olsr/mid.htm) | 0 | ||||
-rw-r--r-- | modules/freifunk/src/view/freifunk-olsr/routes.htm (renamed from modules/freifunk/src/view/public_olsr/routes.htm) | 0 | ||||
-rw-r--r-- | modules/freifunk/src/view/freifunk-olsr/topology.htm (renamed from modules/freifunk/src/view/public_olsr/topology.htm) | 0 | ||||
-rw-r--r-- | modules/freifunk/src/view/freifunk/contact.htm (renamed from modules/freifunk/src/view/public_index/contact.htm) | 0 | ||||
-rw-r--r-- | modules/freifunk/src/view/freifunk/index.htm (renamed from modules/freifunk/src/view/public_index/index.htm) | 0 | ||||
-rw-r--r-- | modules/freifunk/src/view/freifunk/wizard.htm (renamed from modules/freifunk/src/view/admin_index/wizard.htm) | 0 | ||||
-rw-r--r-- | modules/freifunk/src/view/public_status/index.htm | 20 | ||||
-rw-r--r-- | modules/freifunk/src/view/public_status/iwscan.htm | 19 | ||||
-rw-r--r-- | modules/freifunk/src/view/sudo_status/iwconfig.htm | 21 | ||||
-rw-r--r-- | modules/freifunk/src/view/sudo_status/iwscan.htm | 22 |
22 files changed, 160 insertions, 105 deletions
diff --git a/modules/freifunk/src/controller/admin/index/wizard.lua b/modules/freifunk/src/controller/freifunk/freifunk.lua index efca38d21..e73ec263c 100644 --- a/modules/freifunk/src/controller/admin/index/wizard.lua +++ b/modules/freifunk/src/controller/freifunk/freifunk.lua @@ -1,6 +1,79 @@ -module("ffluci.controller.admin.index.wizard", package.seeall) +module("ffluci.controller.freifunk.freifunk", package.seeall) -function action() +function index() + local page = node() + page.target = alias("freifunk") + + local page = node("freifunk") + page.title = "Freifunk" + page.target = alias("freifunk", "index") + page.order = 5 + page.setuser = "nobody" + page.setgroup = "nogroup" + + local page = node("freifunk", "index") + page.target = template("freifunk/index") + page.title = "Übersicht" + page.order = 10 + + local page = node("freifunk", "index", "contact") + page.target = template("freifunk/contact") + page.title = "Kontakt" + + + local page = node("freifunk", "status") + page.target = action_status + page.title = "Status" + page.order = 20 + page.setuser = false + page.setgroup = false + + local page = node("freifunk", "status", "routes") + page.target = template("public_status/routes") + page.title = "Routingtabelle" + page.order = 10 + + local page = node("freifunk", "status", "iwscan") + page.target = template("public_status/iwscan") + page.title = "WLAN-Scan" + page.order = 20 + + + local page = node("admin", "index", "wizard") + page.target = action_wizard + page.title = "Freifunkassistent" + page.order = 20 + + local page = node("admin", "index", "freifunk") + page.target = cbi("freifunk/freifunk") + page.title = "Freifunk" + page.order = 30 + + local page = node("admin", "index", "contact") + page.target = cbi("freifunk/contact") + page.title = "Kontakt" + page.order = 40 +end + +function action_status() + local data = {} + + data.s, data.m, data.r = ffluci.sys.sysinfo() + + data.wifi = ffluci.sys.wifi.getiwconfig() + + data.routes = {} + for i, r in pairs(ffluci.sys.net.routes()) do + if r.Destination == "00000000" then + table.insert(data.routes, r) + end + end + + + ffluci.template.render("public_status/index", data) +end + +function action_wizard() if ffluci.http.formvalue("ip") then return configure_freifunk() end @@ -16,7 +89,7 @@ function action() end end - ffluci.template.render("admin_index/wizard", {ifaces=ifaces}) + ffluci.template.render("freifunk/wizard", {ifaces=ifaces}) end function configure_freifunk() diff --git a/modules/freifunk/src/controller/rpc/luciinfo.lua b/modules/freifunk/src/controller/freifunk/luciinfo.lua index 611423fbb..bc45898d9 100644 --- a/modules/freifunk/src/controller/rpc/luciinfo.lua +++ b/modules/freifunk/src/controller/freifunk/luciinfo.lua @@ -1,4 +1,8 @@ -module("ffluci.controller.rpc.luciinfo", package.seeall) +module("ffluci.controller.freifunk.luciinfo", package.seeall) + +function index() + node("freifunk", "luciinfo").target = action_index +end function action_index() local uci = ffluci.model.uci.StateSession() @@ -7,7 +11,7 @@ function action_index() -- General print("luciinfo.api=1") - print("luciinfo.version=" .. tostring(ffluci.__version__)) + print("luciinfo.version=" .. tostring(require("ffluci").__version__)) -- Sysinfo local s, m, r = ffluci.sys.sysinfo() @@ -28,11 +32,11 @@ function action_index() -- Freifunk local ff = uci:sections("freifunk") or {} for k, v in pairs(ff) do - if k:sub(1, 1) ~= "." then for i, j in pairs(v) do - print("freifunk." .. k .. "." .. i .. "=" .. j) + if i:sub(1, 1) ~= "." then + print("freifunk." .. k .. "." .. i .. "=" .. j) + end end - end end end diff --git a/modules/freifunk/src/controller/public/olsr.lua b/modules/freifunk/src/controller/freifunk/olsr.lua index d41f5ed41..6031cd431 100644 --- a/modules/freifunk/src/controller/public/olsr.lua +++ b/modules/freifunk/src/controller/freifunk/olsr.lua @@ -1,11 +1,38 @@ -module("ffluci.controller.public.olsr", package.seeall) +module("ffluci.controller.freifunk.olsr", package.seeall) require("ffluci.sys") +function index() + local page = node("freifunk", "olsr") + page.target = action_index + page.title = "OLSR" + page.order = 30 + + local page = node("freifunk", "olsr", "routes") + page.target = action_routes + page.title = "Routen" + page.order = 10 + + local page = node("freifunk", "olsr", "topology") + page.target = action_topology + page.title = "Topologie" + page.order = 20 + + local page = node("freifunk", "olsr", "hna") + page.target = action_hna + page.title = "HNA" + page.order = 30 + + local page = node("freifunk", "olsr", "mid") + page.target = action_mid + page.title = "MID" + page.order = 50 +end + function action_index() local data = fetch_txtinfo("links") if not data or not data.Links then - ffluci.template.render("public_olsr/error_olsr") + ffluci.template.render("freifunk-olsr/error_olsr") return nil end @@ -23,14 +50,14 @@ function action_index() table.sort(data.Links, compare) - ffluci.template.render("public_olsr/index", {links=data.Links}) + ffluci.template.render("freifunk-olsr/index", {links=data.Links}) end function action_routes() local data = fetch_txtinfo("routes") if not data or not data.Routes then - ffluci.template.render("public_olsr/error_olsr") + ffluci.template.render("freifunk-olsr/error_olsr") return nil end @@ -48,14 +75,14 @@ function action_routes() table.sort(data.Routes, compare) - ffluci.template.render("public_olsr/routes", {routes=data.Routes}) + ffluci.template.render("freifunk-olsr/routes", {routes=data.Routes}) end function action_topology() local data = fetch_txtinfo("topology") if not data or not data.Topology then - ffluci.template.render("public_olsr/error_olsr") + ffluci.template.render("freifunk-olsr/error_olsr") return nil end @@ -65,14 +92,14 @@ function action_topology() table.sort(data.Topology, compare) - ffluci.template.render("public_olsr/topology", {routes=data.Topology}) + ffluci.template.render("freifunk-olsr/topology", {routes=data.Topology}) end function action_hna() local data = fetch_txtinfo("hna") if not data or not data.HNA then - ffluci.template.render("public_olsr/error_olsr") + ffluci.template.render("freifunk-olsr/error_olsr") return nil end @@ -82,14 +109,14 @@ function action_hna() table.sort(data.HNA, compare) - ffluci.template.render("public_olsr/hna", {routes=data.HNA}) + ffluci.template.render("freifunk-olsr/hna", {routes=data.HNA}) end function action_mid() local data = fetch_txtinfo("mid") if not data or not data.MID then - ffluci.template.render("public_olsr/error_olsr") + ffluci.template.render("freifunk-olsr/error_olsr") return nil end @@ -99,7 +126,7 @@ function action_mid() table.sort(data.MID, compare) - ffluci.template.render("public_olsr/mid", {mids=data.MID}) + ffluci.template.render("freifunk-olsr/mid", {mids=data.MID}) end diff --git a/modules/freifunk/src/controller/public/index.lua b/modules/freifunk/src/controller/public/index.lua deleted file mode 100644 index f65478c05..000000000 --- a/modules/freifunk/src/controller/public/index.lua +++ /dev/null @@ -1 +0,0 @@ -module("ffluci.controller.public.index", package.seeall)
\ No newline at end of file diff --git a/modules/freifunk/src/controller/public/status.lua b/modules/freifunk/src/controller/public/status.lua deleted file mode 100644 index 8d2f7a303..000000000 --- a/modules/freifunk/src/controller/public/status.lua +++ /dev/null @@ -1,21 +0,0 @@ -module("ffluci.controller.public.status", package.seeall) - -function action_index() - local data = {} - - data.s, data.m, data.r = ffluci.sys.sysinfo() - - data.wifi = ffluci.sys.wifi.getiwconfig() - - data.routes = {} - for i, r in pairs(ffluci.sys.net.routes()) do - if r.Destination == "00000000" then - table.insert(data.routes, r) - end - end - - - ffluci.template.render("public_status/index", data) -end - - diff --git a/modules/freifunk/src/controller/sudo/status.lua b/modules/freifunk/src/controller/sudo/status.lua deleted file mode 100644 index fd5127d2c..000000000 --- a/modules/freifunk/src/controller/sudo/status.lua +++ /dev/null @@ -1 +0,0 @@ -module("ffluci.controller.sudo.status", package.seeall)
\ No newline at end of file diff --git a/modules/freifunk/src/model/cbi/admin_index/contact.lua b/modules/freifunk/src/model/cbi/freifunk/contact.lua index 66a1ec4bd..66a1ec4bd 100644 --- a/modules/freifunk/src/model/cbi/admin_index/contact.lua +++ b/modules/freifunk/src/model/cbi/freifunk/contact.lua diff --git a/modules/freifunk/src/model/cbi/admin_index/freifunk.lua b/modules/freifunk/src/model/cbi/freifunk/freifunk.lua index fe9e285b4..fe9e285b4 100644 --- a/modules/freifunk/src/model/cbi/admin_index/freifunk.lua +++ b/modules/freifunk/src/model/cbi/freifunk/freifunk.lua diff --git a/modules/freifunk/src/model/menu/10freifunk.lua b/modules/freifunk/src/model/menu/10freifunk.lua deleted file mode 100644 index 3adbe8985..000000000 --- a/modules/freifunk/src/model/menu/10freifunk.lua +++ /dev/null @@ -1,18 +0,0 @@ -add("public", "index", "Übersicht", 10) -act("contact", "Kontakt") - -add("public", "status", "Status", 20) -act("routes", "Routingtabelle") -act("iwscan", "WLAN-Scan") - -add("public", "olsr", "OLSR", 30) -act("routes", "Routen") -act("topology", "Topologie") -act("hna", "HNA") -act("mid", "MID") - - -sel("admin", "index") -act("wizard", "Freifunkassistent") -act("contact", "Kontakt") -act("freifunk", "Freifunk")
\ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/error_olsr.htm b/modules/freifunk/src/view/freifunk-olsr/error_olsr.htm index 25426f50d..25426f50d 100644 --- a/modules/freifunk/src/view/public_olsr/error_olsr.htm +++ b/modules/freifunk/src/view/freifunk-olsr/error_olsr.htm diff --git a/modules/freifunk/src/view/public_olsr/hna.htm b/modules/freifunk/src/view/freifunk-olsr/hna.htm index c13369f42..c13369f42 100644 --- a/modules/freifunk/src/view/public_olsr/hna.htm +++ b/modules/freifunk/src/view/freifunk-olsr/hna.htm diff --git a/modules/freifunk/src/view/public_olsr/index.htm b/modules/freifunk/src/view/freifunk-olsr/index.htm index 0633d1f45..0633d1f45 100644 --- a/modules/freifunk/src/view/public_olsr/index.htm +++ b/modules/freifunk/src/view/freifunk-olsr/index.htm diff --git a/modules/freifunk/src/view/public_olsr/mid.htm b/modules/freifunk/src/view/freifunk-olsr/mid.htm index 6553237ea..6553237ea 100644 --- a/modules/freifunk/src/view/public_olsr/mid.htm +++ b/modules/freifunk/src/view/freifunk-olsr/mid.htm diff --git a/modules/freifunk/src/view/public_olsr/routes.htm b/modules/freifunk/src/view/freifunk-olsr/routes.htm index f3a0fd336..f3a0fd336 100644 --- a/modules/freifunk/src/view/public_olsr/routes.htm +++ b/modules/freifunk/src/view/freifunk-olsr/routes.htm diff --git a/modules/freifunk/src/view/public_olsr/topology.htm b/modules/freifunk/src/view/freifunk-olsr/topology.htm index c622026d4..c622026d4 100644 --- a/modules/freifunk/src/view/public_olsr/topology.htm +++ b/modules/freifunk/src/view/freifunk-olsr/topology.htm diff --git a/modules/freifunk/src/view/public_index/contact.htm b/modules/freifunk/src/view/freifunk/contact.htm index 221dc89cc..221dc89cc 100644 --- a/modules/freifunk/src/view/public_index/contact.htm +++ b/modules/freifunk/src/view/freifunk/contact.htm diff --git a/modules/freifunk/src/view/public_index/index.htm b/modules/freifunk/src/view/freifunk/index.htm index 6c7fe8588..6c7fe8588 100644 --- a/modules/freifunk/src/view/public_index/index.htm +++ b/modules/freifunk/src/view/freifunk/index.htm diff --git a/modules/freifunk/src/view/admin_index/wizard.htm b/modules/freifunk/src/view/freifunk/wizard.htm index b08703ffe..b08703ffe 100644 --- a/modules/freifunk/src/view/admin_index/wizard.htm +++ b/modules/freifunk/src/view/freifunk/wizard.htm diff --git a/modules/freifunk/src/view/public_status/index.htm b/modules/freifunk/src/view/public_status/index.htm index be0b96888..3ea120c1e 100644 --- a/modules/freifunk/src/view/public_status/index.htm +++ b/modules/freifunk/src/view/public_status/index.htm @@ -34,7 +34,25 @@ <th><%:signal Signal%></th> <th><%:noise Rausch%></th> </tr> -<%=ffluci.sys.httpget("http://127.0.0.1" .. controller .. "/sudo/status/iwconfig")%> +<%for k, v in pairs(ffluci.sys.wifi.getiwconfig()) do +%> +<tr> +<td rowspan="2"><%=k%></td> +<td><%=v[1]%></td> +<td><%=v.Frequency%></td> +<td><%=v["Tx-Power"]%></td> +<td><%=v["Bit Rate"]%></td> +<td><%=v["RTS thr"]%></td> +<td><%=v["Fragment thr"]%></td> +<td><%=v["Link Quality"]%></td> +<td><%=v["Signal level"]%></td> +<td><%=v["Noise level"]%></td> +</tr> +<tr> +<td colspan="4"><strong>ESSID: </strong><%=v.ESSID%></td> +<td colspan="5"><strong>BSSID: </strong><%=(v.Cell or v["Access Point"])%></td> +</tr> +<%end%> </table> <br /> <br /> diff --git a/modules/freifunk/src/view/public_status/iwscan.htm b/modules/freifunk/src/view/public_status/iwscan.htm index a8924c892..c5acdb9ac 100644 --- a/modules/freifunk/src/view/public_status/iwscan.htm +++ b/modules/freifunk/src/view/public_status/iwscan.htm @@ -15,7 +15,24 @@ <th><%:signal Signal%></th> <th><%:noise Rausch%></th> </tr> -<%=ffluci.sys.httpget("http://127.0.0.1" .. controller .. "/sudo/status/iwscan")%> +<%for iface, cells in pairs(ffluci.sys.wifi.iwscan()) do + for i, cell in ipairs(cells) do +%> +<tr> +<td><%=iface%></td> +<td><%=cell.ESSID%></td> +<td><%=cell.Address%></td> +<td><%=cell.Mode%></td> +<td><%=(cell.Channel or cell.Frequency or "")%></td> +<td><%=cell["Encryption key"]%></td> +<td><%=cell.Quality%></td> +<td><%=cell["Signal level"]%></td> +<td><%=cell["Noise level"]%></td> +</tr> +<% + end +end +%> </table> <br /> <%+footer%>
\ No newline at end of file diff --git a/modules/freifunk/src/view/sudo_status/iwconfig.htm b/modules/freifunk/src/view/sudo_status/iwconfig.htm deleted file mode 100644 index 6f5dede70..000000000 --- a/modules/freifunk/src/view/sudo_status/iwconfig.htm +++ /dev/null @@ -1,21 +0,0 @@ -<% -ffluci.http.prepare_content("text/plain") -for k, v in pairs(ffluci.sys.wifi.getiwconfig()) do -%> -<tr> -<td rowspan="2"><%=k%></td> -<td><%=v[1]%></td> -<td><%=v.Frequency%></td> -<td><%=v["Tx-Power"]%></td> -<td><%=v["Bit Rate"]%></td> -<td><%=v["RTS thr"]%></td> -<td><%=v["Fragment thr"]%></td> -<td><%=v["Link Quality"]%></td> -<td><%=v["Signal level"]%></td> -<td><%=v["Noise level"]%></td> -</tr> -<tr> -<td colspan="4"><strong>ESSID: </strong><%=v.ESSID%></td> -<td colspan="5"><strong>BSSID: </strong><%=(v.Cell or v["Access Point"])%></td> -</tr> -<%end%> diff --git a/modules/freifunk/src/view/sudo_status/iwscan.htm b/modules/freifunk/src/view/sudo_status/iwscan.htm deleted file mode 100644 index 6f321ae9e..000000000 --- a/modules/freifunk/src/view/sudo_status/iwscan.htm +++ /dev/null @@ -1,22 +0,0 @@ -<% -ffluci.http.prepare_content("text/plain") -for iface, cells in pairs(ffluci.sys.wifi.iwscan()) do - for i, cell in ipairs(cells) do -%> -<tr> -<td><%=iface%></td> -<td><%=cell.ESSID%></td> -<td><%=cell.Address%></td> -<td><%=cell.Mode%></td> -<td><%=(cell.Channel or cell.Frequency or "")%></td> -<td><%=cell["Encryption key"]%></td> -<td><%=cell.Quality%></td> -<td><%=cell["Signal level"]%></td> -<td><%=cell["Noise level"]%></td> -</tr> -<% - end -end -%> - - |