luci-0.10: merge r8102
This commit is contained in:
parent
fe08392b7e
commit
3cbb9b3796
2 changed files with 32 additions and 0 deletions
|
@ -233,6 +233,24 @@ var cbi_validators = {
|
||||||
if (args[0] && typeof cbi_validators[args[0]] == "function")
|
if (args[0] && typeof cbi_validators[args[0]] == "function")
|
||||||
return cbi_validators[args[0]](v.replace(/^\s*!\s*/, ''));
|
return cbi_validators[args[0]](v.replace(/^\s*!\s*/, ''));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
'list': function(v, args)
|
||||||
|
{
|
||||||
|
var cb = cbi_validators[args[0] || 'string'];
|
||||||
|
if (typeof cb == "function")
|
||||||
|
{
|
||||||
|
var cbargs = args.slice(1);
|
||||||
|
var values = v.match(/[^\s]+/g);
|
||||||
|
|
||||||
|
for (var i = 0; i < values.length; i++)
|
||||||
|
if (!cb(values[i], cbargs))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -282,3 +282,17 @@ function neg(val, what)
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function list(val, what, ...)
|
||||||
|
if type(val) == "string" and what and type(_M[what]) == "function" then
|
||||||
|
for val in val:gmatch("%S+") do
|
||||||
|
if not _M[what](val, ...) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue