Globally reduce copyright headers
[project/luci.git] / applications / luci-app-splash / luasrc / model / cbi / splash / splash.lua
1 -- Licensed to the public under the Apache License 2.0.
2
3 require("luci.model.uci")
4
5 m = Map("luci_splash", translate("Client-Splash"), translate("Client-Splash is a hotspot authentification system for wireless mesh networks."))
6
7 s = m:section(NamedSection, "general", "core", translate("General"))
8 s.addremove = false
9
10 s:option(Value, "leasetime", translate("Clearance time"), translate("Clients that have accepted the splash are allowed to use the network for that many hours."))
11 local redir = s:option(Value, "redirect_url", translate("Redirect target"), translate("Clients are redirected to this page after they have accepted the splash. If this is left empty they are redirected to the page they had requested."))
12 redir.rmempty = true
13
14 s:option(Value, "limit_up", translate("Upload limit"), translate("Clients upload speed is limited to this value (kbyte/s)"))
15 s:option(Value, "limit_down", translate("Download limit"), translate("Clients download speed is limited to this value (kbyte/s)"))
16
17 s:option(DummyValue, "_tmp", "",
18         translate("Bandwidth limit for clients is only activated when both up- and download limit are set. " ..
19         "Use a value of 0 here to completely disable this limitation. Whitelisted clients are not limited."))
20
21 s = m:section(TypedSection, "iface", translate("Interfaces"), translate("Interfaces that are used for Splash."))
22
23 s.template = "cbi/tblsection"
24 s.addremove = true
25 s.anonymous = true
26
27 local uci = luci.model.uci.cursor()
28
29 zone = s:option(ListValue, "zone", translate("Firewall zone"),
30         translate("Splash rules are integrated in this firewall zone"))
31
32 uci:foreach("firewall", "zone",
33         function (section)
34                 zone:value(section.name)
35         end)
36         
37 iface = s:option(ListValue, "network", translate("Network"),
38         translate("Intercept client traffic on this Interface"))
39
40 uci:foreach("network", "interface",
41         function (section)
42                 if section[".name"] ~= "loopback" then
43                         iface:value(section[".name"])
44                 end
45         end)
46         
47 uci:foreach("network", "alias",
48         function (section)
49                 iface:value(section[".name"])
50         end)
51
52
53 s = m:section(TypedSection, "whitelist", translate("Whitelist"),
54         translate("MAC addresses of whitelisted clients. These do not need to accept the splash and are not bandwidth limited."))
55
56 s.template = "cbi/tblsection"
57 s.addremove = true
58 s.anonymous = true
59 s:option(Value, "mac", translate ("MAC Address"))
60
61
62 s = m:section(TypedSection, "blacklist", translate("Blacklist"),
63         translate("MAC addresses in this list are blocked."))
64
65 s.template = "cbi/tblsection"
66 s.addremove = true
67 s.anonymous = true
68 s:option(Value, "mac", translate ("MAC Address"))
69
70 s = m:section(TypedSection, "subnet", translate("Allowed hosts/subnets"),
71         translate("Destination hosts and networks that are excluded from splashing, i.e. they are always allowed."))
72
73 s.template = "cbi/tblsection"
74 s.addremove = true
75 s.anonymous = true
76 s:option(Value, "ipaddr", translate("IP Address"))
77 s:option(Value, "netmask", translate("Netmask"), translate("optional when using host addresses")).rmempty = true
78         
79 return m