applications/luci-olsr: Fix rowstyle, make html valid
This commit is contained in:
parent
2392f40cd2
commit
32be6cea93
7 changed files with 32 additions and 34 deletions
|
@ -41,7 +41,7 @@ local i = 1
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% if i == 1 then i = 0 elseif i == 0 then i = 1 end
|
<% i = ((i % 2) + 1)
|
||||||
end %>
|
end %>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -47,7 +47,7 @@ local i = 1
|
||||||
<td class="cbi-section-table-cell"><%=iface.Mask%></td>
|
<td class="cbi-section-table-cell"><%=iface.Mask%></td>
|
||||||
<td class="cbi-section-table-cell"><%=iface["Dst-Adress"]%></td>
|
<td class="cbi-section-table-cell"><%=iface["Dst-Adress"]%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% if i == 1 then i = 0 elseif i == 0 then i = 1 end
|
<% i = ((i % 2) + 1)
|
||||||
end %>
|
end %>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -35,7 +35,7 @@ local i = 1
|
||||||
<td class="cbi-section-table-cell"><%=mid.Aliases%></td>
|
<td class="cbi-section-table-cell"><%=mid.Aliases%></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% if i == 1 then i = 0 elseif i == 0 then i = 1 end
|
<% i = ((i % 2) + 1)
|
||||||
end %>
|
end %>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -14,11 +14,10 @@ You may obtain a copy of the License at
|
||||||
|
|
||||||
<%
|
<%
|
||||||
local olsrtools = require "luci.tools.olsr"
|
local olsrtools = require "luci.tools.olsr"
|
||||||
|
local i = 1
|
||||||
|
|
||||||
if luci.http.formvalue("status") == "1" then
|
if luci.http.formvalue("status") == "1" then
|
||||||
local rv = {}
|
local rv = {}
|
||||||
local i = 1
|
|
||||||
|
|
||||||
for k, link in ipairs(links) do
|
for k, link in ipairs(links) do
|
||||||
link.Cost = tonumber(link.Cost) or 0
|
link.Cost = tonumber(link.Cost) or 0
|
||||||
local color = olsrtools.etx_color(link.Cost)
|
local color = olsrtools.etx_color(link.Cost)
|
||||||
|
@ -36,10 +35,8 @@ if luci.http.formvalue("status") == "1" then
|
||||||
nlq = link.NLQ,
|
nlq = link.NLQ,
|
||||||
cost = string.format("%.3f", link.Cost),
|
cost = string.format("%.3f", link.Cost),
|
||||||
color = color,
|
color = color,
|
||||||
rs = i,
|
|
||||||
dfgcolor = defaultgw_color
|
dfgcolor = defaultgw_color
|
||||||
}
|
}
|
||||||
if i == 1 then i = 0 elseif i == 0 then i = 1 end
|
|
||||||
end
|
end
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(rv)
|
luci.http.write_json(rv)
|
||||||
|
@ -64,9 +61,9 @@ end
|
||||||
var neigh = info[idx];
|
var neigh = info[idx];
|
||||||
|
|
||||||
s += String.format(
|
s += String.format(
|
||||||
'<tr class="cbi-section-table-row cbi-rowstyle-%s">' +
|
'<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+'">' +
|
||||||
'<td class="cbi-section-table-cell" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></td>',
|
'<td class="cbi-section-table-cell" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></td>',
|
||||||
neigh.rs, neigh.dfgcolor, neigh.rip, neigh.rip
|
neigh.dfgcolor, neigh.rip, neigh.rip
|
||||||
);
|
);
|
||||||
if (neigh.hn) {
|
if (neigh.hn) {
|
||||||
s += String.format(
|
s += String.format(
|
||||||
|
@ -105,6 +102,7 @@ end
|
||||||
<legend><%:Overview of currently established OLSR connections%></legend>
|
<legend><%:Overview of currently established OLSR connections%></legend>
|
||||||
|
|
||||||
<table class="cbi-section-table">
|
<table class="cbi-section-table">
|
||||||
|
<thead>
|
||||||
<tr class="cbi-section-table-titles">
|
<tr class="cbi-section-table-titles">
|
||||||
<th class="cbi-section-table-cell"><%:Neighbour IP%></th>
|
<th class="cbi-section-table-cell"><%:Neighbour IP%></th>
|
||||||
<th class="cbi-section-table-cell"><%:Hostname%></th>
|
<th class="cbi-section-table-cell"><%:Hostname%></th>
|
||||||
|
@ -114,7 +112,7 @@ end
|
||||||
<th class="cbi-section-table-cell">NLQ</th>
|
<th class="cbi-section-table-cell">NLQ</th>
|
||||||
<th class="cbi-section-table-cell">ETX</th>
|
<th class="cbi-section-table-cell">ETX</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
<tbody id="olsr_neigh_table">
|
<tbody id="olsr_neigh_table">
|
||||||
<% local i = 1
|
<% local i = 1
|
||||||
|
@ -138,7 +136,7 @@ end
|
||||||
<td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=string.format("%.3f", link.Cost)%></td>
|
<td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=string.format("%.3f", link.Cost)%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
if i == 1 then i = 0 elseif i == 0 then i = 1 end
|
i = ((i % 2) + 1)
|
||||||
end %>
|
end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -27,9 +27,7 @@ if luci.http.formvalue("status") == "1" then
|
||||||
metric = route.Metric,
|
metric = route.Metric,
|
||||||
etx = tonumber(route.ETX),
|
etx = tonumber(route.ETX),
|
||||||
color = olsrtools.etx_color(tonumber(route.ETX)),
|
color = olsrtools.etx_color(tonumber(route.ETX)),
|
||||||
rs = i
|
|
||||||
}
|
}
|
||||||
if i == 1 then i = 0 elseif i == 0 then i = 1 end
|
|
||||||
end
|
end
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(rv)
|
luci.http.write_json(rv)
|
||||||
|
@ -56,11 +54,11 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
|
||||||
var route = info[idx];
|
var route = info[idx];
|
||||||
|
|
||||||
s += String.format(
|
s += String.format(
|
||||||
'<tr class="cbi-section-table-row cbi-rowstyle-%s">' +
|
'<tr class="cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+'">' +
|
||||||
'<td class="cbi-section-table-cell">%s</td>' +
|
'<td class="cbi-section-table-cell">%s</td>' +
|
||||||
'<td class="cbi-section-table-cell">' +
|
'<td class="cbi-section-table-cell">' +
|
||||||
'<a href="http://%s/cgi-bin-status.html">%s</a>',
|
'<a href="http://%s/cgi-bin-status.html">%s</a>',
|
||||||
route.rs, route.dest, route.gw, route.gw
|
route.dest, route.gw, route.gw
|
||||||
)
|
)
|
||||||
|
|
||||||
if (route.hostname)
|
if (route.hostname)
|
||||||
|
@ -94,6 +92,7 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
|
||||||
<legend><%:Overview of currently known routes to other OLSR nodes%></legend>
|
<legend><%:Overview of currently known routes to other OLSR nodes%></legend>
|
||||||
|
|
||||||
<table class="cbi-section-table">
|
<table class="cbi-section-table">
|
||||||
|
<thead>
|
||||||
<tr class="cbi-section-table-titles">
|
<tr class="cbi-section-table-titles">
|
||||||
<th class="cbi-section-table-cell"><%:Announced network%></th>
|
<th class="cbi-section-table-cell"><%:Announced network%></th>
|
||||||
<th class="cbi-section-table-cell"><%:OLSR gateway%></th>
|
<th class="cbi-section-table-cell"><%:OLSR gateway%></th>
|
||||||
|
@ -101,6 +100,7 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
|
||||||
<th class="cbi-section-table-cell"><%:Metric%></th>
|
<th class="cbi-section-table-cell"><%:Metric%></th>
|
||||||
<th class="cbi-section-table-cell">ETX</th>
|
<th class="cbi-section-table-cell">ETX</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
<tbody id="olsrd_routes">
|
<tbody id="olsrd_routes">
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
|
||||||
<td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=string.format("%.3f", tonumber(route.ETX) or 0)%></td>
|
<td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=string.format("%.3f", tonumber(route.ETX) or 0)%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
if i == 1 then i = 0 elseif i == 0 then i = 1 end
|
i = ((i % 2) + 1)
|
||||||
end %>
|
end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -57,7 +57,7 @@ end)
|
||||||
<td class="cbi-section-table-cell"><%=gw.Prefix%></td>
|
<td class="cbi-section-table-cell"><%=gw.Prefix%></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% if i == 1 then i = 0 elseif i == 0 then i = 1 end
|
<% i = ((i % 2) + 1)
|
||||||
end %>
|
end %>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -45,7 +45,7 @@ local olsrtools = require "luci.tools.olsr"
|
||||||
<td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=cost%></td>
|
<td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=cost%></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% if i == 1 then i = 0 elseif i == 0 then i = 1 end
|
<% i = ((i % 2) + 1)
|
||||||
end %>
|
end %>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
Loading…
Reference in a new issue