2 Copyright 2008 Steven Barth <steven@midlink.org>
3 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
4 Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
5 Licensed to the public under the Apache License 2.0.
11 if luci.http.formvalue("status") == "1" then
13 for k, hna in ipairs(hna) do
16 destination = hna["destination"],
17 genmask = hna["genmask"],
18 gateway = hna["gateway"],
19 hostname = hna["hostname"],
20 validityTime = hna["validityTime"]
23 luci.http.prepare_content("application/json")
24 luci.http.write_json(rv)
31 <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
32 <script type="text/javascript">//<![CDATA[
33 XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
36 var hnadiv = document.getElementById('olsrd_hna');
40 for (var idx = 0; idx < info.length; idx++)
44 s += '<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-' + hna.proto + '">'
45 if (hna.proto == '6') {
46 linkgw = '<a href="http://[' + hna.gateway + ']/cgi-bin-status.html">' + hna.gateway + '</a>'
48 linkgw = '<a href="http://' + hna.gateway + '/cgi-bin-status.html">' + hna.gateway + '</a>'
51 if (hna.validityTime != undefined) {
52 validity = hna.validityTime + 's'
57 if (hna.hostname != undefined) {
58 hostname = ' / <a href="http://' + hna.hostname + '/cgi-bin-status.html">' + hna.hostname + '</a>'
64 '<td class="cbi-section-table-cell">%s</td>' +
65 '<td class="cbi-section-table-cell">%s</td>' +
66 '<td class="cbi-section-table-cell">%s</td>', hna.destination + '/' + hna.genmask, linkgw + hostname, validity
76 <h2><a id="content" name="content"><%:Active host net announcements%></a></h2>
78 <div id="togglebuttons"></div>
79 <fieldset class="cbi-section">
81 <legend><%:Overview of currently active OLSR host net announcements%></legend>
82 <table class="cbi-section-table">
84 <tr class="cbi-section-table-titles">
85 <th class="cbi-section-table-cell"><%:Announced network%></th>
86 <th class="cbi-section-table-cell"><%:OLSR gateway%></th>
87 <th class="cbi-section-table-cell"><%:Validity Time%></th>
91 <tbody id="olsrd_hna">
92 <% for k, route in ipairs(hna) do %>
94 <tr class="cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=hna[k].proto%>">
95 <td class="cbi-section-table-cell"><%=hna[k].destination%>/<%=hna[k].genmask%> </td>
96 <td class="cbi-section-table-cell">
97 <% if hna[k].proto == '6' then %>
98 <a href="http://[<%=hna[k].gateway%>]/cgi-bin-status.html"><%=hna[k].gateway%></a>
100 <a href="http://<%=hna[k].gateway%>/cgi-bin-status.html"><%=hna[k].gateway%></a>
102 <% if hna[k].hostname then %>
103 / <a href="http://<%=hna[k].hostname%>/cgi-bin-status.html"><%=hna[k].hostname%></a>
106 <% if hna[k].validityTime then
107 validity = hna[k].validityTime .. 's'
112 <td class="cbi-section-table-cell"><%=validity%></td>
121 <%+status-olsr/common_js%>