- Timestamp:
- 10/27/09 22:42:40 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm
r5406 r5430 21 21 local zone, net, iface 22 22 local zones = fwm:get_zones() 23 local value = self:cfgvalue(section) or self.default 23 local value = self:formvalue(section) 24 if not value or value == "-" then value = self:cfgvalue(section) or self.default end 25 24 26 local selected = false 27 local checked = { } 25 28 26 if value and #value == 0 then value = nil end 29 if value and #value == 0 then 30 value = nil 31 elseif type(value) == "table" then 32 for _, value in ipairs(value) do 33 checked[value] = true 34 end 35 elseif value then 36 checked[value] = true 37 end 27 38 -%> 28 39 29 <ul style="margin:0; list-style-type:none ">40 <ul style="margin:0; list-style-type:none; text-align:left"> 30 41 <% 31 42 for _, zone in utl.spairs(zones, function(a,b) return (zones[a]:name() < zones[b]:name()) end) do 32 selected = selected or (value == zone:name()) 43 if zone:name() ~= self.exclude then 44 selected = selected or (value == zone:name()) 33 45 %> 34 46 <li style="padding:0.5em"> 35 <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")%> /> 47 <input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "." .. zone:name()) .. attr("name", cbid) .. attr("value", zone:name()) .. ifattr(checked[zone:name()], "checked", "checked")%> /> 36 48 <label<%=attr("for", cbid .. "." .. zone:name())%> style="background-color:<%=zone:get_color()%>; padding:0.5em"> 37 49 <strong><%=zone:name()%>:</strong> … … 40 52 for _, net in ipairs(zone:get_networks()) do 41 53 net = nwm:get_network(net) 54 if net then 55 %> 56 57 <%- if net:name() == self.network then -%> 58 <span style="background-color:#FFFFFF; border:1px solid #000000; padding:2px; font-weight:bold"><%=net:name()%>: 59 <%- else -%> 60 <span style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:2px"><%=net:name()%>: 61 <%- end -%> 62 <% 42 63 for _, iface in ipairs(net and net:get_interfaces() or {}) do 43 64 if not iface:is_bridgeport() then 44 65 empty = false 45 %> 46 <img title="<%=iface:get_type_i18n()%>" style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" /> 47 <% if iface:name() == self.iface then %><strong><%=iface:shortname()%></strong><% else %><%=iface:shortname()%><% end %> 48 <% end end end %> 66 %> 67 <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" /> 68 <% end end %> 69 </span> 70 <% end end %> 49 71 <% if empty then %><em><%:a_s_ipt_zone_empty (no interfaces attached)%></em><% end %> 50 72 </label> 51 73 </li> 52 <% end %>74 <% end end %> 53 75 54 <% if not self.nocreate then %>76 <% if self.widget ~= "checkbox" and not self.nocreate then %> 55 77 <li style="padding:0.5em"> 56 78 <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 selected, "checked", "checked")%> />
