Merge pull request #1793 from TDT-AG/pr/20180514-luci-app-ddns-fix-output
[project/luci.git] / applications / luci-app-adblock / luasrc / model / cbi / adblock / overview_tab.lua
index 67d593c..3f39622 100644 (file)
@@ -7,25 +7,16 @@ local sys      = require("luci.sys")
 local util     = require("luci.util")
 local dump     = util.ubus("network.interface", "dump", {})
 local json     = require("luci.jsonc")
-local adbinput = uci.get("adblock", "global", "adb_rtfile") or "/tmp/adb_runtime.json"
-
-if not uci:get("adblock", "extra") then
-       m = SimpleForm("", nil, translate("Please update your adblock config file to use this package.<br />")
-       .. translatef("During opkg package installation use the '--force-maintainer' option to overwrite the pre-existing config file or download a fresh default config from "
-       .. "<a href=\"%s\" target=\"_blank\">"
-       .. "here</a>", "https://raw.githubusercontent.com/openwrt/packages/master/net/adblock/files/adblock.conf"))
-       m.submit = false
-       m.reset = false
-       return m
-end
+local adbinput = uci:get("adblock", "global", "adb_rtfile") or "/tmp/adb_runtime.json"
 
 m = Map("adblock", translate("Adblock"),
        translate("Configuration of the adblock package to block ad/abuse domains by using DNS. ")
        .. translatef("For further information "
        .. "<a href=\"%s\" target=\"_blank\">"
        .. "check the online documentation</a>", "https://github.com/openwrt/packages/blob/master/net/adblock/files/README.md"))
+m.apply_on_parse = true
 
-function m.on_after_commit(self)
+function m.on_apply(self)
        luci.sys.call("/etc/init.d/adblock reload >/dev/null 2>&1")
        luci.http.redirect(luci.dispatcher.build_url("admin", "services", "adblock"))
 end
@@ -174,9 +165,7 @@ end
 -- Blocklist table
 
 bl = m:section(TypedSection, "source", translate("Blocklist Sources"),
-       translate("Available blocklist sources. ")
-       .. translate("List URLs and Shallalist category selections are configurable in the 'Advanced' section.<br />")
-       .. translate("Caution: To prevent OOM exceptions on low memory devices with less than 64 MB free RAM, please do not select more than five blocklist sources!"))
+       translate("<b>Caution:</b> To prevent OOM exceptions on low memory devices with less than 64 MB free RAM, please only select a few of them!"))
 bl.template = "adblock/blocklist"
 
 name = bl:option(Flag, "enabled", translate("Enabled"))
@@ -191,8 +180,13 @@ function ssl.cfgvalue(self, section)
                return translate("No")
        end
 end
+
 des = bl:option(DummyValue, "adb_src_desc", translate("Description"))
 
+cat = bl:option(DynamicList, "adb_src_cat", translate("Categories"))
+cat.datatype = "uciname"
+cat.optional = true
+
 -- Extra options
 
 e = m:section(NamedSection, "extra", "adblock", translate("Extra Options"),
@@ -232,7 +226,7 @@ e6.default = e6.disabled
 e6.rmempty = true
 
 e7 = e:option(Value, "adb_maxqueue", translate("Max. Download Queue"),
-       translate("Size of the download queue to handle downloads & list processing in parallel (default '4').<br />")
+       translate("Size of the download queue to handle downloads &amp; list processing in parallel (default '4').<br />")
        .. translate("For further performance improvements you can raise this value, e.g. '8' or '16' should be safe."))
 e7.default = 4
 e7.datatype = "range(1,32)"
@@ -251,7 +245,7 @@ e9.rmempty = true
 
 e10 = e:option(Flag, "adb_notify", translate("Email Notification"),
        translate("Send notification emails in case of a processing error or if domain count is &le; 0.<br />")
-       .. translate("Please note: this needs additional 'mstmp' package installation and setup."))
+       .. translate("Please note: this needs additional 'msmtp' package installation and setup."))
 e10.default = e10.disabled
 e10.rmempty = true