fixed dynapoint.lua, there was no translation
[project/luci.git] / applications / luci-app-simple-adblock / luasrc / model / cbi / simpleadblock.lua
1 m = Map("simple-adblock", translate("Simple AdBlock Settings"))
2 s = m:section(NamedSection, "config", "simple-adblock")
3
4 -- General options
5 e = s:option(Flag, "enabled", translate("Enable/start service"))
6 e.rmempty  = false
7
8 function e.cfgvalue(self, section)
9         return self.map:get(section, "enabled") == "1" and luci.sys.init.enabled("simple-adblock") and self.enabled or self.disabled
10 end
11
12 function e.write(self, section, value)
13         if value == "1" then
14                 luci.sys.init.enable("simple-adblock")
15                 luci.sys.init.start("simple-adblock")
16         else
17                 luci.sys.init.stop("simple-adblock")
18                 luci.sys.init.disable("simple-adblock")
19         end
20         return Flag.write(self, section, value)
21 end
22
23 o2 = s:option(ListValue, "verbosity", translate("Output Verbosity Setting"),translate("Controls system log and console output verbosity"))
24 o2:value("0", translate("Suppress output"))
25 o2:value("1", translate("Some output"))
26 o2:value("2", translate("Verbose output"))
27 o2.rmempty = false
28 o2.default = 2
29
30 o3 = s:option(ListValue, "force_dns", translate("Force Router DNS"), translate("Forces Router DNS use on local devices, also known as DNS Hijacking"))
31 o3:value("0", translate("Let local devices use their own DNS servers if set"))
32 o3:value("1", translate("Force Router DNS server to all local devices"))
33 o3.rmempty = false
34 o3.default = 1
35
36
37 local sysfs_path = "/sys/class/leds/"
38 local leds = {}
39 if nixio.fs.access(sysfs_path) then
40         leds = nixio.util.consume((nixio.fs.dir(sysfs_path)))
41 end
42 if #leds ~= 0 then
43         o3 = s:option(Value, "led", translate("LED to indicate status"), translate("Pick the LED not already used in")
44                 .. [[ <a href="]] .. luci.dispatcher.build_url("admin/system/leds") .. [[">]]
45                 .. translate("System LED Configuration") .. [[</a>]])
46         o3.rmempty = true
47         o3:value("", translate("none"))
48         for k, v in ipairs(leds) do
49                 o3:value(v)
50         end
51 end
52
53
54 s2 = m:section(NamedSection, "config", "simple-adblock")
55 -- Whitelisted Domains
56 d1 = s2:option(DynamicList, "whitelist_domain", translate("Whitelisted Domains"), translate("Individual domains to be whitelisted"))
57 d1.addremove = false
58 d1.optional = false
59
60 -- Blacklisted Domains
61 d3 = s2:option(DynamicList, "blacklist_domain", translate("Blacklisted Domains"), translate("Individual domains to be blacklisted"))
62 d3.addremove = false
63 d3.optional = false
64
65 -- Whitelisted Domains URLs
66 d2 = s2:option(DynamicList, "whitelist_domains_url", translate("Whitelisted Domain URLs"), translate("URLs to lists of domains to be whitelisted"))
67 d2.addremove = false
68 d2.optional = false
69
70 -- Blacklisted Domains URLs
71 d4 = s2:option(DynamicList, "blacklist_domains_url", translate("Blacklisted Domain URLs"), translate("URLs to lists of domains to be blacklisted"))
72 d4.addremove = false
73 d4.optional = false
74
75 -- Blacklisted Hosts URLs
76 d5 = s2:option(DynamicList, "blacklist_hosts_url", translate("Blacklisted Hosts URLs"), translate("URLs to lists of hosts to be blacklisted"))
77 d5.addremove = false
78 d5.optional = false
79
80 return m