diff options
Diffstat (limited to 'applications/luci-olsr/luasrc/view/status-olsr/overview.htm')
-rw-r--r-- | applications/luci-olsr/luasrc/view/status-olsr/overview.htm | 220 |
1 files changed, 0 insertions, 220 deletions
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%> |