From 3812f2908731c6ff5e59aec4e0c899dbff35c469 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 7 Jan 2012 22:06:02 +0000 Subject: [PATCH] libs/web: remove neg_ipaddr, neg_ip4addr and neg_network_ip4addr datatypes, can be represented with neg(type) --- libs/web/htdocs/luci-static/resources/cbi.js | 16 --------------- libs/web/luasrc/cbi/datatypes.lua | 21 -------------------- 2 files changed, 37 deletions(-) diff --git a/libs/web/htdocs/luci-static/resources/cbi.js b/libs/web/htdocs/luci-static/resources/cbi.js index b21adbbba..05e15d27a 100644 --- a/libs/web/htdocs/luci-static/resources/cbi.js +++ b/libs/web/htdocs/luci-static/resources/cbi.js @@ -42,11 +42,6 @@ var cbi_validators = { return cbi_validators.ip4addr(v) || cbi_validators.ip6addr(v); }, - 'neg_ipaddr': function(v) - { - return cbi_validators.ip4addr(v.replace(/^\s*!/, "")) || cbi_validators.ip6addr(v.replace(/^\s*!/, "")); - }, - 'ip4addr': function(v) { if (v.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})(\/(\S+))?$/)) @@ -64,11 +59,6 @@ var cbi_validators = { return false; }, - 'neg_ip4addr': function(v) - { - return cbi_validators.ip4addr(v.replace(/^\s*!/, "")); - }, - 'ip6addr': function(v) { if( v.match(/^([a-fA-F0-9:.]+)(\/(\d+))?$/) ) @@ -191,12 +181,6 @@ var cbi_validators = { return (v.match(/^[a-zA-Z0-9_]+$/) != null); }, - 'neg_network_ip4addr': function(v) - { - v = v.replace(/^\s*!/, ""); - return cbi_validators.uciname(v) || cbi_validators.ip4addr(v); - }, - 'range': function(v, args) { var min = parseInt(args[0]); diff --git a/libs/web/luasrc/cbi/datatypes.lua b/libs/web/luasrc/cbi/datatypes.lua index 65a8eedeb..9f5a3eb1b 100644 --- a/libs/web/luasrc/cbi/datatypes.lua +++ b/libs/web/luasrc/cbi/datatypes.lua @@ -66,13 +66,6 @@ function ipaddr(val) return ip4addr(val) or ip6addr(val) end -function neg_ipaddr(v) - if type(v) == "string" then - v = v:gsub("^%s*!", "") - end - return v and ipaddr(v) -end - function ip4addr(val) if val then return ip.IPv4(val) and true or false @@ -81,13 +74,6 @@ function ip4addr(val) return false end -function neg_ip4addr(v) - if type(v) == "string" then - v = v:gsub("^%s*!", "") - end - return v and ip4addr(v) -end - function ip4prefix(val) val = tonumber(val) return ( val and val >= 0 and val <= 32 ) @@ -235,13 +221,6 @@ function uciname(val) return (val:match("^[a-zA-Z0-9_]+$") ~= nil) end -function neg_network_ip4addr(val) - if type(v) == "string" then - v = v:gsub("^%s*!", "") - return (uciname(v) or ip4addr(v)) - end -end - function range(val, min, max) val = tonumber(val) min = tonumber(min) -- 2.25.1