diff options
Diffstat (limited to 'applications/luci-app-olsr/luasrc/view/status-olsr')
11 files changed, 0 insertions, 1055 deletions
diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/common_js.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/common_js.htm deleted file mode 100644 index 213013f22c..0000000000 --- a/applications/luci-app-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() { - var 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-app-olsr/luasrc/view/status-olsr/error_olsr.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/error_olsr.htm deleted file mode 100644 index eb41219c7e..0000000000 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/error_olsr.htm +++ /dev/null @@ -1,11 +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 name="content"><%:OLSR Daemon%></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-app-olsr/luasrc/view/status-olsr/hna.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/hna.htm deleted file mode 100644 index 34cf563363..0000000000 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/hna.htm +++ /dev/null @@ -1,124 +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. --%> - -<% -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">//<![CDATA[ -XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 }, - function(x, info) - { - var hnadiv = document.getElementById('olsrd_hna'); - if (hnadiv) - { - var s = '<div class="tr cbi-section-table-titles">' + - '<div class="th cbi-section-table-cell"><%:Announced network%></div>' + - '<div class="th cbi-section-table-cell"><%:OLSR gateway%></div>' + - '<div class="th cbi-section-table-cell"><%:Validity Time%></div>' + - '</div>'; - - for (var idx = 0; idx < info.length; idx++) - { - var hna = info[idx]; - var linkgw = '' - s += '<div class="tr 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>' - } - - var validity; - if (hna.validityTime != undefined) { - validity = hna.validityTime + 's' - } else { - validity = '-' - } - - var hostname; - if (hna.hostname != undefined) { - hostname = ' / <a href="http://' + hna.hostname + '/cgi-bin-status.html">' + hna.hostname + '</a>' - } else { - hostname = '' - } - - s += String.format( - '<div class="td cbi-section-table-cell left">%s</div>' + - '<div class="td cbi-section-table-cell left">%s</div>' + - '<div class="td cbi-section-table-cell left">%s</div>', hna.destination + '/' + hna.genmask, linkgw + hostname, validity - ) - s += '</div>' - } - hnadiv.innerHTML = s; - } -} -); -//]]></script> - -<h2 name="content"><%:Active host net announcements%></h2> - -<div id="togglebuttons"></div> -<fieldset class="cbi-section"> - - <legend><%:Overview of currently active OLSR host net announcements%></legend> - <div class="table cbi-section-table" id="olsrd_hna"> - <div class="tr cbi-section-table-titles"> - <div class="th cbi-section-table-cell"><%:Announced network%></div> - <div class="th cbi-section-table-cell"><%:OLSR gateway%></div> - <div class="th cbi-section-table-cell"><%:Validity Time%></div> - </div> - - <% for k, route in ipairs(hna) do %> - - <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=hna[k].proto%>"> - <div class="td cbi-section-table-cell left"><%=hna[k].destination%>/<%=hna[k].genmask%> </div> - <div class="td cbi-section-table-cell left"> - <% 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 %> - </div> - <% if hna[k].validityTime then - validity = hna[k].validityTime .. 's' - else - validity = '-' - end %> - - <div class="td cbi-section-table-cell left"><%=validity%></div> - </div> - - <% i = ((i % 2) + 1) - end %> - </div> -</fieldset> - -<%+status-olsr/common_js%> -<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/interfaces.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/interfaces.htm deleted file mode 100644 index 12f7cba967..0000000000 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/interfaces.htm +++ /dev/null @@ -1,52 +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. --%> - -<% -local i = 1 -%> - -<%+header%> - -<h2 name="content"><%:Interfaces%></h2> - -<div id="togglebuttons"></div> - -<fieldset class="cbi-section"> - <legend><%:Overview of interfaces where OLSR is running%></legend> - - <div class="table cbi-section-table"> - <div class="tr"> - <div class="th cbi-section-table-cell"><%:Interface%></div> - <div class="th cbi-section-table-cell"><%:Device%></div> - <div class="th cbi-section-table-cell"><%:State%></div> - <div class="th cbi-section-table-cell"><%:MTU%></div> - <div class="th cbi-section-table-cell"><%:WLAN%></div> - <div class="th cbi-section-table-cell"><%:Source address%></div> - <div class="th cbi-section-table-cell"><%:Netmask%></div> - <div class="th cbi-section-table-cell"><%:Broadcast address%></div> - </div> - - <% for k, iface in ipairs(iface) do %> - - <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=iface.proto%>"> - <div class="td cbi-section-table-cell left"><%=iface.interface%></div> - <div class="td cbi-section-table-cell left"><%=iface.name%></div> - <div class="td cbi-section-table-cell left"><%=iface.olsrInterface.up and luci.i18n.translate('up') or luci.i18n.translate('down')%></div> - <div class="td cbi-section-table-cell left"><%=iface.olsrInterface.mtu%></div> - <div class="td cbi-section-table-cell left"><%=iface.olsrInterface.wireless and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div> - <div class="td cbi-section-table-cell left"><%=iface.olsrInterface.ipAddress%></div> - <div class="td cbi-section-table-cell left"><%=iface.olsrInterface.ipv4Address ~= '0.0.0.0' and iface.olsrInterface.ipv4Netmask%></div> - <div class="td cbi-section-table-cell left"><%=iface.olsrInterface.ipv4Address ~= '0.0.0.0' and iface.olsrInterface.ipv4Broadcast or iface.olsrInterface.ipv6Multicast%></div> - </div> - <% i = ((i % 2) + 1) - end %> - </div> -</fieldset> -<%+status-olsr/common_js%> -<%+footer%> - - diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/legend.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/legend.htm deleted file mode 100644 index 2f598489dc..0000000000 --- a/applications/luci-app-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-app-olsr/luasrc/view/status-olsr/mid.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/mid.htm deleted file mode 100644 index 469d89111a..0000000000 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/mid.htm +++ /dev/null @@ -1,50 +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. --%> - -<% -local i = 1 -%> - -<%+header%> -<h2 name="content"><%:Active MID announcements%></h2> - -<div id="togglebuttons"></div> -<fieldset class="cbi-section"> - <legend><%:Overview of known multiple interface announcements%></legend> - <div class="table cbi-section-table"> - <div class="tr cbi-section-table-titles"> - <div class="th cbi-section-table-cell"><%:OLSR node%></div> - <div class="th cbi-section-table-cell" ><%:Secondary OLSR interfaces%></div> - </div> - - <% 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.main.ipAddress - if mid.proto == '6' then - host = '[' .. mid.main.ipAddress .. ']' - end - %> - - <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=mid.proto%>"> - <div class="td cbi-section-table-cell left"><a href="http://<%=host%>/cgi-bin-status.html"><%=mid.main.ipAddress%></a></div> - <div class="td cbi-section-table-cell left"><%=aliases%></div> - </div> - - <% i = ((i % 2) + 1) - end %> - </div> -</fieldset> -<%+status-olsr/common_js%> -<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm deleted file mode 100644 index 8cdda14916..0000000000 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm +++ /dev/null @@ -1,179 +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. --%> - -<% -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) or 0 - if link.linkCost == 4194304 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">//<![CDATA[ - - XHR.poll(10 , '<%=REQUEST_URI%>', { status: 1 }, - function(x, info) - { - var nt = document.getElementById('olsr_neigh_table'); - if (nt) - { - var s = '<div class="tr cbi-section-table-cell">' + - '<div class="th cbi-section-table-cell"><%:Neighbour IP%></div>' + - '<div class="th cbi-section-table-cell"><%:Hostname%></div>' + - '<div class="th cbi-section-table-cell"><%:Interface%></div>' + - '<div class="th cbi-section-table-cell"><%:Local interface IP%></div>' + - '<div class="th cbi-section-table-cell">LQ</div>' + - '<div class="th cbi-section-table-cell">NLQ</div>' + - '<div class="th cbi-section-table-cell">ETX</div>' + - '<div class="th cbi-section-table-cell">SNR</div>' + - '</div>'; - - for (var idx = 0; idx < info.length; idx++) - { - var neigh = info[idx]; - - if (neigh.proto == '6') { - s += String.format( - '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' + - '<div class="td cbi-section-table-cell left" style="background-color:%s"><a href="http://[%s]/cgi-bin-status.html">%s</a></div>', - neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip - ); - } else { - s += String.format( - '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' + - '<div class="td cbi-section-table-cell left" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></div>', - neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip - ); - } - if (neigh.hn) { - s += String.format( - '<div class="td cbi-section-table-cell left" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></div>', - neigh.dfgcolor, neigh.hn, neigh.hn - ); - } else { - s += String.format( - '<div class="td cbi-section-table-cell left" style="background-color:%s">?</div>', - neigh.dfgcolor - ); - } - s += String.format( - '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' + - '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' + - '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' + - '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' + - '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' + - '<div class="td cbi-section-table-cell left" style="background-color:%s" title="Signal: %s Noise: %s">%s</div>' + - '</div>', - 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 name="content"><%:OLSR connections%></h2> - -<div id="togglebuttons"></div> - -<fieldset class="cbi-section"> - <legend><%:Overview of currently established OLSR connections%></legend> - - <div class="table cbi-section-table" id="olsr_neigh_table"> - <div class="tr cbi-section-table-cell"> - <div class="th cbi-section-table-cell"><%:Neighbour IP%></div> - <div class="th cbi-section-table-cell"><%:Hostname%></div> - <div class="th cbi-section-table-cell"><%:Interface%></div> - <div class="th cbi-section-table-cell"><%:Local interface IP%></div> - <div class="th cbi-section-table-cell">LQ</div> - <div class="th cbi-section-table-cell">NLQ</div> - <div class="th cbi-section-table-cell">ETX</div> - <div class="th cbi-section-table-cell">SNR</div> - </div> - - <% local i = 1 - for k, link in ipairs(links) do - link.linkCost = tonumber(link.linkCost) or 0 - if link.linkCost == 4194304 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 - %> - - <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=link.proto%>"> - <% if link.proto == "6" then %> - <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><a href="http://[<%=link.remoteIP%>]/cgi-bin-status.html"><%=link.remoteIP%></a></div> - <% else %> - <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.remoteIP%>/cgi-bin-status.html"><%=link.remoteIP%></a></div> - <% end %> - <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.hostname%>/cgi-bin-status.html"><%=link.hostname%></a></div> - <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><%=link.interface%></div> - <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><%=link.localIP%></div> - <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.linkQuality)%></div> - <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.neighborLinkQuality)%></div> - <div class="td cbi-section-table-cell left" style="background-color:<%=color%>"><%=string.format("%.3f", link.linkCost)%></div> - <div class="td cbi-section-table-cell left" style="background-color:<%=snr_color%>" title="Signal: <%=link.signal%> Noise: <%=link.noise%>"><%=link.snr%></div> - </div> - <% - i = ((i % 2) + 1) - end %> - </div> -<br /> - -<%+status-olsr/legend%> -</fieldset> -<%+status-olsr/common_js%> -<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm deleted file mode 100644 index 7bfd73df20..0000000000 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm +++ /dev/null @@ -1,220 +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. --%> - -<% - -has_ipv4_conf = luci.model.uci.cursor():get_first("olsrd", "olsrd", "IpVersion") -has_ipv6_conf = luci.model.uci.cursor():get_first("olsrd6", "olsrd", "IpVersion") - -function write_conf(conf, file) - local fs = require "nixio.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_v4 then - write_conf("/etc/config/olsrd", "olsrd") - return false -end - -if conf.openwrt_v6 then - write_conf("/etc/config/olsrd6", "olsrd6") - return false -end - -if conf.conf_v4 then - write_conf("/var/etc/olsrd.conf", "olsrd.conf") - return false -end - -if conf.conf_v6 then - write_conf("/var/etc/olsrd6.conf", "olsrd6.conf") - return false -end - -%> - -<%+header%> - -<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.version.version != undefined) { - version = info.v4.version.version - date = info.v4.version.date - } else if (info.v6.version.version != undefined) { - version = info.v6.version.version - date = info.v6.version.date - } 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 name="content">OLSR <%:Overview%></h2> - -<fieldset class="cbi-section"> - <legend><%:Network%></legend> - - <div class="table" width="100%" cellspacing="10"> - <div class="tr"><div class="td" width="33%"><%:Interfaces%></div><div class="td"> - <a href="<%=REQUEST_URI%>/interfaces"> - <span id="nr_ifaces">-<span> - </a> - </div></div> - <div class="tr"><div class="td" width="33%"><%:Neighbors%></div><div class="td"> - <a href="<%=REQUEST_URI%>/neighbors"> - <span id="nr_neigh">-</span> - </a> - </div></div> - <div class="tr"><div class="td" width="33%"><%:Nodes%></div><div class="td"> - <a href="<%=REQUEST_URI%>/topology"> - <span id="nr_nodes">-</span> - </a> - </div></div> - <div class="tr"><div class="td" width="33%"><%:HNA%></div><div class="td"> - <a href="<%=REQUEST_URI%>/hna"> - <span id="nr_hna">-</span> - </a> - </div></div> - <div class="tr"><div class="td" width="33%"><%:Links total%></div><div class="td"> - <a href="<%=REQUEST_URI%>/topology"> - <span id="nr_topo">-</span> - </a> - </div></div> - <div class="tr"><div class="td" width="33%"><%:Links per node (average)%></div><div class="td"> - <span id="meshfactor">-</span> - </div></div> - - - </div> -</fieldset> - - -<fieldset class="cbi-section"> - <legend>OLSR <%:Configuration%></legend> - <div class="table" width="100%" cellspacing="10"> - <div class="tr"><div class="td" width="33%"><%:Version%></div><div class="td"> - <span id="version">-<span> - </div></div> - <div class="tr"><div class="td" width="33%"><%:Download Config%></div><div class="td"> - <% if has_ipv4_conf then %> - <a href="<%=REQUEST_URI%>?openwrt_v4">OpenWrt (IPv4)</a>, - <% end %> - <% if has_ipv6_conf then %> - <a href="<%=REQUEST_URI%>?openwrt_v6">OpenWrt (IPv6)</a>, - <% end %> - <% if has_ipv4_conf then %> - <a href="<%=REQUEST_URI%>?conf_v4">OLSRD (IPv4)</a>, - <% end %> - <% if has_ipv6_conf then %> - <a href="<%=REQUEST_URI%>?conf_v6">OLSRD (IPv6)</a> - <% end %> - </div></div> - </div> -</fieldset> - -<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/routes.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/routes.htm deleted file mode 100644 index 624047f40c..0000000000 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/routes.htm +++ /dev/null @@ -1,143 +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. --%> - -<% - -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.etx) 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">//<![CDATA[ - -XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 }, - function(x, info) - { - - var rt = document.getElementById('olsrd_routes'); - if (rt) - { - var s = '<div class="tr cbi-section-table-cell">' + - '<div class="th cbi-section-table-cell"><%:Announced network%></div>' + - '<div class="th cbi-section-table-cell"><%:OLSR gateway%></div>' + - '<div class="th cbi-section-table-cell"><%:Interface%></div>' + - '<div class="th cbi-section-table-cell"><%:Metric%></div>' + - '<div class="th cbi-section-table-cell">ETX</div>' + - '</div>'; - - for (var idx = 0; idx < info.length; idx++) - { - var route = info[idx]; - - s += String.format( - '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' + - '<div class="td cbi-section-table-cell left">%s/%s</div>' + - '<div class="td cbi-section-table-cell left">' + - '<a href="http://%s/cgi-bin-status.html">%s</a>', - route.proto, route.dest, route.genmask, route.gw, route.gw - ) - - if (route.hostname) { - if (route.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( - '</div>' + - '<div class="td cbi-section-table-cell left">%s</div>' + - '<div class="td cbi-section-table-cell left">%s</div>' + - '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' + - '</div>', - route.interface, route.metric, route.color, route.etx || '?' - ); - } - } - rt.innerHTML = s; - - } - ); -//]]></script> - - - -<h2 name="content"><%:Known OLSR routes%></h2> - -<div id="togglebuttons"></div> - -<fieldset class="cbi-section"> -<legend><%:Overview of currently known routes to other OLSR nodes%></legend> - -<div class="table cbi-section-table" id="olsrd_routes"> - <div class="tr cbi-section-table-cell"> - <div class="th cbi-section-table-cell"><%:Announced network%></div> - <div class="th cbi-section-table-cell"><%:OLSR gateway%></div> - <div class="th cbi-section-table-cell"><%:Interface%></div> - <div class="th cbi-section-table-cell"><%:Metric%></div> - <div class="th cbi-section-table-cell">ETX</div> - </div> - - <% for k, route in ipairs(routes) do - ETX = tonumber(route.etx) or '0' - color = olsrtools.etx_color(ETX) - %> - - <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=route.proto%>"> - <div class="td cbi-section-table-cell left"><%=route.destination%>/<%=route.genmask%></div> - <div class="td cbi-section-table-cell left"> - <% 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 %> - </div> - <div class="td cbi-section-table-cell left"><%=route.networkInterface%></div> - <div class="td cbi-section-table-cell left"><%=route.metric%></div> - <div class="td cbi-section-table-cell left" style="background-color:<%=color%>"><%=string.format("%.3f", ETX)%></div> - </div> - <% - i = ((i % 2) + 1) - end %> -</div> - -<%+status-olsr/legend%> -</fieldset> -<%+status-olsr/common_js%> -<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm deleted file mode 100644 index 99da8154be..0000000000 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm +++ /dev/null @@ -1,155 +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. --%> - -<% -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.ipv4, gws.ipv6) do - gw.cost = tonumber(gw.cost)/1024 or 0 - if gw.cost >= 100 then - gw.cost = 0 - end - - rv[#rv+1] = { - proto = gw.IPv4 and '4' or '6', - originator = gw.originator, - selected = gw.selected and luci.i18n.translate('yes') or luci.i18n.translate('no'), - cost = gw.cost > 0 and string.format("%.3f", gw.cost) or luci.i18n.translate('infinite'), - hops = gw.hops, - uplink = gw.uplink, - downlink = gw.downlink, - 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'), - prefix = gw.prefix - } - end - luci.http.prepare_content("application/json") - luci.http.write_json(rv) - return -end -%> - -<%+header%> - -<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 = '<div class="tr cbi-section-table-titles">' + - '<div class="th cbi-section-table-cell"><%:Gateway%></div>' + - '<div class="th cbi-section-table-cell"><%:Selected%></div>' + - '<div class="th cbi-section-table-cell"><%:ETX%></div>' + - '<div class="th cbi-section-table-cell"><%:Hops%></div>' + - '<div class="th cbi-section-table-cell"><%:Uplink%></div>' + - '<div class="th cbi-section-table-cell"><%:Downlink%></div>' + - '<div class="th cbi-section-table-cell"><%:IPv4%></div>' + - '<div class="th cbi-section-table-cell"><%:IPv6%></div>' + - '<div class="th cbi-section-table-cell"><%:Prefix%></div>' + - '</div>'; - - for (var idx = 0; idx < info.length; idx++) - { - var smartgw = info[idx]; - var linkgw; - s += '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-' + smartgw.proto + '">' - if (smartgw.proto == '6') { - linkgw = '<a href="http://[' + smartgw.originator + ']/cgi-bin-status.html">' + smartgw.originator + '</a>' - } else { - linkgw = '<a href="http://' + smartgw.originator + '/cgi-bin-status.html">' + smartgw.originator + '</a>' - } - - s += String.format( - '<div class="td cbi-section-table-cell left">%s</div>' + - '<div class="td cbi-section-table-cell left">%s</div>' + - '<div class="td cbi-section-table-cell left">%s</div>' + - '<div class="td cbi-section-table-cell left">%s</div>' + - '<div class="td cbi-section-table-cell left">%s</div>' + - '<div class="td cbi-section-table-cell left">%s</div>' + - '<div class="td cbi-section-table-cell left">%s</div>' + - '<div class="td cbi-section-table-cell left">%s</div>' + - '<div class="td cbi-section-table-cell left">%s</div>', - linkgw, smartgw.selected, smartgw.cost, smartgw.hops, smartgw.uplink, smartgw.downlink, smartgw.v4, smartgw.v6, smartgw.prefix - ) - s += '</div>' - } - smartgwdiv.innerHTML = s; - } -} -); -//]]></script> - -<h2 name="content"><%:SmartGW announcements%></h2> - -<div id="togglebuttons"></div> - -<% if has_smartgw then %> - - <fieldset class="cbi-section"> - <legend><%:Overview of smart gateways in this network%></legend> - <div class="table cbi-section-table" id="olsrd_smartgw"> - <div class="tr cbi-section-table-titles"> - <div class="th cbi-section-table-cell"><%:Gateway%></div> - <div class="th cbi-section-table-cell"><%:Selected%></div> - <div class="th cbi-section-table-cell"><%:ETX%></div> - <div class="th cbi-section-table-cell"><%:Hops%></div> - <div class="th cbi-section-table-cell"><%:Uplink%></div> - <div class="th cbi-section-table-cell"><%:Downlink%></div> - <div class="th cbi-section-table-cell"><%:IPv4%></div> - <div class="th cbi-section-table-cell"><%:IPv6%></div> - <div class="th cbi-section-table-cell"><%:Prefix%></div> - </div> - - <% for k, gw in ipairs(gws.ipv4, gws.ipv6) do - - gw.cost = tonumber(gw.cost)/1024 or 0 - if gw.cost >= 100 then - gw.cost = 0 - end - %> - - <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=proto%>"> - <% if gw.proto == '6' then %> - <div class="td cbi-section-table-cell left"><a href="http://[<%=gw.originator%>]/cgi-bin-status.html"><%=gw.originator%></a></div> - <% else %> - <div class="td cbi-section-table-cell left"><a href="http://<%=gw.originator%>/cgi-bin-status.html"><%=gw.originator%></a></div> - <% end %> - - <div class="td cbi-section-table-cell left"><%=gw.selected and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div> - <div class="td cbi-section-table-cell left"><%=gw.cost > 0 and string.format("%.3f", gw.cost) or luci.i18n.translate('infinite')%></div> - <div class="td cbi-section-table-cell left"><%=gw.hops%></div> - <div class="td cbi-section-table-cell left"><%=gw.uplink%></div> - <div class="td cbi-section-table-cell left"><%=gw.downlink%></div> - <div class="td cbi-section-table-cell left"><%=gw.IPv4 and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div> - <div class="td cbi-section-table-cell left"><%=gw.IPv6 and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div> - <div class="td cbi-section-table-cell left"><%=gw.prefix%></div> - </div> - - <% i = ((i % 2) + 1) - end %> - </div> - </fieldset> - -<% else %> - - <%:SmartGateway is not configured on this system.%> - -<% end %> - -<%+status-olsr/common_js%> -<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/topology.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/topology.htm deleted file mode 100644 index fe673c4111..0000000000 --- a/applications/luci-app-olsr/luasrc/view/status-olsr/topology.htm +++ /dev/null @@ -1,62 +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. --%> - -<% -local i = 1 -local olsrtools = require "luci.tools.olsr" -%> - -<%+header%> -<h2 name="content"><%:Active OLSR nodes%></h2> - -<div id="togglebuttons"></div> - -<fieldset class="cbi-section"> - <legend><%:Overview of currently known OLSR nodes%></legend> - <div class="table cbi-section-table"> - <div class="tr cbi-section-table-titles"> - <div class="th cbi-section-table-cell"><%:OLSR node%></div> - <div class="th cbi-section-table-cell"><%:Last hop%></div> - <div class="th cbi-section-table-cell"><%:LQ%></div> - <div class="th cbi-section-table-cell"><%:NLQ%></div> - <div class="th cbi-section-table-cell"><%:ETX%></div> - </div> - - <% for k, route in ipairs(routes) do - local cost = string.format("%.3f", tonumber(route.tcEdgeCost) 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) - %> - - <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=route.proto%>"> - - <% if route.proto == "6" then %> - - <div class="td cbi-section-table-cell left"><a href="http://[<%=route.destinationIP%>]/cgi-bin-status.html"><%=route.destinationIP%></a></div> - <div class="td cbi-section-table-cell left"><a href="http://[<%=route.lastHopIP%>]/cgi-bin-status.html"><%=route.lastHopIP%></a></div> - - <% else %> - - <div class="td cbi-section-table-cell left"><a href="http://<%=route.destinationIP%>/cgi-bin-status.html"><%=route.destinationIP%></a></div> - <div class="td cbi-section-table-cell left"><a href="http://<%=route.lastHopIP%>/cgi-bin-status.html"><%=route.lastHopIP%></a></div> - - <%end%> - - <div class="td cbi-section-table-cell left"><%=lq%></div> - <div class="td cbi-section-table-cell left"><%=nlq%></div> - <div class="td cbi-section-table-cell left" style="background-color:<%=color%>"><%=cost%></div> - </div> - - <% i = ((i % 2) + 1) - end %> - </div> -<%+status-olsr/legend%> -</fieldset> - -<%+status-olsr/common_js%> -<%+footer%> |