diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2019-02-17 16:43:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-17 16:43:29 +0200 |
commit | 55cd0c4c6b572f5b35244927a738c46b7dd711b8 (patch) | |
tree | 57a427db406f6e0358a0dd1a1afe93c3a4139782 /modules/luci-mod-freifunk/luasrc/view/freifunk | |
parent | 7f791e9cf428b9c5347a48b6f39e20bd7f7a24e7 (diff) | |
parent | 4654ba92c3999d84b08211f05d2ccb5ea9da731b (diff) |
Merge pull request #2533 from freifunk-berlin/freifunk-repo
treewide: move freifunk-related packages to separate repo
Diffstat (limited to 'modules/luci-mod-freifunk/luasrc/view/freifunk')
6 files changed, 0 insertions, 604 deletions
diff --git a/modules/luci-mod-freifunk/luasrc/view/freifunk/adminindex.htm b/modules/luci-mod-freifunk/luasrc/view/freifunk/adminindex.htm deleted file mode 100644 index a3f079716c..0000000000 --- a/modules/luci-mod-freifunk/luasrc/view/freifunk/adminindex.htm +++ /dev/null @@ -1,44 +0,0 @@ -<%+header%> -<% -local uci = require "luci.model.uci".cursor() -local nickname = uci:get("freifunk", "contact", "nickname") or "" -local name = uci:get("freifunk", "contact", "name") or "" -local mail = uci:get("freifunk", "contact", "mail") or "" -local contacturl = luci.dispatcher.build_url(luci.dispatcher.context.path[1], "freifunk", "contact") -local hostname = uci:get_first ("system", "system", "hostname") -local latitude = uci:get_first ("system", "system", "latitude") -local longitude = uci:get_first ("system", "system", "longitude") -local location = uci:get_first ("system", "system", "location") -local basicsurl = luci.dispatcher.build_url(luci.dispatcher.context.path[1], "freifunk", "basics") -%> - -<h2><%:Freifunk Overview%></h2> - -<%:These pages will assist you in setting up your router for Freifunk or similar wireless community networks.%> -<p /> - -<% if not (hostname and latitude and longitude and location) then%> -<div class="error"> - <%:Basic settings are incomplete. Please go to%> <a href='<%=basicsurl%>'><%:Basic settings%></a> <%:and fill out all required fields.%> -</div> -<%end%> -<p /> - -<% if not (nickname and name and mail) then%> -<div class="error"> - <%:Contact information is incomplete. Please go to%> <a href='<%=contacturl%>'><%:Contact%></a> <%:and fill out all required fields.%> - <p /> -</div> -<%end%> - -<% uci:foreach("wireless", "wifi-device", function(section) - local device = section[".name"] - local url = luci.dispatcher.build_url(luci.dispatcher.context.path[1], "network", "wireless") - if section.diversity ~= "0" and section.disabled ~= "1" and section.type ~= "mac80211" then - print('<div class="error">' .. translate("Diversity is enabled for device") .. ' <b>' .. section[".name"] .. '</b>. ' - .. translate("Go to") .. ' <a href="' .. url .. '">' .. translate("wireless settings") .. '</a> ' .. - translate("to disable it.") .. '</div><p />') - end -end) %> - -<%+footer%> diff --git a/modules/luci-mod-freifunk/luasrc/view/freifunk/contact.htm b/modules/luci-mod-freifunk/luasrc/view/freifunk/contact.htm deleted file mode 100644 index dececeff51..0000000000 --- a/modules/luci-mod-freifunk/luasrc/view/freifunk/contact.htm +++ /dev/null @@ -1,57 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> - Copyright 2011 Manuel Munz <freifunk at somakoma dot de> - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> - -<% -local uci = require "luci.model.uci".cursor() -local nickname = uci:get("freifunk", "contact", "nickname") or "" -local name = uci:get("freifunk", "contact", "name") or "" -local homepage = uci:get("freifunk", "contact", "homepage") or {} -local mail = uci:get("freifunk", "contact", "mail") or "" -local phone = uci:get("freifunk", "contact", "phone") or "" -local location = uci:get_first("system", "system", "locaton") or uci:get("freifunk", "contact", "location") or "" -local note = uci:get("freifunk", "contact", "note") or "" -local lon = uci:get_first("system", "system", "longitude") or "" -local lat = uci:get_first("system", "system", "latitude") or "" -%> - -<h2 name="content"><%:Contact%></h2> - -<fieldset xmlns="http://www.w3.org/1999/xhtml" class="cbi-section"> -<legend><%:Operator%></legend> - <div class="table" cellspacing="10" width="100%" style="text-align:left"> - <div class="tr"><div class="th" width="33%"><%:Nickname%>:</div><div class="td"><%=nickname%></div></div> - <div class="tr"><div class="th" width="33%"><%:Realname%>:</div><div class="td"><%=name%></div></div> - <div class="tr"><div class="th" width="33%"><%:Homepage%>:</div><div class="td"> - <% for k, v in ipairs(homepage) do %> - <a href="<%=v%>"><%=v%></a><br /> - <% end %> - </div></div> - <div class="tr"><div class="th" width="33%"><%:E-Mail%>:</div><div class="td"><a href="mailto:<%=mail%>"><%=mail%></a></div></div> - <div class="tr"><div class="th" width="33%"><%:Phone%>:</div><div class="td"><%=phone%></div></div> - </div> -</fieldset> - -<fieldset xmlns="http://www.w3.org/1999/xhtml" class="cbi-section"> -<legend><%:Location%></legend> - <div class="table" cellspacing="10" width="100%" style="text-align:left"> - <div class="tr"><div class="th" width="33%"><%:Location%>:</div><div class="td"><%=location%></div></div> - <div class="tr"><div class="th" width="33%"><%:Coordinates%>:</div><div class="td"><%=lat%> <%=lon%> (<a href="<%=pcdata(luci.dispatcher.build_url("freifunk/map"))%>"><%:Show on map%>)</a></div></div> - </div> -</fieldset> - -<% if note then %> -<fieldset xmlns="http://www.w3.org/1999/xhtml" class="cbi-section"> -<legend><%:Notice%></legend> - <div class="table" cellspacing="10" width="100%" style="text-align:left"> - <div class="tr"><div class="td"><%=note%></div></div> - </div> -</fieldset> -<%end%> - -<%+footer%> diff --git a/modules/luci-mod-freifunk/luasrc/view/freifunk/index.htm b/modules/luci-mod-freifunk/luasrc/view/freifunk/index.htm deleted file mode 100644 index 3affc73fb9..0000000000 --- a/modules/luci-mod-freifunk/luasrc/view/freifunk/index.htm +++ /dev/null @@ -1,76 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> -<% -local uci = require "luci.model.uci".cursor() -local tpl = require "luci.template" -local fs = require "nixio.fs" - -local community = uci:get("freifunk", "community", "name") or "Freifunk" -local DefaultText = uci:get("freifunk", "community", "DefaultText") or "" -local nickname = uci:get("freifunk", "contact", "nickname") or "No Nickname set" - -local co = "profile_" .. community ---local community = uci:get_first(co, "community", "name") or "Freifunk" -local url = uci:get_first(co, "community", "homepage") or "http://www.freifunk.net" - - -local usertext = fs.readfile("/www/luci-static/index_user.html") - -if DefaultText ~= "disabled" then - - defaulttext = '<h2><a id="content" name="content">'.. - (translate("Hello and welcome in the network of")).. - ' '.. - (community or "Freifunk Deutschland").. - '!</a></h2><p>'.. - translate("We are an initiative to establish a free, independent and open wireless mesh network.").. - '<br />'.. - translate("This is the access point").. - ' '.. - luci.sys.hostname().. - '. '.. - translate("It is operated by").. - ' <a href="'.. - luci.dispatcher.build_url("freifunk", "contact").. - '">'.. - (nickname or translate("Please set your contact information")).. - '</a>.</p><p>'.. - translate("You can find further information about the global Freifunk initiative at").. - ' <a href="http://freifunk.net">Freifunk.net</a>.<br />'.. - translate("If you are interested in our project then contact the local community").. - ' <a href="'..url..'">'..community..'</a>.</p><p><strong>'.. - translate("Notice").. - '</strong>: '.. - translate("Internet access depends on technical and organisational conditions and may or may not work for you.").. - '</p>' -end -%> - -<%=defaulttext%> -<%=usertext%> - -<% --- add custom widgets from view/freifunk/widgets -local widgets = {} -local dir = "/usr/lib/lua/luci/view/freifunk/widgets" - -uci:foreach("freifunk-widgets", "widget", - function(s) - if s.enabled == "1" then - table.insert(widgets, s) - end - end) - -for k, v in ipairs(widgets) do - if v['template'] and fs.access(dir .. "/" .. v['template'] .. "/main.htm") then - tpl.render("freifunk/widgets/" .. v['template'] .. "/main", { data = v }) - end -end - -%> -<%+footer%> diff --git a/modules/luci-mod-freifunk/luasrc/view/freifunk/profile_error.htm b/modules/luci-mod-freifunk/luasrc/view/freifunk/profile_error.htm deleted file mode 100644 index 984fa0acfc..0000000000 --- a/modules/luci-mod-freifunk/luasrc/view/freifunk/profile_error.htm +++ /dev/null @@ -1,11 +0,0 @@ -<%+header%> - -<% -local profileurl = luci.dispatcher.build_url(luci.dispatcher.context.path[1], "freifunk", "basics") -%> - -<h2><%:Error%></h2> -<%:You need to select a profile before you can edit it. To select a profile go to%> <a href='<%=profileurl%>'><%:Basic settings%></a>. -<p/> - -<%+footer%> diff --git a/modules/luci-mod-freifunk/luasrc/view/freifunk/public_status.htm b/modules/luci-mod-freifunk/luasrc/view/freifunk/public_status.htm deleted file mode 100644 index 572f8585d1..0000000000 --- a/modules/luci-mod-freifunk/luasrc/view/freifunk/public_status.htm +++ /dev/null @@ -1,363 +0,0 @@ -<% -local utl = require "luci.util" -local sys = require "luci.sys" -local twa = require "luci.tools.webadmin" -local ip = require "luci.ip" - --- System - -local sysinfo = utl.ubus("system", "info") or { } -local boardinfo = utl.ubus("system", "board") or { } - -local loads = sysinfo.load or { 0, 0, 0 } -local meminfo = sysinfo.memory or { - total = 0, - free = 0, - buffered = 0, - shared = 0 -} - -local uptime = twa.date_format(sysinfo.uptime or 0) -local time = os.date("%a, %d %b %Y, %H:%M:%S") -local load = string.format("%.2f, %.2f, %.2f", loads[1] / 65535.0, loads[2] / 65535.0, loads[3] / 65535.0) - -local mem = string.format( - "%.2f MB (%.2f %s, %.2f %s, %.2f %s)", - meminfo.total / 1024 / 1024, - (meminfo.total - meminfo.free) / 1024 / 1024, - tostring(i18n.translate("used")), - meminfo.free / 1024 / 1024, - tostring(i18n.translate("free")), - meminfo.buffered / 1024 / 1024, - tostring(i18n.translate("buffered")) -) - -local interval = 5 - --- wireless -local ntm = require "luci.model.network".init() -local devices = ntm:get_wifidevs() -local netlist = { } -local netdevs = { } -local dev -for _, dev in ipairs(devices) do - local net - for _, net in ipairs(dev:get_wifinets()) do - netlist[#netlist+1] = net:ifname() - netdevs[net:ifname()] = dev:name() - end -end -local has_iwinfo = pcall(require, "iwinfo") - - --- Find default routes - -local _, r, def4, def6 - -for _, r in ipairs(ip.routes({ type = 1, dest_exact = "0.0.0.0/0" })) do - def4 = { - gateway = r.gw:string(), - dest = r.dest:string(), - dev = r.dev, - metr = r.metric or 0 - } - break -end - -for _, r in ipairs(ip.routes({ type = 1, dest_exact = "::/0" })) do - def6 = { - gateway = r.gw:string(), - dest = r.dest:string(), - dev = r.dev, - metr = r.metric or 0 - } - break -end - - -if luci.http.formvalue("status") == "1" then - local rv = { } - for dev in pairs(netdevs) do - local j = { id = dev } - local iw = luci.sys.wifi.getiwinfo(dev) - if iw then - local f - for _, f in ipairs({ - "channel", "txpower", "bitrate", "signal", "noise", - "quality", "quality_max", "mode", "ssid", "bssid", "encryption", "ifname" - }) do - j[f] = iw[f] - end - end - rv[#rv+1] = j - end - - - rv[#rv+1] = { - time = time, - uptime = uptime, - load = load, - mem = mem, - defroutev4 = def4, - defroutev6 = def6 - } - - luci.http.prepare_content("application/json") - luci.http.write_json(rv) - return -end --%> - -<%+header%> - - -<script type="text/javascript">//<![CDATA[ - XHR.poll(<%=interval%> , '<%=REQUEST_URI%>', { status: 1 }, - function(x, st) - { - if (st) - { - for( var i = 0; i < st.length; i++ ) - { - var iw = st[i]; - var is_assoc = (iw.bssid && iw.channel); - var p = (100 / iw.quality_max * iw.quality); - var q = is_assoc ? p : -1; - - var icon; - if (q < 0) - icon = "<%=resource%>/icons/signal-none.png"; - else if (q == 0) - icon = "<%=resource%>/icons/signal-0.png"; - else if (q < 25) - icon = "<%=resource%>/icons/signal-0-25.png"; - else if (q < 50) - icon = "<%=resource%>/icons/signal-25-50.png"; - else if (q < 75) - icon = "<%=resource%>/icons/signal-50-75.png"; - else - icon = "<%=resource%>/icons/signal-75-100.png"; - - var power = document.getElementById(iw.id + '-txpower'); - if (power) - power.innerHTML = String.format('%s dbm', iw.txpower); - - var signal = document.getElementById(iw.id + '-signal'); - if (signal) - signal.innerHTML = String.format( - '<img src="%s" title="Signal: %s db / Noise: %s db" alt="Signal Quality" />', - icon, iw.signal, iw.noise - ); - - var bitrate = document.getElementById(iw.id + '-bitrate'); - if (bitrate) - bitrate.innerHTML = String.format('%s Mb/s', iw.bitrate ? iw.bitrate / 1000 : '?'); - - var ssid = document.getElementById(iw.id + '-ssid'); - if (ssid) - ssid.innerHTML = iw.ssid; - - var bssid = document.getElementById(iw.id + '-bssid'); - if (bssid) - bssid.innerHTML = iw.bssid; - - var channel = document.getElementById(iw.id + '-channel'); - if (channel) - channel.innerHTML = iw.channel; - - var mode = document.getElementById(iw.id + '-mode'); - if (mode) - mode.innerHTML = iw.mode; - } - - i = st.length - 1 - var u - - if (u = document.getElementById('dynuptime')) - u.innerHTML = st[i].uptime; - - if (u = document.getElementById('dynload')) - u.innerHTML = st[i].load; - - if (u = document.getElementById('dynmem')) - u.innerHTML = st[i].mem; - - if (u = document.getElementById('dyntime')) - u.innerHTML = st[i].time; - - if (st[i].defroutev4) - { - if (u = document.getElementById('v4dst')) - u.innerHTML = st[i].defroutev4.dest; - - if (u = document.getElementById('v4gw')) - u.innerHTML = st[i].defroutev4.gateway; - - if (u = document.getElementById('v4dev')) - u.innerHTML = st[i].defroutev4.dev; - - if (u = document.getElementById('v4metr')) - u.innerHTML = st[i].defroutev4.metr; - } - - if (st[i].defroutev6) - { - if (u = document.getElementById('v6dst')) - u.innerHTML = st[i].defroutev6.dest; - - if (u = document.getElementById('v6gw')) - u.innerHTML = st[i].defroutev6.gateway; - - if (u = document.getElementById('v6dev')) - u.innerHTML = st[i].defroutev6.dev; - - if (u = document.getElementById('v6metr')) - u.innerHTML = st[i].defroutev6.metr; - } - } - } - ); -//]]></script> - -<div class="cbi-map"> - <h2><%:System%></h2> - <div class="cbi-section-node"> - <div class="cbi-value"><label class="cbi-value-title"><%:System%></label><div class="cbi-value-field"><%=boardinfo.system or "?"%></div></div> - <div class="cbi-value"><label class="cbi-value-title"><%:Model%></label><div class="cbi-value-field"><%=boardinfo.model or "?"%></div></div> - <div class="cbi-value"><label class="cbi-value-title"><%:Load%></label><div class="cbi-value-field" id="dynload"><%=load%></div></div> - <div class="cbi-value"><label class="cbi-value-title"><%:Memory%></label><div class="cbi-value-field" id="dynmem"><%=mem%></div></div> - <div class="cbi-value"><label class="cbi-value-title"><%:Local Time%></label><div class="cbi-value-field" id="dyntime"><%=time%></div></div> - <div class="cbi-value"><label class="cbi-value-title"><%:Uptime%></label><div class="cbi-value-field" id="dynuptime"><%=uptime%></div></div> - </div> -</div> - -<% if devices[1] then %> - -<div class="cbi-map"> - <h2><%:Wireless Overview%></h2> - - <% if not has_iwinfo then %> - <div class="alert-message warning"> - <h4><%:Package libiwinfo required!%></h4> - <p><%_The <em>libiwinfo</em> package is not installed. You must install this component for working wireless configuration!%></p> - </div> - <% end %> - - <div class="cbi-section"> - <div class="cbi-section-node"> - <div class="table cbi-section-table"> - <div class="tr cbi-section-table-titles"> - <div class="th cbi-section-table-cell"><%:Signal%></div> - <div class="th cbi-section-table-cell"><%:Bitrate%></div> - <div class="th cbi-section-table-cell"><%:SSID%></div> - <div class="th cbi-section-table-cell"><%:BSSID%></div> - <div class="th cbi-section-table-cell"><%:Channel%></div> - <div class="th cbi-section-table-cell"><%:Mode%></div> - <div class="th cbi-section-table-cell"><%:TX%>-<%:Power%></div> - <div class="th cbi-section-table-cell"><%:Interface%></div> - </div> - <% - for _, dev in ipairs(devices) do - local net - for _, net in ipairs(dev:get_wifinets()) do - netlist[#netlist+1] = net:ifname() - netdevs[net:ifname()] = dev:name() - - if net.iwinfo.signal and net.iwinfo.bssid then - local signal = net.iwinfo.signal or "N/A" - local noise = net.iwinfo.noise or "N/A" - local q = net.iwinfo.quality or "0" - local qmax = net.iwinfo.quality_max or "100" - local qperc = q / qmax * 100 - - if qperc == 0 then - icon = "signal-none.png" - elseif qperc < 26 then - icon = "signal-0-25.png" - elseif qperc < 51 then - icon = "signal-25-50.png" - elseif qperc < 76 then - icon = "signal-50-75.png" - elseif qperc < 100 then - icon = "signal-75-100.png" - else - icon = "signal-0.png" - end - - signal_string = "<img src='"..resource.."/icons/"..icon.."' title='Signal: "..signal.." db / Noise: "..noise.." db' alt='Signal Quality'></img>" - - local ssid = net.iwinfo.ssid or "N/A" - local bssid = net.iwinfo.bssid or "N/A" - local chan = net.iwinfo.channel or "N/A" - local mode = net.iwinfo.mode or "N/A" - local txpwr = net.iwinfo.txpower or "N/A" - if txpwr ~= "N/A" then - txpwr = txpwr.." dbm" - end - local bitrate = net.iwinfo.bitrate or "N/A" - if bitrate ~= "N/A" then - bitrate = ( bitrate / 1000 ).."Mb/s" - end - local interface = net.iwinfo.ifname or "N/A" - %> - <div class="tr cbi-section-table-row cbi-rowstyle-1"> - <div class="td cbi-value-field" id="<%=net:ifname()%>-signal"><%=signal_string%></div> - <div class="td cbi-value-field" id="<%=net:ifname()%>-bitrate"><%=bitrate%></div> - <div class="td cbi-value-field" id="<%=net:ifname()%>-ssid"><%=ssid%></div> - <div class="td cbi-value-field" id="<%=net:ifname()%>-bssid"><%=bssid%></div> - <div class="td cbi-value-field" id="<%=net:ifname()%>-channel"><%=chan%></div> - <div class="td cbi-value-field" id="<%=net:ifname()%>-mode"><%=mode%></div> - <div class="td cbi-value-field" id="<%=net:ifname()%>-txpower"><%=txpwr%></div> - <div class="td cbi-value-field"><%=interface%></div> - </div> - <% end - end - end %> - </div> - </div> - </div> -</div> -<% end %> - -<div class="cbi-map"> - <h2><%:Default routes%></h2> - <div class="cbi-section"> - <div class="cbi-section-node"> - -<% if not def4 and not def6 then %> - <%:No default routes known.%> -<%else%> - <div class="table cbi-section-table"> - <div class="tr cbi-section-table-titles"> - <div class="th cbi-section-table-cell"><%:Network%></div> - <div class="th cbi-section-table-cell"><%:Interface%></div> - <div class="th cbi-section-table-cell"><%:Gateway%></div> - <div class="th cbi-section-table-cell"><%:Metric%></div> - </div> - - <% if def4 then %> - <div class="tr cbi-section-table-row cbi-rowstyle-1"> - <div class="td cbi-value-field" id="v4dst"><%=def4.dest%></div> - <div class="td cbi-value-field" id="v4dev"><%=def4.dev%></div> - <div class="td cbi-value-field" id="v4gw"><%=def4.gateway%></div> - <div class="td cbi-value-field" id="v4metr"><%=def4.metr%></div> - </div> - - <% end - if def6 then %> - - <div class="tr cbi-section-table-row cbi-rowstyle-2"> - <div class="td cbi-value-field" id="v6dst"><%=def6.dest%></div> - <div class="td cbi-value-field" id="v6dev"><%=def6.dev%></div> - <div class="td cbi-value-field" id="v6gw"><%=def6.gateway%></div> - <div class="td cbi-value-field" id="v6metr"><%=def6.metr%></div> - </div> - - <% end %> - - </div> -<% end %> - </div> - </div> -</div> -<%+footer%> diff --git a/modules/luci-mod-freifunk/luasrc/view/freifunk/remote_update.htm b/modules/luci-mod-freifunk/luasrc/view/freifunk/remote_update.htm deleted file mode 100644 index f087472d31..0000000000 --- a/modules/luci-mod-freifunk/luasrc/view/freifunk/remote_update.htm +++ /dev/null @@ -1,53 +0,0 @@ -<%# - Copyright 2008 Steven Barth <steven@midlink.org> - Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> - -<h2><%:Freifunk Remote Update%></h2> - -<p><%:Check for new firmware versions and perform automatic updates.%></p> - -<% if update then %> - - <% if update.info then %> - <strong><%:Update available!%></strong> - <br /><br /> - <pre><%=update.info%></pre><br /> - <% else %> - <strong><%:The installed firmware is the most recent version.%></strong> - <br /><br /> - <% end %> - - <p> - <form method="post" action="" class="inline"> - <input type="hidden" name="flash" value="1" /> - <input type="submit" class="cbi-button cbi-button-apply" value="<%:Start Upgrade%>" /> - </form> - </p> - -<% elseif confirm then %> - - <strong><%:Update Settings%></strong> - <br /><br /> - - <p><form method="post" action="" class="inline"> - <input type="hidden" name="flash" value="1" /> - <input type="hidden" name="confirm" value="1" /> - - <input type="checkbox" class="cbi-input-checkbox" name="keepcfg" value="1" checked="checked" id="cb_keepcfg" /> - <label for="cb_keepcfg"></label> - <label for="cb_keepcfg"><%:Keep configuration%></label><br /> - - <input type="checkbox" class="cbi-input-checkbox" name="verify" value="1" checked="checked" id="cb_verify" /> - <label for="cb_verify"></label> - <label for="cb_verify"><%:Verify downloaded images%></label><br /><br /> - - <input type="submit" class="cbi-button cbi-button-apply" value="<%:Confirm Upgrade%>" /> - </form></p> - -<% end %> - -<%+footer%> |