diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-12-03 15:17:05 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-08 16:26:20 +0100 |
commit | 1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch) | |
tree | 35e16f100466e4e00657199b38bb3d87d52bf73f /applications/luci-olsr/luasrc/view | |
parent | 9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff) |
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names
* Make each LuCI module its own standalone package
* Deploy a shared luci.mk which is used by each module Makefile
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications/luci-olsr/luasrc/view')
11 files changed, 0 insertions, 1095 deletions
diff --git a/applications/luci-olsr/luasrc/view/status-olsr/common_js.htm b/applications/luci-olsr/luasrc/view/status-olsr/common_js.htm deleted file mode 100644 index 1ee763e11..000000000 --- a/applications/luci-olsr/luasrc/view/status-olsr/common_js.htm +++ /dev/null @@ -1,35 +0,0 @@ -<% if has_v4 and has_v6 then %> -<script type="text/javascript">//<![CDATA[ - -function css(selector, property, value) { - for (var i=0; i<document.styleSheets.length;i++) { - try { document.styleSheets[i].insertRule(selector+ ' {'+property+':'+value+'}', document.styleSheets[i].cssRules.length); - } catch(err) {try { document.styleSheets[i].addRule(selector, property+':'+value);} catch(err) {}}//IE - } -} - -window.onload = function() { - buttons = '<input type="button" name="show-proto-4" id="show-proto-4" class="cbi-button cbi-button-apply" style="margin-right: 5px" value="<%:Hide IPv4%>">' - buttons += '<input type="button" name="show-proto-6" id="show-proto-6" class="cbi-button cbi-button-apply" value="<%:Hide IPv6%>">' - - document.getElementById('togglebuttons').innerHTML = buttons; - - var visible = true; - document.getElementById('show-proto-4').onclick = function() { - visible = !visible; - document.getElementById('show-proto-4').value = visible ? '<%:Hide IPv4%>' : '<%:Show IPv4%>'; - document.getElementById('show-proto-4').className = visible ? 'cbi-button cbi-button-apply' : 'cbi-button cbi-button-reset'; - css('.proto-4', 'display', visible ? 'table-row' : 'none') - }; - - var visible6 = true; - document.getElementById('show-proto-6').onclick = function() { - visible6 = !visible6; - document.getElementById('show-proto-6').value = visible6 ? '<%:Hide IPv6%>' : '<%:Show IPv6%>'; - document.getElementById('show-proto-6').className = visible6 ? 'cbi-button cbi-button-apply' : 'cbi-button cbi-button-reset'; - css('.proto-6', 'display', visible6 ? 'table-row' : 'none') - }; - -} -//]]></script> -<%end %> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/error_olsr.htm b/applications/luci-olsr/luasrc/view/status-olsr/error_olsr.htm deleted file mode 100644 index 2c872fa5a..000000000 --- a/applications/luci-olsr/luasrc/view/status-olsr/error_olsr.htm +++ /dev/null @@ -1,17 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> - -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 - --%> -<%+header%> -<h2><a id="content" name="content"><%:OLSR Daemon%></a></h2> -<p class="error"><%:Unable to connect to the OLSR daemon!%></p> -<p><%:Make sure that OLSRd is running, the "jsoninfo" plugin is loaded, configured on port 9090 and accepts connections from "127.0.0.1".%></p> -<%+footer%> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/hna.htm b/applications/luci-olsr/luasrc/view/status-olsr/hna.htm deleted file mode 100644 index 689bafdfa..000000000 --- a/applications/luci-olsr/luasrc/view/status-olsr/hna.htm +++ /dev/null @@ -1,129 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> -Copyright 2011 Manuel Munz <freifunk at somakoma dot de> - -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 i = 1 - -if luci.http.formvalue("status") == "1" then - local rv = {} - for k, hna in ipairs(hna) do - rv[#rv+1] = { - proto = hna["proto"], - destination = hna["destination"], - genmask = hna["genmask"], - gateway = hna["gateway"], - hostname = hna["hostname"], - validityTime = hna["validityTime"] - } - end - luci.http.prepare_content("application/json") - luci.http.write_json(rv) - return -end -%> - -<%+header%> - -<script type="text/javascript" src="<%=resource%>/cbi.js"></script> -<script type="text/javascript">//<![CDATA[ -XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 }, - function(x, info) - { - var hnadiv = document.getElementById('olsrd_hna'); - if (hnadiv) - { - var s = ''; - for (var idx = 0; idx < info.length; idx++) - { - var hna = info[idx]; - var linkgw = '' - s += '<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-' + hna.proto + '">' - if (hna.proto == '6') { - linkgw = '<a href="http://[' + hna.gateway + ']/cgi-bin-status.html">' + hna.gateway + '</a>' - } else { - linkgw = '<a href="http://' + hna.gateway + '/cgi-bin-status.html">' + hna.gateway + '</a>' - } - - if (hna.validityTime != undefined) { - validity = hna.validityTime + 's' - } else { - validity = '-' - } - - if (hna.hostname != undefined) { - hostname = ' / <a href="http://' + hna.hostname + '/cgi-bin-status.html">' + hna.hostname + '</a>' - } else { - hostname = '' - } - - s += String.format( - '<td class="cbi-section-table-cell">%s</td>' + - '<td class="cbi-section-table-cell">%s</td>' + - '<td class="cbi-section-table-cell">%s</td>', hna.destination + '/' + hna.genmask, linkgw + hostname, validity - ) - s += '</tr>' - } - hnadiv.innerHTML = s; - } -} -); -//]]></script> - -<h2><a id="content" name="content"><%:Active host net announcements%></a></h2> - -<div id="togglebuttons"></div> -<fieldset class="cbi-section"> - - <legend><%:Overview of currently active OLSR host net announcements%></legend> - <table class="cbi-section-table"> - <thead> - <tr class="cbi-section-table-titles"> - <th class="cbi-section-table-cell"><%:Announced network%></th> - <th class="cbi-section-table-cell"><%:OLSR gateway%></th> - <th class="cbi-section-table-cell"><%:Validity Time%></th> - </tr> - - </thead> - <tbody id="olsrd_hna"> - <% for k, route in ipairs(hna) do %> - - <tr class="cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=hna[k].proto%>"> - <td class="cbi-section-table-cell"><%=hna[k].destination%>/<%=hna[k].genmask%> </td> - <td class="cbi-section-table-cell"> - <% if hna[k].proto == '6' then %> - <a href="http://[<%=hna[k].gateway%>]/cgi-bin-status.html"><%=hna[k].gateway%></a> - <% else %> - <a href="http://<%=hna[k].gateway%>/cgi-bin-status.html"><%=hna[k].gateway%></a> - <% end %> - <% if hna[k].hostname then %> - / <a href="http://<%=hna[k].hostname%>/cgi-bin-status.html"><%=hna[k].hostname%></a> - <% end %> - </td> - <% if hna[k].validityTime then - validity = hna[k].validityTime .. 's' - else - validity = '-' - end %> - - <td class="cbi-section-table-cell"><%=validity%></td> - </tr> - - <% i = ((i % 2) + 1) - end %> - </tbody> - </table> -</fieldset> - -<%+status-olsr/common_js%> -<%+footer%> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/interfaces.htm b/applications/luci-olsr/luasrc/view/status-olsr/interfaces.htm deleted file mode 100644 index dd1a21ea6..000000000 --- a/applications/luci-olsr/luasrc/view/status-olsr/interfaces.htm +++ /dev/null @@ -1,57 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> -Copyright 2011 Manuel Munz <freifunk at somakoma dot de> - -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 i = 1 -%> - -<%+header%> - -<h2><a id="content" name="content"><%:Interfaces%></a></h2> - -<div id="togglebuttons"></div> - -<fieldset class="cbi-section"> - <legend><%:Overview of interfaces where OLSR is running%></legend> - - <table class="cbi-section-table"> - <tr> - <th class="cbi-section-table-cell"><%:Interface%></th> - <th class="cbi-section-table-cell"><%:State%></th> - <th class="cbi-section-table-cell"><%:MTU%></th> - <th class="cbi-section-table-cell"><%:WLAN%></th> - <th class="cbi-section-table-cell"><%:Source address%></th> - <th class="cbi-section-table-cell"><%:Netmask%></th> - <th class="cbi-section-table-cell"><%:Broadcast address%></th> - </tr> - - <% for k, iface in ipairs(iface) do %> - - <tr class="cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=iface.proto%>"> - <td class="cbi-section-table-cell"><%=iface.name%></td> - <td class="cbi-section-table-cell"><%=iface.state%></td> - <td class="cbi-section-table-cell"><%=iface.olsrMTU%></td> - <td class="cbi-section-table-cell"><%=iface.wireless and luci.i18n.translate('yes') or luci.i18n.translate('no')%></td> - <td class="cbi-section-table-cell"><%=iface.ipv4Address or iface.ipv6Address%></td> - <td class="cbi-section-table-cell"><%=iface.netmask%></td> - <td class="cbi-section-table-cell"><%=iface.broadcast or iface.multicast%></td> - </tr> - <% i = ((i % 2) + 1) - end %> - </table> -</fieldset> -<%+status-olsr/common_js%> -<%+footer%> - - diff --git a/applications/luci-olsr/luasrc/view/status-olsr/legend.htm b/applications/luci-olsr/luasrc/view/status-olsr/legend.htm deleted file mode 100644 index 2f598489d..000000000 --- a/applications/luci-olsr/luasrc/view/status-olsr/legend.htm +++ /dev/null @@ -1,24 +0,0 @@ -<h3><%:Legend%>:</h3> -<ul> - <li><strong>LQ: </strong><%:Success rate of packages received from the neighbour%></li> - <li><strong>NLQ: </strong><%:Success rate of packages sent to the neighbour%></li> - <li><strong>ETX: </strong><%:Expected retransmission count%></li> - <li style="list-style: none"> - <ul> - <li><strong><span style="color:#00cc00"><%:Green%></span></strong>:<%:Very good (ETX < 2)%></li> - <li><strong><span style="color:#ffcb05"><%:Yellow%></span></strong>:<%:Good (2 < ETX < 4)%></li> - <li><strong><span style="color:#ff6600"><%:Orange%></span></strong>:<%:Still usable (4 < ETX < 10)%></li> - <li><strong><span style="color:#bb3333"><%:Red%></span></strong>:<%:Bad (ETX > 10)%></li> - </ul> - </li> - <li><strong>SNR: </strong><%:Signal Noise Ratio in dB%></li> - <li style="list-style: none"> - <ul> - <li><strong><span style="color:#00cc00"><%:Green%></span></strong>:<%:Very good (SNR > 30)%></li> - <li><strong><span style="color:#ffcb05"><%:Yellow%></span></strong>:<%:Good (30 > SNR > 20)%></li> - <li><strong><span style="color:#ff6600"><%:Orange%></span></strong>:<%:Still usable (20 > SNR > 5)%></li> - <li><strong><span style="color:#bb3333"><%:Red%></span></strong>:<%:Bad (SNR < 5)%></li> - </ul> - </li> -</ul> - diff --git a/applications/luci-olsr/luasrc/view/status-olsr/mid.htm b/applications/luci-olsr/luasrc/view/status-olsr/mid.htm deleted file mode 100644 index ec5caaa95..000000000 --- a/applications/luci-olsr/luasrc/view/status-olsr/mid.htm +++ /dev/null @@ -1,58 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> -Copyright 2011 Manuel Munz <freifunk at somakoma dot de> - -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$ - --%> -<% -local i = 1 -%> - -<%+header%> -<h2><a id="content" name="content"><%:Active MID announcements%></a></h2> - -<div id="togglebuttons"></div> -<fieldset class="cbi-section"> - <legend><%:Overview of known multiple interface announcements%></legend> - <table class="cbi-section-table"> - <tr class="cbi-section-table-titles"> - <th class="cbi-section-table-cell"><%:OLSR node%></th> - <th class="cbi-section-table-cell" ><%:Secondary OLSR interfaces%></th> - </tr> - - <% for k, mid in ipairs(mids) do - local aliases = '' - for k,v in ipairs(mid.aliases) do - if aliases == '' then - sep = '' - else - sep = ', ' - end - aliases = v.ipAddress .. sep .. aliases - end - local host = mid.ipAddress - if mid.proto == '6' then - host = '[' .. mid.ipAddress .. ']' - end - %> - - <tr class="cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=mid.proto%>"> - <td class="cbi-section-table-cell"><a href="http://<%=host%>/cgi-bin-status.html"><%=mid.ipAddress%></a></td> - <td class="cbi-section-table-cell"><%=aliases%></td> - </tr> - - <% i = ((i % 2) + 1) - end %> - </table> -</fieldset> -<%+status-olsr/common_js%> -<%+footer%> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm b/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm deleted file mode 100644 index daa52831f..000000000 --- a/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm +++ /dev/null @@ -1,181 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> -Copyright 2011 Manuel Munz <freifunk at somakoma dot de> - -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 olsrtools = require "luci.tools.olsr" -local i = 1 - -if luci.http.formvalue("status") == "1" then - local rv = {} - for k, link in ipairs(links) do - link.linkCost = tonumber(link.linkCost)/1024 or 0 - if link.linkCost == 4096 then - link.linkCost = 0 - end - local color = olsrtools.etx_color(link.linkCost) - local snr_color = olsrtools.snr_color(link.snr) - defaultgw_color = "" - if link.defaultgw == 1 then - defaultgw_color = "#ffff99" - end - - rv[#rv+1] = { - rip = link.remoteIP, - hn = link.hostname, - lip = link.localIP, - ifn = link.interface, - lq = string.format("%.3f", link.linkQuality), - nlq = string.format("%.3f",link.neighborLinkQuality), - cost = string.format("%.3f", link.linkCost), - snr = link.snr, - signal = link.signal, - noise = link.noise, - color = color, - snr_color = snr_color, - dfgcolor = defaultgw_color, - proto = link.proto - } - end - luci.http.prepare_content("application/json") - luci.http.write_json(rv) - return -end -%> - -<%+header%> - -<script type="text/javascript" src="<%=resource%>/cbi.js"></script> -<script type="text/javascript">//<![CDATA[ - - XHR.poll(10 , '<%=REQUEST_URI%>', { status: 1 }, - function(x, info) - { - var nt = document.getElementById('olsr_neigh_table'); - if (nt) - { - var s = ''; - for (var idx = 0; idx < info.length; idx++) - { - var neigh = info[idx]; - - if (neigh.proto == '6') { - s += String.format( - '<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' + - '<td class="cbi-section-table-titles" style="background-color:%s"><a href="http://[%s]/cgi-bin-status.html">%s</a></td>', - neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip - ); - } else { - s += String.format( - '<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' + - '<td class="cbi-section-table-titles" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></td>', - neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip - ); - } - if (neigh.hn) { - s += String.format( - '<td class="cbi-section-table-titles" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></td>', - neigh.dfgcolor, neigh.hn, neigh.hn - ); - } else { - s += String.format( - '<td class="cbi-section-table-titles" style="background-color:%s">?</td>', - neigh.dfgcolor - ); - } - s += String.format( - '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' + - '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' + - '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' + - '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' + - '<td class="cbi-section-table-titles" style="background-color:%s">%s</td>' + - '<td class="cbi-section-table-titles" style="background-color:%s" title="Signal: %s Noise: %s">%s</td>' + - '</tr>', - neigh.dfgcolor, neigh.ifn, neigh.dfgcolor, neigh.lip, neigh.dfgcolor, neigh.lq, neigh.dfgcolor, neigh.nlq, neigh.color, neigh.cost, neigh.snr_color, neigh.signal, neigh.noise, neigh.snr || '?' - ); - } - - nt.innerHTML = s; - } - } - ); -//]]></script> - - -<h2><a id="content" name="content"><%:OLSR connections%></a></h2> - -<div id="togglebuttons"></div> - -<fieldset class="cbi-section"> - <legend><%:Overview of currently established OLSR connections%></legend> - - <table class="cbi-section-table"> - <thead> - <tr class="cbi-section-table-titles"> - <th class="cbi-section-table-cell"><%:Neighbour IP%></th> - <th class="cbi-section-table-cell"><%:Hostname%></th> - <th class="cbi-section-table-cell"><%:Interface%></th> - <th class="cbi-section-table-cell"><%:Local interface IP%></th> - <th class="cbi-section-table-cell">LQ</th> - <th class="cbi-section-table-cell">NLQ</th> - <th class="cbi-section-table-cell">ETX</th> - <th class="cbi-section-table-cell">SNR</th> - </tr> - </thead> - - <tbody id="olsr_neigh_table"> - <% local i = 1 - for k, link in ipairs(links) do - link.linkCost = tonumber(link.linkCost)/1024 or 0 - if link.linkCost == 4096 then - link.linkCost = 0 - end - - color = olsrtools.etx_color(link.linkCost) - snr_color = olsrtools.snr_color(link.snr) - - if link.snr == 0 then - link.snr = '?' - end - - defaultgw_color = "" - if link.defaultgw == 1 then - defaultgw_color = "#ffff99" - end - %> - - <tr class="cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=link.proto%>"> - <% if link.proto == "6" then %> - <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://[<%=link.remoteIP%>]/cgi-bin-status.html"><%=link.remoteIP%></a></td> - <% else %> - <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.remoteIP%>/cgi-bin-status.html"><%=link.remoteIP%></a></td> - <% end %> - <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.hostname%>/cgi-bin-status.html"><%=link.hostname%></a></td> - <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=link.interface%></td> - <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=link.localIP%></td> - <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.linkQuality)%></td> - <td class="cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.neighborLinkQuality)%></td> - <td class="cbi-section-table-titles" style="background-color:<%=color%>"><%=string.format("%.3f", link.linkCost)%></td> - <td class="cbi-section-table-titles" style="background-color:<%=snr_color%>" title="Signal: <%=link.signal%> Noise: <%=link.noise%>"><%=link.snr%></td> - </tr> - <% - i = ((i % 2) + 1) - end %> - </tbody> - </table> -<br /> - -<%+status-olsr/legend%> -</fieldset> -<%+status-olsr/common_js%> -<%+footer%> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/overview.htm b/applications/luci-olsr/luasrc/view/status-olsr/overview.htm deleted file mode 100644 index 6d8eca874..000000000 --- a/applications/luci-olsr/luasrc/view/status-olsr/overview.htm +++ /dev/null @@ -1,220 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> -Copyright 2011 Manuel Munz <freifunk at somakoma dot de> - -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 ipv = luci.model.uci.cursor():get_first("olsrd", "olsrd", "IpVersion", "4") - -function write_conf(conf, file) - local fs = require "luci.fs" - if fs.access(conf) then - luci.http.header("Content-Disposition", "attachment; filename="..file) - luci.http.prepare_content("text/plain") - luci.http.write(fs.readfile(conf)) - end -end - -conf = luci.http.formvalue() - -if conf.openwrt then - write_conf("/etc/config/olsrd", "olsrd") - return false -end - -if conf.conf_v4 then - write_conf("/var/etc/olsrd.conf.ipv4", "olsrd.conf.ipv4") - return false -end - -if conf.conf_v6 then - write_conf("/var/etc/olsrd.conf.ipv6", "olsrd.conf.ipv6") - return false -end - -if conf.conf then - write_conf("/var/etc/olsrd.conf", "olsrd.conf") - return false -end - -%> - -<%+header%> - -<script type="text/javascript" src="<%=resource%>/cbi.js"></script> -<script type="text/javascript">//<![CDATA[ - -XHR.poll(10, '<%=REQUEST_URI%>/json', { }, - function(x, info) - { - var e; - - if (! info) { - document.getElementById('error').innerHTML = '<%:Could not get any data. Make sure the jsoninfo plugin is installed and allows connections from localhost.%>'; - return - } - document.getElementById('error').innerHTML = ''; - - if (e = document.getElementById('version')) - var version; - var date; - if (info.v4.config.olsrdVersion != undefined) { - version = info.v4.config.olsrdVersion - date = info.v4.config.olsrdBuildDate - } else if (info.v6.config.olsrdVersion != undefined) { - version = info.v6.config.olsrdVersion - date = info.v6.config.olsrdBuildDate - } else { - version = 'unknown' - date = 'unknown' - } - e.innerHTML = version + '<br />' + date; - - if (e = document.getElementById('nr_neigh')) - var neigh = 0; - if (info.v4.links != undefined) { - neigh = neigh + info.v4.links.length - } - if (info.v6.links != undefined) { - neigh = neigh + info.v6.links.length - } - e.innerHTML = neigh; - - - if (e = document.getElementById('nr_hna')) - var hna = 0; - if (info.v4.hna != undefined) { - hna = hna + info.v4.hna.length - } - if (info.v6.hna != undefined) { - hna = hna + info.v6.hna.length - } - e.innerHTML = hna; - - - if (e = document.getElementById('nr_ifaces')) - var nrint = 0 - if (info.v4.interfaces != undefined) { - nrint = nrint + info.v4.interfaces.length - } - if (info.v6.interfaces != undefined) { - nrint = nrint + info.v6.interfaces.length - } - e.innerHTML = nrint - - - if (e = document.getElementById('nr_topo')) - var topo = 0; - var nodes = []; - - Array.prototype.contains = function (element) { - for (var i = 0; i < this.length; i++) { - if (this[i] == element) { - return true; - } - } - return false; - } - - if (info.v4.topology != undefined) { - topo = topo + info.v4.topology.length; - for (var i = 0; i < info.v4.topology.length; i++) { - var destip = info.v4.topology[i].destinationIP - if (! nodes.contains(destip) ) { - nodes.push(destip) - } - } - } - - if (info.v6.topology != undefined) { - topo = topo + info.v6.topology.length - for (var i = 0; i < info.v6.topology.length; i++) { - var destip = info.v6.topology[i].destinationIP - if (! nodes.contains(destip) ) { - nodes.push(destip) - } - } - - } - e.innerHTML = topo; - - if (e = document.getElementById('nr_nodes')) - e.innerHTML = nodes.length; - - if (e = document.getElementById('meshfactor')) - var meshfactor = topo / nodes.length - e.innerHTML = meshfactor.toFixed(2) - } - ); -//]]></script> - - -<div id="error" class="error"></div> - -<h2><a id="content" name="content">OLSR <%:Overview%></a></h2> - -<fieldset class="cbi-section"> - <legend><%:Network%></legend> - - <table width="100%" cellspacing="10"> - <tr><td width="33%"><%:Interfaces%></td><td> - <a href="<%=REQUEST_URI%>/interfaces"> - <span id="nr_ifaces">-<span> - </a> - </td></tr> - <tr><td width="33%"><%:Neighbors%></td><td> - <a href="<%=REQUEST_URI%>/neighbors"> - <span id="nr_neigh">-</span> - </a> - </td></tr> - <tr><td width="33%"><%:Nodes%></td><td> - <a href="<%=REQUEST_URI%>/topology"> - <span id="nr_nodes">-</span> - </a> - </td></tr> - <tr><td width="33%"><%:HNA%></td><td> - <a href="<%=REQUEST_URI%>/hna"> - <span id="nr_hna">-</span> - </a> - </td></tr> - <tr><td width="33%"><%:Links total%></td><td> - <a href="<%=REQUEST_URI%>/topology"> - <span id="nr_topo">-</span> - </a> - </td></tr> - <tr><td width="33%"><%:Links per node (average)%></td><td> - <span id="meshfactor">-</span> - </td></tr> - - - </table> -</fieldset> - - -<fieldset class="cbi-section"> - <legend>OLSR <%:Configuration%></legend> - <table width="100%" cellspacing="10"> - <tr><td width="33%"><%:Version%></td><td> - <span id="version">-<span> - </td></tr> - <tr><td width="33%"><%:Download Config%></td><td> - <a href="<%=REQUEST_URI%>?openwrt">OpenWrt</a>, - <% if ipv == "6and4" then %> - <a href="<%=REQUEST_URI%>?conf_v4">OLSRD IPv4</a>, - <a href="<%=REQUEST_URI%>?conf_v6">OLSRD IPv6</a> - <% else %> - <a href="<%=REQUEST_URI%>?conf">OLSRD</a> - <% end %> - </td></tr> - </table> -</fieldset> - -<%+footer%> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/routes.htm b/applications/luci-olsr/luasrc/view/status-olsr/routes.htm deleted file mode 100644 index 76e1b1078..000000000 --- a/applications/luci-olsr/luasrc/view/status-olsr/routes.htm +++ /dev/null @@ -1,148 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> -Copyright 2011 Manuel Munz <freifunk at somakoma dot de> - -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 olsrtools = require "luci.tools.olsr" -local i = 1 - -if luci.http.formvalue("status") == "1" then - local rv = {} - for k, route in ipairs(routes) do - local ETX = string.format("%.3f", tonumber(route.rtpMetricCost)/1024 or 0) - rv[#rv+1] = { - hostname = route.hostname, - dest = route.destination, - genmask = route.genmask, - gw = route.gateway, - interface = route.networkInterface, - metric = route.metric, - etx = ETX, - color = olsrtools.etx_color(tonumber(ETX)) - } - end - luci.http.prepare_content("application/json") - luci.http.write_json(rv) - return -end - -%> - -<%+header%> - -<script type="text/javascript" src="<%=resource%>/cbi.js"></script> -<script type="text/javascript">//<![CDATA[ - -XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 }, - function(x, info) - { - - var rt = document.getElementById('olsrd_routes'); - if (rt) - { - var s = ''; - for (var idx = 0; idx < info.length; idx++) - { - var route = info[idx]; - - s += String.format( - '<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' + - '<td class="cbi-section-table-cell">%s/%s</td>' + - '<td class="cbi-section-table-cell">' + - '<a href="http://%s/cgi-bin-status.html">%s</a>', - route.proto, route.dest, route.genmask, route.gw, route.gw - ) - - if (route.hostname) { - if (hna.proto == '6') { - s += String.format( - ' / <a href="http://[%s]/cgi-bin-status.html">%s</a>', - route.hostname, route.hostname || '?' - ); - } else { - s += String.format( - ' / <a href="http://%s/cgi-bin-status.html">%s</a>', - route.hostname, route.hostname || '?' - ); - } - - } - s += String.format( - '</td>' + - '<td class="cbi-section-table-cell">%s</td>' + - '<td class="cbi-section-table-cell">%s</td>' + - '<td class="cbi-section-table-cell" style="background-color:%s">%s</td>' + - '</tr>', - route.interface, route.metric, route.color, route.etx || '?' - ); - } - } - rt.innerHTML = s; - - } - ); -//]]></script> - - - -<h2><a id="content" name="content"><%:Known OLSR routes%></a></h2> - -<div id="togglebuttons"></div> - -<fieldset class="cbi-section"> -<legend><%:Overview of currently known routes to other OLSR nodes%></legend> - -<table class="cbi-section-table"> - <thead> - <tr class="cbi-section-table-titles"> - <th class="cbi-section-table-cell"><%:Announced network%></th> - <th class="cbi-section-table-cell"><%:OLSR gateway%></th> - <th class="cbi-section-table-cell"><%:Interface%></th> - <th class="cbi-section-table-cell"><%:Metric%></th> - <th class="cbi-section-table-cell">ETX</th> - </tr> - </thead> - - <tbody id="olsrd_routes"> - - <% for k, route in ipairs(routes) do - ETX = tonumber(route.rtpMetricCost)/1024 or '0' - color = olsrtools.etx_color(ETX) - %> - - <tr class="cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=route.proto%>"> - <td class="cbi-section-table-cell"><%=route.destination%>/<%=route.genmask%></td> - <td class="cbi-section-table-cell"> - <% if route.proto == '6' then %> - <a href="http://[<%=route.gateway%>]/cgi-bin-status.html"><%=route.gateway%></a> - <% else %> - <a href="http://<%=route.gateway%>/cgi-bin-status.html"><%=route.gateway%></a> - <% end %> - <% if route.hostname then %> - / <a href="http://<%=route.Hostname%>/cgi-bin-status.html"><%=route.hostname%></a> - <% end %> - </td> - <td class="cbi-section-table-cell"><%=route.networkInterface%></td> - <td class="cbi-section-table-cell"><%=route.metric%></td> - <td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=string.format("%.3f", ETX)%></td> - </tr> - <% - i = ((i % 2) + 1) - end %> - </tbody> -</table> - -<%+status-olsr/legend%> -</fieldset> -<%+status-olsr/common_js%> -<%+footer%> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/smartgw.htm b/applications/luci-olsr/luasrc/view/status-olsr/smartgw.htm deleted file mode 100644 index 75d0c1c2f..000000000 --- a/applications/luci-olsr/luasrc/view/status-olsr/smartgw.htm +++ /dev/null @@ -1,158 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> -Copyright 2011 Manuel Munz <freifunk at somakoma dot de> - -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 i = 1 -require("luci.model.uci") -local uci = luci.model.uci.cursor_state() - -uci:foreach("olsrd", "olsrd", function(s) - if s.SmartGateway and s.SmartGateway == "yes" then has_smartgw = true end -end) - - -if luci.http.formvalue("status") == "1" then - local rv = {} - for k, gw in ipairs(gws) do - gw.tcPathCost = tonumber(gw.tcPathCost)/1024 or 0 - if gw.tcPathCost == 4096 then - gw.tcPathCost = 0 - end - - rv[#rv+1] = { - proto = gw.proto, - ipAddress = gw.ipAddress, - status = gw.ipv4Status or gw.ipv6Status, - tcPathCost = string.format("%.3f", gw.tcPathCost), - hopCount = gw.hopCount, - uplinkSpeed = gw.uplinkSpeed, - downlinkSpeed = gw.downlinkSpeed, - v4 = gw.ipv4 and luci.i18n.translate('yes') or luci.i18n.translate('no'), - v6 = gw.ipv6 and luci.i18n.translate('yes') or luci.i18n.translate('no'), - externalPrefix = gw.externalPrefix - } - end - luci.http.prepare_content("application/json") - luci.http.write_json(rv) - return -end -%> - -<%+header%> - -<script type="text/javascript" src="<%=resource%>/cbi.js"></script> -<script type="text/javascript">//<![CDATA[ -XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 }, - function(x, info) - { - var smartgwdiv = document.getElementById('olsrd_smartgw'); - if (smartgwdiv) - { - var s = ''; - for (var idx = 0; idx < info.length; idx++) - { - var smartgw = info[idx]; - s += '<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-' + smartgw.proto + '">' - if (smartgw.proto == '6') { - linkgw = '<a href="http://[' + smartgw.ipAddress + ']/cgi-bin-status.html">' + smartgw.ipAddress + '</a>' - } else { - linkgw = '<a href="http://' + smartgw.ipAddress + '/cgi-bin-status.html">' + smartgw.ipAddress + '</a>' - } - - s += String.format( - '<td class="cbi-section-table-cell">%s</td>' + - '<td class="cbi-section-table-cell">%s</td>' + - '<td class="cbi-section-table-cell">%s</td>' + - '<td class="cbi-section-table-cell">%s</td>' + - '<td class="cbi-section-table-cell">%s</td>' + - '<td class="cbi-section-table-cell">%s</td>' + - '<td class="cbi-section-table-cell">%s</td>' + - '<td class="cbi-section-table-cell">%s</td>' + - '<td class="cbi-section-table-cell">%s</td>', - linkgw, smartgw.status, smartgw.tcPathCost, smartgw.hopCount, smartgw.uplinkSpeed, smartgw.downlinkSpeed, smartgw.v4, smartgw.v6, smartgw.externalPrefix - ) - s += '</tr>' - } - smartgwdiv.innerHTML = s; - } -} -); -//]]></script> - - -<%+header%> - -<h2><a id="content" name="content"><%:SmartGW announcements%></a></h2> - -<div id="togglebuttons"></div> - -<% if has_smartgw then %> - - <fieldset class="cbi-section"> - <legend><%:Overview of smart gateways in this network%></legend> - <table class="cbi-section-table"> - <thead> - <tr class="cbi-section-table-titles"> - <th class="cbi-section-table-cell"><%:Gateway%></th> - <th class="cbi-section-table-cell"><%:Status%></th> - <th class="cbi-section-table-cell"><%:ETX%></th> - <th class="cbi-section-table-cell"><%:Hops%></th> - <th class="cbi-section-table-cell"><%:Uplink%></th> - <th class="cbi-section-table-cell"><%:Downlink%></th> - <th class="cbi-section-table-cell"><%:IPv4%></th> - <th class="cbi-section-table-cell"><%:IPv6%></th> - <th class="cbi-section-table-cell"><%:Prefix%></th> - - </tr> - </thead> - - <tbody id="olsrd_smartgw"> - <% for k, gw in ipairs(gws) do - - gw.tcPathCost = tonumber(gw.tcPathCost)/1024 or 0 - if gw.tcPathCost == 4096 then - gw.tcPathCost = 0 - end - %> - - <tr class="cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=proto%>"> - <% if gw.proto == '6' then %> - <td class="cbi-section-table-cell"><a href="http://[<%=gw.ipAddress%>]/cgi-bin-status.html"><%=gw.ipAddress%></a></td> - <% else %> - <td class="cbi-section-table-cell"><a href="http://<%=gw.ipAddress%>/cgi-bin-status.html"><%=gw.ipAddress%></a></td> - <% end %> - - <td class="cbi-section-table-cell"><%=gw.ipv4Status or gw.ipv6Status or '-' %></td> - <td class="cbi-section-table-cell"><%=string.format("%.3f", gw.tcPathCost)%></td> - <td class="cbi-section-table-cell"><%=gw.hopCount%></td> - <td class="cbi-section-table-cell"><%=gw.uplinkSpeed%></td> - <td class="cbi-section-table-cell"><%=gw.downlinkSpeed%></td> - <td class="cbi-section-table-cell"><%=gw.ipv4 and luci.i18n.translate('yes') or luci.i18n.translate('no')%></td> - <td class="cbi-section-table-cell"><%=gw.ipv6 and luci.i18n.translate('yes') or luci.i18n.translate('no')%></td> - <td class="cbi-section-table-cell"><%=gw.externalPrefix%></td> - </tr> - - <% i = ((i % 2) + 1) - end %> - </tbody> - </table> - </fieldset> - -<% else %> - - <%:SmartGateway is not configured on this system.%> - -<% end %> - -<%+status-olsr/common_js%> -<%+footer%> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/topology.htm b/applications/luci-olsr/luasrc/view/status-olsr/topology.htm deleted file mode 100644 index eb3df5ff5..000000000 --- a/applications/luci-olsr/luasrc/view/status-olsr/topology.htm +++ /dev/null @@ -1,68 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> -Copyright 2011 Manuel Munz <freifunk at somakoma dot de> - -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 i = 1 -local olsrtools = require "luci.tools.olsr" -%> - -<%+header%> -<h2><a id="content" name="content"><%:Active OLSR nodes%></a></h2> - -<div id="togglebuttons"></div> - -<fieldset class="cbi-section"> - <legend><%:Overview of currently known OLSR nodes%></legend> - <table class="cbi-section-table"> - <tr class="cbi-section-table-titles"> - <th class="cbi-section-table-cell"><%:OLSR node%></th> - <th class="cbi-section-table-cell"><%:Last hop%></th> - <th class="cbi-section-table-cell"><%:LQ%></th> - <th class="cbi-section-table-cell"><%:NLQ%></th> - <th class="cbi-section-table-cell"><%:ETX%></th> - </tr> - - <% for k, route in ipairs(routes) do - local cost = string.format("%.3f", tonumber(route.tcEdgeCost/1024) or 0) - local color = olsrtools.etx_color(tonumber(cost)) - local lq = string.format("%.3f", tonumber(route.linkQuality) or 0) - local nlq = string.format("%.3f", tonumber(route.neighborLinkQuality) or 0) - %> - - <tr class="cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=route.proto%>"> - - <% if route.proto == "6" then %> - - <td class="cbi-section-table-cell"><a href="http://[<%=route.destinationIP%>]/cgi-bin-status.html"><%=route.destinationIP%></a></td> - <td class="cbi-section-table-cell"><a href="http://[<%=route.lastHopIP%>]/cgi-bin-status.html"><%=route.lastHopIP%></a></td> - - <% else %> - - <td class="cbi-section-table-cell"><a href="http://<%=route.destinationIP%>/cgi-bin-status.html"><%=route.destinationIP%></a></td> - <td class="cbi-section-table-cell"><a href="http://<%=route.lastHopIP%>/cgi-bin-status.html"><%=route.lastHopIP%></a></td> - - <%end%> - - <td class="cbi-section-table-cell"><%=lq%></td> - <td class="cbi-section-table-cell"><%=nlq%></td> - <td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=cost%></td> - </tr> - - <% i = ((i % 2) + 1) - end %> - </table> -<%+status-olsr/legend%> -</fieldset> - -<%+status-olsr/common_js%> -<%+footer%> |