From 32be6cea9305168b303d1e54ec3e658826725ef2 Mon Sep 17 00:00:00 2001 From: Manuel Munz Date: Sun, 13 Nov 2011 12:34:09 +0000 Subject: [PATCH] applications/luci-olsr: Fix rowstyle, make html valid --- .../luci-olsr/luasrc/view/status-olsr/hna.htm | 2 +- .../luasrc/view/status-olsr/interfaces.htm | 2 +- .../luci-olsr/luasrc/view/status-olsr/mid.htm | 2 +- .../luasrc/view/status-olsr/neighbors.htm | 32 ++++++++++------------ .../luci-olsr/luasrc/view/status-olsr/routes.htm | 24 ++++++++-------- .../luci-olsr/luasrc/view/status-olsr/smartgw.htm | 2 +- .../luci-olsr/luasrc/view/status-olsr/topology.htm | 2 +- 7 files changed, 32 insertions(+), 34 deletions(-) diff --git a/applications/luci-olsr/luasrc/view/status-olsr/hna.htm b/applications/luci-olsr/luasrc/view/status-olsr/hna.htm index 9e29edf64..bde1f009b 100644 --- a/applications/luci-olsr/luasrc/view/status-olsr/hna.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/hna.htm @@ -41,7 +41,7 @@ local i = 1 - <% if i == 1 then i = 0 elseif i == 0 then i = 1 end + <% i = ((i % 2) + 1) end %> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/interfaces.htm b/applications/luci-olsr/luasrc/view/status-olsr/interfaces.htm index 2d3ff876a..17090ff4a 100644 --- a/applications/luci-olsr/luasrc/view/status-olsr/interfaces.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/interfaces.htm @@ -47,7 +47,7 @@ local i = 1 <%=iface.Mask%> <%=iface["Dst-Adress"]%> - <% if i == 1 then i = 0 elseif i == 0 then i = 1 end + <% i = ((i % 2) + 1) end %> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/mid.htm b/applications/luci-olsr/luasrc/view/status-olsr/mid.htm index 1af864d85..48823b5bc 100644 --- a/applications/luci-olsr/luasrc/view/status-olsr/mid.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/mid.htm @@ -35,7 +35,7 @@ local i = 1 <%=mid.Aliases%> - <% if i == 1 then i = 0 elseif i == 0 then i = 1 end + <% i = ((i % 2) + 1) end %> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm b/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm index 4eff933c9..029f58547 100644 --- a/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm @@ -14,11 +14,10 @@ You may obtain a copy of the License at <% local olsrtools = require "luci.tools.olsr" +local i = 1 if luci.http.formvalue("status") == "1" then local rv = {} - local i = 1 - for k, link in ipairs(links) do link.Cost = tonumber(link.Cost) or 0 local color = olsrtools.etx_color(link.Cost) @@ -36,10 +35,8 @@ if luci.http.formvalue("status") == "1" then nlq = link.NLQ, cost = string.format("%.3f", link.Cost), color = color, - rs = i, dfgcolor = defaultgw_color } - if i == 1 then i = 0 elseif i == 0 then i = 1 end end luci.http.prepare_content("application/json") luci.http.write_json(rv) @@ -64,9 +61,9 @@ end var neigh = info[idx]; s += String.format( - '' + + '' + '%s', - neigh.rs, neigh.dfgcolor, neigh.rip, neigh.rip + neigh.dfgcolor, neigh.rip, neigh.rip ); if (neigh.hn) { s += String.format( @@ -105,16 +102,17 @@ end <%:Overview of currently established OLSR connections%> - - - - - - - - - - + + + + + + + + + + + <% local i = 1 @@ -138,7 +136,7 @@ end <% - if i == 1 then i = 0 elseif i == 0 then i = 1 end + i = ((i % 2) + 1) end %>
<%:Neighbour IP%><%:Hostname%><%:Local interface IP%><%:Device%>LQNLQETX
<%:Neighbour IP%><%:Hostname%><%:Local interface IP%><%:Device%>LQNLQETX
<%=string.format("%.3f", link.Cost)%>
diff --git a/applications/luci-olsr/luasrc/view/status-olsr/routes.htm b/applications/luci-olsr/luasrc/view/status-olsr/routes.htm index 5281f7083..e32b696d5 100644 --- a/applications/luci-olsr/luasrc/view/status-olsr/routes.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/routes.htm @@ -27,9 +27,7 @@ if luci.http.formvalue("status") == "1" then metric = route.Metric, etx = 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 luci.http.prepare_content("application/json") luci.http.write_json(rv) @@ -56,11 +54,11 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 }, var route = info[idx]; s += String.format( - '' + + '' + '%s' + '' + '%s', - route.rs, route.dest, route.gw, route.gw + route.dest, route.gw, route.gw ) if (route.hostname) @@ -94,13 +92,15 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 }, <%:Overview of currently known routes to other OLSR nodes%> - - - - - - - + + + + + + + + + @@ -121,7 +121,7 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 }, <% - if i == 1 then i = 0 elseif i == 0 then i = 1 end + i = ((i % 2) + 1) end %>
<%:Announced network%><%:OLSR gateway%><%:Interface%><%:Metric%>ETX
<%:Announced network%><%:OLSR gateway%><%:Interface%><%:Metric%>ETX
<%=string.format("%.3f", tonumber(route.ETX) or 0)%>
diff --git a/applications/luci-olsr/luasrc/view/status-olsr/smartgw.htm b/applications/luci-olsr/luasrc/view/status-olsr/smartgw.htm index 60f43b7f8..7fa873042 100644 --- a/applications/luci-olsr/luasrc/view/status-olsr/smartgw.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/smartgw.htm @@ -57,7 +57,7 @@ end) <%=gw.Prefix%> - <% if i == 1 then i = 0 elseif i == 0 then i = 1 end + <% i = ((i % 2) + 1) end %> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/topology.htm b/applications/luci-olsr/luasrc/view/status-olsr/topology.htm index b4221bb80..d0e85280e 100644 --- a/applications/luci-olsr/luasrc/view/status-olsr/topology.htm +++ b/applications/luci-olsr/luasrc/view/status-olsr/topology.htm @@ -45,7 +45,7 @@ local olsrtools = require "luci.tools.olsr" <%=cost%> - <% if i == 1 then i = 0 elseif i == 0 then i = 1 end + <% i = ((i % 2) + 1) end %> -- 2.11.0