all: change most translate statements to new format, some need manual cleanup
[project/luci.git] / modules / admin-full / luasrc / view / admin_status / routes.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008-2009 Steven Barth <steven@midlink.org>
4 Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 -%>
15
16 <%-
17 require "bit"
18 require "luci.sys"
19 require "luci.tools.webadmin"
20 require "nixio.fs"
21
22 local style = true
23 -%>
24
25 <%+header%>
26
27 <div class="cbi-map" id="cbi-network">
28 <h2><a id="content" name="content"><%:Routes%></a></h2>
29 <div class="cbi-map-descr"><%:a_n_routes1%></div>
30
31 <fieldset class="cbi-section" id="cbi-table-table">
32 <legend><%:Active <abbr title="Internet Protocol Version 4">IPv4</abbr>-Routes%></legend>
33
34 <div class="cbi-section-node">
35 <table class="cbi-section-table">
36 <tr class="cbi-section-table-titles">
37 <th class="cbi-section-table-cell"><%:Network%></th>
38 <th class="cbi-section-table-cell"><%:Target%></th>
39 <th class="cbi-section-table-cell"><%:<abbr title="Internet Protocol Version 4">IPv4</abbr>-Netmask%></th>
40 <th class="cbi-section-table-cell"><%:<abbr title="Internet Protocol Version 4">IPv4</abbr>-Gateway%></th>
41 <th class="cbi-section-table-cell"><%:Metric%></th>
42 </tr>
43 <% luci.sys.net.routes(function(rt) %>
44 <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
45 <td class="cbi-value-field"><%=luci.tools.webadmin.iface_get_network(rt.device) or rt.device%></td>
46 <td class="cbi-value-field"><%=rt.dest:network():string()%></td>
47 <td class="cbi-value-field"><%=rt.dest:mask():string()%></td>
48 <td class="cbi-value-field"><%=rt.gateway:string()%></td>
49 <td class="cbi-value-field"><%=rt.metric%></td>
50 </tr>
51 <% style = not style; end) %>
52 </table>
53 </div>
54 </fieldset>
55 <br />
56
57 <% if nixio.fs.access("/proc/net/ipv6_route") then style = true %>
58 <fieldset class="cbi-section" id="cbi-table-table">
59 <legend><%:Active <abbr title="Internet Protocol Version 6">IPv6</abbr>-Routes%></legend>
60
61 <div class="cbi-section-node">
62 <table class="cbi-section-table">
63 <tr class="cbi-section-table-titles">
64 <th class="cbi-section-table-cell"><%:Network%></th>
65 <th class="cbi-section-table-cell"><%:Target%></th>
66 <th class="cbi-section-table-cell"><%:<abbr title="Internet Protocol Version 6">IPv6</abbr>-Gateway%></th>
67 <th class="cbi-section-table-cell"><%:Metric%></th>
68 </tr>
69 <% luci.sys.net.routes6(function(rt) %>
70 <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
71 <td class="cbi-value-field"><%=luci.tools.webadmin.iface_get_network(rt.device) or rt.device%></td>
72 <td class="cbi-value-field"><%=rt.dest:string()%></td>
73 <td class="cbi-value-field"><%=rt.source:string()%></td>
74 <td class="cbi-value-field"><%-
75 local metr = rt.metric
76 local lower = bit.band(metr, 0xffff)
77 local higher = bit.rshift(bit.band(metr, 0xffff0000), 16)
78 write(string.format("%04X%04X", higher, lower))
79 -%></td>
80 </tr>
81 <% style = not style; end) %>
82 </table>
83 </div>
84 </fieldset>
85 <br />
86 <% end %>
87 </div>
88
89 <%+footer%>