firewall_zoneforwards.htm 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <%+cbi/valueheader%>
  2. <%-
  3. local utl = require "luci.util"
  4. local fwm = require "luci.model.firewall".init()
  5. local nwm = require "luci.model.network".init()
  6. local zone, fwd, fz
  7. local value = self:formvalue(section)
  8. if not value or value == "-" then
  9. value = self:cfgvalue(section) or self.default
  10. end
  11. local def = fwm:get_defaults()
  12. local zone = fwm:get_zone(value)
  13. local empty = true
  14. -%>
  15. <% if zone then %>
  16. <div style="white-space:nowrap">
  17. <label class="zonebadge" style="background-color:<%=zone:get_color()%>">
  18. <strong><%=zone:name()%>:</strong>
  19. <%-
  20. local zempty = true
  21. for _, net in ipairs(zone:get_networks()) do
  22. net = nwm:get_network(net)
  23. if net then
  24. zempty = false
  25. -%>
  26. <span class="ifacebadge<% if net:name() == self.network then %> ifacebadge-active<% end %>"><%=net:name()%>:
  27. <%
  28. local nempty = true
  29. for _, iface in ipairs(net:is_bridge() and net:get_interfaces() or { net:get_interface() }) do
  30. nempty = false
  31. %>
  32. <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" />
  33. <% end %>
  34. <% if nempty then %><em><%:(empty)%></em><% end %>
  35. </span>
  36. <%- end end -%>
  37. <%- if zempty then %><em><%:(empty)%></em><% end -%>
  38. </label>
  39. &#160;&#8658;&#160;
  40. <% for _, fwd in ipairs(zone:get_forwardings_by("src")) do
  41. fz = fwd:dest_zone()
  42. empty = false %>
  43. <label class="zonebadge" style="background-color:<%=fz:get_color()%>">
  44. <strong><%=fz:name()%></strong>
  45. </label>&#160;
  46. <% end %>
  47. <% if empty then %>
  48. <label class="zonebadge zonebadge-empty">
  49. <strong><%=zone:forward():upper()%></strong>
  50. </label>
  51. <% end %>
  52. </div>
  53. <% end %>
  54. <%+cbi/valuefooter%>