luci-app-mwan3: translate missing text in diagnostic page
[project/luci.git] / protocols / luci-proto-ppp / luasrc / model / cbi / admin_network / proto_pptp.lua
1 -- Copyright 2011-2012 Jo-Philipp Wich <jow@openwrt.org>
2 -- Licensed to the public under the Apache License 2.0.
3
4 local map, section, net = ...
5
6 local server, username, password
7 local defaultroute, metric, peerdns, dns,
8 keepalive_failure, keepalive_interval, demand, mtu
9
10
11 server = section:taboption("general", Value, "server", translate("VPN Server"))
12 server.datatype = "host(0)"
13
14
15 username = section:taboption("general", Value, "username", translate("PAP/CHAP username"))
16
17
18 password = section:taboption("general", Value, "password", translate("PAP/CHAP password"))
19 password.password = true
20
21
22 defaultroute = section:taboption("advanced", Flag, "defaultroute",
23 translate("Use default gateway"),
24 translate("If unchecked, no default route is configured"))
25
26 defaultroute.default = defaultroute.enabled
27
28
29 metric = section:taboption("advanced", Value, "metric",
30 translate("Use gateway metric"))
31
32 metric.placeholder = "0"
33 metric.datatype = "uinteger"
34 metric:depends("defaultroute", defaultroute.enabled)
35
36
37 peerdns = section:taboption("advanced", Flag, "peerdns",
38 translate("Use DNS servers advertised by peer"),
39 translate("If unchecked, the advertised DNS server addresses are ignored"))
40
41 peerdns.default = peerdns.enabled
42
43
44 dns = section:taboption("advanced", DynamicList, "dns",
45 translate("Use custom DNS servers"))
46
47 dns:depends("peerdns", "")
48 dns.datatype = "ipaddr"
49 dns.cast = "string"
50
51
52 keepalive_failure = section:taboption("advanced", Value, "_keepalive_failure",
53 translate("LCP echo failure threshold"),
54 translate("Presume peer to be dead after given amount of LCP echo failures, use 0 to ignore failures"))
55
56 function keepalive_failure.cfgvalue(self, section)
57 local v = m:get(section, "keepalive")
58 if v and #v > 0 then
59 return tonumber(v:match("^(%d+)[ ,]+%d+") or v)
60 end
61 end
62
63 keepalive_failure.placeholder = "0"
64 keepalive_failure.datatype = "uinteger"
65
66
67 keepalive_interval = section:taboption("advanced", Value, "_keepalive_interval",
68 translate("LCP echo interval"),
69 translate("Send LCP echo requests at the given interval in seconds, only effective in conjunction with failure threshold"))
70
71 function keepalive_interval.cfgvalue(self, section)
72 local v = m:get(section, "keepalive")
73 if v and #v > 0 then
74 return tonumber(v:match("^%d+[ ,]+(%d+)"))
75 end
76 end
77
78 function keepalive_interval.write(self, section, value)
79 local f = tonumber(keepalive_failure:formvalue(section)) or 0
80 local i = tonumber(value) or 5
81 if i < 1 then i = 1 end
82 if f > 0 then
83 m:set(section, "keepalive", "%d %d" %{ f, i })
84 else
85 m:del(section, "keepalive")
86 end
87 end
88
89 keepalive_interval.remove = keepalive_interval.write
90 keepalive_failure.write = keepalive_interval.write
91 keepalive_failure.remove = keepalive_interval.write
92 keepalive_interval.placeholder = "5"
93 keepalive_interval.datatype = "min(1)"
94
95
96 demand = section:taboption("advanced", Value, "demand",
97 translate("Inactivity timeout"),
98 translate("Close inactive connection after the given amount of seconds, use 0 to persist connection"))
99
100 demand.placeholder = "0"
101 demand.datatype = "uinteger"
102
103
104 mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU"))
105 mtu.placeholder = "1500"
106 mtu.datatype = "max(9200)"