libs/web: move XHR apply callback into subtemplate
[project/luci.git] / applications / luci-fw / luasrc / model / cbi / luci_fw / miniportfw.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 m = Map("firewall", translate("Port forwarding"),
16         translate("Port forwarding allows to provide network services in " ..
17                 "the internal network to an external network."))
18
19
20 s = m:section(TypedSection, "redirect", "")
21 s:depends("src", "wan")
22 s.defaults.src = "wan"
23
24 s.template  = "cbi/tblsection"
25 s.addremove = true
26 s.anonymous = true
27
28 name = s:option(Value, "_name", translate("Name"), translate("(optional)"))
29 name.size = 10
30
31 proto = s:option(ListValue, "proto", translate("Protocol"))
32 proto:value("tcp", "TCP")
33 proto:value("udp", "UDP")
34 proto:value("tcpudp", "TCP+UDP")
35
36 dport = s:option(Value, "src_dport", translate("External port"))
37 dport.size = 5
38
39 to = s:option(Value, "dest_ip", translate("Internal IP address"))
40 for i, dataset in ipairs(luci.sys.net.arptable()) do
41         to:value(dataset["IP address"])
42 end
43
44 toport = s:option(Value, "dest_port", translate("Internal port"),
45         translate("(optional)"))
46 toport.size = 5
47
48 return m