all: various i18n realted fixes
[project/luci.git] / applications / luci-fw / luasrc / model / cbi / luci_fw / zones.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14
15 local nw = require "luci.model.network"
16 local fw = require "luci.model.firewall"
17
18 require("luci.tools.webadmin")
19 m = Map("firewall", translate("Firewall"), translate("The firewall creates zones over your network interfaces to control network traffic flow."))
20
21 fw.init(m.uci)
22 nw.init(m.uci)
23
24 s = m:section(TypedSection, "defaults")
25 s.anonymous = true
26
27 s:option(Flag, "syn_flood")
28
29 local di = s:option(Flag, "drop_invalid", translate("Drop invalid packets"))
30 di.rmempty = false
31 function di.cfgvalue(...)
32         return AbstractValue.cfgvalue(...) or "1"
33 end
34
35 p = {}
36 p[1] = s:option(ListValue, "input")
37 p[2] = s:option(ListValue, "output")
38 p[3] = s:option(ListValue, "forward")
39
40 for i, v in ipairs(p) do
41         v:value("REJECT", translate("reject"))
42         v:value("DROP", translate("drop"))
43         v:value("ACCEPT", translate("accept"))
44 end
45
46
47 s = m:section(TypedSection, "zone", translate("Zones"))
48 s.template = "cbi/tblsection"
49 s.anonymous = true
50 s.addremove = true
51
52 name = s:option(Value, "name", translate("Name"))
53 name.size = 8
54
55 p = {}
56 p[1] = s:option(ListValue, "input")
57 p[2] = s:option(ListValue, "output")
58 p[3] = s:option(ListValue, "forward")
59
60 for i, v in ipairs(p) do
61         v:value("REJECT", translate("reject"))
62         v:value("DROP", translate("drop"))
63         v:value("ACCEPT", translate("accept"))
64 end
65
66 s:option(Flag, "masq")
67
68 net = s:option(MultiValue, "network")
69 net.template = "cbi/network_netlist"
70 net.widget = "checkbox"
71 net.rmempty = true
72 luci.tools.webadmin.cbi_add_networks(net)
73
74 function net.cfgvalue(self, section)
75         local value = MultiValue.cfgvalue(self, section)
76         return value or name:cfgvalue(section)
77 end
78
79 return m