convert luci.fs users to nixio.fs api
[project/luci.git] / modules / freifunk / luasrc / controller / freifunk / freifunk.lua
index e30cdb10f8fe0a8c06a9c9f079711441d7eeb850..5efd50f813034f950afa2aadffae6017e90f380e 100644 (file)
@@ -41,20 +41,22 @@ function index()
        page.target = template("freifunk/contact")
        page.title  = "Kontakt"
 
+       entry({"freifunk", "status"}, alias("freifunk", "status", "status"), "Status", 20)
 
-       local page  = node("freifunk", "status")
+       local page  = node("freifunk", "status", "status")
        page.target = form("freifunk/public_status")
-       page.title  = "Status"
+       page.title  = i18n("overview")
        page.order  = 20
        page.i18n   = "admin-core"
        page.setuser  = false
        page.setgroup = false
 
        entry({"freifunk", "status.json"}, call("jsonstatus"))
+       entry({"freifunk", "status", "zeroes"}, call("zeroes"), "Testdownload") 
 
        assign({"freifunk", "olsr"}, {"admin", "status", "olsr"}, "OLSR", 30)
 
-       if luci.fs.access("/etc/config/luci_statistics") then
+       if nixio.fs.access("/etc/config/luci_statistics") then
                assign({"freifunk", "graph"}, {"admin", "statistics", "graph"}, i18n("stat_statistics", "Statistiken"), 40)
        end
 
@@ -69,6 +71,9 @@ function index()
        page.target = cbi("freifunk/contact")
        page.title  = "Kontakt"
        page.order  = 40
+
+       entry({"freifunk", "map"}, template("freifunk-map/frame"), i18n("freifunk_map", "Karte"), 50)
+       entry({"freifunk", "map", "content"}, template("freifunk-map/map"), nil, 51)
 end
 
 local function fetch_olsrd()
@@ -78,7 +83,7 @@ local function fetch_olsrd()
        local rawdata = sys.httpget("http://127.0.0.1:2006/")
 
        if #rawdata == 0 then
-               if luci.fs.access("/proc/net/ipv6_route", "r") then
+               if nixio.fs.access("/proc/net/ipv6_route", "r") then
                        rawdata = sys.httpget("http://[::1]:2006/")
                        if #rawdata == 0 then
                                return nil
@@ -120,6 +125,21 @@ local function fetch_olsrd()
        return data
 end
 
+function zeroes()
+       local string = require "string"
+       local http = require "luci.http"
+       local zeroes = string.rep(string.char(0), 8192)
+       local cnt = 0
+       local lim = 1024 * 1024 * 1024
+       
+       http.prepare_content("application/x-many-zeroes")
+
+       while cnt < lim do
+               http.write(zeroes)
+               cnt = cnt + #zeroes
+       end
+end
+
 function jsonstatus()
        local root = {}
        local sys = require "luci.sys"