libs/web: fix another invalid entity
[project/luci.git] / libs / web / luasrc / view / cbi / firewall_zoneforwards.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2009 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: firewall_zonelist.htm 5651 2009-12-26 00:09:47Z jow $
12
13 -%>
14
15 <%+cbi/valueheader%>
16
17 <%-
18 local utl = require "luci.util"
19 local fwm = require "luci.model.firewall".init()
20 local nwm = require "luci.model.network".init()
21
22 local zone, fwd, fz
23 local value = self:formvalue(section)
24 if not value or value == "-" then
25 value = self:cfgvalue(section) or self.default
26 end
27
28 local def = fwm:get_defaults()
29 local zone = fwm:get_zone(value)
30 local empty = true
31 -%>
32
33 <% if zone then %>
34 <div style="padding:0.5em">
35 <label style="background-color:<%=zone:get_color()%>; padding:0.4em">
36 <strong><%=zone:name()%>:</strong>
37 <%
38 local zempty = true
39 for _, net in ipairs(zone:get_networks()) do
40 net = nwm:get_network(net)
41 if net then
42 zempty = false
43 %>
44 &#160;
45 <%- if net:name() == self.network then -%>
46 <span style="background-color:#FFFFFF; border:1px solid #000000; padding:2px; font-weight:bold"><%=net:name()%>:
47 <%- else -%>
48 <span style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:2px"><%=net:name()%>:
49 <%- end -%>
50 <%
51 local nempty = true
52 for _, iface in ipairs(net and net:get_interfaces() or {}) do
53 nempty = false
54 %>
55 <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" />
56 <% end %>
57 <% if nempty then %><em><%:(empty)%></em><% end %>
58 </span>
59 <% end end %>
60 <% if zempty then %><em><%:(empty)%></em><% end %>
61 </label>
62 &#160;&#8658;&#160;
63 <% for _, fwd in ipairs(zone:get_forwardings_by("src")) do
64 fz = fwd:dest_zone()
65 empty = false %>
66 <label style="background-color:<%=fz:get_color()%>; padding:0.4em">
67 <strong><%=fz:name()%></strong>
68 </label>&#160;
69 <% end %>
70 <% if empty then %>
71 <label style="border:1px dashed #AAAAAA; color:#AAAAAA; padding:0.3em">
72 <strong><small><em><%=zone:forward():upper()%></em></small></strong>
73 </label>
74 <% end %>
75 </div>
76 <% end %>
77
78 <%+cbi/valuefooter%>