2 Copyright
2008 Steven Barth
<steven@midlink.org
>
3 Copyright
2008 Jo-Philipp Wich
<jow@openwrt.org
>
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">//<![CDATA[
32 XHR.poll(
10, '<%=REQUEST_URI%
>', { status:
1 },
35 var hnadiv = document.getElementById('olsrd_hna');
39 for (var idx =
0; idx < info.length; idx++)
43 s += '
<div class=
"tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-' + hna.proto + '">'
44 if (hna.proto == '
6') {
45 linkgw = '
<a href=
"http://[' + hna.gateway + ']/cgi-bin-status.html">' + hna.gateway + '
</a>'
47 linkgw = '
<a href=
"http://' + hna.gateway + '/cgi-bin-status.html">' + hna.gateway + '
</a>'
50 if (hna.validityTime != undefined) {
51 validity = hna.validityTime + 's'
56 if (hna.hostname != undefined) {
57 hostname = ' /
<a href=
"http://' + hna.hostname + '/cgi-bin-status.html">' + hna.hostname + '
</a>'
63 '
<div class=
"td cbi-section-table-cell">%s
</div>' +
64 '
<div class=
"td cbi-section-table-cell">%s
</div>' +
65 '
<div class=
"td cbi-section-table-cell">%s
</div>', hna.destination + '/' + hna.genmask, linkgw + hostname, validity
75 <h2 name=
"content"><%:Active host net announcements%
></h2>
77 <div id=
"togglebuttons"></div>
78 <fieldset class=
"cbi-section">
80 <legend><%:Overview of currently active OLSR host net announcements%
></legend>
81 <div class=
"table cbi-section-table">
83 <div class=
"tr cbi-section-table-titles">
84 <div class=
"th cbi-section-table-cell"><%:Announced network%
></div>
85 <div class=
"th cbi-section-table-cell"><%:OLSR gateway%
></div>
86 <div class=
"th cbi-section-table-cell"><%:Validity Time%
></div>
90 <div class=
"tbody" id=
"olsrd_hna">
91 <% for k, route in ipairs(hna) do %
>
93 <div class=
"tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=hna[k].proto%>">
94 <div class=
"td cbi-section-table-cell"><%=hna[k].destination%
>/<%=hna[k].genmask%
> </div>
95 <div class=
"td cbi-section-table-cell">
96 <% if hna[k].proto == '
6' then %
>
97 <a href=
"http://[<%=hna[k].gateway%>]/cgi-bin-status.html"><%=hna[k].gateway%
></a>
99 <a href=
"http://<%=hna[k].gateway%>/cgi-bin-status.html"><%=hna[k].gateway%
></a>
101 <% if hna[k].hostname then %
>
102 /
<a href=
"http://<%=hna[k].hostname%>/cgi-bin-status.html"><%=hna[k].hostname%
></a>
105 <% if hna[k].validityTime then
106 validity = hna[k].validityTime .. 's'
111 <div class=
"td cbi-section-table-cell"><%=validity%
></div>
120 <%+status-olsr/common_js%
>