applications/luci-qos: list all L7 patterns in all subdirs (#187)
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 20 Jan 2011 23:44:41 +0000 (23:44 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 20 Jan 2011 23:44:41 +0000 (23:44 +0000)
applications/luci-qos/luasrc/model/cbi/qos/qos.lua
applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua

index dcce7f12c1ec677ffb70ca3a49322e1b85702044..3e4b7817386f3de2e7d3e3fe314ee79d1b3d071e 100644 (file)
@@ -23,6 +23,7 @@ m = Map("qos", translate("Quality of Service"),
 s = m:section(TypedSection, "interface", translate("Interfaces"))
 s.addremove = true
 s.anonymous = false
+s.template  = "cbi/tblsection"
 
 e = s:option(Flag, "enabled", translate("Enable"))
 e.rmempty = false
@@ -64,14 +65,20 @@ wa.cbi_add_knownips(dsth)
 l7 = s:option(ListValue, "layer7", translate("Service"))
 l7.rmempty = true
 l7:value("", translate("all"))
-local pats = fs.glob("/etc/l7-protocols/*/*.pat")
+
+local pats = io.popen("find /etc/l7-protocols/ -type f -name '*.pat'")
 if pats then
-       for f in pats do
-               f = f:match("([^/]+)%.pat$")
-               if f then
-                       l7:value(f)
+       local l
+       while true do
+               l = pats:read("*l")
+               if not l then break end
+
+               l = l:match("([^/]+)%.pat$")
+               if l then
+                       l7:value(l)
                end
        end
+       pats:close()
 end
 
 p = s:option(Value, "proto", translate("Protocol"))
index b4120895715c50a714bfe191fc341ba04286cad3..fb2298f8e7ae0a6ec4d456443017ff45bffdf478 100644 (file)
@@ -50,14 +50,20 @@ wa.cbi_add_knownips(dsth)
 l7 = s:option(ListValue, "layer7", translate("Service"))
 l7.rmempty = true
 l7:value("", translate("all"))
-local pats = fs.glob("/etc/l7-protocols/*/*.pat")
+
+local pats = io.popen("find /etc/l7-protocols/ -type f -name '*.pat'")
 if pats then
-       for f in pats do
-               f = f:match("([^/]+)%.pat$")
-               if f then
-                       l7:value(f)
+       local l
+       while true do
+               l = pats:read("*l")
+               if not l then break end
+
+               l = l:match("([^/]+)%.pat$")
+               if l then
+                       l7:value(l)
                end
        end
+       pats:close()
 end
 
 p = s:option(ListValue, "proto", translate("Protocol"))