all: change most translate statements to new format, some need manual cleanup
[project/luci.git] / applications / luci-fw / luasrc / model / cbi / luci_fw / rrule.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 require("luci.sys")
15 arg[1] = arg[1] or ""
16
17 m = Map("firewall", translate("Traffic Redirection"), translate("Traffic redirection allows you to change the destination address of forwarded packets."))
18
19
20 s = m:section(NamedSection, arg[1], "redirect", "")
21 s.anonymous = true
22 s.addremove = false
23
24 back = s:option(DummyValue, "_overview", translate("Overview"))
25 back.value = ""
26 back.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "redirect")
27
28 name = s:option(Value, "_name", translate("Name"))
29 name.rmempty = true
30 name.size = 10
31
32 iface = s:option(ListValue, "src", translate("Zone"))
33 iface.default = "wan"
34 luci.model.uci.cursor():foreach("firewall", "zone",
35         function (section)
36                 iface:value(section.name)
37         end)
38         
39 s:option(Value, "src_ip", translate("Source address")).optional = true
40 s:option(Value, "src_mac", translate("Source MAC")).optional = true
41
42 sport = s:option(Value, "src_port", translate("Source port"))
43 sport.optional = true
44 sport:depends("proto", "tcp")
45 sport:depends("proto", "udp")
46 sport:depends("proto", "tcpudp")
47
48 proto = s:option(ListValue, "proto", translate("Protocol"))
49 proto.optional = true
50 proto:value("")
51 proto:value("tcp", "TCP")
52 proto:value("udp", "UDP")
53 proto:value("tcpudp", "TCP+UDP")
54
55 dport = s:option(Value, "src_dport", translate("External port"))
56 dport.size = 5
57 dport:depends("proto", "tcp")
58 dport:depends("proto", "udp")
59 dport:depends("proto", "tcpudp")
60
61 to = s:option(Value, "dest_ip", translate("Internal address"))
62 for i, dataset in ipairs(luci.sys.net.arptable()) do
63         to:value(dataset["IP address"])
64 end
65
66 toport = s:option(Value, "dest_port", translate("Internal port (optional)"))
67 toport.optional = true
68 toport.size = 5
69
70 return m