2 LuCI - Lua Configuration Interface
3 Copyright
2008 Steven Barth
<steven@midlink.org
>
4 Copyright
2008 Jo-Philipp Wich
<xm@leipzig.freifunk.net
>
5 Copyright
2011 Manuel Munz
<freifunk at somakoma dot de
>
7 Licensed under the Apache License, Version
2.0 (the
"License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-
2.0
18 if luci.http.formvalue(
"status") ==
"1" then
20 for k, hna in ipairs(hna) do
23 destination = hna[
"destination"],
24 genmask = hna[
"genmask"],
25 gateway = hna[
"gateway"],
26 hostname = hna[
"hostname"],
27 validityTime = hna[
"validityTime"]
30 luci.http.prepare_content(
"application/json")
31 luci.http.write_json(rv)
38 <script type=
"text/javascript" src=
"<%=resource%>/cbi.js"></script>
39 <script type=
"text/javascript">//<![CDATA[
40 XHR.poll(
10, '<%=REQUEST_URI%
>', { status:
1 },
43 var hnadiv = document.getElementById('olsrd_hna');
47 for (var idx =
0; idx < info.length; idx++)
51 s += '
<tr class=
"cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-' + hna.proto + '">'
52 if (hna.proto == '
6') {
53 linkgw = '
<a href=
"http://[' + hna.gateway + ']/cgi-bin-status.html">' + hna.gateway + '
</a>'
55 linkgw = '
<a href=
"http://' + hna.gateway + '/cgi-bin-status.html">' + hna.gateway + '
</a>'
58 if (hna.validityTime != undefined) {
59 validity = hna.validityTime + 's'
64 if (hna.hostname != undefined) {
65 hostname = ' /
<a href=
"http://' + hna.hostname + '/cgi-bin-status.html">' + hna.hostname + '
</a>'
71 '
<td class=
"cbi-section-table-cell">%s
</td>' +
72 '
<td class=
"cbi-section-table-cell">%s
</td>' +
73 '
<td class=
"cbi-section-table-cell">%s
</td>', hna.destination + '/' + hna.genmask, linkgw + hostname, validity
83 <h2><a id=
"content" name=
"content"><%:Active host net announcements%
></a></h2>
85 <div id=
"togglebuttons"></div>
86 <fieldset class=
"cbi-section">
88 <legend><%:Overview of currently active OLSR host net announcements%
></legend>
89 <table class=
"cbi-section-table">
91 <tr class=
"cbi-section-table-titles">
92 <th class=
"cbi-section-table-cell"><%:Announced network%
></th>
93 <th class=
"cbi-section-table-cell"><%:OLSR gateway%
></th>
94 <th class=
"cbi-section-table-cell"><%:Validity Time%
></th>
98 <tbody id=
"olsrd_hna">
99 <% for k, route in ipairs(hna) do %
>
101 <tr class=
"cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=hna[k].proto%>">
102 <td class=
"cbi-section-table-cell"><%=hna[k].destination%
>/<%=hna[k].genmask%
> </td>
103 <td class=
"cbi-section-table-cell">
104 <% if hna[k].proto == '
6' then %
>
105 <a href=
"http://[<%=hna[k].gateway%>]/cgi-bin-status.html"><%=hna[k].gateway%
></a>
107 <a href=
"http://<%=hna[k].gateway%>/cgi-bin-status.html"><%=hna[k].gateway%
></a>
109 <% if hna[k].hostname then %
>
110 /
<a href=
"http://<%=hna[k].hostname%>/cgi-bin-status.html"><%=hna[k].hostname%
></a>
113 <% if hna[k].validityTime then
114 validity = hna[k].validityTime .. 's'
119 <td class=
"cbi-section-table-cell"><%=validity%
></td>
128 <%+status-olsr/common_js%
>