diff options
author | Manuel Munz <freifunk@somakoma.de> | 2011-11-13 12:34:09 +0000 |
---|---|---|
committer | Manuel Munz <freifunk@somakoma.de> | 2011-11-13 12:34:09 +0000 |
commit | 32be6cea9305168b303d1e54ec3e658826725ef2 (patch) | |
tree | 9f6a62c55adb2570924657a5a4b4327b29518a94 /applications/luci-olsr/luasrc | |
parent | 2392f40cd2147c2e5d2cf192a6bb4dbac067745f (diff) |
applications/luci-olsr: Fix rowstyle, make html valid
Diffstat (limited to 'applications/luci-olsr/luasrc')
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 9e29edf64f..bde1f009b5 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 </td> </tr> - <% if i == 1 then i = 0 elseif i == 0 then i = 1 end + <% i = ((i % 2) + 1) end %> </table> </fieldset> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/interfaces.htm b/applications/luci-olsr/luasrc/view/status-olsr/interfaces.htm index 2d3ff876ab..17090ff4aa 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 <td class="cbi-section-table-cell"><%=iface.Mask%></td> <td class="cbi-section-table-cell"><%=iface["Dst-Adress"]%></td> </tr> - <% if i == 1 then i = 0 elseif i == 0 then i = 1 end + <% i = ((i % 2) + 1) end %> </table> </fieldset> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/mid.htm b/applications/luci-olsr/luasrc/view/status-olsr/mid.htm index 1af864d852..48823b5bc1 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 <td class="cbi-section-table-cell"><%=mid.Aliases%></td> </tr> - <% if i == 1 then i = 0 elseif i == 0 then i = 1 end + <% i = ((i % 2) + 1) end %> </table> </fieldset> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm b/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm index 4eff933c94..029f585473 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( - '<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>', - 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 <legend><%:Overview of currently established OLSR connections%></legend> <table class="cbi-section-table"> - <tr class="cbi-section-table-titles"> - <th class="cbi-section-table-cell"><%:Neighbour IP%></th> - <th class="cbi-section-table-cell"><%:Hostname%></th> - <th class="cbi-section-table-cell"><%:Local interface IP%></th> - <th class="cbi-section-table-cell"><%:Device%></th> - <th class="cbi-section-table-cell">LQ</th> - <th class="cbi-section-table-cell">NLQ</th> - <th class="cbi-section-table-cell">ETX</th> - </tr> - + <thead> + <tr class="cbi-section-table-titles"> + <th class="cbi-section-table-cell"><%:Neighbour IP%></th> + <th class="cbi-section-table-cell"><%:Hostname%></th> + <th class="cbi-section-table-cell"><%:Local interface IP%></th> + <th class="cbi-section-table-cell"><%:Device%></th> + <th class="cbi-section-table-cell">LQ</th> + <th class="cbi-section-table-cell">NLQ</th> + <th class="cbi-section-table-cell">ETX</th> + </tr> + </thead> <tbody id="olsr_neigh_table"> <% local i = 1 @@ -138,7 +136,7 @@ end <td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=string.format("%.3f", link.Cost)%></td> </tr> <% - if i == 1 then i = 0 elseif i == 0 then i = 1 end + i = ((i % 2) + 1) end %> </tbody> </table> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/routes.htm b/applications/luci-olsr/luasrc/view/status-olsr/routes.htm index 5281f70834..e32b696d58 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( - '<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">' + '<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) @@ -94,13 +92,15 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 }, <legend><%:Overview of currently known routes to other OLSR nodes%></legend> <table class="cbi-section-table"> - <tr class="cbi-section-table-titles"> - <th class="cbi-section-table-cell"><%:Announced network%></th> - <th class="cbi-section-table-cell"><%:OLSR gateway%></th> - <th class="cbi-section-table-cell"><%:Interface%></th> - <th class="cbi-section-table-cell"><%:Metric%></th> - <th class="cbi-section-table-cell">ETX</th> - </tr> + <thead> + <tr class="cbi-section-table-titles"> + <th class="cbi-section-table-cell"><%:Announced network%></th> + <th class="cbi-section-table-cell"><%:OLSR gateway%></th> + <th class="cbi-section-table-cell"><%:Interface%></th> + <th class="cbi-section-table-cell"><%:Metric%></th> + <th class="cbi-section-table-cell">ETX</th> + </tr> + </thead> <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> </tr> <% - if i == 1 then i = 0 elseif i == 0 then i = 1 end + i = ((i % 2) + 1) end %> </tbody> </table> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/smartgw.htm b/applications/luci-olsr/luasrc/view/status-olsr/smartgw.htm index 60f43b7f86..7fa8730423 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) <td class="cbi-section-table-cell"><%=gw.Prefix%></td> </tr> - <% if i == 1 then i = 0 elseif i == 0 then i = 1 end + <% i = ((i % 2) + 1) end %> </table> </fieldset> diff --git a/applications/luci-olsr/luasrc/view/status-olsr/topology.htm b/applications/luci-olsr/luasrc/view/status-olsr/topology.htm index b4221bb80d..d0e85280e2 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" <td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=cost%></td> </tr> - <% if i == 1 then i = 0 elseif i == 0 then i = 1 end + <% i = ((i % 2) + 1) end %> </table> </fieldset> |