summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-compat
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-compat')
-rw-r--r--modules/luci-compat/Makefile2
-rw-r--r--modules/luci-compat/luasrc/cbi/datatypes.lua41
-rw-r--r--modules/luci-compat/luasrc/view/cbi/footer.htm2
3 files changed, 30 insertions, 15 deletions
diff --git a/modules/luci-compat/Makefile b/modules/luci-compat/Makefile
index d73ca070a1..4b11f16419 100644
--- a/modules/luci-compat/Makefile
+++ b/modules/luci-compat/Makefile
@@ -12,7 +12,7 @@ LUCI_TYPE:=mod
LUCI_BASENAME:=compat
LUCI_TITLE:=LuCI compatibility libraries
-LUCI_DEPENDS:=+luci-base
+LUCI_DEPENDS:=+luci-lua-runtime
include ../../luci.mk
diff --git a/modules/luci-compat/luasrc/cbi/datatypes.lua b/modules/luci-compat/luasrc/cbi/datatypes.lua
index c1cf01f9cd..7ef12eaf32 100644
--- a/modules/luci-compat/luasrc/cbi/datatypes.lua
+++ b/modules/luci-compat/luasrc/cbi/datatypes.lua
@@ -13,34 +13,49 @@ module "luci.cbi.datatypes"
_M['or'] = function(v, ...)
- local i
- for i = 1, select('#', ...), 2 do
+ local i, n = 1, select('#', ...)
+ while i <= n do
local f = select(i, ...)
- local a = select(i+1, ...)
if type(f) ~= "function" then
- if f == v then
+ i = i + 1
+ local c = v
+ if type(f) == "number" then
+ c = tonumber(c)
+ end
+ if f == c then
+ return true
+ end
+ else
+ i = i + 2
+ local a = select(i-1, ...)
+ if f(v, unpack(a)) then
return true
end
- i = i - 1
- elseif f(v, unpack(a)) then
- return true
end
end
return false
end
_M['and'] = function(v, ...)
- local i
- for i = 1, select('#', ...), 2 do
+ local i, n = 1, select('#', ...)
+ while i <= n do
local f = select(i, ...)
- local a = select(i+1, ...)
if type(f) ~= "function" then
- if f ~= v then
+ i = i + 1
+ local c = v
+ if type(f) == "number" then
+ c = tonumber(c)
+ end
+ if f ~= c then
return false
end
i = i - 1
- elseif not f(v, unpack(a)) then
- return false
+ else
+ i = i + 2
+ local a = select(i-1, ...)
+ if not f(v, unpack(a)) then
+ return false
+ end
end
end
return true
diff --git a/modules/luci-compat/luasrc/view/cbi/footer.htm b/modules/luci-compat/luasrc/view/cbi/footer.htm
index abcc47b920..c72102340f 100644
--- a/modules/luci-compat/luasrc/view/cbi/footer.htm
+++ b/modules/luci-compat/luasrc/view/cbi/footer.htm
@@ -8,7 +8,7 @@
if pageaction and
(display_back or display_skip or display_apply or display_save or display_reset)
then
- %><div class="cbi-page-actions control-group"><%
+ %><div class="cbi-page-actions"><%
if display_back then
%><input class="btn cbi-button cbi-button-link" type="button" value="<%:Back to Overview%>" onclick="location.href='<%=pcdata(redirect)%>'" /> <%