* luci/app/qos: slight change in i18n handling to allow female "all" string for portu...
[project/luci.git] / applications / luci-qos / luasrc / model / cbi / qos / qosmini.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11         http://www.apache.org/licenses/LICENSE-2.0
12
13 $Id$
14 ]]--
15 require("luci.tools.webadmin")
16 m = Map("qos")
17
18 s = m:section(NamedSection, "wan", "interface", translate("m_n_inet"))
19
20 s:option(Flag, "enabled", translate("qos"))
21 s:option(Value, "download", translate("qos_interface_download"), "kb/s")
22 s:option(Value, "upload", translate("qos_interface_upload"), "kb/s")
23
24 s = m:section(TypedSection, "classify")
25 s.template = "cbi/tblsection"
26
27 s.anonymous = true
28 s.addremove = true
29
30 t = s:option(ListValue, "target")
31 t:value("Priority", translate("qos_priority"))
32 t:value("Express", translate("qos_express"))
33 t:value("Normal", translate("qos_normal"))
34 t:value("Bulk", translate("qos_bulk"))
35 t.default = "Normal"
36
37 srch = s:option(Value, "srchost")
38 srch.rmempty = true
39 srch:value("", translate("all"))
40 luci.tools.webadmin.cbi_add_knownips(srch)
41
42 dsth = s:option(Value, "dsthost")
43 dsth.rmempty = true
44 dsth:value("", translate("all"))
45 luci.tools.webadmin.cbi_add_knownips(dsth)
46
47 l7 = s:option(ListValue, "layer7", translate("service"))
48 l7.rmempty = true
49 l7:value("", translate("all"))
50 local pats = luci.fs.dir("/etc/l7-protocols")
51 if pats then
52         for i,f in ipairs(pats) do
53                 if f:sub(-4) == ".pat" then
54                         l7:value(f:sub(1, #f-4))
55                 end
56         end
57 end
58
59 p2p = s:option(ListValue, "ipp2p", "P2P")
60 p2p:value("", "-")
61 p2p:value("all", translate("all"))
62 p2p:value("bit", "BitTorrent")
63 p2p:value("dc", "DirectConnect")
64 p2p:value("edk", "eDonkey")
65 p2p:value("gnu", "Gnutella")
66 p2p:value("kazaa", "Kazaa")
67 p2p.rmempty = true
68
69 p = s:option(ListValue, "proto", translate("protocol"))
70 p:value("", translate("all"))
71 p:value("tcp", "TCP")
72 p:value("udp", "UDP")
73 p:value("icmp", "ICMP")
74 p.rmempty = true
75
76 ports = s:option(Value, "ports", translate("ports"))
77 ports.rmempty = true
78 ports:value("", translate("allf", translate("all")))
79
80 return m