libs/web: add network_netinfo widget
[project/luci.git] / libs / web / luasrc / view / cbi / network_netinfo.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9         http://www.apache.org/licenses/LICENSE-2.0
10
11 $Id$
12 -%>
13
14 <%+cbi/valueheader%>
15
16 <%-
17         local value = self:formvalue(section)
18         if not value or value == "-" then
19                 value = self:cfgvalue(section) or self.default
20         end
21
22         local nwm = require "luci.model.network".init()
23         local net = nwm:get_network(value)
24 -%>
25
26 <% if net then %>
27 <div style="padding:0.5em">
28         <span style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:2px"><%=net:name()%>:
29                 <%
30                         local empty = true
31                         for _, iface in ipairs(net:get_interfaces()) do
32                                 if not iface:is_bridge() then
33                                         empty = false
34                  %>
35                         <img<%=attr("title", iface:get_i18n())%> style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" />
36                 <% end end %>
37                 <% if empty then %><em><%:(no interfaces attached)%></em><% end %>
38         </span>
39 </div>
40 <% end %>
41
42 <%+cbi/valuefooter%>