all: change most translate statements to new format, some need manual cleanup
[project/luci.git] / applications / luci-fw / luasrc / model / cbi / luci_fw / trule.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 arg[1] = arg[1] or ""
15 m = Map("firewall", translate("Advanced Rules"), translate("Advanced rules let you customize the firewall to your needs. Only new connections will be matched. Packets belonging to already open connections are automatically allowed to pass the firewall."))
16
17 s = m:section(NamedSection, arg[1], "rule", "")
18 s.anonymous = true
19 s.addremove = false
20
21 back = s:option(DummyValue, "_overview", translate("Overview"))
22 back.value = ""
23 back.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "rule")
24
25
26 name = s:option(Value, "_name", translate("Name")..translate(" (optional)"))
27 name.rmempty = true
28
29 iface = s:option(ListValue, "src", translate("Source"))
30 iface.rmempty = true
31
32 oface = s:option(ListValue, "dest", translate("Destination"))
33 oface:value("", translate("Device"))
34 oface.rmempty = true
35
36 luci.model.uci.cursor():foreach("firewall", "zone",
37         function (section)
38                 iface:value(section.name)
39                 oface:value(section.name)
40         end)
41
42 proto = s:option(Value, "proto", translate("Protocol"))
43 proto.optional = true
44 proto:value("")
45 proto:value("tcpudp", "TCP+UDP")
46 proto:value("tcp", "TCP")
47 proto:value("udp", "UDP")
48 proto:value("icmp", "ICMP")
49
50 s:option(Value, "src_ip", translate("Source address")).optional = true
51 s:option(Value, "dest_ip", translate("Destination address")).optional = true
52 s:option(Value, "src_mac", translate("Source MAC-Address")).optional = true
53
54 sport = s:option(Value, "src_port", translate("Source port"))
55 sport:depends("proto", "tcp")
56 sport:depends("proto", "udp")
57 sport:depends("proto", "tcpudp")
58
59 dport = s:option(Value, "dest_port", translate("Destination port"))
60 dport:depends("proto", "tcp")
61 dport:depends("proto", "udp")
62 dport:depends("proto", "tcpudp")
63
64 jump = s:option(ListValue, "target", translate("Action"))
65 jump.rmempty = true
66 jump.default = "ACCEPT"
67 jump:value("DROP", translate("drop"))
68 jump:value("ACCEPT", translate("accept"))
69 jump:value("REJECT", translate("reject"))
70
71
72 return m