root/luci/trunk/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm @ 5369

Revision 5369, 2.6 KB (checked in by jow, 4 years ago)

libs/cbi: i18n for zone picker

  • Property svn:keywords set to Id
Line 
1<%#
2LuCI - Lua Configuration Interface
3Copyright 2009 Jo-Philipp Wich <xm@subsignal.org>
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You 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 utl = require "luci.util"
18    local wba = require "luci.tools.webadmin"
19    local wbi = require "luci.tools.webadmin_interfaces"
20    local fwm = require "luci.model.firewall"
21
22    wbi.init(self.map.uci)
23
24    local zone, iface, ifname
25    local zones = fwm.get_zones()
26    local value = self:cfgvalue(section) or self.default
27
28    if value and #value == 0 then value = nil end
29-%>
30
31<ul style="margin:0; list-style-type:none">
32    <% for _, zone in utl.spairs(zones, function(a,b) return (zones[a]:name() < zones[b]:name()) end) do %>
33    <li style="padding:0.5em">
34        <input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)" type="radio"<%=attr("id", cbid .. "." .. zone:name()) .. attr("name", cbid) .. attr("value", zone:name()) .. ifattr(value == zone:name(), "checked", "checked")%> /> &nbsp;
35        <label<%=attr("for", cbid .. "." .. zone:name())%> style="background-color:<%=zone:get_color()%>; padding:0.5em">
36            <strong><%=zone:name()%>:</strong>
37            <%
38                local empty = true
39                for _, iface in ipairs(zone:get_networks()) do
40                    local ifname = wbi.network_get_ifname(iface)
41                    local dev    = wbi.iface_get_list()[ifname]
42             %>
43                <% if ifname and dev then empty = false %>
44                    <img title="<%=wbi.iface_format_type(dev.type)%>" style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=dev.type or "ethernet"%><%=dev.flags and dev.flags.up and "" or "_disabled"%>.png" />
45                    <% if iface == self.iface then %><strong><%=ifname%></strong><% else %><%=ifname%><% end %> &nbsp;
46                <% end %>
47            <% end %>
48            <% if empty then %><em><%:a_s_ipt_zone_empty (no interfaces attached)%></em><% end %>
49        </label>
50    </li>
51    <% end %>
52
53    <li style="padding:0.5em">
54        <input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)" type="radio"<%=attr("id", cbid .. "_new") .. attr("name", cbid) .. attr("value", "-") .. ifattr(not value, "checked", "checked")%> /> &nbsp;
55        <div style="background-color:<%=fwm.zone.get_color()%>; padding:0.5em; display:inline">
56            <label<%=attr("for", cbid .. "_new")%>><em><%:a_s_ipt_zone_unspec_create unspecified -or- create:%>&nbsp;</em></label>
57            <input style="width:6em" type="text"<%=attr("name", cbid .. ".newzone")%> />
58        </div>
59    </li>
60</ul>
61
62<%+cbi/valuefooter%>
Note: See TracBrowser for help on using the browser.